mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
drop quiet download stuff, not worth an API debate
This commit is contained in:
parent
44df5e3081
commit
a4000c606c
@ -348,8 +348,8 @@ def copy(src_pkg, release, simulate=False, force=False):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Check whether a fakesync would be required.
|
# Check whether a fakesync would be required.
|
||||||
src_pkg.pull_dsc(quiet=not Logger.verbose)
|
src_pkg.pull_dsc()
|
||||||
ubuntu_pkg.pull_dsc(quiet=not Logger.verbose)
|
ubuntu_pkg.pull_dsc()
|
||||||
if not src_pkg.dsc.compare_dsc(ubuntu_pkg.dsc):
|
if not src_pkg.dsc.compare_dsc(ubuntu_pkg.dsc):
|
||||||
Logger.error('The checksums of the Debian and Ubuntu packages '
|
Logger.error('The checksums of the Debian and Ubuntu packages '
|
||||||
'mismatch. A fake sync using --no-lp is required.')
|
'mismatch. A fake sync using --no-lp is required.')
|
||||||
|
@ -231,7 +231,7 @@ class SourcePackage(object):
|
|||||||
yield self._mirror_url(mirror, name)
|
yield self._mirror_url(mirror, name)
|
||||||
yield self._lp_url(name)
|
yield self._lp_url(name)
|
||||||
|
|
||||||
def pull_dsc(self, quiet = False):
|
def pull_dsc(self):
|
||||||
"Retrieve dscfile and parse"
|
"Retrieve dscfile and parse"
|
||||||
if self._dsc_source:
|
if self._dsc_source:
|
||||||
parsed = urlparse.urlparse(self._dsc_source)
|
parsed = urlparse.urlparse(self._dsc_source)
|
||||||
@ -245,12 +245,11 @@ class SourcePackage(object):
|
|||||||
# Temporarily rename to the filename we are going to open
|
# Temporarily rename to the filename we are going to open
|
||||||
os.rename(parsed.path, self.dsc_pathname)
|
os.rename(parsed.path, self.dsc_pathname)
|
||||||
else:
|
else:
|
||||||
if not self._download_file(self._dsc_source, self.dsc_name,
|
if not self._download_file(self._dsc_source, self.dsc_name):
|
||||||
quiet=quiet):
|
|
||||||
raise DownloadError('dsc not found')
|
raise DownloadError('dsc not found')
|
||||||
else:
|
else:
|
||||||
if not self._download_file(self._lp_url(self.dsc_name),
|
if not self._download_file(self._lp_url(self.dsc_name),
|
||||||
self.dsc_name, quiet=quiet):
|
self.dsc_name):
|
||||||
raise DownloadError('dsc not found')
|
raise DownloadError('dsc not found')
|
||||||
self._check_dsc()
|
self._check_dsc()
|
||||||
|
|
||||||
@ -297,7 +296,7 @@ class SourcePackage(object):
|
|||||||
else:
|
else:
|
||||||
Logger.info(message)
|
Logger.info(message)
|
||||||
|
|
||||||
def _download_file(self, url, filename, quiet = False):
|
def _download_file(self, url, filename):
|
||||||
"Download url to filename in workdir."
|
"Download url to filename in workdir."
|
||||||
logurl = url
|
logurl = url
|
||||||
if os.path.basename(url) != filename:
|
if os.path.basename(url) != filename:
|
||||||
@ -311,12 +310,10 @@ class SourcePackage(object):
|
|||||||
if entry['name'] == filename]
|
if entry['name'] == filename]
|
||||||
assert len(size) == 1
|
assert len(size) == 1
|
||||||
size = int(size[0])
|
size = int(size[0])
|
||||||
if not quiet:
|
Logger.normal('Downloading %s (%0.3f MiB)', logurl,
|
||||||
Logger.normal('Downloading %s (%0.3f MiB)', logurl,
|
size / 1024.0 / 1024)
|
||||||
size / 1024.0 / 1024)
|
|
||||||
else:
|
else:
|
||||||
if not quiet:
|
Logger.normal('Downloading %s', logurl)
|
||||||
Logger.normal('Downloading %s', logurl)
|
|
||||||
|
|
||||||
# Launchpad will try to redirect us to plain-http Launchpad Librarian,
|
# Launchpad will try to redirect us to plain-http Launchpad Librarian,
|
||||||
# but we want SSL when fetching the dsc
|
# but we want SSL when fetching the dsc
|
||||||
@ -336,13 +333,11 @@ class SourcePackage(object):
|
|||||||
if block == '':
|
if block == '':
|
||||||
break
|
break
|
||||||
out.write(block)
|
out.write(block)
|
||||||
if not quiet:
|
Logger.stdout.write('.')
|
||||||
Logger.stdout.write('.')
|
Logger.stdout.flush()
|
||||||
Logger.stdout.flush()
|
|
||||||
in_.close()
|
in_.close()
|
||||||
if not quiet:
|
Logger.stdout.write(' done\n')
|
||||||
Logger.stdout.write(' done\n')
|
Logger.stdout.flush()
|
||||||
Logger.stdout.flush()
|
|
||||||
if self.dsc and not url.endswith('.dsc'):
|
if self.dsc and not url.endswith('.dsc'):
|
||||||
if not self.dsc.verify_file(pathname):
|
if not self.dsc.verify_file(pathname):
|
||||||
Logger.error('Checksum does not match.')
|
Logger.error('Checksum does not match.')
|
||||||
@ -461,10 +456,10 @@ class DebianSourcePackage(SourcePackage):
|
|||||||
if self.snapshot_list:
|
if self.snapshot_list:
|
||||||
yield self._snapshot_url(name)
|
yield self._snapshot_url(name)
|
||||||
|
|
||||||
def pull_dsc(self, quiet = False):
|
def pull_dsc(self):
|
||||||
"Retrieve dscfile and parse"
|
"Retrieve dscfile and parse"
|
||||||
try:
|
try:
|
||||||
super(DebianSourcePackage, self).pull_dsc(quiet=quiet)
|
super(DebianSourcePackage, self).pull_dsc()
|
||||||
return
|
return
|
||||||
except DownloadError:
|
except DownloadError:
|
||||||
pass
|
pass
|
||||||
@ -472,7 +467,7 @@ class DebianSourcePackage(SourcePackage):
|
|||||||
# Not all Debian Source packages get imported to LP
|
# Not all Debian Source packages get imported to LP
|
||||||
# (or the importer could be lagging)
|
# (or the importer could be lagging)
|
||||||
for url in self._source_urls(self.dsc_name):
|
for url in self._source_urls(self.dsc_name):
|
||||||
if self._download_file(url, self.dsc_name, quiet=quiet):
|
if self._download_file(url, self.dsc_name):
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise DownloadError('dsc could not be found anywhere')
|
raise DownloadError('dsc could not be found anywhere')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user