[yum-git] 8 commits - plugins/security plugins/tmprepo yum-utils.spec

James Antill james at linux.duke.edu
Wed Aug 6 17:24:52 UTC 2008


 plugins/security/security.py |   11 ++++--
 plugins/tmprepo/tmprepo.py   |   69 ++++++++++++++++---------------------------
 yum-utils.spec               |   35 ++++++++++++++++++---
 3 files changed, 63 insertions(+), 52 deletions(-)

New commits:
commit fe27cf9b75553c663859d0a4ef0e52997d3dd933
Author: James Antill <james at and.org>
Date:   Wed Aug 6 13:22:05 2008 -0400

    Allow --tmprepo=~/blah/... to be nice

diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index ea67209..f82d247 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -126,6 +126,8 @@ def add_repos(base, log, tmp_repos, tvalidate, tlocvalidate, cleanup_dir_temp):
     """ Add temporary repos to yum. """
     # Don't use self._splitArg()? ... or require URLs without commas?
     for trepo in tmp_repos:
+        if trepo.startswith("~/"):
+            trepo = "%s%s" % (os.environ['HOME'], trepo[1:])
         if trepo.startswith("/"):
             trepo = "file:%s" % trepo
         validate = tvalidate
commit b12be358947ea1d2668edc78bdc7d73615d3d770
Author: James Antill <james at and.org>
Date:   Wed Aug 6 13:08:50 2008 -0400

    Fix tmprepo gpgcheck to use the new new, config.

diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index 95bd039..ea67209 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -34,37 +34,22 @@ import os
 import shutil
 import time
 
-from yum.config import CaselessSelectionOption
-
 requires_api_version = '2.5'
 plugin_type = (TYPE_INTERACTIVE,)
 
-def make_validate(log, gpgcheck):
+def make_validate(log, pkgs_gpgcheck, repo_gpgcheck):
     def tvalidate(repo):
-        if gpgcheck != 'none':
-
-            if gpgcheck not in ('packages', 'all', 'repo'):
-                log.warn("GPGcheck set to unknown value: %s" % gpgcheck)
-                return False
-
-            if repo.gpgcheck not in ('packages', 'all', 'repo'):
-                log.warn("Repo %s GPGcheck set to unknown value: %s" %
-                         (repo, gpgcheck))
-                return False
+        if pkgs_gpgcheck or repo_gpgcheck:
 
             # Don't ever allow them to set gpgcheck='false'
-            if repo.gpgcheck == 'none':
+            if pkgs_gpgcheck and not repo.gpgcheck:
                 log.warn("Repo %s tried to set gpgcheck=false" % repo)
                 return False
 
-            # Now do the more complicated comparisons...
-            if gpgcheck() in ('packages', 'all') and repo.gpgcheck == 'repo':
-                log.warn("Repo %s tried to set gpgcheck=repository" % repo)
-                return False
-            if gpgcheck in ('repo', 'all') and repo.gpgcheck == 'packages':
-                log.warn("Repo %s tried to set gpgcheck=packages" % repo)
+            if repo_gpgcheck and not repo.repo_gpgcheck:
+                log.warn("Repo %s tried to set repo_gpgcheck=false" % repo)
                 return False
-            
+
             # Don't allow them to set gpgkey=anything
             for key in repo.gpgkey:
                 if not key.startswith('file:/'):
@@ -115,7 +100,8 @@ def add_dir_repo(base, trepo, cleanup):
 name=Tmp. repo. for %(path)s
 baseurl=file:%(dname)s
 enabled=1
-gpgcheck=packages
+gpgcheck=true
+repo_gpgcheck=false
 metadata_expire=0
 #  Make cost smaller, as we know it's "local" ... if this isn't good just create
 # your own .repo file. ... then you won't need to createrepo each run either.
@@ -167,15 +153,19 @@ def add_repos(base, log, tmp_repos, tvalidate, tlocvalidate, cleanup_dir_temp):
     # Just do it all again...
     base.setupProgressCallbacks()
 
-rgpgcheck = 'repo' # Remote 
-lgpgcheck = 'packages'
+rpgpgcheck = True # Remote 
+rrgpgcheck = True # Remote 
+lpgpgcheck = True
+lrgpgcheck = False
 def config_hook(conduit):
     '''
     Yum Plugin Config Hook: 
     Add the --tmprepo option.
     '''
-    global rgpgcheck
-    global lgpgcheck
+    global rpgpgcheck
+    global rrgpgcheck
+    global lpgpgcheck
+    global lrgpgcheck
     global def_tmp_repos_cleanup
     
     parser = conduit.getOptParser()
@@ -192,21 +182,12 @@ def config_hook(conduit):
                       help="keep created direcotry based tmp. repos.")
     #  We default to repository for actual repo files, because that's the most
     # secure, but packages for local dirs./files
-    rgpgcheck = conduit.confString('main', 'remote_gpgcheck', default='repo')
-    lgpgcheck = conduit.confString('main', 'local_gpgcheck', default='packages')
-
-    opt_gpg  = CaselessSelectionOption('all',
-                                       ('none', 'all', 'packages', 'repo'),
-                                       {'0'          : 'none',
-                                        'no'         : 'none',
-                                        'false'      : 'none',
-                                        '1'          : 'all',
-                                        'yes'        : 'all',
-                                        'true'       : 'all',
-                                        'pkgs'       : 'packages',
-                                        'repository' : 'repo'}).parse
-    rgpgcheck = opt_gpg(rgpgcheck)
-    lgpgcheck = opt_gpg(lgpgcheck)
+    rpgpgcheck = conduit.confBool('main', 'pkgs_gpgcheck', default=True)
+    rrgpgcheck = conduit.confBool('main', 'repo_gpgcheck', default=True)
+    lpgpgcheck = conduit.confBool('main', 'pkgs_local_gpgcheck',
+                                  default=rpgpgcheck)
+    lrgpgcheck = conduit.confBool('main', 'repo_local_gpgcheck',
+                                  default=False)
     def_tmp_repos_cleanup = conduit.confBool('main', 'cleanup', default=False)
 
 _tmprepo_done = False
@@ -226,6 +207,6 @@ def prereposetup_hook(conduit):
 
     log = logging.getLogger("yum.verbose.main")
     add_repos(conduit._base, log, opts.tmp_repos,
-              make_validate(log, my_gpgcheck),
-              make_validate(log, my_dgpgcheck),
+              make_validate(log, rpgpgcheck, rrgpgcheck),
+              make_validate(log, lpgpgcheck, lrgpgcheck),
               not (opts.tmp_repos_cleanup or def_tmp_repos_cleanup))
commit 80986f7e632286e910cc761300c9403cab652aba
Author: James Antill <james at and.org>
Date:   Wed Aug 6 13:08:20 2008 -0400

    Fix minor text overflow in yum-fedorakmod specfile description

diff --git a/yum-utils.spec b/yum-utils.spec
index 11ed040..ca0b114 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -55,8 +55,8 @@ Group: System Environment/Base
 Requires: yum >= 3.0
 
 %description -n yum-fedorakmod
-Plugin for Yum to handle installation of kmod-foo type of kernel modules, when new kernel versions
-are installed.
+Plugin for Yum to handle installation of kmod-foo type of kernel modules,
+when new kernel versions are installed.
 kmod-foo kernel modules is described by the Fedora Extras packaging standards.
 
 %package -n yum-protectbase
commit e4be8271452994f38b6c8fdc261f7292eb29cc8c
Author: James Antill <james at and.org>
Date:   Tue Aug 5 19:07:28 2008 -0400

    Split specfile plugins variable across multiple lines to help patch/diff out

diff --git a/yum-utils.spec b/yum-utils.spec
index c0423f0..11ed040 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -270,9 +270,31 @@ make DESTDIR=$RPM_BUILD_ROOT install
 make -C updateonboot DESTDIR=$RPM_BUILD_ROOT install
 
 # Plugins to install
-plugins="changelog fastestmirror fedorakmod protectbase versionlock tsflags kernel-module \
-         downloadonly allowdowngrade skip-broken priorities refresh-updatesd merge-conf \
-         security protect-packages basearchonly upgrade-helper aliases list-data filter-data tmprepo verify keys"
+plugins="\
+ changelog \
+ fastestmirror \
+ fedorakmod \
+ protectbase \
+ versionlock \
+ tsflags \
+ kernel-module \
+ downloadonly \
+ allowdowngrade \
+ skip-broken \
+ priorities \
+ refresh-updatesd \
+ merge-conf \
+ security \
+ protect-packages \
+ basearchonly \
+ upgrade-helper \
+ aliases \
+ list-data \
+ filter-data \
+ tmprepo \
+ verify \
+ keys \
+"
 
 mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d/ $RPM_BUILD_ROOT/usr/lib/yum-plugins/
 
commit 3df06f8903d14517c64d4d8027ade12378aa9b19
Author: James Antill <james at and.org>
Date:   Tue Aug 5 18:54:29 2008 -0400

    Tidy up description overflow in specfile

diff --git a/yum-utils.spec b/yum-utils.spec
index ebac530..c0423f0 100644
--- a/yum-utils.spec
+++ b/yum-utils.spec
@@ -15,7 +15,8 @@ yum-utils is a collection of utilities and examples for the yum package
 manager. It includes utilities by different authors that make yum easier and
 more powerful to use. These tools include: debuginfo-install, package-cleanup,
 repoclosure, repodiff, repo-graph, repomanage, repoquery, repo-rss, reposync,
-repotrack, verifytree, yum-builddep, yum-complete-transaction, yumdownloader, yum-debug-dump
+repotrack, verifytree, yum-builddep, yum-complete-transaction, yumdownloader,
+yum-debug-dump
 
 %package -n yum-updateonboot
 Summary: Run yum update on system boot
commit f1a5cb0ba6233c05c6de10d4dd2f53b7723c9e48
Author: James Antill <james at and.org>
Date:   Mon Aug 4 17:07:00 2008 -0400

    Test for '0' epochs and not None in list-security

diff --git a/plugins/security/security.py b/plugins/security/security.py
index cc36dbd..fbb6c7c 100755
--- a/plugins/security/security.py
+++ b/plugins/security/security.py
@@ -247,7 +247,7 @@ class SecurityListCommand:
                                                            used_map, filt_type):
                 d = {}
                 (d['n'], d['a'], d['e'], d['v'], d['r']) = pkgtup
-                if d['e'] is None:
+                if d['e'] == '0':
                     d['epoch'] = ''
                 else:
                     d['epoch'] = "%s:" % d['e']
commit d9a1c3db38e44dc7e97a1f195d244926a545fb8b
Author: James Antill <james at and.org>
Date:   Mon Aug 4 17:05:28 2008 -0400

    Output list-security data in oldest to newest pkgs

diff --git a/plugins/security/security.py b/plugins/security/security.py
index 71ed970..cc36dbd 100755
--- a/plugins/security/security.py
+++ b/plugins/security/security.py
@@ -137,7 +137,7 @@ def ysp_should_show_pkgtup(opts, pkgtup, md_info, used_map, rname=None):
     """ Do we want to show this package in list-security. """
     
     name = pkgtup[0]
-    for (pkgtup, notice) in md_info.get_applicable_notices(pkgtup):
+    for (pkgtup, notice) in reversed(md_info.get_applicable_notices(pkgtup)):
         if rname and not ysp_has_info_md(rname, notice):
             continue
         if ysp_should_filter_pkg(opts, name, notice, used_map):
commit ae91fab7607d355692c9cbaa4250ef8901475726
Author: James Antill <james at and.org>
Date:   Mon Aug 4 17:03:24 2008 -0400

     Don't show 0: for 0 epochs in list-security

diff --git a/plugins/security/security.py b/plugins/security/security.py
index 38aceeb..71ed970 100755
--- a/plugins/security/security.py
+++ b/plugins/security/security.py
@@ -33,6 +33,8 @@
 # yum list-security bugzillas / bzs
 # yum list-security cves
 # yum list-security security / sec
+#
+# yum update-minimal --security
 
 import yum
 import fnmatch
@@ -245,8 +247,11 @@ class SecurityListCommand:
                                                            used_map, filt_type):
                 d = {}
                 (d['n'], d['a'], d['e'], d['v'], d['r']) = pkgtup
-                if d['e'] is None: d['e'] = '0'
-                self.show_pkg(msg, "%(n)s-%(e)s:%(v)s-%(r)s.%(a)s" % d,
+                if d['e'] is None:
+                    d['epoch'] = ''
+                else:
+                    d['epoch'] = "%s:" % d['e']
+                self.show_pkg(msg, "%(n)s-%(epoch)s%(v)s-%(r)s.%(a)s" % d,
                               notice, show_type)
         ysp_chk_used_map(used_map, msg)
 



More information about the Yum-cvs-commits mailing list