mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-13 09:51:30 +00:00
Check the sync blacklist
This commit is contained in:
parent
ce2f96bc0d
commit
e04d4df889
49
syncpackage
49
syncpackage
@ -20,15 +20,17 @@
|
|||||||
#
|
#
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
|
|
||||||
import debian.deb822
|
import codecs
|
||||||
import debian.debian_support
|
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import urllib
|
||||||
|
|
||||||
|
import debian.deb822
|
||||||
|
import debian.debian_support
|
||||||
from devscripts.logger import Logger
|
from devscripts.logger import Logger
|
||||||
|
|
||||||
from lazr.restfulclient.errors import HTTPError
|
from lazr.restfulclient.errors import HTTPError
|
||||||
|
|
||||||
from ubuntutools.archive import (DebianSourcePackage, UbuntuSourcePackage,
|
from ubuntutools.archive import (DebianSourcePackage, UbuntuSourcePackage,
|
||||||
@ -380,6 +382,27 @@ def copy(src_pkg, release, simulate=False, force=False):
|
|||||||
Logger.normal('Request succeeded; you should get an e-mail once it is '
|
Logger.normal('Request succeeded; you should get an e-mail once it is '
|
||||||
'processed.')
|
'processed.')
|
||||||
|
|
||||||
|
def is_blacklisted(query):
|
||||||
|
url = 'http://people.canonical.com/~ubuntu-archive/sync-blacklist.txt'
|
||||||
|
with codecs.EncodedFile(urllib.urlopen(url), 'UTF-8') as f:
|
||||||
|
applicable_comments = []
|
||||||
|
for line in f:
|
||||||
|
if not line.strip():
|
||||||
|
applicable_comments = []
|
||||||
|
continue
|
||||||
|
m = re.match(r'^\s*([a-z0-9.+-]+)?\s*(?:#\s*(.+)?)?$', line)
|
||||||
|
source, comment = m.groups()
|
||||||
|
if source and query == source:
|
||||||
|
if comment:
|
||||||
|
applicable_comments.append(comment)
|
||||||
|
if applicable_comments:
|
||||||
|
return u'; '.join(applicable_comments)
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
elif comment:
|
||||||
|
applicable_comments.append(comment)
|
||||||
|
return False
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
usage = "%prog [options] <.dsc URL/path or package name>"
|
usage = "%prog [options] <.dsc URL/path or package name>"
|
||||||
epilog = "See %s(1) for more info." % os.path.basename(sys.argv[0])
|
epilog = "See %s(1) for more info." % os.path.basename(sys.argv[0])
|
||||||
@ -491,28 +514,30 @@ def main():
|
|||||||
|
|
||||||
if options.lpinstance is None:
|
if options.lpinstance is None:
|
||||||
options.lpinstance = config.get_value('LPINSTANCE')
|
options.lpinstance = config.get_value('LPINSTANCE')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
Launchpad.login(service=options.lpinstance, api_version='devel')
|
Launchpad.login(service=options.lpinstance, api_version='devel')
|
||||||
except IOError:
|
except IOError:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
src_pkg = fetch_source_pkg(args[0], options.dist, options.debversion,
|
|
||||||
options.component, options.release, None)
|
|
||||||
|
|
||||||
copy(src_pkg, options.release, options.simulate, options.force)
|
|
||||||
else:
|
|
||||||
Launchpad.login_anonymously()
|
|
||||||
if options.release is None:
|
if options.release is None:
|
||||||
ubuntu = Launchpad.distributions["ubuntu"]
|
ubuntu = Launchpad.distributions["ubuntu"]
|
||||||
options.release = ubuntu.current_series.name
|
options.release = ubuntu.current_series.name
|
||||||
|
|
||||||
os.environ['DEB_VENDOR'] = 'Ubuntu'
|
|
||||||
|
|
||||||
src_pkg = fetch_source_pkg(args[0], options.dist, options.debversion,
|
src_pkg = fetch_source_pkg(args[0], options.dist, options.debversion,
|
||||||
options.component, options.release,
|
options.component, options.release,
|
||||||
options.debian_mirror)
|
options.debian_mirror)
|
||||||
|
|
||||||
|
blacklisted = is_blacklisted(src_pkg.source)
|
||||||
|
if blacklisted:
|
||||||
|
Logger.error("Source package is blacklisted")
|
||||||
|
if isinstance(blacklisted, basestring):
|
||||||
|
Logger.error(u"Reason: %s", blacklisted)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if options.lp:
|
||||||
|
copy(src_pkg, options.release, options.simulate, options.force)
|
||||||
|
else:
|
||||||
|
os.environ['DEB_VENDOR'] = 'Ubuntu'
|
||||||
sync_dsc(src_pkg, options.dist, options.release, options.uploader_name,
|
sync_dsc(src_pkg, options.dist, options.release, options.uploader_name,
|
||||||
options.uploader_email, options.bugs, options.ubuntu_mirror,
|
options.uploader_email, options.bugs, options.ubuntu_mirror,
|
||||||
options.keyid, options.simulate, options.force)
|
options.keyid, options.simulate, options.force)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user