yum-utils package update
Signed-off-by: basebuilder_pel7ppc64bebuilder0 <basebuilder@powerel.org>master
parent
bd29c7de5f
commit
a2057b8d68
SOURCES
SPECS
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,66 @@
|
|||
commit 8d1f2b4a8ba6306152c25591ab6b14b6ad9915bd
|
||||
Author: Zdenek Pavlas <zpavlas@redhat.com>
|
||||
Date: Fri Jan 17 14:45:46 2014 +0100
|
||||
|
||||
yum-builddep: Use srpms in already enabled repos. BZ 1024070
|
||||
|
||||
Enable "src" arch first, then source repos, then init sacks.
|
||||
Fixes BZ and we don't have to disable/enable to change arches.
|
||||
|
||||
diff --git a/yum-builddep.py b/yum-builddep.py
|
||||
index b9e682a..216066e 100755
|
||||
--- a/yum-builddep.py
|
||||
+++ b/yum-builddep.py
|
||||
@@ -92,6 +92,10 @@ class YumBuildDep(YumUtilBase):
|
||||
self.logger.error("Error: You must be root to install packages")
|
||||
sys.exit(1)
|
||||
|
||||
+ # Use source rpms
|
||||
+ self.arch.archlist.append('src')
|
||||
+ self.setupSourceRepos()
|
||||
+
|
||||
# Setup yum (Ts, RPM db, Repo & Sack)
|
||||
self.doUtilYumSetup()
|
||||
# Do the real action
|
||||
@@ -122,7 +126,6 @@ class YumBuildDep(YumUtilBase):
|
||||
|
||||
def setupSourceRepos(self):
|
||||
# enable the -source repos for enabled primary repos
|
||||
- archlist = rpmUtils.arch.getArchList() + ['src']
|
||||
for repo in self.repos.listEnabled():
|
||||
issource_repo = repo.id.endswith('-source')
|
||||
if rhn_source_repos and repo.id.endswith('-source-rpms'):
|
||||
@@ -133,24 +136,13 @@ class YumBuildDep(YumUtilBase):
|
||||
elif not issource_repo:
|
||||
srcrepo = '%s-source' % repo.id
|
||||
else:
|
||||
- # Need to change the arch.
|
||||
- repo.close()
|
||||
- self.repos.disableRepo(repo.id)
|
||||
- srcrepo = repo.id
|
||||
+ continue
|
||||
|
||||
for r in self.repos.findRepos(srcrepo):
|
||||
if r in self.repos.listEnabled():
|
||||
continue
|
||||
self.logger.info('Enabling %s repository' % r.id)
|
||||
r.enable()
|
||||
- # Setup the repo, without a cache
|
||||
- r.setup(0)
|
||||
- # Setup pkgSack with 'src' in the archlist
|
||||
- try:
|
||||
- self._getSacks(archlist=archlist,thisrepo=r.id)
|
||||
- except yum.Errors.RepoError, e:
|
||||
- print "Could not setup repo %s: %s" % (r.id, e)
|
||||
- sys.exit(1)
|
||||
|
||||
def install_deps(self, deplist):
|
||||
errors = set()
|
||||
@@ -213,7 +205,6 @@ class YumBuildDep(YumUtilBase):
|
||||
|
||||
toActOn = []
|
||||
if srcnames:
|
||||
- self.setupSourceRepos()
|
||||
pkgs = self.pkgSack.returnPackages(patterns=srcnames)
|
||||
exact, match, unmatch = yum.packages.parsePackages(pkgs, srcnames, casematch=1)
|
||||
srpms += exact + match
|
|
@ -0,0 +1,12 @@
|
|||
diff -up yum-utils-1.1.31/repoquery.py.old yum-utils-1.1.31/repoquery.py
|
||||
--- yum-utils-1.1.31/repoquery.py.old 2014-01-10 11:43:02.213877563 +0100
|
||||
+++ yum-utils-1.1.31/repoquery.py 2014-01-10 11:45:52.755169727 +0100
|
||||
@@ -1412,7 +1412,7 @@ def main(args):
|
||||
repoq.preconf.root = opts.installroot
|
||||
try:
|
||||
repoq.conf
|
||||
- except YumBaseError, e:
|
||||
+ except yum.Errors.YumBaseError, e:
|
||||
repoq.logger.error(e)
|
||||
sys.exit(1)
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
diff --git a/debuginfo-install.py b/debuginfo-install.py
|
||||
index 0f026f1..bb61a1d 100755
|
||||
--- a/debuginfo-install.py
|
||||
+++ b/debuginfo-install.py
|
||||
@@ -86,7 +86,10 @@ class DebugInfoInstall(YumUtilBase):
|
||||
for repo in self.repos.listEnabled():
|
||||
repos[repo.id] = repo
|
||||
for repoid in repos:
|
||||
- di = '%s-debuginfo' % repoid
|
||||
+ if repoid.endswith('-rpms'):
|
||||
+ di = repoid[:-5] + '-debug-rpms'
|
||||
+ else:
|
||||
+ di = '%s-debuginfo' % repoid
|
||||
if di in repos:
|
||||
continue
|
||||
repo = repos[repoid]
|
|
@ -0,0 +1,30 @@
|
|||
commit fbdc19f411ee31bf18af242e7b3b39947ed28f2d
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Feb 13 15:30:23 2014 +0100
|
||||
|
||||
Fix 'reposync -r nosuchrepo' behaviour. BZ 1060702
|
||||
|
||||
Show a warning if user-provided repoid was not found and
|
||||
exit(1) if none of user-provided repoids were found.
|
||||
|
||||
diff --git a/reposync.py b/reposync.py
|
||||
index b1ee285..e7c98a3 100755
|
||||
--- a/reposync.py
|
||||
+++ b/reposync.py
|
||||
@@ -179,7 +179,15 @@ def main():
|
||||
|
||||
# find the ones we want
|
||||
for glob in opts.repoid:
|
||||
- myrepos.extend(my.repos.findRepos(glob))
|
||||
+ add_repos = my.repos.findRepos(glob)
|
||||
+ if not add_repos:
|
||||
+ print >> sys.stderr, "Warning: cannot find repository %s" % glob
|
||||
+ continue
|
||||
+ myrepos.extend(add_repos)
|
||||
+
|
||||
+ if not myrepos:
|
||||
+ print >> sys.stderr, "No repositories found"
|
||||
+ sys.exit(1)
|
||||
|
||||
# disable them all
|
||||
for repo in my.repos.repos.values():
|
|
@ -0,0 +1,37 @@
|
|||
commit 2b617b86358aeedd3ed83fad0719cb0fada3241c
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue May 26 09:08:37 2015 +0200
|
||||
|
||||
yum-config-manager: update config file specified using -c option. BZ#1075708
|
||||
|
||||
diff --git a/README b/README
|
||||
index 8abe805..0c01d0e 100644
|
||||
--- a/README
|
||||
+++ b/README
|
||||
@@ -67,3 +67,5 @@ Author of the update on boot init scripts
|
||||
- Tim Lauridsen
|
||||
Maintainer of yum-utils - fixer of a lot of misc utils.
|
||||
|
||||
+- Valentina Mukhamedzhanova
|
||||
+Maintainer of yum-utils.
|
||||
diff --git a/yum-config-manager.py b/yum-config-manager.py
|
||||
index 380a54f..708c33f 100755
|
||||
--- a/yum-config-manager.py
|
||||
+++ b/yum-config-manager.py
|
||||
@@ -155,10 +155,13 @@ if (not args and not opts.addrepo) or 'main' in args:
|
||||
print yb.fmtSection('main')
|
||||
print yb.conf.dump()
|
||||
if opts.save and hasattr(yb, 'main_setopts') and yb.main_setopts:
|
||||
- fn = '/etc/yum/yum.conf'
|
||||
+ fn = opts.conffile
|
||||
if not os.path.exists(fn):
|
||||
- # Try the old default
|
||||
- fn = '/etc/yum.conf'
|
||||
+ if fn == '/etc/yum/yum.conf':
|
||||
+ # Try the old default
|
||||
+ fn = '/etc/yum.conf'
|
||||
+ else:
|
||||
+ raise yum.Errors.ConfigError("Error accessing file for config %s" % fn)
|
||||
ybc = yb.conf
|
||||
writeRawConfigFile(fn, 'main', ybc.yumvar,
|
||||
ybc.cfg.options, ybc.iteritems, ybc.optionobj,
|
|
@ -0,0 +1,32 @@
|
|||
Index: /yum-builddep.py
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- /yum-builddep.py (revision )
|
||||
+++ /yum-builddep.py (revision )
|
||||
@@ -27,7 +27,7 @@
|
||||
import rpmUtils
|
||||
import rpm
|
||||
|
||||
-rhn_source_repos = False
|
||||
+rhn_source_repos = True
|
||||
|
||||
# Copied from yumdownloader (need a yum-utils python module ;)
|
||||
# This is to fix Bug 469
|
||||
Index: /yumdownloader.py
|
||||
IDEA additional info:
|
||||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
||||
<+>UTF-8
|
||||
===================================================================
|
||||
--- /yumdownloader.py (revision )
|
||||
+++ /yumdownloader.py (revision )
|
||||
@@ -32,7 +32,7 @@
|
||||
import rpmUtils
|
||||
import logging
|
||||
|
||||
-rhn_source_repos = False
|
||||
+rhn_source_repos = True
|
||||
|
||||
# This is to fix Bug 469
|
||||
# To convert from a pkg to a source pkg, we have a problem in that all we have
|
|
@ -0,0 +1,36 @@
|
|||
commit 92fd923f75f1f42d246e925f1c4526f36f6fd88d
|
||||
Author: Stephen Degler <stephen@degler.net>
|
||||
Date: Tue Sep 24 17:06:14 2013 +0200
|
||||
|
||||
fs-snapshot: btrfsctl is obsolete, use btrfs. BZ 1010974
|
||||
|
||||
diff --git a/plugins/fs-snapshot/fs-snapshot.py b/plugins/fs-snapshot/fs-snapshot.py
|
||||
index 4f99b6a..786b0c1 100644
|
||||
--- a/plugins/fs-snapshot/fs-snapshot.py
|
||||
+++ b/plugins/fs-snapshot/fs-snapshot.py
|
||||
@@ -198,9 +198,8 @@ def _create_btrfs_snapshot(conduit, snapshot_tag, volume):
|
||||
"""
|
||||
Runs the commands necessary for a snapshot. Basically its just
|
||||
|
||||
- btrfsctl -c /dir/to/snapshot #this syncs the fs
|
||||
- btrfsctl -s /dir/to/snapshot/${snapshot_tag}
|
||||
- /dir/to/snapshot
|
||||
+ btrfs filesystem sync /dir/to/snapshot #this syncs the fs
|
||||
+ btrfs subvolume snapshot /dir/to/snapshot /dir/to/snapshot/${snapshot_tag}
|
||||
|
||||
and then we're done.
|
||||
"""
|
||||
@@ -212,11 +211,11 @@ def _create_btrfs_snapshot(conduit, snapshot_tag, volume):
|
||||
|
||||
snapname = mntpnt + snapshot_tag
|
||||
conduit.info(1, "fs-snapshot: snapshotting " + mntpnt + ": " + snapname)
|
||||
- p = Popen(["/sbin/btrfsctl", "-c", mntpnt], stdout=PIPE, stderr=PIPE)
|
||||
+ p = Popen(["/sbin/btrfs", "filesystem", "sync", mntpnt], stdout=PIPE, stderr=PIPE)
|
||||
err = p.wait()
|
||||
if err:
|
||||
return 1
|
||||
- p = Popen(["/sbin/btrfsctl", "-s", snapname, mntpnt], stdout=PIPE, stderr=PIPE)
|
||||
+ p = Popen(["/sbin/btrfs", "subvolume", "snapshot", mntpnt, snapname], stdout=PIPE, stderr=PIPE)
|
||||
err = p.wait()
|
||||
if err:
|
||||
return 1
|
|
@ -0,0 +1,54 @@
|
|||
diff -up yum-utils-1.1.31/needs-restarting.py.old yum-utils-1.1.31/needs-restarting.py
|
||||
--- yum-utils-1.1.31/needs-restarting.py.old 2014-09-04 14:19:27.000000000 +0200
|
||||
+++ yum-utils-1.1.31/needs-restarting.py 2014-09-04 14:29:47.825438668 +0200
|
||||
@@ -44,6 +44,8 @@ import yum.misc
|
||||
import glob
|
||||
import stat
|
||||
from optparse import OptionParser
|
||||
+sys.path.insert(0,'/usr/share/yum-cli')
|
||||
+import utils
|
||||
|
||||
def parseargs(args):
|
||||
usage = """
|
||||
@@ -77,7 +79,8 @@ def get_open_files(pid):
|
||||
files = []
|
||||
smaps = '/proc/%s/smaps' % pid
|
||||
try:
|
||||
- maps = open(smaps, 'r').readlines()
|
||||
+ with open(smaps, 'r') as maps_f:
|
||||
+ maps = maps_f.readlines()
|
||||
except (IOError, OSError), e:
|
||||
print "Could not open %s" % smaps
|
||||
return files
|
||||
@@ -88,7 +91,7 @@ def get_open_files(pid):
|
||||
continue
|
||||
line = line.replace('\n', '')
|
||||
filename = line[slash:]
|
||||
- #filename = filename.replace('(deleted)', '') #only mildly retarded
|
||||
+ filename = filename.split(';')[0]
|
||||
filename = filename.strip()
|
||||
if filename not in files:
|
||||
files.append(filename)
|
||||
@@ -109,10 +112,11 @@ def main(args):
|
||||
|
||||
needing_restart = set()
|
||||
|
||||
+ boot_time = utils.get_boot_time()
|
||||
for pid in return_running_pids(uid=myuid):
|
||||
try:
|
||||
- pid_start = os.stat('/proc/' + pid)[stat.ST_CTIME]
|
||||
- except OSError, e:
|
||||
+ pid_start = utils.get_process_time(int(pid), boot_time)['start_time']
|
||||
+ except (OSError, IOError), e:
|
||||
continue
|
||||
found_match = False
|
||||
for fn in get_open_files(pid):
|
||||
@@ -158,7 +162,7 @@ def main(args):
|
||||
for pid in needing_restart:
|
||||
try:
|
||||
cmdline = open('/proc/' +pid+ '/cmdline', 'r').read()
|
||||
- except OSError, e:
|
||||
+ except (OSError, IOError), e:
|
||||
print "Couldn't access process information for %s: %s" % (pid, str(e))
|
||||
continue
|
||||
# proc cmdline is null-delimited so clean that up
|
|
@ -0,0 +1,38 @@
|
|||
commit 682227430bb2124fb2897371fa5bc5261099064a
|
||||
Author: Zdenek Pavlas <zpavlas@redhat.com>
|
||||
Date: Mon Sep 9 15:15:35 2013 +0200
|
||||
|
||||
yumdownloader: make --destdir less of a hack. BZ 1004089
|
||||
|
||||
Instead of changing po.localpath, use the conf.downloaddir option
|
||||
already used to override repo.pkgdir(s).
|
||||
|
||||
diff --git a/yumdownloader.py b/yumdownloader.py
|
||||
index 4c5eefb..b491c7f 100755
|
||||
--- a/yumdownloader.py
|
||||
+++ b/yumdownloader.py
|
||||
@@ -96,6 +96,9 @@ class YumDownloader(YumUtilBase):
|
||||
if not self.setCacheDir():
|
||||
self.logger.error("Error: Could not make cachedir, exiting")
|
||||
sys.exit(50)
|
||||
+
|
||||
+ # override all pkgdirs
|
||||
+ self.conf.downloaddir = opts.destdir
|
||||
|
||||
# Setup yum (Ts, RPM db, Repo & Sack)
|
||||
self.doUtilYumSetup(opts)
|
||||
@@ -202,14 +205,8 @@ class YumDownloader(YumUtilBase):
|
||||
print urljoin(pkg.repo.urls[0], pkg.relativepath)
|
||||
return 0
|
||||
|
||||
- # create dest dir
|
||||
- if not os.path.exists(opts.destdir):
|
||||
- os.makedirs(opts.destdir)
|
||||
-
|
||||
# set localpaths
|
||||
for pkg in toDownload:
|
||||
- rpmfn = os.path.basename(pkg.remote_path)
|
||||
- pkg.localpath = os.path.join(opts.destdir, rpmfn)
|
||||
pkg.repo.copy_local = True
|
||||
pkg.repo.cache = 0
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
diff -up yum-utils-1.1.31/needs-restarting.py.old yum-utils-1.1.31/needs-restarting.py
|
||||
--- yum-utils-1.1.31/needs-restarting.py.old 2014-09-18 10:17:13.000000000 +0200
|
||||
+++ yum-utils-1.1.31/needs-restarting.py 2014-09-18 10:22:41.596236067 +0200
|
||||
@@ -44,6 +44,7 @@ import yum.misc
|
||||
import glob
|
||||
import stat
|
||||
from optparse import OptionParser
|
||||
+from yum.Errors import RepoError
|
||||
sys.path.insert(0,'/usr/share/yum-cli')
|
||||
import utils
|
||||
|
||||
@@ -82,7 +83,7 @@ def get_open_files(pid):
|
||||
with open(smaps, 'r') as maps_f:
|
||||
maps = maps_f.readlines()
|
||||
except (IOError, OSError), e:
|
||||
- print "Could not open %s" % smaps
|
||||
+ print >>sys.stderr, "Could not open %s" % smaps
|
||||
return files
|
||||
|
||||
for line in maps:
|
||||
@@ -164,7 +165,7 @@ def main(args):
|
||||
try:
|
||||
cmdline = open('/proc/' +pid+ '/cmdline', 'r').read()
|
||||
except (OSError, IOError), e:
|
||||
- print "Couldn't access process information for %s: %s" % (pid, str(e))
|
||||
+ print >>sys.stderr, "Couldn't access process information for %s: %s" % (pid, str(e))
|
||||
continue
|
||||
# proc cmdline is null-delimited so clean that up
|
||||
cmdline = cmdline.replace('\000', ' ')
|
||||
@@ -173,4 +174,8 @@ def main(args):
|
||||
return 0
|
||||
|
||||
if __name__ == "__main__":
|
||||
- sys.exit(main(sys.argv))
|
||||
+ try:
|
||||
+ sys.exit(main(sys.argv))
|
||||
+ except RepoError, e:
|
||||
+ print >>sys.stderr, e
|
||||
+ sys.exit(1)
|
|
@ -0,0 +1,23 @@
|
|||
commit 36280feaee2b0cfb83d8af134f6aff3bcc976af1
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Wed Apr 9 15:30:21 2014 +0200
|
||||
|
||||
Print depsolving errors in yumdownloader instead of ignoring them. BZ 998892
|
||||
|
||||
diff --git a/yumdownloader.py b/yumdownloader.py
|
||||
index 1b57777..1b95e8d 100755
|
||||
--- a/yumdownloader.py
|
||||
+++ b/yumdownloader.py
|
||||
@@ -197,7 +197,11 @@ class YumDownloader(YumUtilBase):
|
||||
self.tsInfo.addInstall(po)
|
||||
self.localPackages.append(po)
|
||||
# Resolve dependencies
|
||||
- self.resolveDeps()
|
||||
+ result, resultmsgs = self.resolveDeps()
|
||||
+ if result == 1:
|
||||
+ for msg in resultmsgs:
|
||||
+ self.logger.critical(msg)
|
||||
+ self.logger.critical('Dependency resolution failed, some packages will not be downloaded.')
|
||||
# Add newly added packages to the toDownload list
|
||||
for pkg in self.tsInfo.getMembers():
|
||||
if pkg.ts_state in ('i', 'u') and pkg.po not in toDownload:
|
|
@ -0,0 +1,44 @@
|
|||
From 4833f65fd4b9bd06a9a5e00fb8bc986ad33273e4 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Chaloupka <jchaloup@redhat.com>
|
||||
Date: Mon, 25 Aug 2014 08:57:22 +0200
|
||||
Subject: [PATCH] reposync.1 missing options
|
||||
|
||||
---
|
||||
docs/reposync.1 | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/docs/reposync.1 b/docs/reposync.1
|
||||
index 29043fb..d6d245a 100644
|
||||
--- a/docs/reposync.1
|
||||
+++ b/docs/reposync.1
|
||||
@@ -20,10 +20,18 @@ Also download .src.rpm files.
|
||||
.IP "\fB\-r REPOID, \-\-repoid=REPOID\fP"
|
||||
Specify repo ids to query, can be specified multiple times (default is
|
||||
all enabled).
|
||||
+.IP "\fB\-e\ CACHEDIR, \-\-cachedir CACHEDIR\fP"
|
||||
+Directory in which to store metadata.
|
||||
.IP "\fB\-t, \-\-tempcache\fP"
|
||||
Use a temp dir for storing/accessing yum-cache.
|
||||
+.IP "\fB\-d, \-\-delete\fP"
|
||||
+Delete local packages no longer present in repository.
|
||||
.IP "\fB\-p DESTDIR, \-\-download_path=DESTDIR\fP"
|
||||
Path to download packages to: defaults to current directory.
|
||||
+.IP "\fB\-\-norepopath\fP"
|
||||
+Don't add the reponame to the download path.
|
||||
+Can only be used when syncing a single repository (default is
|
||||
+to add the reponame).
|
||||
.IP "\fB\-g, \-\-gpgcheck\fP"
|
||||
Remove packages that fail GPG signature checking after downloading.
|
||||
exit status is '1' if at least one package was removed.
|
||||
@@ -31,6 +39,8 @@ exit status is '1' if at least one package was removed.
|
||||
Just list urls of what would be downloaded, don't download.
|
||||
.IP "\fB\-l, \-\-plugins\fP"
|
||||
Enable yum plugin support.
|
||||
+.IP "\fB\-m, \-\-downloadcomps\fP"
|
||||
+Also download comps.xml.
|
||||
.IP "\fB\-n, \-\-newest\-only\fP"
|
||||
Download only newest packages per-repo.
|
||||
.IP "\fB\-q, \-\-quiet\fP"
|
||||
--
|
||||
1.9.3
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
commit d317fd0d8f56eb352c7dbb78bc283c208da9a561
|
||||
Author: Zdenek Pavlas <zpavlas@redhat.com>
|
||||
Date: Tue Jan 14 12:08:43 2014 +0100
|
||||
|
||||
post-transaction-actions: fix filename matching. BZ 1045494
|
||||
|
||||
I believe the code now works as origanally intended. When installing
|
||||
packages, txmbr.po is AvailablePackage instance and .filelist access
|
||||
may trigger filelist metadata download.
|
||||
|
||||
Since this runs after the transaction, we may look the package up
|
||||
in rpmdb instead. On removals, thispo is RPMInstalledPackage already.
|
||||
Thanks to Robert Tomczyk <robert.x.tomczyk@gmail.com> for reporting
|
||||
and testing this.
|
||||
|
||||
diff --git a/plugins/post-transaction-actions/post-transaction-actions.py b/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
index b4da1ce..804af9c 100644
|
||||
--- a/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
+++ b/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
@@ -129,8 +129,10 @@ def posttrans_hook(conduit):
|
||||
|
||||
for txmbr in pkgset:
|
||||
matched = False
|
||||
- #print '%s - %s' % txmbr.name, txmbr.ts_state
|
||||
- if txmbr.po.state in TS_INSTALL_STATES:
|
||||
+ thispo = txmbr.po
|
||||
+ if txmbr.output_state in TS_INSTALL_STATES:
|
||||
+ # thispo is AvailablePackage; filelist access could trigger download
|
||||
+ # of the filelist. Since it's installed now, use rpmdb data instead.
|
||||
thispo = _get_installed_po(rpmdb, txmbr.pkgtup)
|
||||
|
||||
if not yum.misc.re_glob(a_k):
|
||||
commit 78cfff9b48608ad246a8898d002937d9b6ffcc5d
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Wed Aug 20 17:31:16 2014 +0200
|
||||
|
||||
post-transaction-actions: preload filelists for packages to be removed. BZ 1127782
|
||||
|
||||
diff --git a/plugins/post-transaction-actions/post-transaction-actions.py b/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
index 804af9c..4d015c1 100644
|
||||
--- a/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
+++ b/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
@@ -93,6 +93,17 @@ def _convert_vars(txmbr, command):
|
||||
result = varReplace(command, vardict)
|
||||
return result
|
||||
|
||||
+
|
||||
+def pretrans_hook(conduit):
|
||||
+ # Prefetch filelist for packages to be removed,
|
||||
+ # otherwise for updated packages headers will not be available
|
||||
+ ts = conduit.getTsInfo()
|
||||
+ removes = ts.getMembersWithState(output_states=TS_REMOVE_STATES)
|
||||
+
|
||||
+ for txmbr in removes:
|
||||
+ txmbr.po.filelist
|
||||
+
|
||||
+
|
||||
def posttrans_hook(conduit):
|
||||
# we have provides/requires for everything
|
||||
# we do not have filelists for erasures
|
|
@ -0,0 +1,83 @@
|
|||
diff -up yum-utils-1.1.31/plugins/post-transaction-actions/post-transaction-actions.py.orig yum-utils-1.1.31/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
--- yum-utils-1.1.31/plugins/post-transaction-actions/post-transaction-actions.py.orig 2017-11-03 16:26:49.762703946 +0100
|
||||
+++ yum-utils-1.1.31/plugins/post-transaction-actions/post-transaction-actions.py 2017-11-03 16:26:53.607688349 +0100
|
||||
@@ -139,7 +139,6 @@ def posttrans_hook(conduit):
|
||||
c_string = re.compile(restring)
|
||||
|
||||
for txmbr in pkgset:
|
||||
- matched = False
|
||||
thispo = txmbr.po
|
||||
if txmbr.output_state in TS_INSTALL_STATES:
|
||||
# thispo is AvailablePackage; filelist access could trigger download
|
||||
@@ -150,17 +149,13 @@ def posttrans_hook(conduit):
|
||||
if a_k in thispo.filelist + thispo.dirlist + thispo.ghostlist:
|
||||
thiscommand = _convert_vars(txmbr, a_c)
|
||||
commands_to_run[thiscommand] = 1
|
||||
- matched = True
|
||||
+ break
|
||||
else:
|
||||
for name in thispo.filelist + thispo.dirlist + thispo.ghostlist:
|
||||
if c_string.match(name):
|
||||
thiscommand = _convert_vars(txmbr, a_c)
|
||||
commands_to_run[thiscommand] = 1
|
||||
- matched = True
|
||||
break
|
||||
-
|
||||
- if matched:
|
||||
- break
|
||||
continue
|
||||
|
||||
if a_k.find('/') == -1: # pkgspec
|
||||
diff -up yum-utils-1.1.31/plugins/post-transaction-actions/sample.action.orig yum-utils-1.1.31/plugins/post-transaction-actions/sample.action
|
||||
--- yum-utils-1.1.31/plugins/post-transaction-actions/sample.action.orig 2011-08-10 17:20:19.000000000 +0200
|
||||
+++ yum-utils-1.1.31/plugins/post-transaction-actions/sample.action 2017-11-03 16:26:53.607688349 +0100
|
||||
@@ -19,3 +19,8 @@ zsh:install:touch /tmp/zsh-installed-als
|
||||
/bin/z*h:install:touch /tmp/bin-zsh-installed
|
||||
z*h:any:touch /tmp/bin-zsh-any
|
||||
|
||||
+# each action is expanded once for each matching package, and no action is
|
||||
+# executed twice per transaction, for example
|
||||
+*:install:echo $repoid >>/tmp/repos
|
||||
+# will write each repo only once to /tmp/repos, even if multiple packages from
|
||||
+# the same repo were installed
|
||||
diff -up yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py.orig yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py
|
||||
--- yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py.orig 2017-11-03 16:26:49.819703715 +0100
|
||||
+++ yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py 2017-11-03 16:26:53.609688341 +0100
|
||||
@@ -120,24 +120,19 @@ def pretrans_hook(conduit):
|
||||
c_string = re.compile(restring)
|
||||
|
||||
for txmbr in pkgset:
|
||||
- matched = False
|
||||
thispo = txmbr.po
|
||||
|
||||
if not yum.misc.re_glob(a_k):
|
||||
if a_k in thispo.filelist + thispo.dirlist + thispo.ghostlist:
|
||||
thiscommand = _convert_vars(txmbr, a_c)
|
||||
commands_to_run[thiscommand] = 1
|
||||
- matched = True
|
||||
+ break
|
||||
else:
|
||||
for name in thispo.filelist + thispo.dirlist + thispo.ghostlist:
|
||||
if c_string.match(name):
|
||||
thiscommand = _convert_vars(txmbr, a_c)
|
||||
commands_to_run[thiscommand] = 1
|
||||
- matched = True
|
||||
break
|
||||
-
|
||||
- if matched:
|
||||
- break
|
||||
continue
|
||||
|
||||
if a_k.find('/') == -1: # pkgspec
|
||||
diff -up yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action.orig yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action
|
||||
--- yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action.orig 2017-11-03 16:26:49.820703711 +0100
|
||||
+++ yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action 2017-11-03 16:26:53.609688341 +0100
|
||||
@@ -19,3 +19,8 @@ zsh:install:touch /tmp/zsh-installed-als
|
||||
/bin/z*h:install:touch /tmp/bin-zsh-installed
|
||||
z*h:any:touch /tmp/bin-zsh-any
|
||||
|
||||
+# each action is expanded once for each matching package, and no action is
|
||||
+# executed twice per transaction, for example
|
||||
+*:install:echo $repoid >>/tmp/repos
|
||||
+# will write each repo only once to /tmp/repos, even if multiple packages from
|
||||
+# the same repo are going to be installed
|
|
@ -0,0 +1,32 @@
|
|||
diff -up yum-utils-1.1.31/yum-config-manager.py.old yum-utils-1.1.31/yum-config-manager.py
|
||||
--- yum-utils-1.1.31/yum-config-manager.py.old 2014-08-13 11:50:30.000000000 +0200
|
||||
+++ yum-utils-1.1.31/yum-config-manager.py 2014-08-13 11:52:02.801755611 +0200
|
||||
@@ -7,6 +7,7 @@ import yum
|
||||
sys.path.insert(0,'/usr/share/yum-cli')
|
||||
from utils import YumUtilBase
|
||||
import logging
|
||||
+import fnmatch
|
||||
|
||||
from iniparse import INIConfig
|
||||
|
||||
@@ -97,6 +98,11 @@ def writeRawConfigFile(filename, section
|
||||
fp.write(str(ini))
|
||||
fp.close()
|
||||
|
||||
+def match_repoid(repoid, repo_setopts):
|
||||
+ for i in repo_setopts:
|
||||
+ if fnmatch.fnmatch(repoid, i):
|
||||
+ return True
|
||||
+
|
||||
NAME = 'yum-config-manager'
|
||||
VERSION = '1.0'
|
||||
USAGE = '"yum-config-manager [options] [section]'
|
||||
@@ -175,7 +181,7 @@ if not opts.addrepo:
|
||||
repo.disable()
|
||||
print repo.dump()
|
||||
if (opts.save and
|
||||
- (only or (hasattr(yb, 'repo_setopts') and repo.id in yb.repo_setopts))):
|
||||
+ (only or (hasattr(yb, 'repo_setopts') and match_repoid(repo.id, yb.repo_setopts)))):
|
||||
writeRawConfigFile(repo.repofile, repo.id, repo.yumvar,
|
||||
repo.cfg.options, repo.iteritems, repo.optionobj,
|
||||
only)
|
|
@ -0,0 +1,19 @@
|
|||
commit 2cc8c240f6ea6ba7fae15721c9d7892024c65a8f
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Aug 28 10:17:38 2014 +0200
|
||||
|
||||
reposync: show urls for all repos when using -u option. BZ 1133125
|
||||
|
||||
diff --git a/reposync.py b/reposync.py
|
||||
index 6500db6..bb4c59d 100755
|
||||
--- a/reposync.py
|
||||
+++ b/reposync.py
|
||||
@@ -283,7 +283,7 @@ def main():
|
||||
if opts.urls:
|
||||
for pkg in download_list:
|
||||
print urljoin(pkg.repo.urls[0], pkg.relativepath)
|
||||
- return 0
|
||||
+ continue
|
||||
|
||||
# create dest dir
|
||||
if not os.path.exists(local_repo_path):
|
|
@ -0,0 +1,19 @@
|
|||
commit 8b046d7d18e0f582d9f703336d5c25a71cf02966
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Aug 28 18:18:53 2014 +0200
|
||||
|
||||
yum-post-transaction-actions: allow colons in command part. BZ 1134989
|
||||
|
||||
diff --git a/plugins/post-transaction-actions/post-transaction-actions.py b/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
index 4d015c1..d59dc40 100644
|
||||
--- a/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
+++ b/plugins/post-transaction-actions/post-transaction-actions.py
|
||||
@@ -51,7 +51,7 @@ def parse_actions(ddir, conduit):
|
||||
line = line.strip()
|
||||
if line and line[0] != "#":
|
||||
try:
|
||||
- (a_key, a_state, a_command) = line.split(':')
|
||||
+ (a_key, a_state, a_command) = line.split(':', 2)
|
||||
except ValueError,e:
|
||||
conduit.error(2,'Bad Action Line: %s' % line)
|
||||
continue
|
|
@ -0,0 +1,25 @@
|
|||
commit abdc5d04ca75357f7e2cf9852c4b6d3486cf8dd5
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Wed Sep 10 09:45:26 2014 +0200
|
||||
|
||||
reposync: preserve directory structure. BZ 1139032
|
||||
|
||||
diff --git a/reposync.py b/reposync.py
|
||||
index bb4c59d..eb8ab21 100755
|
||||
--- a/reposync.py
|
||||
+++ b/reposync.py
|
||||
@@ -291,10 +291,13 @@ def main():
|
||||
|
||||
# set localpaths
|
||||
for pkg in download_list:
|
||||
- rpmfn = os.path.basename(pkg.remote_path)
|
||||
+ rpmfn = pkg.remote_path
|
||||
pkg.localpath = os.path.join(local_repo_path, rpmfn)
|
||||
pkg.repo.copy_local = True
|
||||
pkg.repo.cache = 0
|
||||
+ localdir = os.path.dirname(pkg.localpath)
|
||||
+ if not os.path.exists(localdir):
|
||||
+ os.makedirs(localdir)
|
||||
|
||||
# use downloader from YumBase
|
||||
probs = my.downloadPkgs(download_list)
|
|
@ -0,0 +1,15 @@
|
|||
diff -up yum-utils-1.1.31/reposync.py.old yum-utils-1.1.31/reposync.py
|
||||
--- yum-utils-1.1.31/reposync.py.old 2014-09-24 09:47:05.000000000 +0200
|
||||
+++ yum-utils-1.1.31/reposync.py 2014-09-24 09:52:46.147944904 +0200
|
||||
@@ -293,7 +293,10 @@ def main():
|
||||
download_list.sort(sortPkgObj)
|
||||
if opts.urls:
|
||||
for pkg in download_list:
|
||||
- print urljoin(pkg.repo.urls[0], pkg.relativepath)
|
||||
+ remote = pkg.returnSimple('relativepath')
|
||||
+ local = os.path.join(local_repo_path, remote)
|
||||
+ if not (os.path.exists(local) and my.verifyPkg(local, pkg, False)):
|
||||
+ print urljoin(pkg.repo.urls[0], pkg.relativepath)
|
||||
continue
|
||||
|
||||
# create dest dir
|
|
@ -0,0 +1,23 @@
|
|||
commit b6e8afc8511262ca5405a084d806cdd5e52519c7
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue May 26 10:01:07 2015 +0200
|
||||
|
||||
yum-config-manager: require \* syntax to disable all repos. BZ#1151154
|
||||
|
||||
diff --git a/yum-config-manager.py b/yum-config-manager.py
|
||||
index 708c33f..0531c72 100755
|
||||
--- a/yum-config-manager.py
|
||||
+++ b/yum-config-manager.py
|
||||
@@ -146,8 +146,11 @@ if opts.enable and opts.disable:
|
||||
logger.error("Error: Trying to enable and disable repos.")
|
||||
opts.enable = opts.disable = False
|
||||
if opts.enable and not args:
|
||||
- logger.error("Error: Trying to enable already enabled repos.")
|
||||
+ logger.error("Error: please specify repos to enable (\* to enable all).")
|
||||
opts.enable = False
|
||||
+if opts.disable and not args:
|
||||
+ logger.error("Error: please specify repos to disable (\* to disable all).")
|
||||
+ opts.disable = False
|
||||
|
||||
only = None
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
commit d9adda1589e131fa0d499432dcfc46b0a72ce519
|
||||
Author: Ville Skyttä <ville.skytta@iki.fi>
|
||||
Date: Sat Feb 8 13:22:22 2014 +0200
|
||||
|
||||
yum-builddep: Note spec support in man page
|
||||
|
||||
diff --git a/docs/yum-builddep.1 b/docs/yum-builddep.1
|
||||
index ac7601e..6cad8a6 100644
|
||||
--- a/docs/yum-builddep.1
|
||||
+++ b/docs/yum-builddep.1
|
||||
@@ -9,7 +9,7 @@ yum-builddep \- install missing dependencies for building an RPM package
|
||||
\fByum-builddep\fP is a program which installs the RPMs needed to build
|
||||
the specified package. The source RPM for the specified package must
|
||||
be available in a Yum repository (which will be automatically enabled, if it is
|
||||
-disabled) or it can be a local source RPM file.
|
||||
+disabled) or it can be a local source RPM or a spec file.
|
||||
.PP
|
||||
.SH "EXAMPLES"
|
||||
.IP "Download and install all the RPMs needed to build the kernel RPM:"
|
||||
commit c08a67e9923ea9c095d62ccb931c0b8a589e4b1e
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Mar 1 18:08:32 2016 +0100
|
||||
|
||||
yum-builddep: mention the workaround for arched srpms in the man page. BZ#1156057
|
||||
|
||||
diff --git a/docs/yum-builddep.1 b/docs/yum-builddep.1
|
||||
index 6cad8a6..fbe32bd 100644
|
||||
--- a/docs/yum-builddep.1
|
||||
+++ b/docs/yum-builddep.1
|
||||
@@ -4,17 +4,28 @@
|
||||
yum-builddep \- install missing dependencies for building an RPM package
|
||||
.SH "SYNOPSIS"
|
||||
\fByum-builddep\fP package
|
||||
-.SH "DESCRIPTION"
|
||||
.PP
|
||||
+\fByum-builddep\fP /path/to/local/package.src.rpm
|
||||
+.PP
|
||||
+\fByum-builddep\fP /path/to/local/package.spec
|
||||
+.SH "DESCRIPTION"
|
||||
+.PP
|
||||
\fByum-builddep\fP is a program which installs the RPMs needed to build
|
||||
the specified package. The source RPM for the specified package must
|
||||
be available in a Yum repository (which will be automatically enabled, if it is
|
||||
disabled) or it can be a local source RPM or a spec file.
|
||||
.PP
|
||||
+Note, that only the BuildRequires information within the SRPM header information is used to determine build dependencies. This will specifically omit any dependencies that are required only for specific architectures.
|
||||
+.PP
|
||||
.SH "EXAMPLES"
|
||||
.IP "Download and install all the RPMs needed to build the kernel RPM:"
|
||||
-\fByum-builddep kernel\fP
|
||||
+\fByumdownloader --source kernel && rpm2cpio kernel*src.rpm | cpio -i kernel.spec && \\ \fP
|
||||
+.br
|
||||
+\fByum-builddep kernel.spec\fP
|
||||
.PP
|
||||
+The kernel includes specific BuildRequires dependencies for different architectures. In order to make sure that those dependencies are downloaded and installed, the SRPM should be downloaded, the .spec file extracted from it and used to determine the full dependency list.
|
||||
+.PP
|
||||
+
|
||||
.SH "FILES"
|
||||
As yum-builddep uses YUM libraries for retrieving all the information, it
|
||||
relies on YUM configuration for its default values like which repositories
|
|
@ -0,0 +1,33 @@
|
|||
--- yum-utils-1.1.31/yum-config-manager.py.orig 2016-02-04 13:54:28.339084020 +0100
|
||||
+++ yum-utils-1.1.31/yum-config-manager.py 2016-02-04 13:55:02.427900621 +0100
|
||||
@@ -10,6 +10,8 @@
|
||||
import fnmatch
|
||||
|
||||
from iniparse import INIConfig
|
||||
+import yum.config
|
||||
+import yum.yumRepo
|
||||
|
||||
from yum.parser import varReplace
|
||||
|
||||
@@ -209,13 +211,16 @@
|
||||
if url.endswith('.repo'): # this is a .repo file - fetch it, put it in our reposdir and enable it
|
||||
destname = os.path.basename(url)
|
||||
destname = myrepodir + '/' + destname
|
||||
- # this sucks - but take the first repo we come to that's enabled
|
||||
- # and steal it's grabber object - it could be proxy-laden but that's the risk we take
|
||||
- # grumbledy grumble
|
||||
- grabber = yb.repos.listEnabled()[0].grabfunc
|
||||
+
|
||||
+ # dummy grabfunc, using [main] options
|
||||
+ repo = yum.yumRepo.YumRepository('dummy')
|
||||
+ repo.baseurl = ['http://dummy']
|
||||
+ repo.populate(yum.config.ConfigParser(), None, yb.conf)
|
||||
+ grabber = repo.grabfunc; del repo
|
||||
+
|
||||
print 'grabbing file %s to %s' % (url, destname)
|
||||
try:
|
||||
- result = grabber.urlgrab(url, filename=destname, copy_local=True)
|
||||
+ result = grabber.urlgrab(url, filename=destname, copy_local=True, reget=None)
|
||||
except (IOError, OSError, yum.Errors.YumBaseError), e:
|
||||
logger.error('Could not fetch/save url %s to file %s: %s' % (url, destname, e))
|
||||
continue
|
|
@ -0,0 +1,70 @@
|
|||
diff -up yum-utils-1.1.31/docs/needs-restarting.1.orig yum-utils-1.1.31/docs/needs-restarting.1
|
||||
--- yum-utils-1.1.31/docs/needs-restarting.1.orig 2016-08-04 12:17:58.638041851 +0200
|
||||
+++ yum-utils-1.1.31/docs/needs-restarting.1 2016-08-04 12:18:37.479777824 +0200
|
||||
@@ -14,6 +14,8 @@ started running before they or some comp
|
||||
Display a help message, and then quit.
|
||||
.IP "\fB\-u, \-\-useronly\fP"
|
||||
Show processes for my userid only.
|
||||
+.IP "\fB\-r, \-\-reboothint\fP"
|
||||
+Only report whether a full reboot is required (returns 1) or not (returns 0).
|
||||
|
||||
.PP
|
||||
.SH "SEE ALSO"
|
||||
diff -up yum-utils-1.1.31/needs-restarting.py.orig yum-utils-1.1.31/needs-restarting.py
|
||||
--- yum-utils-1.1.31/needs-restarting.py.orig 2016-08-04 12:17:41.397159047 +0200
|
||||
+++ yum-utils-1.1.31/needs-restarting.py 2016-08-04 12:19:22.944468776 +0200
|
||||
@@ -48,6 +48,11 @@ from yum.Errors import RepoError
|
||||
sys.path.insert(0,'/usr/share/yum-cli')
|
||||
import utils
|
||||
|
||||
+# For which package updates we should recommend a reboot
|
||||
+# Taken from https://access.redhat.com/solutions/27943
|
||||
+REBOOTPKGS = ['kernel', 'glibc', 'linux-firmware', 'systemd', 'udev',
|
||||
+ 'openssl-libs', 'gnutls', 'dbus']
|
||||
+
|
||||
def parseargs(args):
|
||||
usage = """
|
||||
needs-restarting: Report a list of process ids of programs that started
|
||||
@@ -57,6 +62,9 @@ def parseargs(args):
|
||||
|
||||
parser.add_option("-u", "--useronly", default=False, action="store_true",
|
||||
help='show processes for my userid only')
|
||||
+ parser.add_option("-r", "--reboothint", default=False, action="store_true",
|
||||
+ help=('only report whether a full reboot is required (returns 1) or not '
|
||||
+ '(returns 0)'))
|
||||
|
||||
(opts, args) = parser.parse_args(args)
|
||||
return (opts, args)
|
||||
@@ -111,9 +119,30 @@ def main(args):
|
||||
if opts.useronly:
|
||||
myuid = os.getuid()
|
||||
|
||||
- needing_restart = set()
|
||||
-
|
||||
boot_time = utils.get_boot_time()
|
||||
+
|
||||
+ if opts.reboothint:
|
||||
+ needing_reboot = set()
|
||||
+ for pkg in my.rpmdb.searchNames(REBOOTPKGS):
|
||||
+ if float(pkg.installtime) > float(boot_time):
|
||||
+ needing_reboot.add(pkg)
|
||||
+ if needing_reboot:
|
||||
+ print 'Core libraries or services have been updated:'
|
||||
+ for pkg in needing_reboot:
|
||||
+ print ' %s ->' % pkg.name, pkg.printVer()
|
||||
+ print
|
||||
+ print 'Reboot is required to ensure that your system benefits',
|
||||
+ print 'from these updates.'
|
||||
+ print
|
||||
+ print 'More information:'
|
||||
+ print 'https://access.redhat.com/solutions/27943'
|
||||
+ return 1
|
||||
+ else:
|
||||
+ print 'No core libraries or services have been updated.'
|
||||
+ print 'Reboot is probably not necessary.'
|
||||
+ return 0
|
||||
+
|
||||
+ needing_restart = set()
|
||||
for pid in return_running_pids(uid=myuid):
|
||||
try:
|
||||
pid_start = utils.get_process_time(int(pid), boot_time)['start_time']
|
|
@ -0,0 +1,480 @@
|
|||
commit 0c0b029122b476c269a4b560d9be558e69e054ae
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Jun 25 12:09:52 2015 +0200
|
||||
|
||||
Add plugin for overlayfs issue workaround. Patch by Pavel Odvody. BZ#1213602
|
||||
|
||||
diff --git a/plugins/ovl/ovl.conf b/plugins/ovl/ovl.conf
|
||||
new file mode 100644
|
||||
index 0000000..8e4d76c
|
||||
--- /dev/null
|
||||
+++ b/plugins/ovl/ovl.conf
|
||||
@@ -0,0 +1,2 @@
|
||||
+[main]
|
||||
+enabled=1
|
||||
diff --git a/plugins/ovl/ovl.py b/plugins/ovl/ovl.py
|
||||
new file mode 100644
|
||||
index 0000000..de34081
|
||||
--- /dev/null
|
||||
+++ b/plugins/ovl/ovl.py
|
||||
@@ -0,0 +1,48 @@
|
||||
+# Copyright (C) 2015 Red Hat, Inc.
|
||||
+#
|
||||
+# Authors: Pavel Odvody <podvody@redhat.com>
|
||||
+#
|
||||
+# This copyrighted material is made available to anyone wishing to use,
|
||||
+# modify, copy, or redistribute it subject to the terms and conditions of
|
||||
+# the GNU General Public License v.2, or (at your option) any later version.
|
||||
+# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
+# ANY WARRANTY expressed or implied, including the implied warranties of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
+# Public License for more details. You should have received a copy of the
|
||||
+# GNU General Public License along with this program; if not, write to the
|
||||
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
||||
+# source code or documentation are not subject to the GNU General Public
|
||||
+# License and may only be used or replicated with the express permission of
|
||||
+# Red Hat, Inc.
|
||||
+
|
||||
+from yum.plugins import TYPE_CORE
|
||||
+from os import utime, walk, path
|
||||
+
|
||||
+requires_api_version = '2.3'
|
||||
+plugin_type = (TYPE_CORE,)
|
||||
+base_dir = 'var/lib/rpm/'
|
||||
+mtab = '/etc/mtab'
|
||||
+
|
||||
+def should_touch():
|
||||
+ """
|
||||
+ Touch the files only once we've verified that
|
||||
+ we're on overlay mount
|
||||
+ """
|
||||
+ with open(mtab, 'r') as f:
|
||||
+ line = f.readline()
|
||||
+ return line and line.startswith('overlay /')
|
||||
+ return False
|
||||
+
|
||||
+def init_hook(conduit):
|
||||
+ if not should_touch():
|
||||
+ return
|
||||
+ ir = conduit.getConf().installroot
|
||||
+ try:
|
||||
+ for root, _, files in walk(path.join(ir, base_dir)):
|
||||
+ for f in files:
|
||||
+ p = path.join(root, f)
|
||||
+ with open(p, 'a'):
|
||||
+ utime(p, None)
|
||||
+ except Exception as e:
|
||||
+ conduit.error(1, "Error while doing RPMdb copy-up:\n%s" % e)
|
||||
commit 1555cfa6465e6e31515a86f097c8993d89c0085e
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Jun 25 12:30:13 2015 +0200
|
||||
|
||||
ovl plugin: fix indentation
|
||||
|
||||
diff --git a/plugins/ovl/ovl.py b/plugins/ovl/ovl.py
|
||||
index de34081..eda784e 100644
|
||||
--- a/plugins/ovl/ovl.py
|
||||
+++ b/plugins/ovl/ovl.py
|
||||
@@ -25,24 +25,24 @@ base_dir = 'var/lib/rpm/'
|
||||
mtab = '/etc/mtab'
|
||||
|
||||
def should_touch():
|
||||
- """
|
||||
- Touch the files only once we've verified that
|
||||
- we're on overlay mount
|
||||
- """
|
||||
- with open(mtab, 'r') as f:
|
||||
- line = f.readline()
|
||||
- return line and line.startswith('overlay /')
|
||||
- return False
|
||||
+ """
|
||||
+ Touch the files only once we've verified that
|
||||
+ we're on overlay mount
|
||||
+ """
|
||||
+ with open(mtab, 'r') as f:
|
||||
+ line = f.readline()
|
||||
+ return line and line.startswith('overlay /')
|
||||
+ return False
|
||||
|
||||
def init_hook(conduit):
|
||||
- if not should_touch():
|
||||
- return
|
||||
+ if not should_touch():
|
||||
+ return
|
||||
ir = conduit.getConf().installroot
|
||||
- try:
|
||||
- for root, _, files in walk(path.join(ir, base_dir)):
|
||||
- for f in files:
|
||||
- p = path.join(root, f)
|
||||
- with open(p, 'a'):
|
||||
- utime(p, None)
|
||||
- except Exception as e:
|
||||
- conduit.error(1, "Error while doing RPMdb copy-up:\n%s" % e)
|
||||
+ try:
|
||||
+ for root, _, files in walk(path.join(ir, base_dir)):
|
||||
+ for f in files:
|
||||
+ p = path.join(root, f)
|
||||
+ with open(p, 'a'):
|
||||
+ utime(p, None)
|
||||
+ except Exception as e:
|
||||
+ conduit.error(1, "Error while doing RPMdb copy-up:\n%s" % e)
|
||||
commit 617d2d90a553f9e5bc4dfd9ab2f9c194b956fcab
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Jun 25 12:53:39 2015 +0200
|
||||
|
||||
ovl plugin: get rpmdbpath from conduit
|
||||
|
||||
diff --git a/plugins/ovl/ovl.py b/plugins/ovl/ovl.py
|
||||
index eda784e..f2fbdd4 100644
|
||||
--- a/plugins/ovl/ovl.py
|
||||
+++ b/plugins/ovl/ovl.py
|
||||
@@ -21,7 +21,6 @@ from os import utime, walk, path
|
||||
|
||||
requires_api_version = '2.3'
|
||||
plugin_type = (TYPE_CORE,)
|
||||
-base_dir = 'var/lib/rpm/'
|
||||
mtab = '/etc/mtab'
|
||||
|
||||
def should_touch():
|
||||
@@ -34,12 +33,12 @@ def should_touch():
|
||||
return line and line.startswith('overlay /')
|
||||
return False
|
||||
|
||||
-def init_hook(conduit):
|
||||
+def prereposetup_hook(conduit):
|
||||
if not should_touch():
|
||||
return
|
||||
- ir = conduit.getConf().installroot
|
||||
+ rpmdb_path = conduit.getRpmDB()._rpmdbpath
|
||||
try:
|
||||
- for root, _, files in walk(path.join(ir, base_dir)):
|
||||
+ for root, _, files in walk(rpmdb_path):
|
||||
for f in files:
|
||||
p = path.join(root, f)
|
||||
with open(p, 'a'):
|
||||
commit 5cd70d30bcdbd544e086a1aa3e7522c89bbd893a
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Aug 4 12:00:37 2015 +0200
|
||||
|
||||
ovl plugin: change copy-up strategy, execute when root fs is mounted OverlayFS, add logging. Patch by Pavel Odvody.
|
||||
|
||||
diff --git a/plugins/ovl/ovl.py b/plugins/ovl/ovl.py
|
||||
index f2fbdd4..8dd0a9e 100644
|
||||
--- a/plugins/ovl/ovl.py
|
||||
+++ b/plugins/ovl/ovl.py
|
||||
@@ -1,47 +1,93 @@
|
||||
-# Copyright (C) 2015 Red Hat, Inc.
|
||||
-#
|
||||
-# Authors: Pavel Odvody <podvody@redhat.com>
|
||||
-#
|
||||
-# This copyrighted material is made available to anyone wishing to use,
|
||||
-# modify, copy, or redistribute it subject to the terms and conditions of
|
||||
-# the GNU General Public License v.2, or (at your option) any later version.
|
||||
-# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
-# ANY WARRANTY expressed or implied, including the implied warranties of
|
||||
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
-# Public License for more details. You should have received a copy of the
|
||||
-# GNU General Public License along with this program; if not, write to the
|
||||
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
-# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
||||
-# source code or documentation are not subject to the GNU General Public
|
||||
-# License and may only be used or replicated with the express permission of
|
||||
-# Red Hat, Inc.
|
||||
-
|
||||
from yum.plugins import TYPE_CORE
|
||||
-from os import utime, walk, path
|
||||
+from os import walk, path, fstat
|
||||
|
||||
requires_api_version = '2.3'
|
||||
plugin_type = (TYPE_CORE,)
|
||||
mtab = '/etc/mtab'
|
||||
|
||||
+
|
||||
+def _stat_ino_fp(fp):
|
||||
+ """
|
||||
+ Get the inode number from file descriptor
|
||||
+ """
|
||||
+ return fstat(fp.fileno()).st_ino
|
||||
+
|
||||
+
|
||||
+def get_file_list(rpmpath):
|
||||
+ """
|
||||
+ Enumerate all files in a directory
|
||||
+ """
|
||||
+ for root, _, files in walk(rpmpath):
|
||||
+ for f in files:
|
||||
+ yield path.join(root, f)
|
||||
+
|
||||
+
|
||||
+def for_each_file(files, cb, m='rb'):
|
||||
+ """
|
||||
+ Open each file with mode specified in `m`
|
||||
+ and invoke `cb` on each of the file objects
|
||||
+ """
|
||||
+ if not files or not cb:
|
||||
+ return []
|
||||
+ ret = []
|
||||
+ for f in files:
|
||||
+ with open(f, m) as fp:
|
||||
+ ret.append(cb(fp))
|
||||
+ return ret
|
||||
+
|
||||
+
|
||||
+def do_detect_copy_up(files):
|
||||
+ """
|
||||
+ Open the files first R/O, then R/W and count unique
|
||||
+ inode numbers
|
||||
+ """
|
||||
+ num_files = len(files)
|
||||
+ lower = for_each_file(files, _stat_ino_fp, 'rb')
|
||||
+ upper = for_each_file(files, _stat_ino_fp, 'ab')
|
||||
+ diff = set(lower + upper)
|
||||
+ return len(diff) - num_files
|
||||
+
|
||||
+
|
||||
+def raw_copy_up(files):
|
||||
+ """
|
||||
+ Induce a copy-up by opening R/W
|
||||
+ """
|
||||
+ return for_each_file(files, _stat_ino_fp, 'ab')
|
||||
+
|
||||
+
|
||||
+def should_be_verbose(cmd):
|
||||
+ """
|
||||
+ If the debuglevel is > 2 then be verbose
|
||||
+ """
|
||||
+ if not hasattr(cmd, 'debuglevel'):
|
||||
+ return False
|
||||
+ return cmd.debuglevel > 2
|
||||
+
|
||||
+
|
||||
def should_touch():
|
||||
"""
|
||||
Touch the files only once we've verified that
|
||||
we're on overlay mount
|
||||
"""
|
||||
+ if not path.exists(mtab):
|
||||
+ return False
|
||||
with open(mtab, 'r') as f:
|
||||
line = f.readline()
|
||||
- return line and line.startswith('overlay /')
|
||||
+ return line.startswith('overlay / overlay')
|
||||
return False
|
||||
|
||||
+
|
||||
def prereposetup_hook(conduit):
|
||||
if not should_touch():
|
||||
return
|
||||
+
|
||||
rpmdb_path = conduit.getRpmDB()._rpmdbpath
|
||||
+
|
||||
try:
|
||||
- for root, _, files in walk(rpmdb_path):
|
||||
- for f in files:
|
||||
- p = path.join(root, f)
|
||||
- with open(p, 'a'):
|
||||
- utime(p, None)
|
||||
+ files = list(get_file_list(rpmdb_path))
|
||||
+ if should_be_verbose(conduit.getCmdLine()[0]):
|
||||
+ conduit.info(1, "ovl: Copying up (%i) files from OverlayFS lower layer" % do_detect_copy_up(files))
|
||||
+ else:
|
||||
+ raw_copy_up(files)
|
||||
except Exception as e:
|
||||
- conduit.error(1, "Error while doing RPMdb copy-up:\n%s" % e)
|
||||
+ conduit.error(1, "ovl: Error while doing RPMdb copy-up:\n%s" % e)
|
||||
commit 11e4a7386e2e351e0ff5f8d89663eb66220a6100
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Aug 4 12:18:49 2015 +0200
|
||||
|
||||
ovl plugin: remove redundant debuglevel check
|
||||
|
||||
diff --git a/plugins/ovl/ovl.py b/plugins/ovl/ovl.py
|
||||
index 8dd0a9e..400d3c7 100644
|
||||
--- a/plugins/ovl/ovl.py
|
||||
+++ b/plugins/ovl/ovl.py
|
||||
@@ -4,6 +4,7 @@ from os import walk, path, fstat
|
||||
requires_api_version = '2.3'
|
||||
plugin_type = (TYPE_CORE,)
|
||||
mtab = '/etc/mtab'
|
||||
+VERBOSE_DEBUGLEVEL = 3
|
||||
|
||||
|
||||
def _stat_ino_fp(fp):
|
||||
@@ -48,22 +49,6 @@ def do_detect_copy_up(files):
|
||||
return len(diff) - num_files
|
||||
|
||||
|
||||
-def raw_copy_up(files):
|
||||
- """
|
||||
- Induce a copy-up by opening R/W
|
||||
- """
|
||||
- return for_each_file(files, _stat_ino_fp, 'ab')
|
||||
-
|
||||
-
|
||||
-def should_be_verbose(cmd):
|
||||
- """
|
||||
- If the debuglevel is > 2 then be verbose
|
||||
- """
|
||||
- if not hasattr(cmd, 'debuglevel'):
|
||||
- return False
|
||||
- return cmd.debuglevel > 2
|
||||
-
|
||||
-
|
||||
def should_touch():
|
||||
"""
|
||||
Touch the files only once we've verified that
|
||||
@@ -85,9 +70,7 @@ def prereposetup_hook(conduit):
|
||||
|
||||
try:
|
||||
files = list(get_file_list(rpmdb_path))
|
||||
- if should_be_verbose(conduit.getCmdLine()[0]):
|
||||
- conduit.info(1, "ovl: Copying up (%i) files from OverlayFS lower layer" % do_detect_copy_up(files))
|
||||
- else:
|
||||
- raw_copy_up(files)
|
||||
+ copied_num = do_detect_copy_up(files)
|
||||
+ conduit.info(VERBOSE_DEBUGLEVEL, "ovl: Copying up (%i) files from OverlayFS lower layer" % copied_num)
|
||||
except Exception as e:
|
||||
conduit.error(1, "ovl: Error while doing RPMdb copy-up:\n%s" % e)
|
||||
commit 6f43c2e1aff0ee0746685778544f7b05d2ef78a1
|
||||
Author: Pavel Odvody <podvody@redhat.com>
|
||||
Date: Thu Sep 3 18:09:58 2015 +0200
|
||||
|
||||
Add manpage, remove file-system check
|
||||
|
||||
diff --git a/docs/yum-ovl.1 b/docs/yum-ovl.1
|
||||
new file mode 100644
|
||||
index 0000000..ddfbfab
|
||||
--- /dev/null
|
||||
+++ b/docs/yum-ovl.1
|
||||
@@ -0,0 +1,22 @@
|
||||
+.TH "yum\-ovl" "1" "September 2015" "Red Hat" "User Manual"
|
||||
+.
|
||||
+.SH "NAME"
|
||||
+yum\-ovl \- Performs an initial copy\-up of yum(8) package database\.
|
||||
+.
|
||||
+.SH "OPTIONS"
|
||||
+\fB\-d\fR \fIdebug\-level\fR If debug level is \fI2\fR and more, print out the number of files copied up from the lower layer
|
||||
+.
|
||||
+.SH "FILES"
|
||||
+\fI/usr/lib/yum\-plugins/ovl\.py\fR Plugin itself
|
||||
+.
|
||||
+.P
|
||||
+\fI/etc/yum/pluginconf\.d/ovl\.conf\fR Configuration file allowing to enable/disable the plugin
|
||||
+.
|
||||
+.SH "AUTHOR"
|
||||
+Pavel Odvody \fIpodvody@redhat\.com\fR
|
||||
+.
|
||||
+.SH "LICENSE"
|
||||
+2015, Red Hat, Licensed under GPLv2+
|
||||
+.
|
||||
+.SH "SEE ALSO"
|
||||
+yum(1) yum(8)
|
||||
diff --git a/plugins/ovl/ovl.py b/plugins/ovl/ovl.py
|
||||
index 400d3c7..3d547ed 100644
|
||||
--- a/plugins/ovl/ovl.py
|
||||
+++ b/plugins/ovl/ovl.py
|
||||
@@ -3,7 +3,6 @@ from os import walk, path, fstat
|
||||
|
||||
requires_api_version = '2.3'
|
||||
plugin_type = (TYPE_CORE,)
|
||||
-mtab = '/etc/mtab'
|
||||
VERBOSE_DEBUGLEVEL = 3
|
||||
|
||||
|
||||
@@ -49,23 +48,7 @@ def do_detect_copy_up(files):
|
||||
return len(diff) - num_files
|
||||
|
||||
|
||||
-def should_touch():
|
||||
- """
|
||||
- Touch the files only once we've verified that
|
||||
- we're on overlay mount
|
||||
- """
|
||||
- if not path.exists(mtab):
|
||||
- return False
|
||||
- with open(mtab, 'r') as f:
|
||||
- line = f.readline()
|
||||
- return line.startswith('overlay / overlay')
|
||||
- return False
|
||||
-
|
||||
-
|
||||
def prereposetup_hook(conduit):
|
||||
- if not should_touch():
|
||||
- return
|
||||
-
|
||||
rpmdb_path = conduit.getRpmDB()._rpmdbpath
|
||||
|
||||
try:
|
||||
commit 3980742eb6477c5bd5366222fb033cfc5c95d260
|
||||
Author: Pavel Odvody <podvody@redhat.com>
|
||||
Date: Fri Sep 4 10:38:32 2015 +0200
|
||||
|
||||
Added manpage description and reference to rpmdb
|
||||
|
||||
diff --git a/docs/yum-ovl.1 b/docs/yum-ovl.1
|
||||
index ddfbfab..33e0dfb 100644
|
||||
--- a/docs/yum-ovl.1
|
||||
+++ b/docs/yum-ovl.1
|
||||
@@ -6,6 +6,21 @@ yum\-ovl \- Performs an initial copy\-up of yum(8) package database\.
|
||||
.SH "OPTIONS"
|
||||
\fB\-d\fR \fIdebug\-level\fR If debug level is \fI2\fR and more, print out the number of files copied up from the lower layer
|
||||
.
|
||||
+.SH "DESCRIPTION"
|
||||
+Opening a file on OverlayFS in read\-only mode causes the file from
|
||||
+.br
|
||||
+lower layer to be opened, then later on, if the same file is opened
|
||||
+.br
|
||||
+in write mode, a copy-up into the upper layer takes place,
|
||||
+.br
|
||||
+resulting into a \fBnew\fR file being opened\.
|
||||
+.br
|
||||
+Since yum(8) needs to open the \fBRPMdb\fR first read-only, and then
|
||||
+.br
|
||||
+also with write access, we need to copy-up the files beforehand to
|
||||
+.br
|
||||
+make sure that the access is consistent.
|
||||
+.
|
||||
.SH "FILES"
|
||||
\fI/usr/lib/yum\-plugins/ovl\.py\fR Plugin itself
|
||||
.
|
||||
@@ -19,4 +34,4 @@ Pavel Odvody \fIpodvody@redhat\.com\fR
|
||||
2015, Red Hat, Licensed under GPLv2+
|
||||
.
|
||||
.SH "SEE ALSO"
|
||||
-yum(1) yum(8)
|
||||
+yum(1) yum(8) rpmdb(8)
|
||||
diff -up yum-utils-1.1.31/docs/Makefile.old yum-utils-1.1.31/docs/Makefile
|
||||
--- yum-utils-1.1.31/docs/Makefile.old 2015-09-04 17:10:03.460207371 +0200
|
||||
+++ yum-utils-1.1.31/docs/Makefile 2015-09-04 17:10:19.167260413 +0200
|
||||
@@ -3,7 +3,7 @@ DOCS = repoquery package-cleanup repo-rs
|
||||
yum-groups-manager debuginfo-install repodiff yum-fs-snapshot \
|
||||
show-installed show-changed-rco yum-debug-restore \
|
||||
find-repos-of-install needs-restarting repo-graph repoclosure \
|
||||
- repomanage repotrack verifytree yum-config-manager
|
||||
+ repomanage repotrack verifytree yum-config-manager yum-ovl
|
||||
DOCS5 = yum-changelog.conf yum-versionlock.conf yum-fs-snapshot.conf
|
||||
DOCS8 = yum-complete-transaction yumdb
|
||||
|
||||
commit d03fce57c1fa3f9dff6fdd9867cbcaf66df9f841
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Fri Oct 9 15:16:33 2015 +0200
|
||||
|
||||
ovl plugin: run at init_hook stage
|
||||
|
||||
diff --git a/plugins/ovl/ovl.py b/plugins/ovl/ovl.py
|
||||
index 3d547ed..fe27022 100644
|
||||
--- a/plugins/ovl/ovl.py
|
||||
+++ b/plugins/ovl/ovl.py
|
||||
@@ -47,9 +47,8 @@ def do_detect_copy_up(files):
|
||||
diff = set(lower + upper)
|
||||
return len(diff) - num_files
|
||||
|
||||
-
|
||||
-def prereposetup_hook(conduit):
|
||||
- rpmdb_path = conduit.getRpmDB()._rpmdbpath
|
||||
+def init_hook(conduit):
|
||||
+ rpmdb_path = conduit._base.rpmdb._rpmdbpath
|
||||
|
||||
try:
|
||||
files = list(get_file_list(rpmdb_path))
|
|
@ -0,0 +1,22 @@
|
|||
commit 84988d6ae0e3d6dad07cde3701a69f7717cf8962
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Fri May 13 12:19:33 2016 +0200
|
||||
|
||||
yum-config-manager: document syntax for enabling/disabling all repos.
|
||||
|
||||
diff --git a/docs/yum-config-manager.1 b/docs/yum-config-manager.1
|
||||
index 81b895b..c130070 100644
|
||||
--- a/docs/yum-config-manager.1
|
||||
+++ b/docs/yum-config-manager.1
|
||||
@@ -16,9 +16,9 @@ Display a help message, and then quit.
|
||||
.IP "\fB\-\-save\fP"
|
||||
Save the current options (useful with \-\-setopt).
|
||||
.IP "\fB\-\-enable\fP"
|
||||
-Enable the specified repos (automatically saves).
|
||||
+Enable the specified repos (automatically saves). To enable all repositories run 'yum-config-manager --enable \\*".
|
||||
.IP "\fB\-\-disable\fP"
|
||||
-Disable the specified repos (automatically saves).
|
||||
+Disable the specified repos (automatically saves). To disable all repositories run "yum-config-manager --disable \\*".
|
||||
.IP "\fB\-\-add\-repo=ADDREPO\fP"
|
||||
Add (and enable) the repo from the specified file or url.
|
||||
.SH "ADDITIONAL OPTIONS"
|
|
@ -0,0 +1,19 @@
|
|||
commit ac1a9d171548057961ea040d7f1eaae61cb54bf1
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Mar 11 17:40:48 2014 +0100
|
||||
|
||||
Fix description of --archlist in the manpage. BZ 1045871
|
||||
|
||||
diff --git a/docs/yumdownloader.1 b/docs/yumdownloader.1
|
||||
index e290268..d2cb276 100644
|
||||
--- a/docs/yumdownloader.1
|
||||
+++ b/docs/yumdownloader.1
|
||||
@@ -20,7 +20,7 @@ When downloading RPMs, resolve dependencies and also download the required packa
|
||||
.IP "\fB\-\-source\fP"
|
||||
Instead of downloading the binary RPMs, download the source RPMs.
|
||||
.IP "\fB\-\-archlist=ARCH1[,ARCH2...]\fP"
|
||||
-Limit the query to packages of given architecture(s). Valid values are all
|
||||
+Limit the query to packages of given and compatible architectures. Valid values are all
|
||||
architectures known to rpm/yum such as 'i386' and 'src' for
|
||||
source RPMS. Note that repoquery will now change yum's "arch" to the first
|
||||
value in the archlist. So "\-\-archlist=i386,i686" will change yum's canonical
|
|
@ -0,0 +1,19 @@
|
|||
commit 834a4ff4f2752631252cff4e3b2ba87bee62965b
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Dec 10 16:24:18 2015 +0100
|
||||
|
||||
yum-plugin-priorities: get all obsoletes, not just the newest. BZ#1269414
|
||||
|
||||
diff --git a/plugins/priorities/priorities.py b/plugins/priorities/priorities.py
|
||||
index ce98583..006c545 100644
|
||||
--- a/plugins/priorities/priorities.py
|
||||
+++ b/plugins/priorities/priorities.py
|
||||
@@ -111,7 +111,7 @@ def exclude_hook(conduit):
|
||||
if check_obsoletes and not conduit._base.conf.obsoletes:
|
||||
check_obsoletes = False
|
||||
if check_obsoletes:
|
||||
- obsoletes = conduit._base.up.rawobsoletes
|
||||
+ obsoletes = conduit._base.pkgSack.returnObsoletes()
|
||||
|
||||
# Build a dictionary with package priorities. Either with arch or
|
||||
# archless, based on the user's settings.
|
|
@ -0,0 +1,19 @@
|
|||
commit 624cf40406a2e8bacde8afde807d5efbf74ca4ab
|
||||
Author: James Antill <james@and.org>
|
||||
Date: Thu Dec 5 16:43:04 2013 -0500
|
||||
|
||||
Remove -v from repoquery man page.
|
||||
|
||||
diff --git a/docs/repoquery.1 b/docs/repoquery.1
|
||||
index 30fda8a..85b0047 100644
|
||||
--- a/docs/repoquery.1
|
||||
+++ b/docs/repoquery.1
|
||||
@@ -14,7 +14,7 @@ similarly to rpm queries.
|
||||
.SH "GENERAL OPTIONS"
|
||||
.IP "\fB\-\-querytags\fP"
|
||||
List valid queryformat tags and exit..
|
||||
-.IP "\fB\-v, \-\-version\fP"
|
||||
+.IP "\fB\-\-version\fP"
|
||||
Report program version and exit.
|
||||
.IP "\fB\-\-repoid=<repo>\fP"
|
||||
Specify which repository to query. Using this option disables all repositories
|
|
@ -0,0 +1,52 @@
|
|||
commit 2f1605f65e6bc24d6a2515b99f1486085f281a49
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Mar 1 16:18:39 2016 +0100
|
||||
|
||||
debuginfo-install: install debuginfo only for the latest installed version of installonly package. BZ#1293707
|
||||
|
||||
diff --git a/debuginfo-install.py b/debuginfo-install.py
|
||||
index bb61a1d..19fe8b6 100755
|
||||
--- a/debuginfo-install.py
|
||||
+++ b/debuginfo-install.py
|
||||
@@ -148,9 +148,12 @@ class DebugInfoInstall(YumUtilBase):
|
||||
# add that debuginfo to the ts
|
||||
# look through that pkgs' deps
|
||||
# add all the debuginfos for the pkgs providing those deps
|
||||
+ installonly_added = set()
|
||||
for pkgglob in self.cmds:
|
||||
e, m, u = self.rpmdb.matchPackageNames([pkgglob])
|
||||
- for po in e + m:
|
||||
+ for po in sorted(e + m, reverse=True):
|
||||
+ if po.name in installonly_added:
|
||||
+ continue
|
||||
try:
|
||||
self.di_try_install(po)
|
||||
except yum.Errors.InstallError, e:
|
||||
@@ -167,6 +170,8 @@ class DebugInfoInstall(YumUtilBase):
|
||||
self.di_try_install(deppo)
|
||||
except yum.Errors.InstallError, e:
|
||||
self.logger.critical('Could not find debuginfo pkg for dependency package %s' % deppo)
|
||||
+ if po.name in self.conf.installonlypkgs:
|
||||
+ installonly_added.add(po.name)
|
||||
|
||||
for pkgname in u:
|
||||
self.logger.critical('Could not find a package for: %s' % pkgname)
|
||||
commit 8048d25bf3225b8ddd7d0a90b050bce2cc716e2a
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Jun 21 14:24:12 2016 +0200
|
||||
|
||||
debuginfo-install: also respect provides when testing for installonly.
|
||||
|
||||
diff --git a/debuginfo-install.py b/debuginfo-install.py
|
||||
index 19fe8b6..6053f62 100755
|
||||
--- a/debuginfo-install.py
|
||||
+++ b/debuginfo-install.py
|
||||
@@ -170,7 +170,7 @@ class DebugInfoInstall(YumUtilBase):
|
||||
self.di_try_install(deppo)
|
||||
except yum.Errors.InstallError, e:
|
||||
self.logger.critical('Could not find debuginfo pkg for dependency package %s' % deppo)
|
||||
- if po.name in self.conf.installonlypkgs:
|
||||
+ if self.allowedMultipleInstalls(po):
|
||||
installonly_added.add(po.name)
|
||||
|
||||
for pkgname in u:
|
|
@ -0,0 +1,51 @@
|
|||
diff -up yum-utils-1.1.31/verifytree.py.orig yum-utils-1.1.31/verifytree.py
|
||||
--- yum-utils-1.1.31/verifytree.py.orig 2016-07-21 14:46:21.050199284 +0200
|
||||
+++ yum-utils-1.1.31/verifytree.py 2016-07-21 14:46:43.277058501 +0200
|
||||
@@ -47,8 +47,22 @@ plan_number = 13
|
||||
case_numbers = {'REPODATA': 56, 'CORE_PACKAGES': 57, 'COMPS': 58,
|
||||
'BOOT_IMAGES': 59}
|
||||
|
||||
-# URL for the RELAX NG schema for comps
|
||||
-SCHEMA = 'http://cvs.fedoraproject.org/viewcvs/*checkout*/comps/comps.rng'
|
||||
+def get_schema_path():
|
||||
+ """Return the local path to the RELAX NG comps schema."""
|
||||
+ # Depending on whether our distro uses versioned or unversioned docdirs
|
||||
+ # (the former is true for Fedora < 20, see bug 998579), the schema file
|
||||
+ # should be provided by yum at either of the following locations:
|
||||
+ paths = ['/usr/share/doc/yum%s/comps.rng' % s
|
||||
+ for s in ('', '-' + yum.__version__)]
|
||||
+ for path in paths:
|
||||
+ # Better than os.path.exists() as this also ensures we can actually
|
||||
+ # read the file
|
||||
+ try:
|
||||
+ with open(path):
|
||||
+ return path
|
||||
+ except IOError:
|
||||
+ continue
|
||||
+ raise IOError(paths)
|
||||
|
||||
def testopia_create_run(plan):
|
||||
'''Create a run of the given test plan. Returns the run ID.'''
|
||||
@@ -230,9 +244,19 @@ def main():
|
||||
|
||||
if not (retval & BAD_COMPS):
|
||||
print " verifying comps.xml grammar with xmllint"
|
||||
- comps = newrepo.getGroups()
|
||||
- r = os.system("xmllint --noout --nowarning --relaxng %s %s" %
|
||||
- (SCHEMA,comps))
|
||||
+ try:
|
||||
+ schema = get_schema_path()
|
||||
+ except IOError as e:
|
||||
+ print ' could not read schema file, paths tried:'
|
||||
+ for path in e.args[0]:
|
||||
+ print ' ' + path
|
||||
+ print (' make sure you have the latest version of yum '
|
||||
+ 'properly installed')
|
||||
+ r = 1
|
||||
+ else:
|
||||
+ comps = newrepo.getGroups()
|
||||
+ r = os.system("xmllint --noout --nowarning --relaxng %s %s" %
|
||||
+ (schema, comps))
|
||||
if r != 0:
|
||||
retval = retval | BAD_COMPS
|
||||
report('COMPS','FAILED')
|
|
@ -0,0 +1,19 @@
|
|||
commit cd96c21e6c323e4c73555bbc1360a60fa2b9ddeb
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Oct 14 18:52:04 2014 +0200
|
||||
|
||||
reposync: add --download-metadata to the man page. BZ 1079435
|
||||
|
||||
diff --git a/docs/reposync.1 b/docs/reposync.1
|
||||
index d6d245a..ea5653c 100644
|
||||
--- a/docs/reposync.1
|
||||
+++ b/docs/reposync.1
|
||||
@@ -41,6 +41,8 @@ Just list urls of what would be downloaded, don't download.
|
||||
Enable yum plugin support.
|
||||
.IP "\fB\-m, \-\-downloadcomps\fP"
|
||||
Also download comps.xml.
|
||||
+.IP "\fB\-\-download-metadata\fP"
|
||||
+Download all the non-default metadata.
|
||||
.IP "\fB\-n, \-\-newest\-only\fP"
|
||||
Download only newest packages per-repo.
|
||||
.IP "\fB\-q, \-\-quiet\fP"
|
|
@ -0,0 +1,33 @@
|
|||
commit 56c7eacd9d0ad9237d05e1393c12d5059edb2c7a
|
||||
Author: Michal Domonkos <mdomonko@redhat.com>
|
||||
Date: Mon Oct 23 15:33:13 2017 +0200
|
||||
|
||||
verifytree: fix handling of missing comps. BZ 1333353
|
||||
|
||||
When we have group_command = 'objects' and no comps file, invoking
|
||||
my.comps doesn't raise a GroupsError as we would expect, and we continue
|
||||
to newrepo.getGroups() where we finally traceback. This commit makes
|
||||
sure we detect that beforehand and fail correctly.
|
||||
|
||||
diff --git a/verifytree.py b/verifytree.py
|
||||
index 6a127cd..7f11f10 100755
|
||||
--- a/verifytree.py
|
||||
+++ b/verifytree.py
|
||||
@@ -237,7 +237,8 @@ def main():
|
||||
try:
|
||||
print " verifying comps.xml with yum"
|
||||
b = my.comps.compscount
|
||||
- except Errors.GroupsError, e:
|
||||
+ comps = newrepo.getGroups()
|
||||
+ except (Errors.GroupsError, Errors.RepoMDError):
|
||||
print ' comps file missing or unparseable'
|
||||
report('COMPS','FAILED')
|
||||
retval = retval | BAD_COMPS
|
||||
@@ -254,7 +255,6 @@ def main():
|
||||
'properly installed')
|
||||
r = 1
|
||||
else:
|
||||
- comps = newrepo.getGroups()
|
||||
r = os.system("xmllint --noout --nowarning --relaxng %s %s" %
|
||||
(schema, comps))
|
||||
if r != 0:
|
|
@ -0,0 +1,70 @@
|
|||
diff -up yum-utils-1.1.31/docs/needs-restarting.1.orig yum-utils-1.1.31/docs/needs-restarting.1
|
||||
--- yum-utils-1.1.31/docs/needs-restarting.1.orig 2016-08-04 12:22:33.765295008 +0200
|
||||
+++ yum-utils-1.1.31/docs/needs-restarting.1 2016-08-04 12:24:52.076356702 +0200
|
||||
@@ -16,6 +16,8 @@ Display a help message, and then quit.
|
||||
Show processes for my userid only.
|
||||
.IP "\fB\-r, \-\-reboothint\fP"
|
||||
Only report whether a full reboot is required (returns 1) or not (returns 0).
|
||||
+.IP "\fB\-s, \-\-services\fP"
|
||||
+List the affected systemd services only.
|
||||
|
||||
.PP
|
||||
.SH "SEE ALSO"
|
||||
diff -up yum-utils-1.1.31/needs-restarting.py.orig yum-utils-1.1.31/needs-restarting.py
|
||||
--- yum-utils-1.1.31/needs-restarting.py.orig 2016-08-04 12:22:15.914287046 +0200
|
||||
+++ yum-utils-1.1.31/needs-restarting.py 2016-08-04 12:24:22.235343391 +0200
|
||||
@@ -65,6 +65,8 @@ def parseargs(args):
|
||||
parser.add_option("-r", "--reboothint", default=False, action="store_true",
|
||||
help=('only report whether a full reboot is required (returns 1) or not '
|
||||
'(returns 0)'))
|
||||
+ parser.add_option("-s", "--services", default=False, action="store_true",
|
||||
+ help='list the affected systemd services only')
|
||||
|
||||
(opts, args) = parser.parse_args(args)
|
||||
return (opts, args)
|
||||
@@ -106,6 +108,31 @@ def get_open_files(pid):
|
||||
files.append(filename)
|
||||
return files
|
||||
|
||||
+def get_service(pid):
|
||||
+ """Return the systemd service to which the process belongs.
|
||||
+
|
||||
+ More details:
|
||||
+ http://0pointer.de/blog/projects/systemd-for-admins-2.html
|
||||
+ https://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions/
|
||||
+ """
|
||||
+
|
||||
+ fname = '/proc/%s/cgroup' % pid
|
||||
+ try:
|
||||
+ with open(fname, 'r') as f:
|
||||
+ groups = f.readlines()
|
||||
+ except (IOError, OSError), e:
|
||||
+ print >>sys.stderr, "Could not open %s" % fname
|
||||
+ return None
|
||||
+
|
||||
+ for line in groups:
|
||||
+ line = line.replace('\n', '')
|
||||
+ hid, hsub, cgroup = line.split(':')
|
||||
+ if hsub == 'name=systemd':
|
||||
+ name = cgroup.split('/')[-1]
|
||||
+ if name.endswith('.service'):
|
||||
+ return name
|
||||
+ return None
|
||||
+
|
||||
def main(args):
|
||||
(opts, args) = parseargs(args)
|
||||
|
||||
@@ -189,6 +216,13 @@ def main(args):
|
||||
|
||||
|
||||
|
||||
+ if opts.services:
|
||||
+ names = set([get_service(pid) for pid in needing_restart])
|
||||
+ for name in names:
|
||||
+ if name is not None:
|
||||
+ print name
|
||||
+ return 0
|
||||
+
|
||||
for pid in needing_restart:
|
||||
try:
|
||||
cmdline = open('/proc/' +pid+ '/cmdline', 'r').read()
|
|
@ -0,0 +1,32 @@
|
|||
commit b586ff502946fbd3271db8370cb546f696c51cfd
|
||||
Author: Michal Domonkos <mdomonko@redhat.com>
|
||||
Date: Fri Oct 20 19:47:36 2017 +0200
|
||||
|
||||
verifytree: handle no @core group gracefully. BZ 1349433
|
||||
|
||||
It's not clear to me whether @core group is really mandatory, however
|
||||
let's make verifytree fail if it's not defined so that we don't change
|
||||
the return code to 0 for that case; we would return 1 previously (python
|
||||
traceback) and now we OR the BAD_COMPS flag which is 4 (still not 1 but
|
||||
at least non-zero).
|
||||
|
||||
diff --git a/verifytree.py b/verifytree.py
|
||||
index 6a127cd..603a633 100755
|
||||
--- a/verifytree.py
|
||||
+++ b/verifytree.py
|
||||
@@ -278,7 +278,14 @@ def main():
|
||||
elif not (retval & BAD_COMPS or opts.nocomps):
|
||||
print "Checking mandatory @core packages"
|
||||
group = my.comps.return_group('core')
|
||||
- for pname in group.mandatory_packages:
|
||||
+ if group is not None:
|
||||
+ pkgs = group.mandatory_packages
|
||||
+ else:
|
||||
+ print " @core group not found"
|
||||
+ retval = retval | BAD_COMPS
|
||||
+ report('COMPS','FAILED')
|
||||
+ pkgs = []
|
||||
+ for pname in pkgs:
|
||||
# FIXME: this pulls from pkgSack, which (I guess) is populated
|
||||
# based on the arch etc. of the current host.. so you can't check
|
||||
# the x86_64 repo from an i386 machine, f'rinstance.
|
|
@ -0,0 +1,109 @@
|
|||
diff -up yum-utils-1.1.31/docs/yum-config-manager.1.orig yum-utils-1.1.31/docs/yum-config-manager.1
|
||||
--- yum-utils-1.1.31/docs/yum-config-manager.1.orig 2017-02-27 18:04:05.377037276 +0100
|
||||
+++ yum-utils-1.1.31/docs/yum-config-manager.1 2017-02-27 18:04:06.648030205 +0100
|
||||
@@ -3,20 +3,38 @@
|
||||
.SH "NAME"
|
||||
yum-config-manager \- manage yum configuration options and yum repositories
|
||||
.SH "SYNOPSIS"
|
||||
-\fByum-config-manager\fP [options]
|
||||
+\fByum-config-manager\fP [options] [section ...]
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
\fByum-config-manager\fP is a program that can manage main yum configuration
|
||||
options, toggle which repositories are enabled or disabled, and add new
|
||||
repositories.
|
||||
.PP
|
||||
+Unless \-\-add-repo is used, the program will output the current configuration
|
||||
+of the selected sections, and optionally save it back to the corresponding
|
||||
+files.
|
||||
+.PP
|
||||
+By default, if no positional arguments are specified, the program will select
|
||||
+the [main] section and each enabled repository.
|
||||
+You can override this by specifying your own list of sections as arguments
|
||||
+(these may also include disabled repositories).
|
||||
+A section can either be main or a repoid.
|
||||
+.PP
|
||||
.SH "OPTIONS"
|
||||
.IP "\fB\-h, \-\-help\fP"
|
||||
Display a help message, and then quit.
|
||||
+.IP "\fB\-\-setopt=option=value\fP"
|
||||
+Set any config option in yum config or repo files. For options in the global
|
||||
+config just use: \-\-setopt=option=value for repo options use: \-\-setopt=repoid.option=value.
|
||||
+The latter form accepts wildcards in repoid that will be expanded to the
|
||||
+selected sections.
|
||||
+If repoid contains no wildcard, it will automatically be selected; this is
|
||||
+useful if you are addressing a disabled repo, in which case you don't have to
|
||||
+additionally pass it as an argument.
|
||||
.IP "\fB\-\-save\fP"
|
||||
Save the current options (useful with \-\-setopt).
|
||||
.IP "\fB\-\-enable\fP"
|
||||
-Enable the specified repos (automatically saves). To enable all repositories run 'yum-config-manager --enable \\*".
|
||||
+Enable the specified repos (automatically saves). To enable all repositories run "yum-config-manager --enable \\*".
|
||||
.IP "\fB\-\-disable\fP"
|
||||
Disable the specified repos (automatically saves). To disable all repositories run "yum-config-manager --disable \\*".
|
||||
.IP "\fB\-\-add\-repo=ADDREPO\fP"
|
||||
@@ -25,6 +43,36 @@ Add (and enable) the repo from the speci
|
||||
Yum-config-manager inherits all other options from yum. See the yum(8)
|
||||
man page for more information.
|
||||
|
||||
+.SH "EXAMPLES"
|
||||
+Show the configuration of [main] and the repos foo and bar:
|
||||
+.IP
|
||||
+\fByum-config-manager main foo bar\fP
|
||||
+.PP
|
||||
+Enable the repos foo and bar:
|
||||
+.IP
|
||||
+\fByum-config-manager --enable foo bar\fP
|
||||
+.PP
|
||||
+Change a global option:
|
||||
+.IP
|
||||
+\fByum-config-manager --setopt=installonly_limit=5 --save\fP
|
||||
+.PP
|
||||
+Change a repo option of the repo foo (works even if foo is disabled):
|
||||
+.IP
|
||||
+\fByum-config-manager --setopt=foo.skip_if_unavailable=1 --save\fP
|
||||
+.PP
|
||||
+Change a repo option of more repos at once:
|
||||
+.IP
|
||||
+\fByum-config-manager --setopt=\\*.skip_if_unavailable=1 --save foo bar baz\fP
|
||||
+.PP
|
||||
+Change a repo option of all the enabled repos:
|
||||
+.IP
|
||||
+\fByum-config-manager --setopt=\\*.skip_if_unavailable=1 --save\fP
|
||||
+.PP
|
||||
+Change a repo option of all the configured (that is, enabled and disabled)
|
||||
+repos:
|
||||
+.IP
|
||||
+\fByum-config-manager --setopt=\\*.skip_if_unavailable=1 --save \\*\fP
|
||||
+
|
||||
.PP
|
||||
.SH "SEE ALSO"
|
||||
.nf
|
||||
diff -up yum-utils-1.1.31/yum-config-manager.py.orig yum-utils-1.1.31/yum-config-manager.py
|
||||
--- yum-utils-1.1.31/yum-config-manager.py.orig 2017-02-27 18:04:05.367037332 +0100
|
||||
+++ yum-utils-1.1.31/yum-config-manager.py 2017-02-27 18:04:40.143843850 +0100
|
||||
@@ -107,7 +107,7 @@ def match_repoid(repoid, repo_setopts):
|
||||
|
||||
NAME = 'yum-config-manager'
|
||||
VERSION = '1.0'
|
||||
-USAGE = '"yum-config-manager [options] [section]'
|
||||
+USAGE = 'yum-config-manager [options] [section ...]'
|
||||
|
||||
yum.misc.setup_locale()
|
||||
|
||||
@@ -180,6 +180,15 @@ if args:
|
||||
else:
|
||||
repos = yb.repos.listEnabled()
|
||||
|
||||
+# Automatically select repos specified within --setopt (but only for exact
|
||||
+# matches without wildcards). This way users don't have to specify disabled
|
||||
+# repos twice on the cmdline.
|
||||
+if hasattr(yb, 'repo_setopts') and yb.repo_setopts:
|
||||
+ ids = set(yb.repo_setopts.keys()) & set(yb.repos.repos.keys())
|
||||
+ ids -= set([r.id for r in repos])
|
||||
+ repos += yb.repos.findRepos(','.join(ids),
|
||||
+ name_match=True, ignore_case=True)
|
||||
+
|
||||
if not opts.addrepo:
|
||||
for repo in sorted(repos):
|
||||
print yb.fmtSection('repo: ' + repo.id)
|
|
@ -0,0 +1,85 @@
|
|||
commit f62551849e0f8c5cc3151d78af0975fad831e8ed
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Tue Oct 18 10:31:11 2016 +0200
|
||||
|
||||
yum-plugin-verify: set exit status to 1 in case of problems.
|
||||
|
||||
diff --git a/plugins/verify/verify.py b/plugins/verify/verify.py
|
||||
index 108f96e..94eca26 100644
|
||||
--- a/plugins/verify/verify.py
|
||||
+++ b/plugins/verify/verify.py
|
||||
@@ -287,6 +287,7 @@ Verify packages and display data on bad verifications"""
|
||||
|
||||
def show_data(self, base, msg, pkgs, name):
|
||||
done = False
|
||||
+ problem_found = False
|
||||
mcb = lambda x: base.matchcallback(x, [])
|
||||
for (pkg, results) in self.filter_data(msg, pkgs):
|
||||
if not done:
|
||||
@@ -310,11 +311,13 @@ Verify packages and display data on bad verifications"""
|
||||
(hib, hie) = ("", "")
|
||||
done_prob = False
|
||||
for problem in sorted(results[fname]):
|
||||
+ problem_found = True
|
||||
if not done_prob and problem.file_types:
|
||||
tags = ", ".join(problem.file_types)
|
||||
msg(" Tags: " + hib + tags + hie)
|
||||
self.show_problem(base, msg, problem, done_prob)
|
||||
done_prob = True
|
||||
+ return problem_found
|
||||
|
||||
def doCommand(self, base, basecmd, extcmds):
|
||||
global _verify_configs
|
||||
@@ -360,10 +363,10 @@ Verify packages and display data on bad verifications"""
|
||||
# nevr() match
|
||||
|
||||
ypl = base.returnPkgLists(subgroup + extcmds)
|
||||
- self.show_data(base, msg, ypl.installed, 'Installed Packages')
|
||||
- self.show_data(base, msg, ypl.extras, 'Extra Packages')
|
||||
+ result = (self.show_data(base, msg, ypl.installed, 'Installed Packages')
|
||||
+ or self.show_data(base, msg, ypl.extras, 'Extra Packages'))
|
||||
|
||||
- return 0, [basecmd + ' done']
|
||||
+ return result, [basecmd + ' done']
|
||||
|
||||
def needTs(self, base, basecmd, extcmds):
|
||||
if not len(extcmds) or extcmds[0] != 'extras':
|
||||
|
||||
commit 7a94cf4434107bfcb32e60420af2106b993c7381
|
||||
Author: Michal Domonkos <mdomonko@redhat.com>
|
||||
Date: Thu Feb 16 17:47:53 2017 +0100
|
||||
|
||||
docs: verify: fix wording. BZ 1406891
|
||||
|
||||
diff --git a/docs/yum-verify.1 b/docs/yum-verify.1
|
||||
index 5246a1c..1a8cc11 100644
|
||||
--- a/docs/yum-verify.1
|
||||
+++ b/docs/yum-verify.1
|
||||
@@ -6,7 +6,7 @@ yum verify plugin
|
||||
\fByum\fP [options] verify [package ...]
|
||||
.SH "DESCRIPTION"
|
||||
.PP
|
||||
-This plugin extends \fByum\fP with some commands that give verification information on the installed system, much like rpm \-V. You can change how the verification is done and which files it applies to.
|
||||
+This plugin extends \fByum\fP with some commands that give verification information on the installed system, much like rpm \-V. You can change how the verification is done and which files it applies to. In case any mismatches are found, the exit status is set to 1.
|
||||
.PP
|
||||
added yum \fIcommand\fPs are:
|
||||
.br
|
||||
@@ -17,7 +17,7 @@ added yum \fIcommand\fPs are:
|
||||
.I \fR * verify-all
|
||||
.br
|
||||
.PP
|
||||
-all of which take the same arguments as the list yum command, obviously you can
|
||||
+all of which take the same arguments as the list yum command. You can
|
||||
only verify packages that are installed on the system.
|
||||
.PP
|
||||
.br
|
||||
@@ -29,8 +29,7 @@ output. It removes all false matches due to multilib and ignores changes to
|
||||
configuration files by default.
|
||||
.IP
|
||||
.IP "\fBverify-rpm\fP"
|
||||
-Is meant to be 100% compatible with rpm \-V output, and any differences should be
|
||||
-considered as bugs.
|
||||
+Does the same checks as rpm \-V.
|
||||
.IP
|
||||
.IP "\fBverify-all\fP"
|
||||
Is used to list all the differences, including some that rpm itself will ignore.
|
|
@ -0,0 +1,68 @@
|
|||
commit f62ca0e78ff5b087c0cb49d858e040a5c5284eeb
|
||||
Author: Michal Domonkos <mdomonko@redhat.com>
|
||||
Date: Mon Jun 5 20:29:10 2017 +0200
|
||||
|
||||
fastestmirror: move the logic before MD retrieval. BZ 1428210
|
||||
|
||||
This plugin has had no effect on metadata downloads since commit a522869
|
||||
in yum where we put a RepoStorage.retrieveAllMD() call before
|
||||
postreposetup_hook used by this plugin. Let's change to using
|
||||
prereposetup_hook instead so that retrieveAllMD() can make use of the
|
||||
sorted urls.
|
||||
|
||||
In practice, though, mirrors would still be benchmarked and sorted
|
||||
because of a similar mechanism present in urlgrabber (the timedhosts
|
||||
option, always enabled in yum) with one exception: If the yum cache is
|
||||
empty (no timedhosts file yet), the original order received from the
|
||||
server would be retained (a property of stable sorting [1]) for the
|
||||
repomd.xml download, which is still a bad situation that wouldn't happen
|
||||
before a522869; this is fixed with this commit as it allows the plugin
|
||||
to do its work beforehand.
|
||||
|
||||
Note that the stuff we do in yum/repos.py in between prereposetup_hook
|
||||
and postreposetup_hook has nothing to do with our plugin anyway, so we
|
||||
won't "miss" or break any configuration steps when we move our logic
|
||||
from the latter to the former location.
|
||||
|
||||
[1] urlgrabber/mirror.py:275
|
||||
|
||||
diff --git a/plugins/fastestmirror/fastestmirror.py b/plugins/fastestmirror/fastestmirror.py
|
||||
index fe79629..5887e32 100644
|
||||
--- a/plugins/fastestmirror/fastestmirror.py
|
||||
+++ b/plugins/fastestmirror/fastestmirror.py
|
||||
@@ -146,7 +146,7 @@ def _len_non_ftp(urls):
|
||||
num += 1
|
||||
return num
|
||||
|
||||
-def postreposetup_hook(conduit):
|
||||
+def prereposetup_hook(conduit):
|
||||
"""
|
||||
This function is called after Yum has initiliazed all the repository information.
|
||||
|
||||
@@ -255,7 +255,7 @@ def read_timedhosts():
|
||||
communicate with other functions.
|
||||
|
||||
This function is referred by:
|
||||
- - L{postreposetup_hook()}
|
||||
+ - L{prereposetup_hook()}
|
||||
|
||||
@param timedhosts : A list of time intervals to reach different hosts
|
||||
corresponding to the mirrors. The index of the list are hostnames.
|
||||
@@ -281,7 +281,7 @@ def write_timedhosts():
|
||||
communicate with other functions.
|
||||
|
||||
This function is referred by:
|
||||
- - L{postreposetup_hook()}
|
||||
+ - L{prereposetup_hook()}
|
||||
|
||||
@param timedhosts : A list of time intervals to reach different hosts
|
||||
corresponding to the mirrors. The index of the list are hostnames.
|
||||
@@ -359,7 +359,7 @@ class FastestMirror:
|
||||
- L{FastestMirror._poll_mirrors()}
|
||||
|
||||
This function is referred by:
|
||||
- - L{postreposetup_hook()}
|
||||
+ - L{prereposetup_hook()}
|
||||
- L{main()}
|
||||
|
||||
@rtype: List
|
|
@ -0,0 +1,473 @@
|
|||
diff -N -up -r a/docs/Makefile b/docs/Makefile
|
||||
--- a/docs/Makefile 2017-03-21 14:21:12.326518685 +0100
|
||||
+++ b/docs/Makefile 2017-03-21 14:24:34.711624331 +0100
|
||||
@@ -5,7 +5,7 @@ DOCS = repoquery package-cleanup repo-rs
|
||||
find-repos-of-install needs-restarting repo-graph repoclosure \
|
||||
repomanage repotrack verifytree yum-config-manager yum-ovl
|
||||
DOCS5 = yum-changelog.conf yum-versionlock.conf yum-fs-snapshot.conf
|
||||
-DOCS8 = yum-complete-transaction yumdb
|
||||
+DOCS8 = yum-complete-transaction yumdb yum-copr
|
||||
|
||||
all:
|
||||
echo "Nothing to do"
|
||||
diff -N -up -r a/docs/yum-copr.8 b/docs/yum-copr.8
|
||||
--- a/docs/yum-copr.8 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/docs/yum-copr.8 2017-03-21 14:23:17.436729456 +0100
|
||||
@@ -0,0 +1,120 @@
|
||||
+.\" Man page generated from reStructuredText.
|
||||
+.
|
||||
+.TH "YUM-COPR" "8" "July 29, 2014" "0.1.1" "yum-plugin-copr"
|
||||
+.SH NAME
|
||||
+yum-plugin-copr \- YUM copr Plugin
|
||||
+.
|
||||
+.nr rst2man-indent-level 0
|
||||
+.
|
||||
+.de1 rstReportMargin
|
||||
+\\$1 \\n[an-margin]
|
||||
+level \\n[rst2man-indent-level]
|
||||
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
+-
|
||||
+\\n[rst2man-indent0]
|
||||
+\\n[rst2man-indent1]
|
||||
+\\n[rst2man-indent2]
|
||||
+..
|
||||
+.de1 INDENT
|
||||
+.\" .rstReportMargin pre:
|
||||
+. RS \\$1
|
||||
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
+. nr rst2man-indent-level +1
|
||||
+.\" .rstReportMargin post:
|
||||
+..
|
||||
+.de UNINDENT
|
||||
+. RE
|
||||
+.\" indent \\n[an-margin]
|
||||
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
+.nr rst2man-indent-level -1
|
||||
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
+..
|
||||
+.
|
||||
+.nr rst2man-indent-level 0
|
||||
+.
|
||||
+.de1 rstReportMargin
|
||||
+\\$1 \\n[an-margin]
|
||||
+level \\n[rst2man-indent-level]
|
||||
+level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
+-
|
||||
+\\n[rst2man-indent0]
|
||||
+\\n[rst2man-indent1]
|
||||
+\\n[rst2man-indent2]
|
||||
+..
|
||||
+.de1 INDENT
|
||||
+.\" .rstReportMargin pre:
|
||||
+. RS \\$1
|
||||
+. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
|
||||
+. nr rst2man-indent-level +1
|
||||
+.\" .rstReportMargin post:
|
||||
+..
|
||||
+.de UNINDENT
|
||||
+. RE
|
||||
+.\" indent \\n[an-margin]
|
||||
+.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
+.nr rst2man-indent-level -1
|
||||
+.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
|
||||
+.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
|
||||
+..
|
||||
+.sp
|
||||
+Work with Copr & Playground repositories on the local system.
|
||||
+.INDENT 0.0
|
||||
+.IP \(bu 2
|
||||
+The \fBcopr\fP command is used to add or remove Copr repositories to the local system
|
||||
+.IP \(bu 2
|
||||
+The \fBplayground\fP is used to enable or disable the Playground repository
|
||||
+.UNINDENT
|
||||
+.SH SYNOPSIS
|
||||
+.sp
|
||||
+\fByum copr [enable|disable|list|search] <parameters>\fP
|
||||
+.sp
|
||||
+\fByum playground [enable|disable|upgrade]\fP
|
||||
+.SH ARGUMENTS (COPR)
|
||||
+.INDENT 0.0
|
||||
+.TP
|
||||
+.B \fBenable name/project [chroot]\fP
|
||||
+Enable the \fBname/project\fP Copr repository with the optional \fBchroot\fP\&.
|
||||
+.TP
|
||||
+.B \fBdisable name/project\fP
|
||||
+Disable the \fBname/project\fP Copr repository.
|
||||
+.TP
|
||||
+.B \fBlist name\fP
|
||||
+List available Copr repositories for a given \fBname\fP\&.
|
||||
+.TP
|
||||
+.B \fBsearch project\fP
|
||||
+Search for a given \fBproject\fP\&.
|
||||
+.UNINDENT
|
||||
+.SH ARGUMENTS (PLAYGROUND)
|
||||
+.INDENT 0.0
|
||||
+.TP
|
||||
+.B \fBenable\fP
|
||||
+Enable the Playground repository.
|
||||
+.TP
|
||||
+.B \fBdisable\fP
|
||||
+Disable the Playground repository.
|
||||
+.TP
|
||||
+.B \fBupgrade\fP
|
||||
+Upgrade the Playground repository settings (same as \fBdisable\fP and then \fBenable\fP).
|
||||
+.UNINDENT
|
||||
+.SH EXAMPLES
|
||||
+.INDENT 0.0
|
||||
+.TP
|
||||
+.B \fBcopr enable rhscl/perl516 epel\-6\-x86_64\fP
|
||||
+Enable the \fBrhscl/perl516\fP Copr repository, using the \fBepel\-6\-x86_64\fP chroot.
|
||||
+.TP
|
||||
+.B \fBcopr disable rhscl/perl516\fP
|
||||
+Disable the \fBrhscl/perl516\fP Copr repository
|
||||
+.TP
|
||||
+.B \fBcopr list rita\fP
|
||||
+List available Copr projects for user \fBrita\fP\&.
|
||||
+.TP
|
||||
+.B \fBcopr search tests\fP
|
||||
+Search for Copr projects named \fBtests\fP\&.
|
||||
+.UNINDENT
|
||||
+.SH AUTHOR
|
||||
+See AUTHORS in the Core DNF Plugins distribution
|
||||
+.SH COPYRIGHT
|
||||
+2014, Red Hat, Licensed under GPLv2+
|
||||
+.\" Generated by docutils manpage writer.
|
||||
+.
|
||||
diff -N -up -r a/plugins/copr/copr.conf b/plugins/copr/copr.conf
|
||||
--- a/plugins/copr/copr.conf 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/plugins/copr/copr.conf 2017-03-21 14:22:49.094134790 +0100
|
||||
@@ -0,0 +1,2 @@
|
||||
+[main]
|
||||
+enabled=1
|
||||
diff -N -up -r a/plugins/copr/copr.py b/plugins/copr/copr.py
|
||||
--- a/plugins/copr/copr.py 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ b/plugins/copr/copr.py 2017-03-21 14:22:49.095134776 +0100
|
||||
@@ -0,0 +1,327 @@
|
||||
+# supplies the 'copr' command.
|
||||
+#
|
||||
+# Copyright (C) 2014 Red Hat, Inc.
|
||||
+#
|
||||
+# This copyrighted material is made available to anyone wishing to use,
|
||||
+# modify, copy, or redistribute it subject to the terms and conditions of
|
||||
+# the GNU General Public License v.2, or (at your option) any later version.
|
||||
+# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
+# ANY WARRANTY expressed or implied, including the implied warranties of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
+# Public License for more details. You should have received a copy of the
|
||||
+# GNU General Public License along with this program; if not, write to the
|
||||
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
||||
+# source code or documentation are not subject to the GNU General Public
|
||||
+# License and may only be used or replicated with the express permission of
|
||||
+# Red Hat, Inc.
|
||||
+#
|
||||
+
|
||||
+"""YUM plugin supplying the 'copr' command."""
|
||||
+
|
||||
+from urlgrabber import grabber
|
||||
+
|
||||
+import yum
|
||||
+import glob
|
||||
+import json
|
||||
+import os
|
||||
+import platform
|
||||
+import requests
|
||||
+import urllib
|
||||
+
|
||||
+from yum.i18n import _
|
||||
+from yum.plugins import TYPE_INTERACTIVE
|
||||
+
|
||||
+requires_api_version = '2.5'
|
||||
+plugin_type = (TYPE_INTERACTIVE,)
|
||||
+
|
||||
+yes = set([_('yes'), _('y')])
|
||||
+no = set([_('no'), _('n'), ''])
|
||||
+
|
||||
+YError = yum.Errors.YumBaseError
|
||||
+YCliError = yum.Errors.MiscError
|
||||
+
|
||||
+def config_hook(conduit):
|
||||
+ conduit.registerCommand(CoprCommand())
|
||||
+ conduit.registerCommand(PlaygroundCommand())
|
||||
+
|
||||
+class CoprCommand:
|
||||
+ """ Copr plugin for DNF """
|
||||
+
|
||||
+ def getNames(self):
|
||||
+ return [self.aliases[0]]
|
||||
+
|
||||
+ def getUsage(self):
|
||||
+ return self.usage
|
||||
+
|
||||
+ def getSummary(self):
|
||||
+ return self.summary[1:]
|
||||
+
|
||||
+ def doCheck(self, base, basecmd, extcmds):
|
||||
+ self.base = base
|
||||
+
|
||||
+ copr_url = "https://copr.fedoraproject.org"
|
||||
+ aliases = ("copr",)
|
||||
+ summary = _("Interact with Copr repositories.")
|
||||
+ usage = _("""
|
||||
+ enable name/project [chroot]
|
||||
+ disable name/project
|
||||
+ list name
|
||||
+ search project
|
||||
+
|
||||
+ Examples:
|
||||
+ copr enable rhscl/perl516 epel-6-x86_64
|
||||
+ copr enable ignatenkobrain/ocltoys
|
||||
+ copr disable rhscl/perl516
|
||||
+ copr list ignatenkobrain
|
||||
+ copr search tests
|
||||
+ """)
|
||||
+
|
||||
+ def doCommand(self, base, basecmd, extcmds):
|
||||
+ try:
|
||||
+ subcommand = extcmds[0]
|
||||
+ project_name = extcmds[1]
|
||||
+ except (ValueError, IndexError):
|
||||
+ base.logger.critical(
|
||||
+ _('Error: ') +
|
||||
+ _('exactly two additional parameters to '
|
||||
+ 'copr command are required'))
|
||||
+ # FIXME
|
||||
+ # dnf.cli.commands.err_mini_usage(self.cli, self.cli.base.basecmd)
|
||||
+ raise YCliError(
|
||||
+ _('exactly two additional parameters to '
|
||||
+ 'copr command are required'))
|
||||
+ try:
|
||||
+ chroot = extcmds[2]
|
||||
+ except IndexError:
|
||||
+ chroot = self._guess_chroot()
|
||||
+ repo_filename = "/etc/yum.repos.d/_copr_{}.repo" \
|
||||
+ .format(project_name.replace("/", "-"))
|
||||
+ if subcommand == "enable":
|
||||
+ self._need_root()
|
||||
+ self._ask_user("""
|
||||
+You are about to enable a Copr repository. Please note that this
|
||||
+repository is not part of the main Fedora distribution, and quality
|
||||
+may vary.
|
||||
+
|
||||
+The Fedora Project does not exercise any power over the contents of
|
||||
+this repository beyond the rules outlined in the Copr FAQ at
|
||||
+<https://fedorahosted.org/copr/wiki/UserDocs#WhatIcanbuildinCopr>, and
|
||||
+packages are not held to any quality or securty level.
|
||||
+
|
||||
+Please do not file bug reports about these packages in Fedora
|
||||
+Bugzilla. In case of problems, contact the owner of this repository.
|
||||
+
|
||||
+Do you want to continue? [y/N]: """)
|
||||
+ self._download_repo(project_name, repo_filename, chroot)
|
||||
+ base.logger.info(_("Repository successfully enabled."))
|
||||
+ elif subcommand == "disable":
|
||||
+ self._need_root()
|
||||
+ self._remove_repo(repo_filename)
|
||||
+ base.logger.info(_("Repository successfully disabled."))
|
||||
+ elif subcommand == "list":
|
||||
+ #http://copr.fedoraproject.org/api/coprs/ignatenkobrain/
|
||||
+ api_path = "/api/coprs/{}/".format(project_name)
|
||||
+
|
||||
+ opener = urllib.FancyURLopener({})
|
||||
+ res = opener.open(self.copr_url + api_path)
|
||||
+ try:
|
||||
+ json_parse = json.loads(res.read())
|
||||
+ except ValueError:
|
||||
+ raise YError(
|
||||
+ _("Can't parse repositories for username '{}'.")
|
||||
+ .format(project_name))
|
||||
+ section_text = _("List of {} coprs").format(project_name)
|
||||
+ self._print_match_section(section_text)
|
||||
+ i = 0
|
||||
+ while i < len(json_parse["repos"]):
|
||||
+ msg = "{0}/{1} : ".format(project_name,
|
||||
+ json_parse["repos"][i]["name"])
|
||||
+ desc = json_parse["repos"][i]["description"]
|
||||
+ if not desc:
|
||||
+ desc = _("No description given")
|
||||
+ msg = self.base.fmtKeyValFill(unicode(msg), desc)
|
||||
+ print(msg)
|
||||
+ i += 1
|
||||
+ elif subcommand == "search":
|
||||
+ #http://copr.fedoraproject.org/api/coprs/search/tests/
|
||||
+ api_path = "/api/coprs/search/{}/".format(project_name)
|
||||
+
|
||||
+ opener = urllib.FancyURLopener({})
|
||||
+ res = opener.open(self.copr_url + api_path)
|
||||
+ try:
|
||||
+ json_parse = json.loads(res.read())
|
||||
+ except ValueError:
|
||||
+ raise YError(_("Can't parse search for '{}'.").format(project_name))
|
||||
+ section_text = _("Matched: {}").format(project_name)
|
||||
+ self._print_match_section(section_text)
|
||||
+ i = 0
|
||||
+ while i < len(json_parse["repos"]):
|
||||
+ msg = "{0}/{1} : ".format(json_parse["repos"][i]["username"], json_parse["repos"][i]["coprname"])
|
||||
+ desc = json_parse["repos"][i]["description"]
|
||||
+ if not desc:
|
||||
+ desc = _("No description given.")
|
||||
+ msg = self.base.fmtKeyValFill(unicode(msg), desc)
|
||||
+ print(msg)
|
||||
+ i += 1
|
||||
+ else:
|
||||
+ raise YError(
|
||||
+ _('Unknown subcommand {}.').format(subcommand))
|
||||
+
|
||||
+ return 0, [basecmd + ' done']
|
||||
+
|
||||
+ def _print_match_section(self, text):
|
||||
+ formatted = self.base.fmtSection(text)
|
||||
+ print(formatted)
|
||||
+
|
||||
+ def _ask_user(self, question):
|
||||
+ if self.base.conf.assumeyes and not self.base.conf.assumeno:
|
||||
+ return
|
||||
+ elif self.base.conf.assumeno and not self.base.conf.assumeyes:
|
||||
+ raise YError(_('Safe and good answer. Exiting.'))
|
||||
+
|
||||
+ answer = raw_input(question).lower()
|
||||
+ answer = _(answer)
|
||||
+ while not ((answer in yes) or (answer in no)):
|
||||
+ answer = raw_input(question).lower()
|
||||
+ answer = _(answer)
|
||||
+ if answer in yes:
|
||||
+ return
|
||||
+ else:
|
||||
+ raise YError(_('Safe and good answer. Exiting.'))
|
||||
+
|
||||
+ @classmethod
|
||||
+ def _need_root(cls):
|
||||
+ # FIXME this should do dnf itself (BZ#1062889)
|
||||
+ if os.geteuid() != 0:
|
||||
+ raise YError(
|
||||
+ _('This command has to be run under the root user.'))
|
||||
+
|
||||
+ @classmethod
|
||||
+ def _guess_chroot(cls):
|
||||
+ """ Guess which choot is equivalent to this machine """
|
||||
+ # FIXME Copr should generate non-specific arch repo
|
||||
+ dist = platform.linux_distribution()
|
||||
+ if "Fedora" in dist:
|
||||
+ # x86_64 because repo-file is same for all arch
|
||||
+ # ($basearch is used)
|
||||
+ if "Rawhide" in dist:
|
||||
+ chroot = ("fedora-rawhide-x86_64")
|
||||
+ else:
|
||||
+ chroot = ("fedora-{}-x86_64".format(dist[1]))
|
||||
+ else:
|
||||
+ chroot = ("epel-%s-x86_64" % dist[1].split(".", 1)[0])
|
||||
+ return chroot
|
||||
+
|
||||
+ @classmethod
|
||||
+ def _download_repo(cls, project_name, repo_filename, chroot=None):
|
||||
+ if chroot is None:
|
||||
+ chroot = cls._guess_chroot()
|
||||
+ #http://copr.fedoraproject.org/coprs/larsks/rcm/repo/epel-7-x86_64/
|
||||
+ api_path = "/coprs/{0}/repo/{1}/".format(project_name, chroot)
|
||||
+ ug = grabber.URLGrabber()
|
||||
+ # FIXME when we are full on python2 urllib.parse
|
||||
+ try:
|
||||
+ ug.urlgrab(cls.copr_url + api_path, filename=repo_filename)
|
||||
+ except grabber.URLGrabError as e:
|
||||
+ cls._remove_repo(repo_filename)
|
||||
+ raise YError(str(e))
|
||||
+
|
||||
+ @classmethod
|
||||
+ def _remove_repo(cls, repo_filename):
|
||||
+ # FIXME is it Copr repo ?
|
||||
+ try:
|
||||
+ os.remove(repo_filename)
|
||||
+ except OSError as e:
|
||||
+ raise YError(str(e))
|
||||
+
|
||||
+ @classmethod
|
||||
+ def _get_data(cls, req):
|
||||
+ """ Wrapper around response from server
|
||||
+
|
||||
+ check data and print nice error in case of some error (and return None)
|
||||
+ otherwise return json object.
|
||||
+ """
|
||||
+ try:
|
||||
+ output = json.loads(req.text)
|
||||
+ except ValueError:
|
||||
+ YCliError(_("Unknown response from server."))
|
||||
+ return
|
||||
+ if req.status_code != 200:
|
||||
+ YCliError(_(
|
||||
+ "Something went wrong:\n {0}\n".format(output["error"])))
|
||||
+ return
|
||||
+ return output
|
||||
+
|
||||
+
|
||||
+class PlaygroundCommand(CoprCommand):
|
||||
+ """ Playground plugin for DNF """
|
||||
+
|
||||
+ aliases = ("playground",)
|
||||
+ summary = _("Interact with Playground repository.")
|
||||
+ usage = " [enable|disable|upgrade]"
|
||||
+
|
||||
+ def _cmd_enable(self, chroot):
|
||||
+ self._need_root()
|
||||
+ self._ask_user("""
|
||||
+You are about to enable a Playground repository.
|
||||
+
|
||||
+Do you want to continue? [y/N]: """)
|
||||
+ api_url = "{0}/api/playground/list/".format(
|
||||
+ self.copr_url)
|
||||
+ req = requests.get(api_url)
|
||||
+ output = self._get_data(req)
|
||||
+ if output["output"] != "ok":
|
||||
+ raise YCliError(_("Unknown response from server."))
|
||||
+ for repo in output["repos"]:
|
||||
+ project_name = "{0}/{1}".format(repo["username"],
|
||||
+ repo["coprname"])
|
||||
+ repo_filename = "/etc/yum.repos.d/_playground_{}.repo" \
|
||||
+ .format(project_name.replace("/", "-"))
|
||||
+ try:
|
||||
+ # check if that repo exist? but that will result in twice
|
||||
+ # up calls
|
||||
+ api_url = "{0}/api/coprs/{1}/detail/{2}/".format(
|
||||
+ self.copr_url, project_name, chroot)
|
||||
+ req = requests.get(api_url)
|
||||
+ output2 = self._get_data(req)
|
||||
+ if output2 and ("output" in output2) and (output2["output"] == "ok"):
|
||||
+ self._download_repo(project_name, repo_filename, chroot)
|
||||
+ except YError:
|
||||
+ # likely 404 and that repo does not exist
|
||||
+ pass
|
||||
+
|
||||
+ def _cmd_disable(self):
|
||||
+ self._need_root()
|
||||
+ for repo_filename in glob.glob('/etc/yum.repos.d/_playground_*.repo'):
|
||||
+ self._remove_repo(repo_filename)
|
||||
+
|
||||
+ def doCommand(self, base, basecmd, extcmds):
|
||||
+ try:
|
||||
+ subcommand = extcmds[0]
|
||||
+ except (ValueError, IndexError):
|
||||
+ base.logger.critical(
|
||||
+ _('Error: ') +
|
||||
+ _('exactly one parameter to '
|
||||
+ 'playground command are required'))
|
||||
+ # FIXME:
|
||||
+ # dnf.cli.commands.err_mini_usage(self.cli, self.cli.base.basecmd)
|
||||
+ raise YCliError(
|
||||
+ _('exactly one parameter to '
|
||||
+ 'playground command are required'))
|
||||
+ chroot = self._guess_chroot()
|
||||
+ if subcommand == "enable":
|
||||
+ self._cmd_enable(chroot)
|
||||
+ base.logger.info(_("Playground repositories successfully enabled."))
|
||||
+ elif subcommand == "disable":
|
||||
+ self._cmd_disable()
|
||||
+ base.logger.info(_("Playground repositories successfully disabled."))
|
||||
+ elif subcommand == "upgrade":
|
||||
+ self._cmd_disable()
|
||||
+ self._cmd_enable(chroot)
|
||||
+ base.logger.info(_("Playground repositories successfully updated."))
|
||||
+ else:
|
||||
+ raise YError(
|
||||
+ _('Unknown subcommand {}.').format(subcommand))
|
||||
+
|
||||
+ return 0, [basecmd + ' done']
|
|
@ -0,0 +1,64 @@
|
|||
diff --git a/docs/yum-builddep.1 b/docs/yum-builddep.1
|
||||
index fbe32bd..54dce0e 100644
|
||||
--- a/docs/yum-builddep.1
|
||||
+++ b/docs/yum-builddep.1
|
||||
@@ -17,6 +17,12 @@ disabled) or it can be a local source RPM or a spec file.
|
||||
.PP
|
||||
Note, that only the BuildRequires information within the SRPM header information is used to determine build dependencies. This will specifically omit any dependencies that are required only for specific architectures.
|
||||
.PP
|
||||
+.SH "GENERAL OPTIONS"
|
||||
+.IP "\fB\--target ARCH\fP"
|
||||
+Set target architecture for spec parsing.
|
||||
+.IP "\fB\--define 'MACRO EXPR'\fP"
|
||||
+Define the rpm MACRO with value EXPR for spec parsing.
|
||||
+.PP
|
||||
.SH "EXAMPLES"
|
||||
.IP "Download and install all the RPMs needed to build the kernel RPM:"
|
||||
\fByumdownloader --source kernel && rpm2cpio kernel*src.rpm | cpio -i kernel.spec && \\ \fP
|
||||
diff --git a/yum-builddep.py b/yum-builddep.py
|
||||
index 5f59ab8..dfdd31b 100755
|
||||
--- a/yum-builddep.py
|
||||
+++ b/yum-builddep.py
|
||||
@@ -67,6 +67,13 @@ class YumBuildDep(YumUtilBase):
|
||||
if hasattr(rpm, 'reloadConfig'):
|
||||
self.optparser.add_option("--target",
|
||||
help="set target architecture for spec parsing")
|
||||
+ self.optparser.add_option(
|
||||
+ "--define",
|
||||
+ action="append",
|
||||
+ default=[],
|
||||
+ metavar="'MACRO EXPR'",
|
||||
+ help="define the rpm MACRO with value EXPR for spec parsing",
|
||||
+ )
|
||||
self.main()
|
||||
|
||||
def main(self):
|
||||
@@ -229,11 +236,28 @@ class YumBuildDep(YumUtilBase):
|
||||
self.logger.info('Getting requirements for %s' % srpm)
|
||||
self.install_deps(srpm.requiresList(), opts)
|
||||
|
||||
+ # Parse macro defines
|
||||
+ macros = []
|
||||
+ error = False
|
||||
+ for define in opts.define:
|
||||
+ words = define.split(None, 1)
|
||||
+ if len(words) == 1:
|
||||
+ self.logger.error('Error: No EXPR given for MACRO %%%s'
|
||||
+ % words[0])
|
||||
+ error = True
|
||||
+ continue
|
||||
+ macros.append(words)
|
||||
+ if error:
|
||||
+ sys.exit(1)
|
||||
+
|
||||
for name in specnames:
|
||||
# (re)load rpm config for target if set
|
||||
if reloadworks and opts.target:
|
||||
rpm.reloadConfig(opts.target)
|
||||
|
||||
+ for macro in macros:
|
||||
+ rpm.addMacro(*macro)
|
||||
+
|
||||
try:
|
||||
spec = rpm.spec(name)
|
||||
except ValueError:
|
|
@ -0,0 +1,48 @@
|
|||
commit 61232e9f66cc64fffa8517678b6cf224d44b02ef
|
||||
Author: Michal Domonkos <mdomonko@redhat.com>
|
||||
Date: Wed Jul 12 16:27:53 2017 +0200
|
||||
|
||||
yum-debug-dump: improve repo failure handling. BZ 1445751
|
||||
|
||||
Populate the repos prior to iterating over them in dump_repos(). This
|
||||
fixes the following bugs:
|
||||
|
||||
1) KeyError when calling returnPackages() on a repo that was previously
|
||||
disabled by the pkgSack invocation in the same loop due to
|
||||
skip_if_unavailable=true (BZ 1445751)
|
||||
|
||||
2) One broken repo with skip_if_unavailable=false would cause all other
|
||||
(even working) repos in the for loop to report the same error, thus
|
||||
making the %%%%REPOS section useless
|
||||
|
||||
diff --git a/yum-debug-dump.py b/yum-debug-dump.py
|
||||
index 67d943f..01ca338 100755
|
||||
--- a/yum-debug-dump.py
|
||||
+++ b/yum-debug-dump.py
|
||||
@@ -73,6 +73,26 @@ class YumDebugDump(yum.YumBase):
|
||||
|
||||
def dump_repos(self):
|
||||
msg = "%%%%REPOS\n"
|
||||
+
|
||||
+ # Set up the sacks first, to capture and log any broken repos. We
|
||||
+ # cannot yet call returnPackages() from this loop as that would lead to
|
||||
+ # a KeyError if some repo got disabled by pkgSack due to
|
||||
+ # skip_if_unavailable=true in a previous iteration.
|
||||
+ #
|
||||
+ # A failure means remaining repos were not processed, so we have to
|
||||
+ # retry the whole process ourselves by calling pkgSack again. Since
|
||||
+ # the worst case scenario is that all the repos are broken, we have to
|
||||
+ # do this at least as many times as there are enabled repos.
|
||||
+ for repo in sorted(self.repos.listEnabled()):
|
||||
+ try:
|
||||
+ self.pkgSack
|
||||
+ except Errors.RepoError, e:
|
||||
+ msg += "Error accessing repo %s: %s\n" % (e.repo, str(e))
|
||||
+ self.repos.disableRepo(e.repo.id)
|
||||
+ else:
|
||||
+ break
|
||||
+
|
||||
+ # Dump the packages now
|
||||
for repo in sorted(self.repos.listEnabled()):
|
||||
try:
|
||||
msg += '%%%s - %s\n' % (repo.id, repo.urls[0])
|
|
@ -0,0 +1,199 @@
|
|||
commit f84a2dbcc28312105246fac51771481640759da5
|
||||
Author: Phil Dibowitz <phil@ipom.com>
|
||||
Date: Thu Jul 2 11:40:55 2015 -0700
|
||||
|
||||
Add option to remove newest dupes instead of oldest dupes
|
||||
|
||||
Sometimes in a failed transaction you need to remove the newest of the dupes and
|
||||
not the oldest. This provides that option.
|
||||
|
||||
diff --git a/package-cleanup.py b/package-cleanup.py
|
||||
index acad9f2..13cfb89 100755
|
||||
--- a/package-cleanup.py
|
||||
+++ b/package-cleanup.py
|
||||
@@ -79,6 +79,9 @@ class PackageCleanup(YumUtilBase):
|
||||
dupegrp.add_option("--cleandupes", default=False,
|
||||
dest="cleandupes", action="store_true",
|
||||
help='Scan for duplicates in your rpmdb and remove older ')
|
||||
+ dupegrp.add_option("--removenewestdupes", default=False,
|
||||
+ dest="removenewestdupes", action="store_true",
|
||||
+ help='Remove the newest dupes instead of the oldest dupes.')
|
||||
dupegrp.add_option("--noscripts", default=False,
|
||||
dest="noscripts", action="store_true",
|
||||
help="disable rpm scriptlets from running when cleaning duplicates")
|
||||
@@ -172,7 +175,7 @@ class PackageCleanup(YumUtilBase):
|
||||
|
||||
return results
|
||||
|
||||
- def _remove_old_dupes(self):
|
||||
+ def _remove_dupes(self, newest=False):
|
||||
"""add older duplicate pkgs to be removed in the transaction"""
|
||||
dupedict = self._find_installed_duplicates()
|
||||
|
||||
@@ -180,7 +183,11 @@ class PackageCleanup(YumUtilBase):
|
||||
for (name,dupelists) in dupedict.items():
|
||||
for dupelist in dupelists:
|
||||
dupelist.sort()
|
||||
- for lowpo in dupelist[0:-1]:
|
||||
+ if newest:
|
||||
+ plist = dupelist[1:]
|
||||
+ else:
|
||||
+ plist = dupelist[0:-1]
|
||||
+ for lowpo in plist:
|
||||
removedupes.append(lowpo)
|
||||
|
||||
for po in removedupes:
|
||||
@@ -373,7 +380,7 @@ class PackageCleanup(YumUtilBase):
|
||||
sys.exit(1)
|
||||
if opts.noscripts:
|
||||
self.conf.tsflags.append('noscripts')
|
||||
- self._remove_old_dupes()
|
||||
+ self._remove_dupes(opts.removenewestdupes)
|
||||
self.run_with_package_names.add('yum-utils')
|
||||
|
||||
if hasattr(self, 'doUtilBuildTransaction'):
|
||||
commit 27784822a342debd3ecfa04686a35f2e7e576023
|
||||
Author: Michal Domonkos <mdomonko@redhat.com>
|
||||
Date: Wed Oct 11 19:26:38 2017 +0200
|
||||
|
||||
package-cleanup: don't remove required dupes. BZ 1455318
|
||||
|
||||
Note: Turning removedupes into a set for O(1) complexity on
|
||||
removedupes.remove().
|
||||
|
||||
diff --git a/package-cleanup.py b/package-cleanup.py
|
||||
index 13cfb89..9f74609 100755
|
||||
--- a/package-cleanup.py
|
||||
+++ b/package-cleanup.py
|
||||
@@ -176,10 +176,12 @@ class PackageCleanup(YumUtilBase):
|
||||
return results
|
||||
|
||||
def _remove_dupes(self, newest=False):
|
||||
- """add older duplicate pkgs to be removed in the transaction"""
|
||||
- dupedict = self._find_installed_duplicates()
|
||||
+ """add duplicate pkgs to be removed in the transaction,
|
||||
+ return a dict of excluded dupes and their requiring packages"""
|
||||
|
||||
- removedupes = []
|
||||
+ # Find dupes
|
||||
+ dupedict = self._find_installed_duplicates()
|
||||
+ removedupes = set()
|
||||
for (name,dupelists) in dupedict.items():
|
||||
for dupelist in dupelists:
|
||||
dupelist.sort()
|
||||
@@ -188,11 +190,37 @@ class PackageCleanup(YumUtilBase):
|
||||
else:
|
||||
plist = dupelist[0:-1]
|
||||
for lowpo in plist:
|
||||
- removedupes.append(lowpo)
|
||||
-
|
||||
+ removedupes.add(lowpo)
|
||||
+
|
||||
+ # Exclude any such dupes that would pull other installed packages into
|
||||
+ # the removal transaction (to prevent us from accidentally removing a
|
||||
+ # huge part of a working system) by performing a dry transaction(s)
|
||||
+ # first.
|
||||
+ excluded = {}
|
||||
+ while True:
|
||||
+ for po in removedupes:
|
||||
+ self.remove(po)
|
||||
+ changed = False
|
||||
+ for txmbr in self.tsInfo.getMembers():
|
||||
+ requiredby = self._checkRemove(txmbr)
|
||||
+ if requiredby:
|
||||
+ removedupes.remove(txmbr.po)
|
||||
+ excluded[txmbr.po] = requiredby
|
||||
+ # Do another round, to cover any transitive deps within
|
||||
+ # removedupes, for example: if foo requires bar requires
|
||||
+ # baz and removedupes contains bar and baz, then
|
||||
+ # _checkRemove(baz) won't return bar.
|
||||
+ changed = True
|
||||
+ del self.tsInfo
|
||||
+ if not changed:
|
||||
+ break
|
||||
+
|
||||
+ # Mark the dupes for removal
|
||||
for po in removedupes:
|
||||
self.remove(po)
|
||||
|
||||
+ return excluded
|
||||
+
|
||||
|
||||
def _should_show_leaf(self, po, leaf_regex, exclude_devel, exclude_bin):
|
||||
"""
|
||||
@@ -380,7 +408,13 @@ class PackageCleanup(YumUtilBase):
|
||||
sys.exit(1)
|
||||
if opts.noscripts:
|
||||
self.conf.tsflags.append('noscripts')
|
||||
- self._remove_dupes(opts.removenewestdupes)
|
||||
+ excluded = self._remove_dupes(opts.removenewestdupes)
|
||||
+ for po, requiredby in excluded.iteritems():
|
||||
+ count = len(requiredby)
|
||||
+ print ('Not removing %s because it is required by %s '
|
||||
+ 'installed package%s' %
|
||||
+ (po.hdr.sprintf(opts.qf), count,
|
||||
+ 's' if count > 1 else ''))
|
||||
self.run_with_package_names.add('yum-utils')
|
||||
|
||||
if hasattr(self, 'doUtilBuildTransaction'):
|
||||
@@ -397,9 +431,20 @@ class PackageCleanup(YumUtilBase):
|
||||
|
||||
if len(self.tsInfo) < 1:
|
||||
print 'No duplicates to remove'
|
||||
- sys.exit(0)
|
||||
-
|
||||
- sys.exit(self.doUtilTransaction())
|
||||
+ errc = 0
|
||||
+ else:
|
||||
+ errc = self.doUtilTransaction()
|
||||
+
|
||||
+ if excluded:
|
||||
+ self.logger.warn(
|
||||
+ 'Warning: Some duplicates were not removed because they '
|
||||
+ 'are required by installed packages.\n'
|
||||
+ 'You can try --cleandupes with%s --removenewestdupes, '
|
||||
+ 'or review them with --dupes and remove manually.' %
|
||||
+ ('out' if opts.removenewestdupes else '')
|
||||
+ )
|
||||
+
|
||||
+ sys.exit(errc)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
commit 4594bbc623b68bea6522047fb6267069c8ad94c8
|
||||
Author: Michal Domonkos <mdomonko@redhat.com>
|
||||
Date: Wed Oct 11 20:23:06 2017 +0200
|
||||
|
||||
package-cleanup: update man page
|
||||
|
||||
Add missing options from --help and also clear up the wording of
|
||||
--removenewestdupes.
|
||||
|
||||
diff --git a/docs/package-cleanup.1 b/docs/package-cleanup.1
|
||||
index 61959ac..5b7e1c0 100644
|
||||
--- a/docs/package-cleanup.1
|
||||
+++ b/docs/package-cleanup.1
|
||||
@@ -36,6 +36,10 @@ Scan for duplicates in the local RPM database.
|
||||
.IP "\fB\-\-cleandupes\fP"
|
||||
Scan for duplicates in the local RPM database and clean out the
|
||||
older versions.
|
||||
+.IP "\fB\-\-removenewestdupes\fP"
|
||||
+Remove the newest dupes instead of the oldest dupes when cleaning duplicates.
|
||||
+.IP "\fB\-\-noscripts\fP"
|
||||
+Disable rpm scriptlets from running when cleaning duplicates.
|
||||
.IP "\fB\-\-count <COUNT>\fP"
|
||||
Number of duplicate/kernel packages to keep on the system (default 2)
|
||||
.PP
|
||||
diff --git a/package-cleanup.py b/package-cleanup.py
|
||||
index 9f74609..4a44326 100755
|
||||
--- a/package-cleanup.py
|
||||
+++ b/package-cleanup.py
|
||||
@@ -81,7 +81,7 @@ class PackageCleanup(YumUtilBase):
|
||||
help='Scan for duplicates in your rpmdb and remove older ')
|
||||
dupegrp.add_option("--removenewestdupes", default=False,
|
||||
dest="removenewestdupes", action="store_true",
|
||||
- help='Remove the newest dupes instead of the oldest dupes.')
|
||||
+ help='Remove the newest dupes instead of the oldest dupes when cleaning duplicates.')
|
||||
dupegrp.add_option("--noscripts", default=False,
|
||||
dest="noscripts", action="store_true",
|
||||
help="disable rpm scriptlets from running when cleaning duplicates")
|
|
@ -0,0 +1,21 @@
|
|||
commit 6fa187521c370a3b13503ee330140778d1dbafc1
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Fri Oct 20 13:33:11 2017 +0200
|
||||
|
||||
yumdownloader: fix crash on broken srpm metadata.
|
||||
|
||||
diff --git a/yumdownloader.py b/yumdownloader.py
|
||||
index 1b95e8d..a0db95c 100755
|
||||
--- a/yumdownloader.py
|
||||
+++ b/yumdownloader.py
|
||||
@@ -47,6 +47,10 @@ def _best_convert_pkg2srcpkgs(self, opts, pkg):
|
||||
if not opts.source or pkg.arch == 'src':
|
||||
return [pkg]
|
||||
|
||||
+ if pkg.sourcerpm is None:
|
||||
+ self.logger.error('No source RPM found for %s' % str(pkg))
|
||||
+ return []
|
||||
+
|
||||
(n,v,r,e,a) = rpmUtils.miscutils.splitFilename(pkg.sourcerpm)
|
||||
src = self.pkgSack.searchNevra(name=n, ver=v, rel=r, arch='src')
|
||||
if src == []:
|
|
@ -0,0 +1,200 @@
|
|||
diff -up yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.conf.orig yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.conf
|
||||
--- yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.conf.orig 2017-10-27 17:30:16.579550073 +0200
|
||||
+++ yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.conf 2017-10-27 17:30:16.579550073 +0200
|
||||
@@ -0,0 +1,3 @@
|
||||
+[main]
|
||||
+enabled = 1
|
||||
+actiondir = /etc/yum/pre-actions/
|
||||
diff -up yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py.orig yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py
|
||||
--- yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py.orig 2017-10-27 17:30:16.579550073 +0200
|
||||
+++ yum-utils-1.1.31/plugins/pre-transaction-actions/pre-transaction-actions.py 2017-10-27 17:30:16.579550073 +0200
|
||||
@@ -0,0 +1,164 @@
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# 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
|
||||
+# GNU Library General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
+
|
||||
+# Copyright 2008 Red Hat, Inc
|
||||
+# written by Seth Vidal <skvidal@fedoraproject.org>
|
||||
+
|
||||
+"""
|
||||
+This plugin runs actions prior to the transaction based on the content of the
|
||||
+transaction.
|
||||
+"""
|
||||
+
|
||||
+
|
||||
+from yum.plugins import TYPE_CORE
|
||||
+from yum.constants import *
|
||||
+import yum.misc
|
||||
+from yum.parser import varReplace
|
||||
+from yum.packages import parsePackages
|
||||
+import fnmatch
|
||||
+import re
|
||||
+import os
|
||||
+import glob
|
||||
+import shlex
|
||||
+
|
||||
+requires_api_version = '2.4'
|
||||
+plugin_type = (TYPE_CORE,)
|
||||
+
|
||||
+def parse_actions(ddir, conduit):
|
||||
+ """read in .action files from ddir path.
|
||||
+ store content in a list of tuples"""
|
||||
+ action_tuples = [] # (action key, action_state, shell command)
|
||||
+ action_file_list = []
|
||||
+ if os.access(ddir, os.R_OK):
|
||||
+ action_file_list.extend(glob.glob(ddir + "*.action"))
|
||||
+
|
||||
+ if action_file_list:
|
||||
+ for f in action_file_list:
|
||||
+ for line in open(f).readlines():
|
||||
+ line = line.strip()
|
||||
+ if line and line[0] != "#":
|
||||
+ try:
|
||||
+ (a_key, a_state, a_command) = line.split(':', 2)
|
||||
+ except ValueError,e:
|
||||
+ conduit.error(2,'Bad Action Line: %s' % line)
|
||||
+ continue
|
||||
+ else:
|
||||
+ action_tuples.append((a_key, a_state, a_command))
|
||||
+
|
||||
+ return action_tuples
|
||||
+
|
||||
+def _convert_vars(txmbr, command):
|
||||
+ """converts %options on the command to their values from the package it
|
||||
+ is running it for: takes $name, $arch, $ver, $rel, $epoch,
|
||||
+ $state, $repoid"""
|
||||
+ state_dict = { TS_INSTALL: 'install',
|
||||
+ TS_TRUEINSTALL: 'install',
|
||||
+ TS_OBSOLETING: 'obsoleting',
|
||||
+ TS_UPDATE: 'updating',
|
||||
+ TS_ERASE: 'remove',
|
||||
+ TS_OBSOLETED: 'obsoleted',
|
||||
+ TS_UPDATED: 'updated'}
|
||||
+ try:
|
||||
+ state = state_dict[txmbr.output_state]
|
||||
+ except KeyError:
|
||||
+ state = 'unknown - %s' % txmbr.output_state
|
||||
+
|
||||
+ vardict = {'name': txmbr.name,
|
||||
+ 'arch': txmbr.arch,
|
||||
+ 'ver': txmbr.version,
|
||||
+ 'rel': txmbr.release,
|
||||
+ 'epoch': txmbr.epoch,
|
||||
+ 'repoid': txmbr.repoid,
|
||||
+ 'state': state }
|
||||
+
|
||||
+ result = varReplace(command, vardict)
|
||||
+ return result
|
||||
+
|
||||
+
|
||||
+def pretrans_hook(conduit):
|
||||
+ # we have provides/requires for everything
|
||||
+ # we do not have filelists for erasures
|
||||
+ # we have to fetch filelists for the package object for installs/updates
|
||||
+ action_dir = conduit.confString('main','actiondir','/etc/yum/pre-actions/')
|
||||
+ action_tuples = parse_actions(action_dir, conduit)
|
||||
+ commands_to_run = {}
|
||||
+ ts = conduit.getTsInfo()
|
||||
+ all = ts.getMembers()
|
||||
+ removes = ts.getMembersWithState(output_states=TS_REMOVE_STATES)
|
||||
+ installs = ts.getMembersWithState(output_states=TS_INSTALL_STATES)
|
||||
+ updates = ts.getMembersWithState(output_states=[TS_UPDATE, TS_OBSOLETING])
|
||||
+
|
||||
+ for (a_k, a_s, a_c) in action_tuples:
|
||||
+ #print 'if %s in state %s the run %s' %( a_k, a_s, a_c)
|
||||
+ if a_s == 'update':
|
||||
+ pkgset = updates
|
||||
+ elif a_s == 'install':
|
||||
+ pkgset = installs
|
||||
+ elif a_s == 'remove':
|
||||
+ pkgset = removes
|
||||
+ elif a_s == 'any':
|
||||
+ pkgset = all
|
||||
+ else:
|
||||
+ # no idea what this is skip it
|
||||
+ conduit.error(2,'whaa? %s' % a_s)
|
||||
+ continue
|
||||
+
|
||||
+ if a_k.startswith('/'):
|
||||
+ if yum.misc.re_glob(a_k):
|
||||
+ restring = fnmatch.translate(a_k)
|
||||
+ c_string = re.compile(restring)
|
||||
+
|
||||
+ for txmbr in pkgset:
|
||||
+ matched = False
|
||||
+ thispo = txmbr.po
|
||||
+
|
||||
+ if not yum.misc.re_glob(a_k):
|
||||
+ if a_k in thispo.filelist + thispo.dirlist + thispo.ghostlist:
|
||||
+ thiscommand = _convert_vars(txmbr, a_c)
|
||||
+ commands_to_run[thiscommand] = 1
|
||||
+ matched = True
|
||||
+ else:
|
||||
+ for name in thispo.filelist + thispo.dirlist + thispo.ghostlist:
|
||||
+ if c_string.match(name):
|
||||
+ thiscommand = _convert_vars(txmbr, a_c)
|
||||
+ commands_to_run[thiscommand] = 1
|
||||
+ matched = True
|
||||
+ break
|
||||
+
|
||||
+ if matched:
|
||||
+ break
|
||||
+ continue
|
||||
+
|
||||
+ if a_k.find('/') == -1: # pkgspec
|
||||
+ pkgs = [ txmbr.po for txmbr in pkgset ]
|
||||
+ e,m,u = parsePackages(pkgs, [a_k])
|
||||
+ if not u:
|
||||
+ for pkg in e+m:
|
||||
+ for txmbr in ts.getMembers(pkgtup=pkg.pkgtup):
|
||||
+ thiscommand = _convert_vars(txmbr, a_c)
|
||||
+ commands_to_run[thiscommand] = 1
|
||||
+ continue
|
||||
+
|
||||
+ for comm in commands_to_run.keys():
|
||||
+ try:
|
||||
+ args = shlex.split(comm)
|
||||
+ except ValueError, e:
|
||||
+ conduit.error(2,"command was not parseable: %s" % comm)
|
||||
+ continue
|
||||
+ #try
|
||||
+ conduit.info(2,'Running pre transaction command: %s' % comm)
|
||||
+ p = os.system(comm)
|
||||
+ #except?
|
||||
+
|
||||
+
|
||||
diff -up yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action.orig yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action
|
||||
--- yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action.orig 2017-10-27 17:30:16.579550073 +0200
|
||||
+++ yum-utils-1.1.31/plugins/pre-transaction-actions/sample.action 2017-10-27 17:30:16.579550073 +0200
|
||||
@@ -0,0 +1,21 @@
|
||||
+#action_key:transaction_state:command
|
||||
+# action_key can be: pkgglob, /path/to/file (wildcards allowed)
|
||||
+# transaction_state can be: install,update,remove,any
|
||||
+# command can be: any shell command
|
||||
+# the following variables are allowed to be passed to any command:
|
||||
+# $name - package name
|
||||
+# $arch - package arch
|
||||
+# $ver - package version
|
||||
+# $rel - package release
|
||||
+# $epoch - package epoch
|
||||
+# $repoid - package repository id
|
||||
+# $state - text string of state of the package in the transaction set
|
||||
+#
|
||||
+# file matches cannot be used with removes b/c we don't have the info available
|
||||
+
|
||||
+*:install:touch /tmp/$name-installed
|
||||
+zsh:remove:touch /tmp/zsh-removed
|
||||
+zsh:install:touch /tmp/zsh-installed-also
|
||||
+/bin/z*h:install:touch /tmp/bin-zsh-installed
|
||||
+z*h:any:touch /tmp/bin-zsh-any
|
||||
+
|
|
@ -0,0 +1,47 @@
|
|||
commit 744cf9259ccec046a15ab5372270d931b7d74fc9
|
||||
Author: Valentina Mukhamedzhanova <vmukhame@redhat.com>
|
||||
Date: Thu Jul 2 16:21:22 2015 +0200
|
||||
|
||||
yum-builddep: respect --tolerant to ignore missing dependencies
|
||||
|
||||
diff --git a/yum-builddep.py b/yum-builddep.py
|
||||
index 7c40713..5f59ab8 100755
|
||||
--- a/yum-builddep.py
|
||||
+++ b/yum-builddep.py
|
||||
@@ -145,7 +145,7 @@ class YumBuildDep(YumUtilBase):
|
||||
self.logger.info('Enabling %s repository' % r.id)
|
||||
r.enable()
|
||||
|
||||
- def install_deps(self, deplist):
|
||||
+ def install_deps(self, deplist, opts):
|
||||
errors = set()
|
||||
for dep in deplist:
|
||||
self.logger.debug(' REQ: %s' % dep)
|
||||
@@ -165,7 +165,8 @@ class YumBuildDep(YumUtilBase):
|
||||
if errors:
|
||||
for i in sorted(errors):
|
||||
self.logger.error("Error: %s" % i)
|
||||
- sys.exit(1)
|
||||
+ if not opts.tolerant:
|
||||
+ 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
|
||||
@@ -226,7 +227,7 @@ class YumBuildDep(YumUtilBase):
|
||||
|
||||
for srpm in toActOn:
|
||||
self.logger.info('Getting requirements for %s' % srpm)
|
||||
- self.install_deps(srpm.requiresList())
|
||||
+ self.install_deps(srpm.requiresList(), opts)
|
||||
|
||||
for name in specnames:
|
||||
# (re)load rpm config for target if set
|
||||
@@ -248,7 +249,7 @@ class YumBuildDep(YumUtilBase):
|
||||
buildreqs.append(d.DNEVR()[2:])
|
||||
|
||||
self.logger.info('Getting requirements for %s' % name)
|
||||
- self.install_deps(buildreqs)
|
||||
+ self.install_deps(buildreqs, opts)
|
||||
|
||||
if __name__ == '__main__':
|
||||
setup_locale()
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue