[yum-commits] 5 commits - plugins/keys plugins/security plugins/tmprepo
James Antill
james at osuosl.org
Wed Nov 18 17:18:59 UTC 2009
plugins/keys/keys.py | 11 ++++++-
plugins/security/security.py | 2 +
plugins/tmprepo/tmprepo.py | 65 +++++++++++++++++++++++++++++++++++++------
3 files changed, 69 insertions(+), 9 deletions(-)
New commits:
commit 9978711c499224fc284291243abdbb8ec1f5cd92
Author: James Antill <james at and.org>
Date: Wed Nov 18 12:18:45 2009 -0500
Let tmprepo create/use tmprepos if given mirrorlist/metalink
diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index 38df521..7b00807 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -103,8 +103,7 @@ 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.
cost=500
-""" % {'basename' : trepo_name,
- 'path' : trepo_path,
+""" % {'path' : trepo_path,
'repoid' : repoid,
'dname' : trepo_data})
if cleanup:
@@ -121,7 +120,8 @@ cost=500
def add_repomd_repo(base, repomd):
# Let people do it via. poitning at the repomd.xml file ... smeg it
- trepo_data = repomd[:-len("repodata/repomd.xml")]
+ trepo_data = tempfile.mkdtemp()
+ AutoCleanupDir(trepo_data)
trepo_name = os.path.basename(os.path.dirname(os.path.dirname(repomd)))
tmp_fname = "%s/tmp-%s.repo" % (trepo_data, trepo_name)
repoid = "T-%4.4s-%x" % (trepo_name, int(time.time()))
@@ -131,16 +131,36 @@ name=Tmp. repo. for %(path)s
baseurl=%(dname)s
enabled=1
gpgcheck=true
-repo_gpgcheck=false
metadata_expire=0
-""" % {'basename' : trepo_name,
- 'path' : repomd,
+""" % {'path' : repomd,
'repoid' : repoid,
- 'dname' : trepo_data})
+ 'dname' : repomd[:-len("repodata/repomd.xml")]})
print "Creating tmp. repo for:", repomd
AutoCleanupDir("%s/%s" % (base.conf.cachedir, repoid))
return tmp_fname
+# Note that mirrorlist also includes metalink, due to the anaconda hack.
+def add_mirrorlist_repo(base, mirrorlist):
+ # Let people do it via. poitning at the repomd.xml file ... smeg it
+ trepo_data = tempfile.mkdtemp()
+ AutoCleanupDir(trepo_data)
+ trepo_name = os.path.basename(mirrorlist)
+ tmp_fname = "%s/tmp-%s.repo" % (trepo_data, trepo_name)
+ repoid = "T-%4.4s-%x" % (trepo_name, int(time.time()))
+ open(tmp_fname, "wb").write("""\
+[%(repoid)s]
+name=Tmp. repo. for %(path)s
+mirrorlist=%(dname)s
+enabled=1
+gpgcheck=true
+metadata_expire=0
+""" % {'path' : mirrorlist,
+ 'repoid' : repoid,
+ 'dname' : mirrorlist})
+ print "Creating tmp. repo for:", mirrorlist
+ AutoCleanupDir("%s/%s" % (base.conf.cachedir, repoid))
+ return tmp_fname
+
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?
@@ -159,7 +179,7 @@ def add_repos(base, log, tmp_repos, tvalidate, tlocvalidate, cleanup_dir_temp):
fname = add_dir_repo(base, trepo, cleanup_dir_temp)
elif trepo.endswith("repodata/repomd.xml"):
fname = add_repomd_repo(base, trepo)
- else:
+ elif trepo.endswith(".repo"):
grab = urlgrabber.grabber.URLGrabber()
# Need to keep alive until fname is used
gc_keep = tempfile.NamedTemporaryFile()
@@ -169,6 +189,8 @@ def add_repos(base, log, tmp_repos, tvalidate, tlocvalidate, cleanup_dir_temp):
except urlgrabber.grabber.URLGrabError, e:
log.warn("Failed to retrieve " + trepo)
continue
+ else:
+ fname = add_mirrorlist_repo(base, trepo)
base.getReposFromConfigFile(fname, validate=validate)
added = True
@@ -176,8 +198,8 @@ def add_repos(base, log, tmp_repos, tvalidate, tlocvalidate, cleanup_dir_temp):
# Just do it all again...
base.setupProgressCallbacks()
-rpgpgcheck = True # Remote
-rrgpgcheck = True # Remote
+rpgpgcheck = True # Remote
+rrgpgcheck = False # Remote
lpgpgcheck = True
lrgpgcheck = False
def_tmp_repos_cleanup = False
@@ -207,10 +229,10 @@ def config_hook(conduit):
parser.add_option("--tmprepo-keep-created", action='store_true',
dest='tmp_repos_cleanup', default=False,
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
+ # We don't default to repository checks for repo files, because no one does
+ # that signing.
rpgpgcheck = conduit.confBool('main', 'pkgs_gpgcheck', default=True)
- rrgpgcheck = conduit.confBool('main', 'repo_gpgcheck', default=True)
+ rrgpgcheck = conduit.confBool('main', 'repo_gpgcheck', default=False)
lpgpgcheck = conduit.confBool('main', 'pkgs_local_gpgcheck',
default=rpgpgcheck)
lrgpgcheck = conduit.confBool('main', 'repo_local_gpgcheck',
commit 3ead059a14e04964044ccd68902509a40fd3004f
Author: James Antill <james at and.org>
Date: Wed Nov 18 12:00:48 2009 -0500
Let tmprepo create/use tmprepos if given repodata/repomd.xml
diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index 0473618..38df521 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -119,6 +119,28 @@ cost=500
AutoCleanupDir("%s/%s" % (base.conf.cachedir, repoid))
return tmp_fname
+def add_repomd_repo(base, repomd):
+ # Let people do it via. poitning at the repomd.xml file ... smeg it
+ trepo_data = repomd[:-len("repodata/repomd.xml")]
+ trepo_name = os.path.basename(os.path.dirname(os.path.dirname(repomd)))
+ tmp_fname = "%s/tmp-%s.repo" % (trepo_data, trepo_name)
+ repoid = "T-%4.4s-%x" % (trepo_name, int(time.time()))
+ open(tmp_fname, "wb").write("""\
+[%(repoid)s]
+name=Tmp. repo. for %(path)s
+baseurl=%(dname)s
+enabled=1
+gpgcheck=true
+repo_gpgcheck=false
+metadata_expire=0
+""" % {'basename' : trepo_name,
+ 'path' : repomd,
+ 'repoid' : repoid,
+ 'dname' : trepo_data})
+ print "Creating tmp. repo for:", repomd
+ AutoCleanupDir("%s/%s" % (base.conf.cachedir, repoid))
+ return tmp_fname
+
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?
@@ -135,6 +157,8 @@ def add_repos(base, log, tmp_repos, tvalidate, tlocvalidate, cleanup_dir_temp):
log.warn("Failed to find directory " + trepo[len("file:"):])
continue
fname = add_dir_repo(base, trepo, cleanup_dir_temp)
+ elif trepo.endswith("repodata/repomd.xml"):
+ fname = add_repomd_repo(base, trepo)
else:
grab = urlgrabber.grabber.URLGrabber()
# Need to keep alive until fname is used
commit d3eac8a8fdb60bc3eb16fa04ea26caf43328cf48
Author: James Antill <james at and.org>
Date: Wed Nov 18 11:50:31 2009 -0500
Add yum-plugin-tmprepo to run_with when using it
diff --git a/plugins/tmprepo/tmprepo.py b/plugins/tmprepo/tmprepo.py
index b45bf96..0473618 100644
--- a/plugins/tmprepo/tmprepo.py
+++ b/plugins/tmprepo/tmprepo.py
@@ -208,6 +208,9 @@ def prereposetup_hook(conduit):
if not opts.tmp_repos:
return
+ if hasattr(conduit, 'registerPackageName'):
+ conduit.registerPackageName("yum-plugin-tmprepo")
+
log = logging.getLogger("yum.verbose.main")
add_repos(conduit._base, log, opts.tmp_repos,
make_validate(log, rpgpgcheck, rrgpgcheck),
commit 744d997cd2fee8d23bb751ba0ef945ae25a8d87c
Author: James Antill <james at and.org>
Date: Wed Nov 18 11:48:01 2009 -0500
Add yum-plugin-security to run_with when running update-minimal
diff --git a/plugins/security/security.py b/plugins/security/security.py
index c307953..4247560 100755
--- a/plugins/security/security.py
+++ b/plugins/security/security.py
@@ -422,6 +422,8 @@ class SecurityUpdateCommand:
yumcommands_checkGPGKey(base)
def doCommand(self, base, basecmd, extcmds):
+ if hasattr(base, 'run_with_package_names'):
+ base.run_with_package_names.add(__package_name__)
md_info = ysp_gen_metadata(base.repos.listEnabled())
opts = base.plugins.cmdline[0]
opts.sec_cmds = []
commit c9a213f7ac2aab4080bde8b5600856bc468dc00c
Author: James Antill <james at and.org>
Date: Wed Nov 18 11:47:26 2009 -0500
Fix keys-remove to use rpmdb.returnGPGPubkeyPackages
diff --git a/plugins/keys/keys.py b/plugins/keys/keys.py
index b84d62e..48db342 100644
--- a/plugins/keys/keys.py
+++ b/plugins/keys/keys.py
@@ -116,6 +116,9 @@ class KeysListCommand:
print base.fmtColumns(columns)
def doCommand(self, base, basecmd, extcmds):
+ if hasattr(base, 'run_with_package_names'):
+ base.run_with_package_names.add("yum-plugin-keys")
+
self.exit_code = 0
keys = []
@@ -293,7 +296,13 @@ class KeysRemoveCommand(KeysListCommand):
def show_key(self, base, key):
if key.repoid == "installed":
release = "%x" % key.createts
- base.remove(name='gpg-pubkey', version=key.keyid, release=release)
+ if hasattr(base.rpmdb, 'returnGPGPubkeyPackages'): # New style
+ for pkg in base.rpmdb.returnGPGPubkeyPackages():
+ if pkg.version == key.keyid and pkg.release == release:
+ base.remove(po=pkg)
+ else:
+ base.remove(name='gpg-pubkey',
+ version=key.keyid, release=release)
self.exit_code = 2
else:
print "Delete key %s-%x from %s?" % (key.keyid, key.createts,
More information about the Yum-commits
mailing list