diff options
author | Will Woods <wwoods@redhat.com> | 2009-02-20 18:32:43 -0500 |
---|---|---|
committer | Will Woods <wwoods@redhat.com> | 2009-02-20 18:32:43 -0500 |
commit | 67e86ac7b8d31473999edb75e25fedb2cb947e29 (patch) | |
tree | 12c4df7dcb5284be761067a382945b048c8b8f4f /debuginfofs-mirror | |
parent | f75a9d1ed9df121646b4a14079ca5405bed8bd78 (diff) | |
download | debuginfofs-67e86ac7b8d31473999edb75e25fedb2cb947e29.tar.gz debuginfofs-67e86ac7b8d31473999edb75e25fedb2cb947e29.tar.xz debuginfofs-67e86ac7b8d31473999edb75e25fedb2cb947e29.zip |
Add --download-only and --force-download
Diffstat (limited to 'debuginfofs-mirror')
-rwxr-xr-x | debuginfofs-mirror | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/debuginfofs-mirror b/debuginfofs-mirror index e26b7bf..afc7453 100755 --- a/debuginfofs-mirror +++ b/debuginfofs-mirror @@ -74,7 +74,10 @@ class DebuginfoFSDownloader(YumUtilBase): help="download debuginfo for this arch") o.add_option("--savecache", default=False, action="store_true", help="don't delete downloaded RPMs after unpacking them") - # TODO: --skip-download, --force-unpack + o.add_option("--force-download", default=False, action="store_true", + help="download and unpack RPMs even if they already exist") + o.add_option("--download-only", default=False, action="store_true", + help="download RPMs but don't bother unpacking them") def setup(self): self.modify_options() @@ -261,18 +264,21 @@ def main(): #/var/www/debuginfofs/packages/c/coreutils/coreutils-0:6.12-18.fc10.i386 newdir = os.path.join(n[0],n,nevra) targetdir = os.path.join(opt.exportdir,'packages',newdir) + # Don't bother checking - just add everything to the list + if opt.force_download: + download_packages.append(p) + continue + # Skip it if it's already unpacked if os.path.isdir(targetdir): y.logger.info("Already unpacked %s" % nevra) - # TODO optionally rmtree and redownload/unpack - # FIXME: continue, or just skip fetch/unpack and do links anyway? continue - unpack_packages.append(p) # XXX does y.downloadPackages handle this for us? if (os.path.exists(local) and os.path.getsize(local) == int(p.returnSimple('packagesize'))): y.logger.info("Already downloaded %s" % nevra) + unpack_packages.append(p) else: download_packages.append(p) @@ -283,7 +289,7 @@ def main(): # Show what will be downloaded and get confirmation y.verbose_logger.info(y.listDownloads(download_packages)) y.reportDownloadSize(download_packages) - # TODO: show some info on unpack_packages + # FIXME: show some info on unpack_packages y.verbose_logger.info("Downloading to cachedir %s" % opt.cachedir) y.verbose_logger.info("Unpacking to exportdir %s" % opt.exportdir) if y._promptWanted(): @@ -292,11 +298,13 @@ def main(): sys.exit(1) # Download, unpack, and hardlink debuginfo data - for p in unpack_packages: + for p in unpack_packages + download_packages: if p in download_packages: repo = y.repos.getRepo(p.repoid) # FIXME handle possible errors here repo.getPackage(p) + if opt.download_only: + continue local = p.localpath n = p.pkgtup[0] nevra = pkg_to_nevra(p) |