summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-02-20 18:01:37 -0500
committerWill Woods <wwoods@redhat.com>2009-02-20 18:01:37 -0500
commit32cc56609f5980a62ad63ea54908d71711b57a05 (patch)
treed488735ea843cbeab479e43d30d230155fc14e48
parentbc4e5590ea021b2ccd3a0a25024e2d4074d0b924 (diff)
downloaddebuginfofs-32cc56609f5980a62ad63ea54908d71711b57a05.tar.gz
debuginfofs-32cc56609f5980a62ad63ea54908d71711b57a05.tar.xz
debuginfofs-32cc56609f5980a62ad63ea54908d71711b57a05.zip
Unpack/hardlink directly after downloading
-rwxr-xr-xdebuginfofs-mirror22
1 files changed, 8 insertions, 14 deletions
diff --git a/debuginfofs-mirror b/debuginfofs-mirror
index a9a0f31..aa8e06c 100755
--- a/debuginfofs-mirror
+++ b/debuginfofs-mirror
@@ -64,8 +64,6 @@ class DebuginfoFSDownloader(YumUtilBase):
help="directory to use for caching RPMs and metadata")
o.add_option("--exportdir", default=conf['exportdir'],
help="toplevel directory for debuginfofs exported data")
- o.add_option("--savecache", default=False, action="store_true",
- help="don't delete downloaded RPMs after unpacking them")
# TODO
#o.add_option("--distro", default="Fedora",
# help="Use debuginfo repos for this distro.")
@@ -74,6 +72,8 @@ class DebuginfoFSDownloader(YumUtilBase):
help="download debuginfo for this version of the distro.")
o.add_option("--basearch", default="i386",
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
def setup(self):
@@ -174,6 +174,8 @@ def mkdebuginfolinks(sourcedir, targetdir):
if e.errno != 17:
raise e
if os.path.exists(newlink):
+ # TODO: check to see if the contents of target == newlink
+ # If not, we have a collision. That's bad.
os.unlink(newlink)
os.link(target,newlink)
count += 1
@@ -288,19 +290,11 @@ def main():
y.logger.info(_('Exiting on user Command'))
sys.exit(1)
- # Download packages
- problems = y.downloadPkgs(needpackages,
- callback_total=y.download_callback_total_cb)
- if problems:
- msg = _('Error Downloading Packages:\n')
- for key, val in problems.iteritems():
- errors = yum.misc.unique(val)
- for e in errors:
- msg += ' %s: %s\n' % (key, e)
- raise yum.Errors.YumBaseError, msg
-
- # Unpack and hardlink downloaded RPMs
+ # Download, unpack, and hardlink debuginfo data
for p in needpackages:
+ 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)