summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Woods <wwoods@redhat.com>2009-02-20 17:07:28 -0500
committerWill Woods <wwoods@redhat.com>2009-02-20 17:07:28 -0500
commit8ffddf2cdc52839deafefa37c78607d01121bcc1 (patch)
tree3bc7263fa118e068ef16a92818c2c491413822ad
parent5344c5093b972cda0d95413a4ad3b3ab33c791d7 (diff)
downloaddebuginfofs-8ffddf2cdc52839deafefa37c78607d01121bcc1.tar.gz
debuginfofs-8ffddf2cdc52839deafefa37c78607d01121bcc1.tar.xz
debuginfofs-8ffddf2cdc52839deafefa37c78607d01121bcc1.zip
Handle problems with downloadPkgs
-rwxr-xr-xdebuginfofs-mirror24
1 files changed, 17 insertions, 7 deletions
diff --git a/debuginfofs-mirror b/debuginfofs-mirror
index 5993b41..0aead68 100755
--- a/debuginfofs-mirror
+++ b/debuginfofs-mirror
@@ -21,18 +21,19 @@
import os
import sys
import shutil
-import logging
import optparse
import ConfigParser
import rpmUtils.arch
# Why, yes, I do like to arrange imports by line length
from subprocess import Popen, PIPE
-from yum import _
+# Yum stuff
+sys.path.insert(0,'/usr/share/yum-cli')
+import yum.misc
import yum.Errors
+from yum import _
+from utils import YumUtilBase
from yum.parser import varReplace
from yum.yumRepo import YumRepository
-sys.path.insert(0,'/usr/share/yum-cli')
-from utils import YumUtilBase
configfile = '/etc/debuginfofs.conf'
c = ConfigParser.RawConfigParser()
@@ -277,6 +278,7 @@ if __name__ == '__main__':
else:
needpackages.append(p)
+
if not needpackages:
y.verbose_logger.info(_('Nothing to do!'))
sys.exit(0)
@@ -292,13 +294,21 @@ if __name__ == '__main__':
sys.exit(1)
# Download packages
- y.downloadPkgs(needpackages, callback_total=y.download_callback_total_cb)
+ 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
for p in needpackages:
local = p.localpath
- (n,a,e,v,r) = p.pkgtup
- nevra = "%s-%s:%s-%s.%s" % (n,e,v,r,a)
+ n = p.pkgtup[0]
+ nevra = pkg_to_nevra(p)
newdir = os.path.join(n[0],n,nevra)
targetdir = os.path.join(opt.exportdir,'packages',newdir)