[yum-utils/f18] Update to latest HEAD, but keep yum-plugin-downloadonly.
Zdeněk Pavlas
zpavlas at fedoraproject.org
Thu Jan 17 11:01:29 UTC 2013
commit 80926100c984104a4a2af9ceba90eeb54f0e147f
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date: Thu Jan 17 12:01:15 2013 +0100
Update to latest HEAD, but keep yum-plugin-downloadonly.
yum-utils-HEAD.patch | 884 ++++++++++++++++++++++++++++++++++++++++++++------
yum-utils.spec | 66 ++--
2 files changed, 818 insertions(+), 132 deletions(-)
---
diff --git a/yum-utils-HEAD.patch b/yum-utils-HEAD.patch
index b11b308..9ee6a2e 100644
--- a/yum-utils-HEAD.patch
+++ b/yum-utils-HEAD.patch
@@ -695,7 +695,7 @@ index 0578295..aac29ea 100644
import sys
diff --git a/needs-restarting.py b/needs-restarting.py
-index 6bc883f..0b54e63 100755
+index 6bc883f..a6946b0 100755
--- a/needs-restarting.py
+++ b/needs-restarting.py
@@ -8,11 +8,11 @@
@@ -721,11 +721,19 @@ index 6bc883f..0b54e63 100755
import glob
import stat
from optparse import OptionParser
-@@ -82,12 +83,12 @@ def get_open_files(pid):
+@@ -76,18 +77,18 @@ def get_open_files(pid):
+ files = []
+ smaps = '/proc/%s/smaps' % pid
+ try:
+- maps = open(smaps, 'r')
++ maps = open(smaps, 'r').readlines()
+ except (IOError, OSError), e:
+ print "Could not open %s" % smaps
return files
- for line in maps.readlines():
+- for line in maps.readlines():
- if line.find('fd:') == -1:
++ for line in maps:
+ slash = line.find('/')
+ if slash == -1 or line.find('00:') != -1: # if we don't have a '/' or if we fine 00: in the file then it's not _REALLY_ a file
continue
@@ -886,6 +894,19 @@ index 4794369..aebae67 100755
if issues:
sys.exit(1)
+diff --git a/plugins/aliases/aliases.py b/plugins/aliases/aliases.py
+index 5cb08a1..9277c9b 100644
+--- a/plugins/aliases/aliases.py
++++ b/plugins/aliases/aliases.py
+@@ -44,7 +44,7 @@ class AliasedCommand:
+
+ def doCheck(self, base, basecmd, extcmds):
+ if recursive: # shouldn't happen
+- raise PluginYumExit('And error has occured for %s, please create a bug report')
++ raise PluginYumExit('And error has occurred for %s, please create a bug report')
+
+ raise PluginYumExit('%s is an alias not a command, however recursive processing is turned off')
+ doCommand = doCheck
diff --git a/plugins/auto-update-debuginfo/auto-update-debuginfo.py b/plugins/auto-update-debuginfo/auto-update-debuginfo.py
index 39993ad..9ff927c 100644
--- a/plugins/auto-update-debuginfo/auto-update-debuginfo.py
@@ -899,6 +920,32 @@ index 39993ad..9ff927c 100644
for opt, repoexp in opts.repos:
if opt == '--disablerepo':
mdrs.add(repoexp)
+diff --git a/plugins/fedorakmod/fedorakmod.py b/plugins/fedorakmod/fedorakmod.py
+index b3aed61..82a43d5 100644
+--- a/plugins/fedorakmod/fedorakmod.py
++++ b/plugins/fedorakmod/fedorakmod.py
+@@ -37,7 +37,7 @@ kernelVariants = ["bigmem", "enterprise", "smp", "hugemem", "PAE",
+ "guest", "hypervisor", "xen0", "xenU", "xen"]
+
+ def getRunningKernel():
+- # Taken from the installonlyn.py plugin writen by Jeremy Katz
++ # Taken from the installonlyn.py plugin written by Jeremy Katz
+ # Copyright 2005 Red Hat, Inc.
+ # Modified by Jack Neely to return a kernel provides tuple
+ """This takes the output of uname and figures out the (version, release)
+diff --git a/plugins/fs-snapshot/fs-snapshot.py b/plugins/fs-snapshot/fs-snapshot.py
+index 5094881..ef4afe8 100644
+--- a/plugins/fs-snapshot/fs-snapshot.py
++++ b/plugins/fs-snapshot/fs-snapshot.py
+@@ -21,7 +21,7 @@ This plugin creates a snapshot before any yum update or yum remove operation on
+ any btrfs filesystem that is affected by the update/remove operation.
+
+ This is a giant hammer. Please be aware that if you rollback to a previous
+-snapshot that any other changes that occured to the filesystem after the
++snapshot that any other changes that occurred to the filesystem after the
+ snapshot takes place will not be in the snapshot. You of course can mount the
+ newer version elsewhere and copy the new versions of the files back to your
+ rolled-back snapshot. You have been warned.
diff --git a/plugins/keys/keys.py b/plugins/keys/keys.py
index 3342576..4d2ca96 100644
--- a/plugins/keys/keys.py
@@ -928,11 +975,33 @@ index 3342576..4d2ca96 100644
yum.pgpmsg.str_to_hex(gpg_cert.public_key.key_id()))
+diff --git a/plugins/local/local.py b/plugins/local/local.py
+index c45a1ce..cab69c5 100644
+--- a/plugins/local/local.py
++++ b/plugins/local/local.py
+@@ -146,7 +146,7 @@ def _reposetup(conduit):
+ if repo.id == "_local"]
+ if lrepo:
+ lrepo = lrepo[0]
+- os.unlink("%s/cachecookie" % lrepo.cachedir)
++ yum.misc.unlink_f("%s/cachecookie" % lrepo.cachedir)
+ return
+
+ conf_fname = '/etc/yum.repos.d/_local.repo'
diff --git a/plugins/priorities/priorities.py b/plugins/priorities/priorities.py
-index 202c203..0cdfae2 100644
+index 202c203..ce98583 100644
--- a/plugins/priorities/priorities.py
+++ b/plugins/priorities/priorities.py
-@@ -164,6 +164,10 @@ def exclude_hook(conduit):
+@@ -161,9 +161,19 @@ def exclude_hook(conduit):
+ conduit.delPackage(po)
+ cnt += 1
+ conduit.info(3," --> %s from %s excluded (priority)" % (po,po.repoid))
++ # Remove all occurances of this package
++ for p in conduit.getPackages(repo):
++ if p.name==po.name:
++ conduit.delPackage(p)
++ cnt += 1
++ conduit.info(3," --> %s from %s excluded (priority)" % (p,p.repoid))
break
if cnt:
conduit.info(2, '%d packages excluded due to repository priority protections' % cnt)
@@ -943,6 +1012,18 @@ index 202c203..0cdfae2 100644
def _pkglist_to_dict(pl, priority, addArch = False):
out = dict()
+diff --git a/plugins/versionlock/versionlock.py b/plugins/versionlock/versionlock.py
+index 40756b2..69458cd 100644
+--- a/plugins/versionlock/versionlock.py
++++ b/plugins/versionlock/versionlock.py
+@@ -170,6 +170,7 @@ class VersionLockCommand:
+ if not count:
+ os.unlink(tmpfilename)
+ return 1, ['Error: versionlock delete: no matches']
++ os.chmod(tmpfilename, 0644)
+ os.rename(tmpfilename, filename)
+ return 0, ['versionlock deleted: ' + str(count)]
+
diff --git a/repo-check.py b/repo-check.py
index 7c4ae77..2aa8bde 100755
--- a/repo-check.py
@@ -1008,7 +1089,7 @@ index 4a2917c..f14ff2a 100755
import yum
diff --git a/repoclosure.py b/repoclosure.py
-index e710d8c..22efadc 100755
+index e710d8c..e5aae1b 100755
--- a/repoclosure.py
+++ b/repoclosure.py
@@ -8,11 +8,11 @@
@@ -1026,6 +1107,15 @@ index e710d8c..22efadc 100755
# seth vidal 2005 (c) etc etc
+@@ -166,7 +166,7 @@ class RepoClosure(yum.YumBase):
+
+ for pkg in pkgs:
+ if pkg.repoid in self.lookaside:
+- # don't attempt to resolve dependancy issues for
++ # don't attempt to resolve dependency issues for
+ # packages from lookaside repositories
+ continue
+ for (req, flags, (reqe, reqv, reqr)) in pkg.returnPrco('requires'):
diff --git a/repodiff.py b/repodiff.py
index 67c162e..c16c03e 100755
--- a/repodiff.py
@@ -1272,7 +1362,7 @@ index ff77e0d..bef3b03 100755
# (c) Copyright Seth Vidal 2004
diff --git a/repoquery.py b/repoquery.py
-index a3bb111..7660789 100755
+index a3bb111..a854c23 100755
--- a/repoquery.py
+++ b/repoquery.py
@@ -8,11 +8,11 @@
@@ -1290,7 +1380,15 @@ index a3bb111..7660789 100755
# (c) pmatilai at laiskiainen.org
-@@ -74,6 +74,15 @@ querytags = [ 'name', 'version', 'release', 'epoch', 'arch', 'summary',
+@@ -25,7 +25,6 @@ import fnmatch
+ import time
+ import os
+ import os.path
+-import exceptions
+ import urlparse
+
+ from optparse import OptionParser
+@@ -74,6 +73,15 @@ querytags = [ 'name', 'version', 'release', 'epoch', 'arch', 'summary',
'installedsize', 'archivesize', 'packagesize', 'repoid',
'requires', 'provides', 'conflicts', 'obsoletes',
'relativepath', 'hdrstart', 'hdrend', 'id',
@@ -1306,7 +1404,16 @@ index a3bb111..7660789 100755
]
def sec2isodate(timestr):
-@@ -316,12 +325,13 @@ class pkgQuery:
+@@ -114,7 +122,7 @@ convertmap = { 'date': sec2date,
+ 'h': size2h,
+ }
+
+-class queryError(exceptions.Exception):
++class queryError(Exception):
+ def __init__(self, value=None):
+ Exception.__init__(self)
+ self.value = value
+@@ -316,12 +324,13 @@ class pkgQuery:
print "%s%s [%s]" % (indent, str(req), str(val))
# These are common helpers for the --tree-* options...
@@ -1323,7 +1430,7 @@ index a3bb111..7660789 100755
def _tree_pkg2uniq(self, pkg):
""" Turn a pkg into a "unique" req."""
if self.yb and self.yb.conf.showdupesfromrepos:
-@@ -365,6 +375,7 @@ class pkgQuery:
+@@ -365,6 +374,7 @@ class pkgQuery:
kw['dot'] = DotPlot()
elif 'dot' not in kw.keys() or kw['dot'] is None:
kw['dot'] = None
@@ -1331,7 +1438,7 @@ index a3bb111..7660789 100755
if str(kw['tree_level']).lower() != 'all':
try:
-@@ -375,6 +386,15 @@ class pkgQuery:
+@@ -375,6 +385,15 @@ class pkgQuery:
if not 'output' in kw.keys():
kw['output'] = 'ascii-tree'
@@ -1347,7 +1454,7 @@ index a3bb111..7660789 100755
__req2pkgs = {}
def req2pkgs(ignore, req):
req = str(req)
-@@ -413,14 +433,9 @@ class pkgQuery:
+@@ -413,14 +432,9 @@ class pkgQuery:
__req2pkgs[req] = providers
return providers
@@ -1363,7 +1470,7 @@ index a3bb111..7660789 100755
dot.addPackage(pkg, rpkgs)
lim = level + 2
nlevel = level + 1
-@@ -449,6 +464,7 @@ class pkgQuery:
+@@ -449,6 +463,7 @@ class pkgQuery:
def fmt_tree_obsoletes(self, **kw):
pkg = kw.get('pkg', self.pkg)
@@ -1371,7 +1478,7 @@ index a3bb111..7660789 100755
level = kw.get('level', 0)
all_reqs = kw.get('all_reqs', {})
-@@ -457,6 +473,7 @@ class pkgQuery:
+@@ -457,6 +472,7 @@ class pkgQuery:
kw['dot'] = DotPlot()
elif 'dot' not in kw.keys() or kw['dot'] is None:
kw['dot'] = None
@@ -1379,7 +1486,7 @@ index a3bb111..7660789 100755
if str(kw['tree_level']).lower() != 'all':
try:
-@@ -467,6 +484,15 @@ class pkgQuery:
+@@ -467,6 +483,15 @@ class pkgQuery:
if not 'output' in kw.keys():
kw['output'] = 'ascii-tree'
@@ -1395,7 +1502,7 @@ index a3bb111..7660789 100755
def obs2pkgs():
if self.yb is None:
return []
-@@ -496,10 +522,7 @@ class pkgQuery:
+@@ -496,10 +521,7 @@ class pkgQuery:
else:
reason = 'cmd line'
rpkgs = obs2pkgs()
@@ -1407,7 +1514,7 @@ index a3bb111..7660789 100755
dot.addPackage(pkg, rpkgs)
lim = level + 2
all_reqs[pkg] = None
-@@ -514,6 +537,7 @@ class pkgQuery:
+@@ -514,6 +536,7 @@ class pkgQuery:
self._tree_print_req(rpkg, '', nlevel)
continue
self.fmt_tree_obsoletes(pkg=rpkg, level=nlevel, all_reqs=all_reqs,
@@ -1415,7 +1522,7 @@ index a3bb111..7660789 100755
tree_level = kw['tree_level'],
output = kw['output'],
dot = dot)
-@@ -527,6 +551,7 @@ class pkgQuery:
+@@ -527,6 +550,7 @@ class pkgQuery:
if kw['output'].lower() == 'dot-tree':
if 'dot' not in kw.keys() or kw['dot'] is None:
kw['dot'] = DotPlot()
@@ -1423,7 +1530,7 @@ index a3bb111..7660789 100755
if str(kw['tree_level']).lower() != 'all':
try:
-@@ -537,6 +562,15 @@ class pkgQuery:
+@@ -537,6 +561,15 @@ class pkgQuery:
if not 'output' in kw.keys():
kw['output'] = 'ascii-tree'
@@ -1439,7 +1546,7 @@ index a3bb111..7660789 100755
__prov2pkgs = {}
def prov2pkgs(prov, ignore):
if str(prov) in __prov2pkgs:
-@@ -575,12 +609,8 @@ class pkgQuery:
+@@ -575,12 +608,8 @@ class pkgQuery:
tups = pkg.provides + filetupes
rpkgs, loc_reqs = self._tree_maybe_add_pkgs(all_reqs, tups, prov2pkgs)
@@ -1453,7 +1560,7 @@ index a3bb111..7660789 100755
dot.addPackage(pkg, rpkgs)
lim = level + 2
nlevel = level + 1
-@@ -719,13 +749,13 @@ class groupQuery:
+@@ -719,13 +748,13 @@ class groupQuery:
raise queryError("Invalid group query: %s" % method)
# XXX temporary hack to make --group -a query work
@@ -1470,7 +1577,7 @@ index a3bb111..7660789 100755
pkgs = []
for t in self.grouppkgs.split(','):
if t == "mandatory":
-@@ -741,10 +771,10 @@ class groupQuery:
+@@ -741,10 +770,10 @@ class groupQuery:
return pkgs
@@ -1483,7 +1590,16 @@ index a3bb111..7660789 100755
return ["%s:\n\n%s\n" % (self.name, self.group.description)]
-@@ -1008,12 +1038,12 @@ class YumBaseQuery(yum.YumBase):
+@@ -826,6 +855,8 @@ class YumBaseQuery(yum.YumBase):
+ pkgs = self.pkgSack.returnNewestByNameArch(**kwargs)
+ except yum.Errors.PackageSackError:
+ pkgs = []
++ except yum.Errors.RepoError, e:
++ raise queryError(e)
+ else:
+ what = self.options.pkgnarrow
+ ygh = self.doPackageLists(what, **kwargs)
+@@ -1008,12 +1039,12 @@ class YumBaseQuery(yum.YumBase):
def fmt_whatrequires(self, name, **kw):
pkgs = {}
@@ -1498,7 +1614,7 @@ index a3bb111..7660789 100755
provs = [name]
-@@ -1054,10 +1084,21 @@ class YumBaseQuery(yum.YumBase):
+@@ -1054,10 +1085,21 @@ class YumBaseQuery(yum.YumBase):
def fmt_requires(self, name, **kw):
pkgs = {}
@@ -1521,7 +1637,7 @@ index a3bb111..7660789 100755
return pkgs.values()
def fmt_location(self, name):
-@@ -1070,6 +1111,44 @@ class YumBaseQuery(yum.YumBase):
+@@ -1070,6 +1112,44 @@ class YumBaseQuery(yum.YumBase):
loc.append("%s/%s" % (repo.urls[0], pkg['relativepath']))
return loc
@@ -1566,7 +1682,7 @@ index a3bb111..7660789 100755
def main(args):
-@@ -1198,6 +1277,9 @@ def main(args):
+@@ -1198,6 +1278,9 @@ def main(args):
parser.add_option("--search-fields", action="append", dest="searchfields",
default=[],
help="search fields to search using --search")
@@ -1576,7 +1692,7 @@ index a3bb111..7660789 100755
(opts, regexs) = parser.parse_args()
-@@ -1261,9 +1343,10 @@ def main(args):
+@@ -1261,9 +1344,10 @@ def main(args):
if opts.srpm:
needsource = 1
if opts.whatrequires:
@@ -1588,7 +1704,7 @@ index a3bb111..7660789 100755
if opts.whatprovides:
sackops.append("whatprovides")
if opts.whatobsoletes:
-@@ -1303,6 +1386,13 @@ def main(args):
+@@ -1303,6 +1387,13 @@ def main(args):
repoq = YumBaseQuery(pkgops, sackops, opts)
@@ -1602,7 +1718,7 @@ index a3bb111..7660789 100755
# silence initialisation junk from modules etc unless verbose mode
initnoise = (not opts.quiet) * 2
repoq.preconf.releasever = opts.releasever
-@@ -1314,6 +1404,20 @@ def main(args):
+@@ -1314,6 +1405,20 @@ def main(args):
repoq.preconf.init_plugins = opts.plugins
repoq.conf
@@ -1624,7 +1740,7 @@ index a3bb111..7660789 100755
# setup the fake repos
for repo in opts.repofrompath:
diff --git a/reposync.py b/reposync.py
-index 7950854..fb2c592 100755
+index 7950854..a749973 100755
--- a/reposync.py
+++ b/reposync.py
@@ -11,8 +11,8 @@
@@ -1638,6 +1754,15 @@ index 7950854..fb2c592 100755
# copyright 2006 Duke University
# author seth vidal
+@@ -47,7 +47,7 @@ from yum.constants import *
+ from yum.packageSack import ListPackageSack
+ import rpmUtils.arch
+ import logging
+-from urlgrabber.progress import TextMeter
++from urlgrabber.progress import TextMeter, TextMultiFileMeter
+ import urlgrabber
+
+ # for yum 2.4.X compat
@@ -96,7 +96,7 @@ def parseArgs():
parser.add_option("-c", "--config", default='/etc/yum.conf',
help='config file to use (defaults to /etc/yum.conf)')
@@ -1647,20 +1772,39 @@ index 7950854..fb2c592 100755
parser.add_option("--source", default=False, dest="source", action="store_true",
help='operate on source packages')
parser.add_option("-r", "--repoid", default=[], action='append',
-@@ -162,6 +162,12 @@ def main():
+@@ -153,15 +153,27 @@ def main():
+ opts.tempcache = True
+
+ if opts.tempcache:
+- cachedir = getCacheDir()
+- if cachedir is None:
++ if not my.setCacheDir(force=True):
+ print >> sys.stderr, "Error: Could not make cachedir, exiting"
+ sys.exit(50)
+-
+- my.repos.setCacheDir(cachedir)
++ my.conf.uid = 1 # force locking of user cache
elif opts.cachedir:
my.repos.setCacheDir(opts.cachedir)
++ # Lock if they've not given an explicit cachedir
++ if not opts.cachedir:
++ try:
++ my.doLock()
++ except yum.Errors.LockError, e:
++ print >> sys.stderr, "Error: %s" % e
++ sys.exit(50)
++
+ # Use progress bar display when downloading repo metadata
+ # and package files ... needs to be setup before .repos (ie. RHN/etc.).
+ if not opts.quiet:
-+ my.repos.setProgressBar(TextMeter(fo=sys.stdout))
++ my.repos.setProgressBar(TextMeter(fo=sys.stdout), TextMultiFileMeter(fo=sys.stdout))
+ my.doRepoSetup()
+
if len(opts.repoid) > 0:
myrepos = []
-@@ -182,13 +188,6 @@ def main():
+@@ -182,13 +194,6 @@ def main():
print >> sys.stderr, "Error: Can't use --norepopath with multiple repositories"
sys.exit(1)
@@ -1674,32 +1818,115 @@ index 7950854..fb2c592 100755
try:
arches = rpmUtils.arch.getArchList(opts.arch)
if opts.source:
-@@ -278,6 +277,7 @@ def main():
+@@ -199,6 +204,7 @@ def main():
+ # maybe this shouldn't be entirely fatal
+ sys.exit(1)
+
++ exit_code = 0
+ for repo in my.repos.listEnabled():
+ reposack = ListPackageSack(my.pkgSack.returnPackages(repoid=repo.id))
+
+@@ -277,73 +283,47 @@ def main():
+ urlgrabber.progress.text_meter_total_size(remote_size)
download_list.sort(sortPkgObj)
- n = 0
-+ exit_code = 0
+- n = 0
++ if opts.urls:
++ for pkg in download_list:
++ print urljoin(pkg.repo.urls[0], pkg.relativepath)
++ return 0
++
++ # create dest dir
++ if not os.path.exists(local_repo_path):
++ os.makedirs(local_repo_path)
++
++ # set localpaths
for pkg in download_list:
- n = n + 1
- repo = my.repos.getRepo(pkg.repoid)
-@@ -323,6 +323,7 @@ def main():
- except yum.Errors.RepoError, e:
- my.logger.error("Could not retrieve package %s. Error was %s" % (pkg, str(e)))
- local_size += sz
-+ exit_code = 1
- continue
-
- local_size += sz
-@@ -338,12 +339,14 @@ def main():
+- n = n + 1
+- repo = my.repos.getRepo(pkg.repoid)
+- remote = pkg.returnSimple('relativepath')
+- local = local_repo_path + '/' + remote
+- localdir = os.path.dirname(local)
+- if not os.path.exists(localdir):
+- os.makedirs(localdir)
+-
+- sz = int(pkg.returnSimple('packagesize'))
+- if os.path.exists(local) and os.path.getsize(local) == sz:
+-
+- if not opts.quiet:
+- my.logger.error("[%s: %-5d of %-5d ] Skipping existing %s" % (repo.id, n, len(download_list), remote))
+- continue
+-
+- if opts.urls:
+- baseurl = None
+- if repo.urls[0][-1] != '/':
+- baseurl = repo.urls[0] + '/'
+- else:
+- baseurl = repo.urls[0]
+- url = urljoin(baseurl,remote)
+- print '%s' % url
+- continue
+-
+- # make sure the repo subdir is here before we go on.
+- if not os.path.exists(local_repo_path):
+- try:
+- os.makedirs(local_repo_path)
+- except IOError, e:
+- my.logger.error("Could not make repo subdir: %s" % e)
+- my.closeRpmDB()
+- sys.exit(1)
+-
+- # Disable cache otherwise things won't download
+- repo.cache = 0
+- if not opts.quiet:
+- my.logger.info( '[%s: %-5d of %-5d ] Downloading %s' % (repo.id, n, len(download_list), remote))
+- pkg.localpath = local # Hack: to set the localpath we want.
+- try:
+- path = repo.getPackage(pkg)
+- except yum.Errors.RepoError, e:
+- my.logger.error("Could not retrieve package %s. Error was %s" % (pkg, str(e)))
+- local_size += sz
+- continue
+-
+- local_size += sz
+- if hasattr(urlgrabber.progress, 'text_meter_total_size'):
+- urlgrabber.progress.text_meter_total_size(remote_size, local_size)
+- if opts.gpgcheck:
++ rpmfn = os.path.basename(pkg.remote_path)
++ pkg.localpath = os.path.join(local_repo_path, rpmfn)
++ pkg.repo.copy_local = True
++ pkg.repo.cache = 0
++
++ # use downloader from YumBase
++ probs = my.downloadPkgs(download_list)
++ if probs:
++ exit_code = 1
++ for key in probs:
++ for error in probs[key]:
++ self.logger.error('%s: %s', key, error)
++
++ if opts.gpgcheck:
++ for pkg in download_list:
+ result, error = my.sigCheckPkg(pkg)
+ if result != 0:
++ rpmfn = os.path.basename(pkg.remote_path)
+ if result == 1:
+- my.logger.warning('Removing %s, due to missing GPG key.' % os.path.basename(remote))
++ my.logger.warning('Removing %s, due to missing GPG key.' % rpmfn)
+ elif result == 2:
+- my.logger.warning('Removing %s due to failed signature check.' % os.path.basename(remote))
++ my.logger.warning('Removing %s due to failed signature check.' % rpmfn)
else:
- my.logger.warning('Removing %s due to failed signature check: %s' % (os.path.basename(remote), error))
- os.unlink(path)
+- my.logger.warning('Removing %s due to failed signature check: %s' % (os.path.basename(remote), error))
+- os.unlink(path)
++ my.logger.warning('Removing %s due to failed signature check: %s' % rpmfn)
++ os.unlink(pkg.localpath)
+ exit_code = 1
continue
- if not os.path.exists(local) or not os.path.samefile(path, local):
- shutil.copy2(path, local)
-
+- if not os.path.exists(local) or not os.path.samefile(path, local):
+- shutil.copy2(path, local)
+-
my.closeRpmDB()
+ sys.exit(exit_code)
@@ -1765,6 +1992,49 @@ index 3489247..f314ef0 100755
if opts.cache:
yb.conf.cache = 1
elif not yb.setCacheDir():
+diff --git a/show-installed.py b/show-installed.py
+index 737f97e..65aae11 100755
+--- a/show-installed.py
++++ b/show-installed.py
+@@ -360,7 +360,7 @@ def __main__():
+ choices=('kickstart','human','yum'), default="human",
+ help='yum, kickstart or human; yum gives the result as a yum command line; kickstart the content of a %packages section; "human" readable is default.')
+ parser.add_option("-i", "--input", dest="input", action="store", default=None, help="File to read the package list from instead of using the rpmdb. - for stdin. The file must contain package names only separated by white space (including newlines). rpm -qa --qf='%{name}\\n' produces proper output.")
+- parser.add_option("-o", "--output", dest="output", action="store", default=None, help="File to write the result to. Stdout is used if option is omited.")
++ parser.add_option("-o", "--output", dest="output", action="store", default=None, help="File to write the result to. Stdout is used if option is omitted.")
+ parser.add_option("-q", "--quiet", dest="quiet", action="store_true", help="Do not show warnings.")
+ parser.add_option("-e", "--no-excludes", dest="excludes",
+ action="store_false", default=True,
+diff --git a/test/yum-utils-pylintrc b/test/yum-utils-pylintrc
+index 1a03789..6acaba4 100644
+--- a/test/yum-utils-pylintrc
++++ b/test/yum-utils-pylintrc
+@@ -1,6 +1,6 @@
+ # lint Python modules using external checkers.
+ #
+-# This is the main checker controling the other ones and the reports
++# This is the main checker controlling the other ones and the reports
+ # generation. It is itself both a raw checker and an astng checker in order
+ # to:
+ # * handle message activation / deactivation at the module level
+@@ -106,7 +106,7 @@ reports=yes
+
+ # Python expression which should return a note less than 10 (10 is the highest
+ # note).You have access to the variables errors warning, statement which
+-# respectivly contain the number of errors / warnings messages and the total
++# respectively contain the number of errors / warnings messages and the total
+ # number of statements analyzed. This is used by the global evaluation report
+ # (R0004).
+ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
+@@ -246,7 +246,7 @@ int-import-graph=
+ # checks for :
+ # * methods without self as first argument
+ # * overridden methods signature
+-# * access only to existant members via self
++# * access only to existent members via self
+ # * attributes not defined in the __init__ method
+ # * supported interfaces implementation
+ # * unreachable code
diff --git a/verifytree.py b/verifytree.py
index d1fe5e2..cb89285 100755
--- a/verifytree.py
@@ -1785,10 +2055,10 @@ index d1fe5e2..cb89285 100755
import yum
diff --git a/yum-builddep.py b/yum-builddep.py
-index d7a37c3..f67c810 100755
+index d7a37c3..b9e682a 100755
--- a/yum-builddep.py
+++ b/yum-builddep.py
-@@ -8,11 +8,11 @@
+@@ -8,17 +8,18 @@
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -1803,7 +2073,14 @@ index d7a37c3..f67c810 100755
import sys
sys.path.insert(0,'/usr/share/yum-cli')
-@@ -26,6 +26,8 @@ import logging
+
+ import yum
+ from yum.misc import setup_locale
++from yum.i18n import exception2msg
+ import yum.Errors
+ from utils import YumUtilBase
+
+@@ -26,6 +27,8 @@ import logging
import rpmUtils
import rpm
@@ -1812,7 +2089,7 @@ index d7a37c3..f67c810 100755
# Copied from yumdownloader (need a yum-utils python module ;)
# This is to fix Bug 469
# To convert from a pkg to a source pkg, we have a problem in that all we have
-@@ -61,6 +63,9 @@ class YumBuildDep(YumUtilBase):
+@@ -61,6 +64,9 @@ class YumBuildDep(YumUtilBase):
self.logger = logging.getLogger("yum.verbose.cli.yumbuildep")
# Add util commandline options to the yum-cli ones
self.optparser = self.getOptionParser()
@@ -1822,7 +2099,7 @@ index d7a37c3..f67c810 100755
self.main()
def main(self):
-@@ -118,9 +123,16 @@ class YumBuildDep(YumUtilBase):
+@@ -118,9 +124,16 @@ class YumBuildDep(YumUtilBase):
# enable the -source repos for enabled primary repos
archlist = rpmUtils.arch.getArchList() + ['src']
for repo in self.repos.listEnabled():
@@ -1840,7 +2117,32 @@ index d7a37c3..f67c810 100755
repo.close()
self.repos.disableRepo(repo.id)
srcrepo = repo.id
-@@ -170,10 +182,14 @@ class YumBuildDep(YumUtilBase):
+@@ -140,6 +153,7 @@ class YumBuildDep(YumUtilBase):
+ sys.exit(1)
+
+ def install_deps(self, deplist):
++ errors = set()
+ for dep in deplist:
+ self.logger.debug(' REQ: %s' % dep)
+ if dep.startswith("rpmlib("):
+@@ -152,10 +166,13 @@ class YumBuildDep(YumUtilBase):
+ pkg = self.returnPackageByDep(dep)
+ self.logger.info(' --> %s' % pkg)
+ self.install(pkg)
+-
+ except yum.Errors.YumBaseError, e:
+- self.logger.error("Error: %s" % e)
+- sys.exit(1)
++ errors.add(exception2msg(e))
++
++ if errors:
++ for i in sorted(errors):
++ self.logger.error("Error: %s" % i)
++ sys.exit(1)
+
+ # go through each of the pkgs, figure out what they are/where they are
+ # if they are not a local package then run
+@@ -170,10 +187,14 @@ class YumBuildDep(YumUtilBase):
specnames = []
srpms = []
specworks = False
@@ -1855,7 +2157,20 @@ index d7a37c3..f67c810 100755
for arg in self.cmds:
if arg.endswith('.src.rpm'):
-@@ -216,12 +232,20 @@ class YumBuildDep(YumUtilBase):
+@@ -206,22 +227,30 @@ class YumBuildDep(YumUtilBase):
+ sys.exit(1)
+
+ toActOn = []
++ # Get the best matching srpms
+ for newpkg in srpms:
+- toActOn.extend(_best_convert_pkg2srcpkgs(self, opts, newpkg))
+- # Get the best matching srpm
+- toActOn = self.bestPackagesFromList(toActOn, 'src')
++ srcpkg = _best_convert_pkg2srcpkgs(self, opts, newpkg)
++ toActOn.extend(self.bestPackagesFromList(srcpkg, 'src'))
+
+ for srpm in toActOn:
+ self.logger.info('Getting requirements for %s' % srpm)
self.install_deps(srpm.requiresList())
for name in specnames:
@@ -1877,7 +2192,7 @@ index d7a37c3..f67c810 100755
for d in rpm.ds(spec.sourceHeader, 'requires'):
buildreqs.append(d.DNEVR()[2:])
diff --git a/yum-complete-transaction.py b/yum-complete-transaction.py
-index c5074ab..66c4504 100755
+index c5074ab..b61df9c 100755
--- a/yum-complete-transaction.py
+++ b/yum-complete-transaction.py
@@ -8,11 +8,11 @@
@@ -1895,6 +2210,15 @@ index c5074ab..66c4504 100755
import sys
sys.path.insert(0,'/usr/share/yum-cli')
+@@ -93,7 +93,7 @@ except ImportError:
+ return to_complete_items
+
+ class YumCompleteTransaction(YumUtilBase):
+- NAME = 'yum-complete-transactions'
++ NAME = 'yum-complete-transaction'
+ VERSION = '1.0'
+ USAGE = """
+ yum-complete-transaction: completes unfinished yum transactions which occur due to error, failure
diff --git a/yum-debug-dump.py b/yum-debug-dump.py
index 4653f3c..67d943f 100755
--- a/yum-debug-dump.py
@@ -1915,7 +2239,7 @@ index 4653f3c..67d943f 100755
import os
diff --git a/yum-debug-restore.py b/yum-debug-restore.py
-index fd95741..1e2a659 100755
+index fd95741..1d827f4 100755
--- a/yum-debug-restore.py
+++ b/yum-debug-restore.py
@@ -8,11 +8,11 @@
@@ -1968,6 +2292,19 @@ index fd95741..1e2a659 100755
return ret
def main():
+@@ -223,10 +232,8 @@ def main():
+ sys.exit(0)
+
+ # Want to do the transaction, hacky method
+- if xtra_args:
+- os.system("yum shell %s %s" % (" ".join(xtra_args), fo.name))
+- else:
+- os.system("yum shell %s" % fo.name)
++ xtra_args.append('--setopt=installonly_limit=0')
++ os.system("yum shell %s %s" % (" ".join(xtra_args), fo.name))
+
+ if __name__ == "__main__":
+ main()
diff --git a/yum-util-cli-template b/yum-util-cli-template
index 8bfdbcd..250ebc9 100644
--- a/yum-util-cli-template
@@ -2192,10 +2529,10 @@ index 1d37231..20e8e5c 100644
# mode: shell-script
# sh-basic-offset: 4
diff --git a/yum-utils.spec b/yum-utils.spec
-index ce7fb64..f67f713 100644
+index ce7fb64..0c3ff09 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
-@@ -1,3 +1,9 @@
+@@ -1,4 +1,11 @@
+%if 0%{?rhel}
+%define package_yum_updatesd 0
+%else
@@ -2203,9 +2540,11 @@ index ce7fb64..f67f713 100644
+%endif
+
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
++%define pluginhome /usr/lib/yum-plugins
Summary: Utilities based around the yum package manager
-@@ -130,6 +136,7 @@ This plugin allows repositories to have different priorities.
+ Name: yum-utils
+@@ -130,6 +137,7 @@ This plugin allows repositories to have different priorities.
Packages in a repository with a lower priority can't be overridden by packages
from a repository with a higher priority even if repo has a later version.
@@ -2213,7 +2552,7 @@ index ce7fb64..f67f713 100644
%package -n yum-plugin-refresh-updatesd
Summary: Tell yum-updatesd to check for updates when yum exits
Group: System Environment/Base
-@@ -143,6 +150,7 @@ Requires: yum-updatesd
+@@ -143,6 +151,7 @@ Requires: yum-updatesd
yum-refresh-updatesd tells yum-updatesd to check for updates when yum exits.
This way, if you run 'yum update' and install all available updates, puplet
will almost instantly update itself to reflect this.
@@ -2221,7 +2560,16 @@ index ce7fb64..f67f713 100644
%package -n yum-plugin-merge-conf
Summary: Yum plugin to merge configuration changes when installing packages
-@@ -397,7 +405,6 @@ plugins="\
+@@ -290,7 +299,7 @@ This plugin allows the user to run arbitrary actions immediately following a
+ transaction when specified packages are changed.
+
+ %package -n yum-NetworkManager-dispatcher
+-Summary: NetworkManager script which tells yum to check it's cache on network change
++Summary: NetworkManager script which tells yum to check its cache on network change
+ Group: System Environment/Base
+ Requires: yum >= 3.2.17
+
+@@ -397,7 +406,6 @@ plugins="\
tsflags \
downloadonly \
priorities \
@@ -2229,20 +2577,31 @@ index ce7fb64..f67f713 100644
merge-conf \
security \
upgrade-helper \
-@@ -418,6 +425,12 @@ plugins="\
+@@ -418,14 +426,20 @@ plugins="\
puppetverify \
"
+-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/lib/yum-plugins/
+%if %{package_yum_updatesd}
+plugins="$plugins \
+ refresh-updatesd \
+"
+%endif
+
- mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/lib/yum-plugins/
++mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/%pluginhome
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/post-actions
-@@ -469,8 +482,8 @@ fi
+ cd plugins
+ for plug in $plugins; do
+ install -m 644 $plug/*.conf $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/
+- install -m 644 $plug/*.py $RPM_BUILD_ROOT/usr/lib/yum-plugins/
+- %{__python} -c "import compileall; compileall.compile_dir('$RPM_BUILD_ROOT/usr/lib/yum-plugins', 1)"
++ install -m 644 $plug/*.py $RPM_BUILD_ROOT/%pluginhome
++ %{__python} -c "import compileall; compileall.compile_dir('$RPM_BUILD_ROOT/%pluginhome', 1)"
+ done
+ install -m 644 aliases/aliases $RPM_BUILD_ROOT/%{_sysconfdir}/yum/aliases.conf
+ install -m 644 versionlock/versionlock.list $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/
+@@ -469,8 +483,8 @@ fi
%{_bindir}/yum-builddep
%{_bindir}/yum-config-manager
%{_bindir}/yum-debug-dump
@@ -2252,7 +2611,7 @@ index ce7fb64..f67f713 100644
%{_bindir}/show-installed
%{_bindir}/show-changed-rco
%{_sbindir}/yum-complete-transaction
-@@ -487,6 +500,7 @@ fi
+@@ -487,6 +501,7 @@ fi
%{_mandir}/man1/show-installed.1.*
%{_mandir}/man1/yum-builddep.1.*
%{_mandir}/man1/yum-debug-dump.1.*
@@ -2260,20 +2619,206 @@ index ce7fb64..f67f713 100644
%{_mandir}/man8/yum-complete-transaction.8.*
%{_mandir}/man1/yum-groups-manager.1.*
%{_mandir}/man8/yumdb.8.*
-@@ -545,11 +559,13 @@ fi
+@@ -502,7 +517,7 @@ fi
+ %defattr(-, root, root)
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/changelog.conf
+ %doc COPYING
+-/usr/lib/yum-plugins/changelog.*
++%{pluginhome}/changelog.*
+ %{_mandir}/man1/yum-changelog.1.*
+ %{_mandir}/man5/yum-changelog.conf.5.*
+
+@@ -510,20 +525,20 @@ fi
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/fastestmirror.conf
+-/usr/lib/yum-plugins/fastestmirror*.*
++%{pluginhome}/fastestmirror*.*
+
+ %files -n yum-plugin-protectbase
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/protectbase.conf
+-/usr/lib/yum-plugins/protectbase.*
++%{pluginhome}/protectbase.*
+
+ %files -n yum-plugin-versionlock
+ %defattr(-, root, root)
+ %doc plugins/versionlock/README COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/versionlock.conf
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/versionlock.list
+-/usr/lib/yum-plugins/versionlock.*
++%{pluginhome}/versionlock.*
+ %{_mandir}/man1/yum-versionlock.1.*
+ %{_mandir}/man5/yum-versionlock.conf.5.*
+
+@@ -531,7 +546,7 @@ fi
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/tsflags.conf
+-/usr/lib/yum-plugins/tsflags.*
++%{pluginhome}/tsflags.*
+
+ %files -n yum-plugin-downloadonly
+ %defattr(-, root, root)
+@@ -543,73 +558,75 @@ fi
+ %defattr(-, root, root)
+ %doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/priorities.conf
- /usr/lib/yum-plugins/priorities.*
+-/usr/lib/yum-plugins/priorities.*
++%{pluginhome}/priorities.*
+%if %{package_yum_updatesd}
%files -n yum-plugin-refresh-updatesd
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/refresh-updatesd.conf
- /usr/lib/yum-plugins/refresh-updatesd.*
+-/usr/lib/yum-plugins/refresh-updatesd.*
++%{pluginhome}/refresh-updatesd.*
+%endif
%files -n yum-plugin-merge-conf
%defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/merge-conf.conf
+-/usr/lib/yum-plugins/merge-conf.*
++%{pluginhome}/merge-conf.*
+
+ %files -n yum-plugin-security
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/security.conf
+-/usr/lib/yum-plugins/security.*
++%{pluginhome}/security.*
+ %{_mandir}/man8/yum-security.8.*
+
+ %files -n yum-plugin-upgrade-helper
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/upgrade-helper.conf
+-/usr/lib/yum-plugins/upgrade-helper.*
++%{pluginhome}/upgrade-helper.*
+
+ %files -n yum-plugin-aliases
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/aliases.conf
+ %config(noreplace) %{_sysconfdir}/yum/aliases.conf
+-/usr/lib/yum-plugins/aliases.*
++%{pluginhome}/aliases.*
+ %{_mandir}/man1/yum-aliases.1.*
+
+ %files -n yum-plugin-list-data
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/list-data.conf
+-/usr/lib/yum-plugins/list-data.*
++%{pluginhome}/list-data.*
+ %{_mandir}/man1/yum-list-data.1.*
+
+ %files -n yum-plugin-filter-data
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/filter-data.conf
+-/usr/lib/yum-plugins/filter-data.*
++%{pluginhome}/filter-data.*
+ %{_mandir}/man1/yum-filter-data.1.*
+
+ %files -n yum-plugin-tmprepo
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/tmprepo.conf
+-/usr/lib/yum-plugins/tmprepo.*
++%{pluginhome}/tmprepo.*
+
+ %files -n yum-plugin-verify
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/verify.conf
+-/usr/lib/yum-plugins/verify.*
++%{pluginhome}/verify.*
+ %{_mandir}/man1/yum-verify.1.*
+
+ %files -n yum-plugin-keys
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/keys.conf
+-/usr/lib/yum-plugins/keys.*
++%{pluginhome}/keys.*
+
+ %files -n yum-NetworkManager-dispatcher
+ %defattr(-, root, root)
+@@ -619,13 +636,13 @@ fi
+ %files -n yum-plugin-remove-with-leaves
+ %defattr(-, root, root)
+ %doc COPYING
+-/usr/lib/yum-plugins/remove-with-leaves.*
++%{pluginhome}/remove-with-leaves.*
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/remove-with-leaves.conf
+
+ %files -n yum-plugin-post-transaction-actions
+ %defattr(-, root, root)
+ %doc COPYING
+-/usr/lib/yum-plugins/post-transaction-actions.*
++%{pluginhome}/post-transaction-actions.*
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/post-transaction-actions.conf
+ %doc plugins/post-transaction-actions/sample.action
+ # Default *.action file dropping dir.
+@@ -634,19 +651,19 @@ fi
+ %files -n yum-plugin-rpm-warm-cache
+ %defattr(-, root, root)
+ %doc COPYING
+-/usr/lib/yum-plugins/rpm-warm-cache.*
++%{pluginhome}/rpm-warm-cache.*
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/rpm-warm-cache.conf
+
+ %files -n yum-plugin-auto-update-debug-info
+ %defattr(-, root, root)
+ %doc COPYING
+-/usr/lib/yum-plugins/auto-update-debuginfo.*
++%{pluginhome}/auto-update-debuginfo.*
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/auto-update-debuginfo.conf
+
+ %files -n yum-plugin-show-leaves
+ %defattr(-, root, root)
+ %doc COPYING
+-/usr/lib/yum-plugins/show-leaves.*
++%{pluginhome}/show-leaves.*
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/show-leaves.conf
+
+ %files -n yum-plugin-local
+@@ -654,13 +671,13 @@ fi
+ %doc COPYING
+ %ghost %{_sysconfdir}/yum.repos.d/_local.repo
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/local.conf
+-/usr/lib/yum-plugins/local.*
++%{pluginhome}/local.*
+
+ %files -n yum-plugin-fs-snapshot
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/fs-snapshot.conf
+-/usr/lib/yum-plugins/fs-snapshot.*
++%{pluginhome}/fs-snapshot.*
+ %{_mandir}/man1/yum-fs-snapshot.1.*
+ %{_mandir}/man5/yum-fs-snapshot.conf.5.*
+
+@@ -668,13 +685,13 @@ fi
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/ps.conf
+-/usr/lib/yum-plugins/ps.*
++%{pluginhome}/ps.*
+
+ %files -n yum-plugin-puppetverify
+ %defattr(-, root, root)
+ %doc COPYING
+ %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/puppetverify.conf
+-/usr/lib/yum-plugins/puppetverify.*
++%{pluginhome}/puppetverify.*
+
+ %changelog
+ * Thu Aug 10 2011 Tim Lauridsen <timlau at fedoraproject.org>
diff --git a/yumdb.py b/yumdb.py
index 8a4888e..4e549cd 100755
--- a/yumdb.py
@@ -2327,7 +2872,7 @@ index 8a4888e..4e549cd 100755
args.pop(0)
if args:
diff --git a/yumdownloader.py b/yumdownloader.py
-index e6107d4..d37f15d 100755
+index e6107d4..ba17edd 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -7,11 +7,11 @@
@@ -2354,33 +2899,170 @@ index e6107d4..d37f15d 100755
# This is to fix Bug 469
# To convert from a pkg to a source pkg, we have a problem in that all we have
# is "sourcerpm", which can be a different nevra ... but just to make it fun
-@@ -112,7 +114,10 @@ class YumDownloader(YumUtilBase):
-
- # Get all src repos.
- src_repos = {}
+@@ -92,53 +94,27 @@ class YumDownloader(YumUtilBase):
+
+ # Setup yum (Ts, RPM db, Repo & Sack)
+ self.doUtilYumSetup(opts)
+- # Setup source repos
+- if opts.source:
+- self.setupSourceRepos()
+ # Do the real action
+ self.exit_code = self.downloadPackages(opts)
+
+ def setupSourceRepos(self):
+ # enable the -source repos for enabled primary repos
+- archlist = rpmUtils.arch.getArchList() + ['src']
+- # Ok, we have src and bin repos. What we want to do here is:
+- #
+- # 1. _enable_ source repos for which the bin repos are enabled.
+- # 2. _disable_ the _other_ src repos.
+- #
+- # ...also we don't want to disable the src repos. for #1 and then
+- # re-enable them as then we get annoying messages and call .close() on
+- # them losing the primarydb data etc.
+
+- # Get all src repos.
+- src_repos = {}
- for repo in self.repos.findRepos('*-source'):
-+ repos_source = self.repos.findRepos('*-source')
-+ if rhn_source_repos: # RHN
-+ repos_source += self.repos.findRepos('*-source-rpms')
-+ for repo in repos_source:
- src_repos[repo.id] = False
-
- # Find the enabled bin repos, and mark their respective *-source repo.
-@@ -122,9 +127,16 @@ class YumDownloader(YumUtilBase):
- srcrepo = '%s-source' % repo.id
- if srcrepo in src_repos:
- src_repos[srcrepo] = True
-+ if not rhn_source_repos:
-+ continue
-+ if not repo.id.endswith("-rpms"):
-+ continue
-+ srcrepo = repo.id[:-len('-rpms')] + '-source-rpms'
-+ if srcrepo in src_repos:
-+ src_repos[srcrepo] = True
+- src_repos[repo.id] = False
++ enabled = {}
++ for repo in self.repos.findRepos('*'):
++ enabled[repo.id] = repo.isEnabled()
+
+- # Find the enabled bin repos, and mark their respective *-source repo.
+- # as good.
+- for repo in self.repos.listEnabled():
+- if repo.id not in src_repos:
+- srcrepo = '%s-source' % repo.id
+- if srcrepo in src_repos:
+- src_repos[srcrepo] = True
++ for repo in self.repos.findRepos('*'):
++ if repo.id.endswith('-source'):
++ primary = repo.id[:-7]
++ elif rhn_source_repos and repo.id.endswith('-source-rpms'):
++ primary = repo.id[:-12] + '-rpms'
++ else:
++ continue
- # Toggle src repos that are set the wrong way
+- # Toggle src repos that are set the wrong way
- for repo in self.repos.findRepos('*-source'):
-+ for repo in repos_source:
- if repo.isEnabled() and not src_repos[repo.id]:
- repo.close()
- self.repos.disableRepo(repo.id)
+- if repo.isEnabled() and not src_repos[repo.id]:
+- repo.close()
+- self.repos.disableRepo(repo.id)
+- if not repo.isEnabled() and src_repos[repo.id]:
++ if not repo.isEnabled() and enabled.get(primary):
+ self.logger.info('Enabling %s repository' % repo.id)
+ repo.enable()
+- # Setup the repo, without a cache
+- repo.setup(0)
+- try:
+- # Setup pkgSack with 'src' in the archlist
+- self._getSacks(archlist=archlist, thisrepo=repo.id)
+- except yum.Errors.YumBaseError, msg:
+- self.logger.critical(str(msg))
+- sys.exit(1)
+
+ def downloadPackages(self,opts):
+
+@@ -216,52 +192,30 @@ class YumDownloader(YumUtilBase):
+ if len(toDownload) == 0:
+ self.logger.error('Nothing to download')
+ sys.exit(1)
++ if opts.urls:
++ for pkg in toDownload:
++ print urljoin(pkg.repo.urls[0], pkg.relativepath)
++ return 0
+
+- exit_code = 0
++ # create dest dir
++ if not os.path.exists(opts.destdir):
++ os.makedirs(opts.destdir)
++
++ # set localpaths
+ for pkg in toDownload:
+- n,a,e,v,r = pkg.pkgtup
+- packages = self.pkgSack.searchNevra(n,e,v,r,a)
+- packages.sort()
+- last = None
+- for download in packages:
+- if download.pkgtup == last :
+- continue
+- last = download.pkgtup
+- repo = self.repos.getRepo(download.repoid)
+- remote = download.returnSimple('relativepath')
+- if opts.urls:
+- url = urljoin(repo.urls[0]+'/',remote)
+- self.logger.info('%s' % url)
+- continue
+- local = os.path.basename(remote)
+- if not os.path.exists(opts.destdir):
+- os.makedirs(opts.destdir)
+- local = os.path.join(opts.destdir, local)
+- if (os.path.exists(local) and
+- os.path.getsize(local) == int(download.returnSimple('packagesize'))):
+- self.logger.error("%s already exists and appears to be complete" % local)
+- continue
+- # Disable cache otherwise things won't download
+- repo.cache = 0
+- download.localpath = local # Hack: to set the localpath we want.
+- try:
+- checkfunc = (self.verifyPkg, (download, 1), {})
+- path = repo.getPackage(download, checkfunc=checkfunc)
+- except IOError, e:
+- self.logger.error("Cannot write to file %s. Error was: %s" % (local, e))
+- exit_code = 2
+- continue
+- except RepoError, e:
+- self.logger.error("Could not download/verify pkg %s: %s" % (download, e))
+- exit_code = 2
+- continue
+-
+- if not os.path.exists(local) or not os.path.samefile(path, local):
+- progress = TextMeter()
+- progress.start(basename=os.path.basename(local),
+- size=os.stat(path).st_size)
+- shutil.copy2(path, local)
+- progress.end(progress.size)
++ rpmfn = os.path.basename(pkg.remote_path)
++ pkg.localpath = os.path.join(opts.destdir, rpmfn)
++ pkg.repo.copy_local = True
++ pkg.repo.cache = 0
++
++ # use downloader from YumBase
++ exit_code = 0
++ probs = self.downloadPkgs(toDownload)
++ if probs:
++ exit_code = 2
++ for key in probs:
++ for error in probs[key]:
++ self.logger.error('%s: %s', key, error)
+ return exit_code
+
+ def _groupPackages(self,pkglist):
+@@ -279,6 +233,9 @@ class YumDownloader(YumUtilBase):
+ """do a default setup for all the normal/necessary yum components,
+ really just a shorthand for testing"""
+ try:
++ # Setup source repos
++ if opts.source:
++ self.setupSourceRepos()
+ self._getRepos(doSetup = True)
+ # if '--source' is used the add src to the archlist
+ if opts.source:
+@@ -294,15 +251,8 @@ class YumDownloader(YumUtilBase):
+ self.logger.critical(str(msg))
+ sys.exit(1)
+
+- def _removeEnabledSourceRepos(self):
+- ''' Disable all enabled *-source repos.'''
+- for repo in self.repos.listEnabled():
+- if repo.id.endswith('-source'):
+- repo.close()
+- self.repos.disableRepo(repo.id)
+-
+ def addCmdOptions(self):
+- # this if for compability with old API (utils.py from yum < 3.2.23)
++ # this if for compatibility with old API (utils.py from yum < 3.2.23)
+ if hasattr(self,'getOptionGroup'): # check if the group option API is available
+ group = self.getOptionGroup()
+ else:
diff --git a/yum-utils.spec b/yum-utils.spec
index 258be93..e47942b 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -5,11 +5,12 @@
%endif
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+%define pluginhome /usr/lib/yum-plugins
Summary: Utilities based around the yum package manager
Name: yum-utils
Version: 1.1.31
-Release: 6%{?dist}
+Release: 7%{?dist}
License: GPLv2+
Group: Development/Tools
Source: http://yum.baseurl.org/download/yum-utils/%{name}-%{version}.tar.gz
@@ -300,7 +301,7 @@ This plugin allows the user to run arbitrary actions immediately following a
transaction when specified packages are changed.
%package -n yum-NetworkManager-dispatcher
-Summary: NetworkManager script which tells yum to check it's cache on network change
+Summary: NetworkManager script which tells yum to check its cache on network change
Group: System Environment/Base
Requires: yum >= 3.2.17
@@ -435,14 +436,14 @@ plugins="$plugins \
"
%endif
-mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/lib/yum-plugins/
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/%pluginhome
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/post-actions
cd plugins
for plug in $plugins; do
install -m 644 $plug/*.conf $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/
- install -m 644 $plug/*.py $RPM_BUILD_ROOT/usr/lib/yum-plugins/
- %{__python} -c "import compileall; compileall.compile_dir('$RPM_BUILD_ROOT/usr/lib/yum-plugins', 1)"
+ install -m 644 $plug/*.py $RPM_BUILD_ROOT/%pluginhome
+ %{__python} -c "import compileall; compileall.compile_dir('$RPM_BUILD_ROOT/%pluginhome', 1)"
done
install -m 644 aliases/aliases $RPM_BUILD_ROOT/%{_sysconfdir}/yum/aliases.conf
install -m 644 versionlock/versionlock.list $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/
@@ -520,7 +521,7 @@ fi
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/changelog.conf
%doc COPYING
-/usr/lib/yum-plugins/changelog.*
+%{pluginhome}/changelog.*
%{_mandir}/man1/yum-changelog.1.*
%{_mandir}/man5/yum-changelog.conf.5.*
@@ -528,20 +529,20 @@ fi
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/fastestmirror.conf
-/usr/lib/yum-plugins/fastestmirror*.*
+%{pluginhome}/fastestmirror*.*
%files -n yum-plugin-protectbase
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/protectbase.conf
-/usr/lib/yum-plugins/protectbase.*
+%{pluginhome}/protectbase.*
%files -n yum-plugin-versionlock
%defattr(-, root, root)
%doc plugins/versionlock/README COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/versionlock.conf
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/versionlock.list
-/usr/lib/yum-plugins/versionlock.*
+%{pluginhome}/versionlock.*
%{_mandir}/man1/yum-versionlock.1.*
%{_mandir}/man5/yum-versionlock.conf.5.*
@@ -549,87 +550,87 @@ fi
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/tsflags.conf
-/usr/lib/yum-plugins/tsflags.*
+%{pluginhome}/tsflags.*
%files -n yum-plugin-downloadonly
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/downloadonly.conf
-/usr/lib/yum-plugins/downloadonly.*
+%{pluginhome}/downloadonly.*
%files -n yum-plugin-priorities
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/priorities.conf
-/usr/lib/yum-plugins/priorities.*
+%{pluginhome}/priorities.*
%if %{package_yum_updatesd}
%files -n yum-plugin-refresh-updatesd
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/refresh-updatesd.conf
-/usr/lib/yum-plugins/refresh-updatesd.*
+%{pluginhome}/refresh-updatesd.*
%endif
%files -n yum-plugin-merge-conf
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/merge-conf.conf
-/usr/lib/yum-plugins/merge-conf.*
+%{pluginhome}/merge-conf.*
%files -n yum-plugin-security
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/security.conf
-/usr/lib/yum-plugins/security.*
+%{pluginhome}/security.*
%{_mandir}/man8/yum-security.8.*
%files -n yum-plugin-upgrade-helper
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/upgrade-helper.conf
-/usr/lib/yum-plugins/upgrade-helper.*
+%{pluginhome}/upgrade-helper.*
%files -n yum-plugin-aliases
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/aliases.conf
%config(noreplace) %{_sysconfdir}/yum/aliases.conf
-/usr/lib/yum-plugins/aliases.*
+%{pluginhome}/aliases.*
%{_mandir}/man1/yum-aliases.1.*
%files -n yum-plugin-list-data
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/list-data.conf
-/usr/lib/yum-plugins/list-data.*
+%{pluginhome}/list-data.*
%{_mandir}/man1/yum-list-data.1.*
%files -n yum-plugin-filter-data
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/filter-data.conf
-/usr/lib/yum-plugins/filter-data.*
+%{pluginhome}/filter-data.*
%{_mandir}/man1/yum-filter-data.1.*
%files -n yum-plugin-tmprepo
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/tmprepo.conf
-/usr/lib/yum-plugins/tmprepo.*
+%{pluginhome}/tmprepo.*
%files -n yum-plugin-verify
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/verify.conf
-/usr/lib/yum-plugins/verify.*
+%{pluginhome}/verify.*
%{_mandir}/man1/yum-verify.1.*
%files -n yum-plugin-keys
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/keys.conf
-/usr/lib/yum-plugins/keys.*
+%{pluginhome}/keys.*
%files -n yum-NetworkManager-dispatcher
%defattr(-, root, root)
@@ -639,13 +640,13 @@ fi
%files -n yum-plugin-remove-with-leaves
%defattr(-, root, root)
%doc COPYING
-/usr/lib/yum-plugins/remove-with-leaves.*
+%{pluginhome}/remove-with-leaves.*
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/remove-with-leaves.conf
%files -n yum-plugin-post-transaction-actions
%defattr(-, root, root)
%doc COPYING
-/usr/lib/yum-plugins/post-transaction-actions.*
+%{pluginhome}/post-transaction-actions.*
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/post-transaction-actions.conf
%doc plugins/post-transaction-actions/sample.action
# Default *.action file dropping dir.
@@ -654,19 +655,19 @@ fi
%files -n yum-plugin-rpm-warm-cache
%defattr(-, root, root)
%doc COPYING
-/usr/lib/yum-plugins/rpm-warm-cache.*
+%{pluginhome}/rpm-warm-cache.*
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/rpm-warm-cache.conf
%files -n yum-plugin-auto-update-debug-info
%defattr(-, root, root)
%doc COPYING
-/usr/lib/yum-plugins/auto-update-debuginfo.*
+%{pluginhome}/auto-update-debuginfo.*
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/auto-update-debuginfo.conf
%files -n yum-plugin-show-leaves
%defattr(-, root, root)
%doc COPYING
-/usr/lib/yum-plugins/show-leaves.*
+%{pluginhome}/show-leaves.*
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/show-leaves.conf
%files -n yum-plugin-local
@@ -674,13 +675,13 @@ fi
%doc COPYING
%ghost %{_sysconfdir}/yum.repos.d/_local.repo
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/local.conf
-/usr/lib/yum-plugins/local.*
+%{pluginhome}/local.*
%files -n yum-plugin-fs-snapshot
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/fs-snapshot.conf
-/usr/lib/yum-plugins/fs-snapshot.*
+%{pluginhome}/fs-snapshot.*
%{_mandir}/man1/yum-fs-snapshot.1.*
%{_mandir}/man5/yum-fs-snapshot.conf.5.*
@@ -688,15 +689,18 @@ fi
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/ps.conf
-/usr/lib/yum-plugins/ps.*
+%{pluginhome}/ps.*
%files -n yum-plugin-puppetverify
%defattr(-, root, root)
%doc COPYING
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/puppetverify.conf
-/usr/lib/yum-plugins/puppetverify.*
+%{pluginhome}/puppetverify.*
%changelog
+* Thu Jan 17 2013 Zdenek Pavlas <zpavlas at redhat.com> - 1.1.31-7
+- Update to latest HEAD, but keep yum-plugin-downloadonly.
+
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.1.31-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
More information about the scm-commits
mailing list