From a4000c606c547f08ef8874166e166b778dad7cea Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 18 Aug 2011 15:10:19 +0100 Subject: [PATCH] drop quiet download stuff, not worth an API debate --- syncpackage | 4 ++-- ubuntutools/archive.py | 33 ++++++++++++++------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/syncpackage b/syncpackage index eb43072..832019b 100755 --- a/syncpackage +++ b/syncpackage @@ -348,8 +348,8 @@ def copy(src_pkg, release, simulate=False, force=False): sys.exit(1) # Check whether a fakesync would be required. - src_pkg.pull_dsc(quiet=not Logger.verbose) - ubuntu_pkg.pull_dsc(quiet=not Logger.verbose) + src_pkg.pull_dsc() + ubuntu_pkg.pull_dsc() if not src_pkg.dsc.compare_dsc(ubuntu_pkg.dsc): Logger.error('The checksums of the Debian and Ubuntu packages ' 'mismatch. A fake sync using --no-lp is required.') diff --git a/ubuntutools/archive.py b/ubuntutools/archive.py index b1e09a3..4647615 100644 --- a/ubuntutools/archive.py +++ b/ubuntutools/archive.py @@ -231,7 +231,7 @@ class SourcePackage(object): yield self._mirror_url(mirror, name) yield self._lp_url(name) - def pull_dsc(self, quiet = False): + def pull_dsc(self): "Retrieve dscfile and parse" if 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 os.rename(parsed.path, self.dsc_pathname) else: - if not self._download_file(self._dsc_source, self.dsc_name, - quiet=quiet): + if not self._download_file(self._dsc_source, self.dsc_name): raise DownloadError('dsc not found') else: if not self._download_file(self._lp_url(self.dsc_name), - self.dsc_name, quiet=quiet): + self.dsc_name): raise DownloadError('dsc not found') self._check_dsc() @@ -297,7 +296,7 @@ class SourcePackage(object): else: Logger.info(message) - def _download_file(self, url, filename, quiet = False): + def _download_file(self, url, filename): "Download url to filename in workdir." logurl = url if os.path.basename(url) != filename: @@ -311,12 +310,10 @@ class SourcePackage(object): if entry['name'] == filename] assert len(size) == 1 size = int(size[0]) - if not quiet: - Logger.normal('Downloading %s (%0.3f MiB)', logurl, - size / 1024.0 / 1024) + Logger.normal('Downloading %s (%0.3f MiB)', logurl, + size / 1024.0 / 1024) 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, # but we want SSL when fetching the dsc @@ -336,13 +333,11 @@ class SourcePackage(object): if block == '': break out.write(block) - if not quiet: - Logger.stdout.write('.') - Logger.stdout.flush() + Logger.stdout.write('.') + Logger.stdout.flush() in_.close() - if not quiet: - Logger.stdout.write(' done\n') - Logger.stdout.flush() + Logger.stdout.write(' done\n') + Logger.stdout.flush() if self.dsc and not url.endswith('.dsc'): if not self.dsc.verify_file(pathname): Logger.error('Checksum does not match.') @@ -461,10 +456,10 @@ class DebianSourcePackage(SourcePackage): if self.snapshot_list: yield self._snapshot_url(name) - def pull_dsc(self, quiet = False): + def pull_dsc(self): "Retrieve dscfile and parse" try: - super(DebianSourcePackage, self).pull_dsc(quiet=quiet) + super(DebianSourcePackage, self).pull_dsc() return except DownloadError: pass @@ -472,7 +467,7 @@ class DebianSourcePackage(SourcePackage): # Not all Debian Source packages get imported to LP # (or the importer could be lagging) 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 else: raise DownloadError('dsc could not be found anywhere')