diff options
author | Will Woods <wwoods@redhat.com> | 2009-02-20 18:14:08 -0500 |
---|---|---|
committer | Will Woods <wwoods@redhat.com> | 2009-02-20 18:14:08 -0500 |
commit | 54d0b3f3ec58a30ae2e1bb7fb53f40105c2894be (patch) | |
tree | 61c19b5cc63ad20115b19d024c425359cbf33636 | |
parent | 32cc56609f5980a62ad63ea54908d71711b57a05 (diff) | |
download | debuginfofs-54d0b3f3ec58a30ae2e1bb7fb53f40105c2894be.tar.gz debuginfofs-54d0b3f3ec58a30ae2e1bb7fb53f40105c2894be.tar.xz debuginfofs-54d0b3f3ec58a30ae2e1bb7fb53f40105c2894be.zip |
Make sure we unpack stuff that was already in cache
-rwxr-xr-x | debuginfofs-mirror | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/debuginfofs-mirror b/debuginfofs-mirror index aa8e06c..b834a52 100755 --- a/debuginfofs-mirror +++ b/debuginfofs-mirror @@ -249,7 +249,8 @@ def main(): sys.exit(1) # Figure out which packages we need to fetch - needpackages = [] + download_packages = [] + unpack_packages = [] for p in y.pkgSack.returnPackages(): repo = y.repos.getRepo(p.repoid) remote = p.returnSimple('relativepath') @@ -260,29 +261,29 @@ 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) - # Check to see if it's already unpacked + # 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 - - # Check to see if we've already got it in cache + + 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) else: - needpackages.append(p) + download_packages.append(p) - - if not needpackages: + if not unpack_packages or download_packages: y.verbose_logger.info(_('Nothing to do!')) sys.exit(0) # Show what will be downloaded and get confirmation - y.verbose_logger.info(y.listDownloads(needpackages)) - y.reportDownloadSize(needpackages) + y.verbose_logger.info(y.listDownloads(download_packages)) + y.reportDownloadSize(download_packages) + # TODO: 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(): @@ -291,10 +292,11 @@ def main(): sys.exit(1) # Download, unpack, and hardlink debuginfo data - for p in needpackages: - repo = y.repos.getRepo(p.repoid) - # FIXME handle possible errors here - repo.getPackage(p) + for p in unpack_packages: + if p in download_packages: + repo = y.repos.getRepo(p.repoid) + # FIXME handle possible errors here + repo.getPackage(p) local = p.localpath n = p.pkgtup[0] nevra = pkg_to_nevra(p) |