mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
Merge branch 'pull-debian-source-edge-cases' of git+ssh://git.launchpad.net/~racb/ubuntu-dev-tools
MR: https://code.launchpad.net/~racb/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/326608 Signed-off-by: Mattia Rizzolo <mattia@debian.org>
This commit is contained in:
commit
3f87486de3
10
debian/changelog
vendored
10
debian/changelog
vendored
@ -1,3 +1,13 @@
|
||||
ubuntu-dev-tools (0.170) UNRELEASED; urgency=medium
|
||||
|
||||
[ Robie Basak ]
|
||||
* pull-debian-source:
|
||||
+ Add a new --no-verify-signature option option, to download a source
|
||||
package without checking its signature.
|
||||
+ Port to Python 3.
|
||||
|
||||
-- Mattia Rizzolo <mattia@debian.org> Sat, 20 Jul 2019 15:09:05 +0200
|
||||
|
||||
ubuntu-dev-tools (0.169) unstable; urgency=medium
|
||||
|
||||
[ Colin Watson ]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# pull-debian-source -- pull a source package from Launchpad
|
||||
# Copyright (C) 2011, Stefano Rivera <stefanor@ubuntu.com>
|
||||
@ -19,7 +19,8 @@
|
||||
import json
|
||||
import optparse
|
||||
import sys
|
||||
import urllib2
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
|
||||
from distro_info import DebianDistroInfo, DistroDataOutdated
|
||||
|
||||
@ -54,17 +55,17 @@ def source_package_for(binary, release):
|
||||
"""Query DDE to find the source package for a particular binary"""
|
||||
try:
|
||||
release = DebianDistroInfo().codename(release, default=release)
|
||||
except DistroDataOutdated, e:
|
||||
except DistroDataOutdated as e:
|
||||
Logger.warn(e)
|
||||
url = ('http://dde.debian.net/dde/q/udd/dist/d:debian/r:%s/p:%s/?t=json'
|
||||
% (release, binary))
|
||||
data = None
|
||||
try:
|
||||
data = json.load(urllib2.urlopen(url))['r']
|
||||
except urllib2.URLError, e:
|
||||
data = json.load(urllib.request.urlopen(url))['r']
|
||||
except urllib.error.URLError as e:
|
||||
Logger.error('Unable to retrieve package information from DDE: '
|
||||
'%s (%s)', url, str(e))
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
Logger.error('Unable to parse JSON response from DDE: '
|
||||
'%s (%s)', url, str(e))
|
||||
if not data:
|
||||
@ -89,6 +90,10 @@ def main():
|
||||
parser.add_option('--no-conf',
|
||||
dest='no_conf', default=False, action='store_true',
|
||||
help="Don't read config files or environment variables")
|
||||
parser.add_option('--no-verify-signature',
|
||||
dest='verify_signature', default=True,
|
||||
action='store_false',
|
||||
help="Allow signature verification failure")
|
||||
(options, args) = parser.parse_args()
|
||||
if not args:
|
||||
parser.error('Must specify package name')
|
||||
@ -128,8 +133,8 @@ def main():
|
||||
mirrors=[options.debian_mirror,
|
||||
options.debsec_mirror])
|
||||
try:
|
||||
srcpkg.pull()
|
||||
except DownloadError, e:
|
||||
srcpkg.pull(verify_signature=options.verify_signature)
|
||||
except DownloadError as e:
|
||||
Logger.error('Failed to download: %s', str(e))
|
||||
sys.exit(1)
|
||||
if not options.download_only:
|
||||
|
@ -303,10 +303,10 @@ class SourcePackage(object):
|
||||
else:
|
||||
Logger.info(message)
|
||||
|
||||
def _write_dsc(self):
|
||||
def _write_dsc(self, verify_signature=True):
|
||||
"Write dsc file to workdir"
|
||||
if self._dsc is None:
|
||||
self.pull_dsc()
|
||||
self.pull_dsc(verify_signature=verify_signature)
|
||||
with open(self.dsc_pathname, 'wb') as f:
|
||||
f.write(self.dsc.raw_text)
|
||||
|
||||
@ -359,9 +359,9 @@ class SourcePackage(object):
|
||||
return False
|
||||
return True
|
||||
|
||||
def pull(self):
|
||||
def pull(self, verify_signature=True):
|
||||
"Pull into workdir"
|
||||
self._write_dsc()
|
||||
self._write_dsc(verify_signature=verify_signature)
|
||||
for entry in self.dsc['Files']:
|
||||
name = entry['name']
|
||||
for url in self._source_urls(name):
|
||||
@ -471,7 +471,7 @@ class DebianSourcePackage(SourcePackage):
|
||||
if self.snapshot_list:
|
||||
yield self._snapshot_url(name)
|
||||
|
||||
def pull_dsc(self):
|
||||
def pull_dsc(self, verify_signature=True):
|
||||
"Retrieve dscfile and parse"
|
||||
try:
|
||||
super(DebianSourcePackage, self).pull_dsc()
|
||||
@ -489,7 +489,7 @@ class DebianSourcePackage(SourcePackage):
|
||||
break
|
||||
else:
|
||||
raise DownloadError('dsc could not be found anywhere')
|
||||
self._check_dsc(verify_signature=True)
|
||||
self._check_dsc(verify_signature=verify_signature)
|
||||
|
||||
# Local methods:
|
||||
@property
|
||||
@ -636,7 +636,7 @@ def rmadison(url, package, suite=None, arch=None):
|
||||
|
||||
# pylint bug: http://www.logilab.org/ticket/46273
|
||||
# pylint: disable=E1103
|
||||
for line in output.strip().splitlines():
|
||||
for line in output.decode().strip().splitlines():
|
||||
# pylint: enable=E1103
|
||||
pkg, ver, dist, archs = [x.strip() for x in line.split('|')]
|
||||
comp = 'main'
|
||||
|
Loading…
x
Reference in New Issue
Block a user