[yum-cvs] 2 commits - yum/__init__.py yum/misc.py yum.spec
Seth Vidal
skvidal at linux.duke.edu
Wed Dec 12 22:20:52 UTC 2007
yum.spec | 5 ++++-
yum/__init__.py | 2 ++
yum/misc.py | 29 +++++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 1 deletion(-)
New commits:
commit 0591a77fde3af202938d38b0c4ce15edc7ca9593
Merge: e956691... 9513f69...
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Dec 12 17:19:28 2007 -0500
Merge branch 'master' of ssh://login.linux.duke.edu/home/groups/yum/git/yum
* 'master' of ssh://login.linux.duke.edu/home/groups/yum/git/yum:
Reimplement Updates.checkForObsolete() for better runtime behavior
Fix previous excludes fix, no donut for you
Fix __len__ for sqlitesack to not count excluded packages
Faster __len__ method for MetaSack, should fix speed regression with updates
commit e956691dd3943540397275e7191de8279c8216fb
Author: Seth Vidal <skvidal at fedoraproject.org>
Date: Wed Dec 12 17:17:41 2007 -0500
add in gpg key handling routines - beginning work for
having per-repo gpgkey checks for packages
diff --git a/yum.spec b/yum.spec
index 15b683e..45f397d 100644
--- a/yum.spec
+++ b/yum.spec
@@ -16,7 +16,7 @@ Requires: python-sqlite
Requires: urlgrabber
Requires: yum-metadata-parser >= 1.1.0
Requires: python-iniparse
-
+Requires: pygpgme
Prereq: /sbin/chkconfig, /sbin/service, coreutils
@@ -92,6 +92,9 @@ exit 0
%{_mandir}/man*/yum-updatesd*
%changelog
+* Wed Dec 12 2007 Seth Vidal <skvidal at fedoraproject.org>
+- add pygpgme dep for new gpg key handling
+
* Mon Dec 3 2007 Seth Vidal <skvidal at fedoraproject.org>
- 3.2.8
diff --git a/yum/__init__.py b/yum/__init__.py
index e1799ff..8227c36 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2278,6 +2278,8 @@ class YumBase(depsolve.Depsolve):
if result != 0:
raise Errors.YumBaseError, \
'Key import failed (code %d)' % result
+ misc.import_key_to_pubring(rawkey, po.repo.cachedir)
+
self.logger.info('Key imported successfully')
key_installed = True
diff --git a/yum/misc.py b/yum/misc.py
index 7596077..710b006 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -16,6 +16,7 @@ import pwd
import fnmatch
import bz2
from stat import *
+import gpgme
from Errors import MiscError
@@ -268,6 +269,34 @@ def keyInstalled(ts, keyid, timestamp):
return -1
+def import_key_to_pubring(rawkey, repo_cachedir):
+ gpgdir = '%s/gpgdir' % repo_cachedir
+ if not os.path.exists(gpgdir):
+ os.makedirs(gpgdir)
+
+ key_fo = StringIO(rawkey)
+ ctx = gpgme.Context()
+ os.environ['GNUPGHOME'] = gpgdir
+ fp = open(os.path.join(gpgdir, 'gpg.conf'), 'wb')
+ fp.write('')
+ fp.close()
+ ctx.import_(key_fo)
+ key_fo.close()
+
+def return_keyids_from_pubring(gpgdir):
+ ctx = gpgme.Context()
+ if not os.path.exists(gpgdir):
+ return []
+
+ os.environ['GNUPGHOME'] = gpgdir
+ keyids = []
+ for k in ctx.keylist():
+ for subkey in k.subkeys:
+ if subkey.can_sign:
+ keyids.append(subkey.keyid)
+
+ return keyids
+
def getCacheDir(tmpdir='/var/tmp'):
"""return a path to a valid and safe cachedir - only used when not running
as root or when --tempcache is set"""
More information about the Yum-cvs-commits
mailing list