[yum-commits] Branch 'yum-3_2_X' - 2 commits - docs/yum.8 yum/__init__.py

James Antill james at osuosl.org
Sat Oct 25 17:07:52 UTC 2008


 docs/yum.8      |    4 +++-
 yum/__init__.py |   24 +++++++++++++++++++-----
 2 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit 14ccb3cd86c89f5ae96f74f78210287e14943b68
Author: James Antill <james at and.org>
Date:   Sat Oct 25 13:07:32 2008 -0400

    Add proxy/etc. config. to gpgkey downloads, fixes Fedora BZ 445336

diff --git a/yum/__init__.py b/yum/__init__.py
index 25e1353..d679fca 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -52,7 +52,7 @@ import misc
 from parser import ConfigPreProcessor, varReplace
 import transactioninfo
 import urlgrabber
-from urlgrabber.grabber import URLGrabError
+from urlgrabber.grabber import URLGrabber, URLGrabError
 from urlgrabber.progress import format_number
 from packageSack import packagesNewestByNameArch, packagesNewestByName
 import depsolve
@@ -2864,7 +2864,7 @@ class YumBase(depsolve.Depsolve):
 
         return returndict
 
-    def _retrievePublicKey(self, keyurl):
+    def _retrievePublicKey(self, keyurl, repo=None):
         """
         Retrieve a key file
         @param keyurl: url to the key to retrieve
@@ -2876,7 +2876,21 @@ class YumBase(depsolve.Depsolve):
 
         # Go get the GPG key from the given URL
         try:
-            rawkey = urlgrabber.urlread(keyurl, limit=9999)
+            url = misc.to_utf8(keyurl)
+            if repo is None:
+                rawkey = urlgrabber.urlread(url, limit=9999)
+            else:
+                #  If we have a repo. use the proxy etc. configuration for it.
+                # In theory we have a global proxy config. too, but meh...
+                # external callers should just update.
+                ug = URLGrabber(bandwidth = repo.bandwidth,
+                                retry = repo.retries,
+                                throttle = repo.throttle,
+                                progress_obj = repo.callback,
+                                proxies=repo.proxy_dict)
+                ug.opts.user_agent = default_grabber.opts.user_agent
+                rawkey = ug.urlread(url, text=repo.id + "/gpgkey")
+
         except urlgrabber.grabber.URLGrabError, e:
             raise Errors.YumBaseError(_('GPG key retrieval failed: ') +
                                       to_unicode(str(e)))
@@ -2916,7 +2930,7 @@ class YumBase(depsolve.Depsolve):
         ts = self.rpmdb.readOnlyTS()
 
         for keyurl in keyurls:
-            keys = self._retrievePublicKey(keyurl)
+            keys = self._retrievePublicKey(keyurl, repo)
 
             for info in keys:
                 # Check if key is already installed
@@ -2979,7 +2993,7 @@ class YumBase(depsolve.Depsolve):
         keyurls = repo.gpgkey
         key_installed = False
         for keyurl in keyurls:
-            keys = self._retrievePublicKey(keyurl)
+            keys = self._retrievePublicKey(keyurl, repo)
             for info in keys:
                 # Check if key is already installed
                 if info['keyid'] in misc.return_keyids_from_pubring(repo.gpgdir):
commit 3cc6dff7b9424dba1788522e1a5e89ec4a785557
Author: James Antill <james at and.org>
Date:   Wed Oct 22 01:41:48 2008 -0400

    Add documentation on install @grp

diff --git a/docs/yum.8 b/docs/yum.8
index 4b82533..4ebd19d 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -75,7 +75,9 @@ Repository configuration is honored in all operations.
 Is used to install the latest version of a package or
 group of packages while ensuring that all dependencies are
 satisfied\&.  If no package matches the given package name(s), they are
-assumed to be a shell glob and any matches are then installed\&.
+assumed to be a shell glob and any matches are then installed\&. If the
+name starts with an @ character the rest of the name is used as though
+passed to the groupinstall command\&.
 .IP 
 .IP "\fBupdate\fP"
 If run without any packages, update will update every currently


More information about the Yum-commits mailing list