[yum-commits] 15 commits - cli.py docs/yum.8 docs/yum.conf.5 output.py rpmUtils/arch.py test/yum-leak-test.py yumcommands.py yum/config.py yum/depsolve.py yum/__init__.py yum/packages.py yum/rpmsack.py yum/transactioninfo.py
James Antill
james at osuosl.org
Thu Feb 23 15:19:53 UTC 2012
cli.py | 18 ++++++++-
docs/yum.8 | 9 ++++
docs/yum.conf.5 | 13 +++++++
output.py | 33 ++++++++++++------
rpmUtils/arch.py | 5 ++
test/yum-leak-test.py | 7 +++
yum/__init__.py | 41 +++++++++++++++++++---
yum/config.py | 6 +++
yum/depsolve.py | 57 ++++++++++++++++++++++++++++---
yum/packages.py | 13 +++++--
yum/rpmsack.py | 1
yum/transactioninfo.py | 24 +++++++++++--
yumcommands.py | 89 ++++++++++++++++++++++++++++++++++++++++---------
13 files changed, 269 insertions(+), 47 deletions(-)
New commits:
commit a241013d483defcbc36ee5da314688c765cd7bf8
Author: Dennis Gilmore <dennis at ausil.us>
Date: Wed Feb 22 14:42:37 2012 -0600
add support for 64 bit arm hardware
diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py
index 732f962..e95270d 100644
--- a/rpmUtils/arch.py
+++ b/rpmUtils/arch.py
@@ -70,6 +70,9 @@ arches = {
"armv7hnl": "armv7hl",
"armv7hl": "noarch",
+ # arm64
+ "arm64": "noarch"
+
# super-h
"sh4a": "sh4",
"sh4": "noarch",
@@ -377,6 +380,8 @@ def getBaseArch(myarch=None):
return "sparc"
elif myarch.startswith("ppc64") and not _ppc64_native_is_best:
return "ppc"
+ elif myarch.startswith("arm64"):
+ return "arm64"
elif myarch.startswith("armv7h"):
return "armhfp"
elif myarch.startswith("arm"):
commit 78fd0deb29a43c3cf069822aaaff07f050277582
Author: James Antill <james at and.org>
Date: Wed Feb 22 11:08:08 2012 -0500
Fix tsInfo leaking YumBase via. hidden method references.
diff --git a/yum/depsolve.py b/yum/depsolve.py
index d74e22b..449cf48 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -38,6 +38,8 @@ import Errors
import warnings
warnings.simplefilter("ignore", Errors.YumFutureDeprecationWarning)
+from weakref import proxy as weakref
+
from yum import _, _rpm_ver_atleast
try:
@@ -62,6 +64,45 @@ _rflags = {}
for f in flags:
_rflags[flags[f]] = f
+
+class _wrap_ayum_getPkgSack:
+ """ This is a wrapper for calling YumBase.pkgSack because
+ otherwise we take a real reference through the bound method and
+ that is d00m (this applies to YumBase and TransactionInfo, hence why
+ we have a seperate class). """
+ def __init__(self, ayum):
+ self.ayum = weakref(ayum)
+ def __call__(self):
+ return self.ayum.pkgSack
+
+class _wrap_ayum_install:
+ """ This is a wrapper for calling YumBase.install because
+ otherwise we take a real reference through the bound method and
+ that is d00m (this applies to YumBase and TransactionInfo, hence why
+ we have a seperate class). """
+ def __init__(self, ayum):
+ self.ayum = weakref(ayum)
+ def __call__(self, *args, **kwargs):
+ return self.ayum.install(*args, **kwargs)
+class _wrap_ayum_remove:
+ """ This is a wrapper for calling YumBase.remove because
+ otherwise we take a real reference through the bound method and
+ that is d00m (this applies to YumBase and TransactionInfo, hence why
+ we have a seperate class). """
+ def __init__(self, ayum):
+ self.ayum = weakref(ayum)
+ def __call__(self, *args, **kwargs):
+ return self.ayum.remove(*args, **kwargs)
+class _wrap_ayum_update:
+ """ This is a wrapper for calling YumBase.update because
+ otherwise we take a real reference through the bound method and
+ that is d00m (this applies to YumBase and TransactionInfo, hence why
+ we have a seperate class). """
+ def __init__(self, ayum):
+ self.ayum = weakref(ayum)
+ def __call__(self, *args, **kwargs):
+ return self.ayum.update(*args, **kwargs)
+
class Depsolve(object):
"""A class for resolving dependencies."""
@@ -94,7 +135,8 @@ class Depsolve(object):
if self._tsInfo != None and self._ts != None:
if not remove_only and self._tsInfo.pkgSack is None:
- self._tsInfo.setDatabases(self.rpmdb, self.pkgSack)
+ pkgSackCtor = _wrap_ayum_getPkgSack(self)
+ self._tsInfo.setDatabases(self.rpmdb, None, pkgSackCtor)
return
if not self.conf.installroot:
@@ -114,13 +156,13 @@ class Depsolve(object):
else:
# Don't instant setup, or things like localinstall are screwed.
pkgSack = None
- pkgSackCtor = self._getSacks
+ pkgSackCtor = _wrap_ayum_getPkgSack(self)
self._tsInfo.setDatabases(self.rpmdb, pkgSack, pkgSackCtor)
self._tsInfo.installonlypkgs = self.conf.installonlypkgs # this kinda sucks
# this REALLY sucks, sadly (needed for group conditionals)
- self._tsInfo.install_method = self.install
- self._tsInfo.update_method = self.update
- self._tsInfo.remove_method = self.remove
+ self._tsInfo.install_method = _wrap_ayum_install(self)
+ self._tsInfo.update_method = _wrap_ayum_update(self)
+ self._tsInfo.remove_method = _wrap_ayum_remove(self)
return self._tsInfo
def _setTsInfo(self, value):
diff --git a/yumcommands.py b/yumcommands.py
index e90f43d..cfa6bf7 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -344,6 +344,7 @@ class InstallCommand(YumCommand):
except yum.Errors.YumBaseError, e:
return 1, [str(e)]
+
class UpdateCommand(YumCommand):
"""A class containing methods needed by the cli to execute the
update command.
commit 92f6c8fdd4733dac362c047fb4526e012d5f2f6c
Author: James Antill <james at and.org>
Date: Wed Feb 22 11:07:38 2012 -0500
Add all the properties to the YumBase leak test.
diff --git a/test/yum-leak-test.py b/test/yum-leak-test.py
index 760b770..dd64483 100755
--- a/test/yum-leak-test.py
+++ b/test/yum-leak-test.py
@@ -33,6 +33,13 @@ def _leak_tst_yb():
yb.repos.setCacheDir(yum.misc.getCacheDir())
yb.rpmdb.returnPackages()
yb.pkgSack.returnPackages()
+ yb.tsInfo
+ yb.ts
+ yb.up
+ yb.comps
+ yb.history
+ yb.igroups
+ yb.pkgtags
out_mem(os.getpid())
time.sleep(4)
commit d4bb23292b69252a2c266e5ca57cdaee943996a2
Author: James Antill <james at and.org>
Date: Tue Feb 21 13:43:00 2012 -0500
Don't require pkgSack setup for local install/reinstall/upgrade/downgrade.
diff --git a/yum/__init__.py b/yum/__init__.py
index f03d65a..fab3553 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4138,8 +4138,8 @@ class YumBase(depsolve.Depsolve):
continue
# make sure this shouldn't be passed to update:
- if (self.rpmdb.searchNames([po.name]) and
- po.pkgtup in self.up.updating_dict):
+ ipkgs = self.rpmdb.searchNames([po.name])
+ if ipkgs and po.verGT(sorted(ipkgs)[-1]):
txmbrs = self.update(po=po)
tx_return.extend(txmbrs)
continue
@@ -4148,7 +4148,7 @@ class YumBase(depsolve.Depsolve):
# something else in the repo. Unless there is a obsoletion loop,
# at which point ignore everything.
obsoleting_pkg = None
- if self.conf.obsoletes:
+ if self.conf.obsoletes and not isinstance(po, YumLocalPackage):
obsoleting_pkg = self._test_loop(po, self._pkg2obspkg)
if obsoleting_pkg is not None:
# this is not a definitive check but it'll make sure we don't
@@ -4505,6 +4505,18 @@ class YumBase(depsolve.Depsolve):
tx_return.append(txmbr)
for available_pkg in availpkgs:
+ # "Just do it" if it's a local pkg.
+ if isinstance(available_pkg, YumLocalPackage):
+ n = available_pkg.name
+ for updated_pkg in self.rpmdb.returnNewestByName(n):
+ updated = updated_pkg.pkgtup
+ if self.tsInfo.getMembersWithState(updated,
+ TS_REMOVE_STATES):
+ self.tsInfo.remove(updated)
+ txmbr = self._add_up_txmbr(requiringPo,
+ available_pkg, updated_pkg)
+ tx_return.append(txmbr)
+ continue
# Make sure we're not installing a package which is obsoleted by
# something else in the repo. Unless there is a obsoletion loop,
# at which point ignore everything.
commit 957e2b3a088fbe91788f1b6a388f6dd271bee9e2
Author: James Antill <james at and.org>
Date: Tue Feb 21 13:25:41 2012 -0500
Change tsInfo.setDatabases() so we don't have to setup the pkgSack.
diff --git a/yum/__init__.py b/yum/__init__.py
index 9e18874..f03d65a 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -1126,7 +1126,7 @@ class YumBase(depsolve.Depsolve):
# If transaction was changed by postresolve plugins then we should run skipbroken again
(rescode, restring) = self._doSkipBroken(rescode, restring, clear_skipped=False )
- if self.tsInfo.pkgSack is not None: # rm Transactions don't have pkgSack
+ if self.tsInfo._pkgSack is not None: # Transactions have pkgSack?
self.tsInfo.pkgSack.dropCachedData()
# FIXME: This is horrible, see below and yummain. Maybe create a real
@@ -5952,7 +5952,7 @@ class YumBase(depsolve.Depsolve):
msg = "%s\n" % self.rpmdb.simpleVersion(main_only=True)[0]
msg += "%s\n" % self.ts.getTsFlags()
- if self.tsInfo.pkgSack is None: # rm Transactions don't have pkgSack
+ if self.tsInfo._pkgSack is None: # Transactions have pkgSack?
msg += "0\n"
else:
msg += "%s\n" % len(self.repos.listEnabled())
diff --git a/yum/depsolve.py b/yum/depsolve.py
index a8f9acb..d74e22b 100644
--- a/yum/depsolve.py
+++ b/yum/depsolve.py
@@ -110,9 +110,12 @@ class Depsolve(object):
self._tsInfo = self._transactionDataFactory()
if remove_only:
pkgSack = None
+ pkgSackCtor = None
else:
- pkgSack = self.pkgSack
- self._tsInfo.setDatabases(self.rpmdb, pkgSack)
+ # Don't instant setup, or things like localinstall are screwed.
+ pkgSack = None
+ pkgSackCtor = self._getSacks
+ self._tsInfo.setDatabases(self.rpmdb, pkgSack, pkgSackCtor)
self._tsInfo.installonlypkgs = self.conf.installonlypkgs # this kinda sucks
# this REALLY sucks, sadly (needed for group conditionals)
self._tsInfo.install_method = self.install
diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py
index 4d89d83..97de8f0 100644
--- a/yum/transactioninfo.py
+++ b/yum/transactioninfo.py
@@ -87,7 +87,8 @@ class TransactionData:
self.conditionals = {} # key = pkgname, val = list of pos to add
self.rpmdb = None
- self.pkgSack = None
+ self._pkgSack = None
+ self._pkgSackCtor = None
self.pkgSackPackages = 0
self.localSack = PackageSack()
self._inSack = GetProvReqOnlyPackageSack()
@@ -115,6 +116,18 @@ class TransactionData:
else:
return iter(self.getMembers())
+ def _getPkgSack(self):
+ if self._pkgSack is not None:
+ return self._pkgSack
+ if self._pkgSackCtor is not None:
+ self._pkgSack = self._pkgSackCtor()
+ return self._pkgSack
+
+ pkgSack = property(fget=lambda self: self._getPkgSack(),
+ fset=lambda self, value: setattr(self, "_pkgSack",value),
+ fdel=lambda self: setattr(self, "_pkgSack", None),
+ doc="Package sack object")
+
def debugprint(self, msg):
if self.debug:
print msg
@@ -208,7 +221,9 @@ class TransactionData:
txmbrs = self.matchNaevr(na[0], na[1])
if not txmbrs:
- if self.pkgSack is None:
+ if self._inSack is not None:
+ pkgs = self._inSack.returnPackages(patterns=[pattern])
+ elif self.pkgSack is None:
pkgs = []
else:
pkgs = self.pkgSack.returnPackages(patterns=[pattern])
@@ -547,9 +562,10 @@ class TransactionData:
return txmbr
- def setDatabases(self, rpmdb, pkgSack):
+ def setDatabases(self, rpmdb, pkgSack, pkgSackCtor=None):
self.rpmdb = rpmdb
- self.pkgSack = pkgSack
+ self._pkgSack = pkgSack
+ self._pkgSackCtor = pkgSackCtor
def getNewProvides(self, name, flag=None, version=(None, None, None)):
"""return dict { packages -> list of matching provides }
commit 18df1f36acd907370d55bcef97a3923297850c3e
Merge: 52ec843 d943751
Author: James Antill <james at and.org>
Date: Mon Feb 20 16:42:14 2012 -0500
Merge branch 'retarded-longsize-hack'
* retarded-longsize-hack:
Add massive hack to work around rpm-python size braindamage. BZ 704600.
commit 52ec84385631969d2669ad605196da4cd1ccfca5
Merge: a381302 d56dcaa
Author: James Antill <james at and.org>
Date: Mon Feb 20 16:24:37 2012 -0500
Merge branch 'dev'
* dev: (2 commits)
Add simple install-n etc. functions for rel-eng. Takes giant yum shell install lists from ~12 seconds to ~2.
...
diff --cc docs/yum.8
index 205df04,f36d382..604377b
--- a/docs/yum.8
+++ b/docs/yum.8
@@@ -94,9 -94,14 +94,14 @@@ glob and any matches are then installed
command\&. If the name starts with a - character, then a search is done within
the transaction and any matches are removed. If the name is a file, then install works
like localinstall\&. If the name doesn't match a package, then package
-"provides" are searched (Eg. "_sqlitecache.so()(64bit)") as are
+"provides" are searched (e.g. "_sqlitecache.so()(64bit)") as are
filelists (Eg. "/usr/bin/yum"). Also note that for filelists, wildcards will
match multiple packages\&.
+
+ Because install does a lot of work to make it as easy as possible to use, there
+ are also a few specific install commands "\fBinstall-n\fP", "\fBinstall-na\fP"
+ and "\fBinstall-nevra\fP". These only work on package names, and do not process
+ wildcards etc.
.IP
.IP "\fBupdate\fP"
If run without any packages, update will update every currently
commit a381302e6f2ee842dcfc9635df3990647d3aaf0e
Author: James Antill <james at and.org>
Date: Tue Feb 14 16:05:50 2012 -0500
Try to workaround the case where non-root users can't read certs. BZ 690904.
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 59bd779..babf66d 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -376,6 +376,15 @@ Path to the SSL client key yum should use to connect to repos/remote sites
Defaults to none.
.IP
+\fBssl_check_cert_permissions \fR
+Boolean - Whether yum should check the permissions on the paths for the
+certificates on the repository (both remote and local). If we can't read any of
+the files then yum will force skip_if_unavailable to be true.
+This is most useful for non-root processes which use yum on repos. that have
+client cert files which are readable only by root.
+Defaults to True.
+
+.IP
\fBhistory_record \fR
Boolean - should yum record history entries for transactions. This takes some
disk space, and some extra time in the transactions. But it allows how to know a
@@ -843,6 +852,10 @@ repository.
Overrides the \fBsslclientkey\fR option from the [main] section for this
repository.
+.IP
+\fBssl_check_cert_permissions \fR
+Overrides the \fBssl_check_cert_permissions\fR option from the [main] section
+for this repository.
.IP
\fBmetadata_expire \fR
diff --git a/yum/__init__.py b/yum/__init__.py
index 29305d2..9e18874 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -491,6 +491,20 @@ class YumBase(depsolve.Depsolve):
if validate and not validate(thisrepo):
continue
+ if thisrepo.ssl_check_cert_permissions:
+ for fn in (thisrepo.sslcacert,
+ thisrepo.sslclientcert, thisrepo.sslclientkey):
+ if not fn:
+ continue
+ # If we can't read the SSL certs. we need to skip the repo.
+ # if we don't have all the data.
+ if not os.access(fn, os.R_OK):
+ msg="Repo %s forced skip_if_unavailable=True due to: %s"
+ if thisrepo.enabled:
+ # Don't spam messages for disabled repos.
+ self.logger.warning(msg % (thisrepo.id, fn))
+ thisrepo.skip_if_unavailable = True
+
# Got our list of repo objects, add them to the repos
# collection
try:
diff --git a/yum/config.py b/yum/config.py
index 3beac89..fe7e1cb 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -837,6 +837,7 @@ class YumConf(StartupConf):
sslverify = BoolOption(True)
sslclientcert = Option()
sslclientkey = Option()
+ ssl_check_cert_permissions = BoolOption(True)
history_record = BoolOption(True)
history_record_packages = ListOption(['yum', 'rpm'])
@@ -952,6 +953,7 @@ class RepoConf(BaseConfig):
sslverify = Inherit(YumConf.sslverify)
sslclientcert = Inherit(YumConf.sslclientcert)
sslclientkey = Inherit(YumConf.sslclientkey)
+ ssl_check_cert_permissions = Inherit(YumConf.ssl_check_cert_permissions)
skip_if_unavailable = BoolOption(False)
commit bc5d77676c29be1c7f9161301084228003846b9a
Author: James Antill <james at and.org>
Date: Tue Feb 14 15:40:51 2012 -0500
Generic provide markers for installonlypkgs. BZ 748054/748055/770444.
diff --git a/yum/config.py b/yum/config.py
index e0eee04..3beac89 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -741,6 +741,8 @@ class YumConf(StartupConf):
username = Option()
password = Option()
installonlypkgs = ListOption(['kernel', 'kernel-bigmem',
+ 'installonlypkg(kernel-module)',
+ 'installonlypkg(vm)',
'kernel-enterprise','kernel-smp', 'kernel-modules', 'kernel-debug',
'kernel-unsupported', 'kernel-source', 'kernel-devel', 'kernel-PAE',
'kernel-PAE-debug'])
commit b22f6a75264c173096d937b97ac8c4ce731c4231
Merge: 9fee55a 5b56bc6
Author: James Antill <james at and.org>
Date: Tue Feb 14 15:34:22 2012 -0500
Fix merge result for kernel-highlight, due to doc. changes.
diff --cc output.py
index 37c14cf,e213b43..fd962ae
--- a/output.py
+++ b/output.py
@@@ -883,44 -582,13 +883,45 @@@ class YumOutput
def listPkgs(self, lst, description, outputType, highlight_na={},
columns=None, highlight_modes={}):
- """outputs based on whatever outputType is. Current options:
- 'list' - simple pkg list
- 'info' - similar to rpm -qi output
- ...also highlight_na can be passed, and we'll highlight
- pkgs with (names, arch) in that set."""
-
+ """Prints information about the given list of packages.
+
+ :param lst: a list of packages to print information about
+ :param description: string describing what the list of
+ packages contains, e.g. 'Available Packages'
+ :param outputType: The type of information to be printed.
+ Current options::
+
+ 'list' - simple pkg list
+ 'info' - similar to rpm -qi output
+ :param highlight_na: a dictionary containing information about
+ packages that should be highlighted in the output. The
+ dictionary keys are (name, arch) tuples for the package,
+ and the associated values are the package objects
+ themselves.
+ :param columns: a tuple containing information about how to
+ format the columns of output. The absolute value of each
+ number in the tuple indicates how much space has been
+ allocated for the corresponding column. If the number is
+ negative, the text in the column will be left justified,
+ and if it is positive, the text will be right justified.
+ The columns of output are the package name, version, and
+ repository
+ :param highlight_modes: dictionary containing information
+ about to highlight the packages in *highlight_na*.
+ *highlight_modes* should contain the following keys::
+
+ 'not_in' - highlighting used for packages not in *highlight_na*
+ '=' - highlighting used when the package versions are equal
+ '<' - highlighting used when the package has a lower version number
+ '>' - highlighting used when the package has a higher version number
+ :return: (exit_code, [errors])
+
+ exit_code is::
+
+ 0 = we're done, exit
+ 1 = we've errored, exit with error string
+ """
+ kern_pkgtup = yum.misc.get_running_kernel_pkgtup(self.ts)
if outputType in ['list', 'info']:
thingslisted = 0
if len(lst) > 0:
commit 9fee55aadd54567a4e67afd757c79e6935e05785
Author: James Antill <james at and.org>
Date: Wed Feb 8 15:52:43 2012 -0500
Add group mark convert and docs. Also does a minor cleanup for group
mark/unmark processing.
Also don't load all packages when in groups as objects mode.
This kind of makes it somewhat usable for upgrades.
Note that we currently force install the "core" group, and treat "base"
somewhat specially ... so it's not a true conversion, but should be
closer to what people want in Fedora/etc.
Also adds the group_member attribute to auto hardlinking in yumdb.
diff --git a/docs/yum.8 b/docs/yum.8
index 527f6b9..205df04 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -253,6 +253,10 @@ the packages as a member of the group.
"\fBgroup mark packages-force\fP" works like mark packages, but doesn't care if
the packages are already members of another group.
+"\fBgroup mark convert\fP" converts the automatic data you get without using
+groups as objects into groups as objects data. This makes it much easier to
+convert to groups as objects without having to reinstall.
+
"\fBgroup unmark packages\fP" remove a package as a member from any groups.
.IP
.IP "\fBshell\fP"
diff --git a/yum/__init__.py b/yum/__init__.py
index a786248..29305d2 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -914,7 +914,10 @@ class YumBase(depsolve.Depsolve):
if self._comps.compscount == 0:
raise Errors.GroupsError, _('No Groups Available in any repository')
- self._comps.compile(self.rpmdb.simplePkgList())
+ # Note that this means that grp.installed is not usable, when using
+ # groups as objects ... but that's GOOD.
+ if self.conf.group_command != 'objects':
+ self._comps.compile(self.rpmdb.simplePkgList())
self.verbose_logger.debug('group time: %0.3f' % (time.time() - group_st))
return self._comps
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 424b821..4f2ccd0 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -1635,6 +1635,7 @@ class RPMDBAdditionalDataPackage(object):
'installed_by', 'changed_by',
'from_repo', 'from_repo_revision',
'from_repo_timestamp', 'releasever',
+ 'group_member',
'command_line'])
def __init__(self, conf, pkgdir, yumdb_cache=None):
diff --git a/yumcommands.py b/yumcommands.py
index 31cb190..ba424f1 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -795,6 +795,10 @@ class GroupsCommand(YumCommand):
else:
cmd = 'summary'
+ if cmd in ('mark', 'unmark') and extcmds:
+ cmd = "%s-%s" % (cmd, extcmds[0])
+ extcmds = extcmds[1:]
+
remap = {'update' : 'upgrade',
'erase' : 'remove',
'mark-erase' : 'mark-remove',
@@ -815,18 +819,23 @@ class GroupsCommand(YumCommand):
cmd, extcmds = self._grp_cmd(basecmd, extcmds)
checkEnabledRepo(base)
+ ocmds_all = []
+ ocmds_arg = []
+ if base.conf.group_command == 'objects':
+ ocmds_arg = ('mark-install', 'mark-remove',
+ 'mark-packages', 'mark-packages-force',
+ 'unmark-packages',
+ 'mark-packages-sync', 'mark-packages-sync-force')
+
+ ocmds_all = ('mark-install', 'mark-remove', 'mark-convert',
+ 'mark-packages', 'mark-packages-force',
+ 'unmark-packages',
+ 'mark-packages-sync', 'mark-packages-sync-force')
- if cmd in ('install', 'remove',
- 'mark-install', 'mark-remove',
- 'info',
- 'mark-packages', 'mark-packages-force', 'unmark-packages',
- 'mark-packages-sync', 'mark-packages-sync-force'):
+ if cmd in ('install', 'remove', 'info') or cmd in ocmds_arg:
checkGroupArg(base, cmd, extcmds)
- if cmd in ('install', 'remove', 'upgrade',
- 'mark-install', 'mark-remove',
- 'mark-packages', 'mark-packages-force', 'unmark-packages',
- 'mark-packages-sync', 'mark-packages-sync-force'):
+ if cmd in ('install', 'remove', 'upgrade') or cmd in ocmds_all:
checkRootUID(base)
if cmd in ('install', 'upgrade'):
@@ -834,10 +843,7 @@ class GroupsCommand(YumCommand):
cmds = set(('list', 'info', 'remove', 'install', 'upgrade', 'summary'))
if base.conf.group_command == 'objects':
- ocmds = ('mark-install', 'mark-remove',
- 'mark-packages', 'mark-packages-force', 'unmark-packages',
- 'mark-packages-sync', 'mark-packages-sync-force')
- cmds.update(ocmds)
+ cmds.update(ocmds_all)
if cmd not in cmds:
base.logger.critical(_('Invalid groups sub-command, use: %s.'),
@@ -931,6 +937,54 @@ class GroupsCommand(YumCommand):
else:
return 0, ['Marked packages-sync: ' + ','.join(extcmds)]
+ if cmd == 'mark-convert':
+ # Convert old style info. into groups as objects.
+
+ def _convert_grp(grp):
+ if not grp.installed:
+ return
+ pkg_names = grp.packages
+ base.igroups.add_group(grp.groupid, pkg_names)
+
+ for pkg in base.rpmdb.searchNames(pkg_names):
+ if 'group_member' in pkg.yumdb_info:
+ continue
+ pkg.yumdb_info.group_member = grp.groupid
+
+ # Blank everything.
+ for gid in base.igroups.groups.keys():
+ base.igroups.del_group(gid)
+ for pkg in base.rpmdb:
+ if 'group_member' in pkg.yumdb_info:
+ del pkg.yumdb_info.group_member
+
+ # Need to do this by hand, when using objects, to setup the
+ # .installed attribute in comps.
+ base.comps.compile(base.rpmdb.simplePkgList())
+
+ # This is kind of a hack, to work around the biggest problem
+ # with having pkgs in more than one group. Treat Fedora/EL/etc.
+ # base/core special. Maybe other groups?
+
+ # Not 100% we want to force install "core", as that's then
+ # "different", but it is better ... so, meh.
+ special_gids = (('core', True),
+ ('base', False))
+ for gid, force_installed in special_gids:
+ grp = base.comps.return_group(gid)
+ if grp is None:
+ continue
+ if force_installed:
+ grp.installed = True
+ _convert_grp(grp)
+ for grp in base.comps.get_groups():
+ if grp.groupid in special_gids:
+ continue
+ _convert_grp(grp)
+
+ base.igroups.save()
+ return 0, ['Converted old style groups to objects.']
+
if cmd == 'mark-remove':
for strng in extcmds:
for group in base.comps.return_groups(strng):
commit d56dcaa8ba266873b32832e713fc8199c9a9f45f
Author: James Antill <james at and.org>
Date: Fri Nov 18 13:10:12 2011 -0500
Add simple install-n etc. functions for rel-eng. Takes giant yum shell
install lists from ~12 seconds to ~2.
Test Eg.
repoquery -gl base core gnome-desktop xfce-desktop | \
perl -pe 's//install-n /' | \
yum shell
diff --git a/cli.py b/cli.py
index bbe8e55..8d8bc75 100755
--- a/cli.py
+++ b/cli.py
@@ -780,7 +780,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
return ret
- def installPkgs(self, userlist):
+ def installPkgs(self, userlist, basecmd='install'):
"""Attempt to take the user specified list of packages or
wildcards and install them, or if they are installed, update
them to a newer version. If a complete version number is
@@ -815,7 +815,21 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
continue # it was something on disk and it ended in rpm
# no matter what we don't go looking at repos
try:
- txmbrs = self.install(pattern=arg)
+ if False: pass
+ elif basecmd == 'install-n':
+ txmbrs = self.install(name=arg)
+ elif basecmd == 'install-na':
+ n,a = arg.split('.')
+ txmbrs = self.install(name=n, arch=a)
+ elif basecmd == 'install-nevra':
+ nevr,a = arg.rsplit('.', 2)
+ n,ev,r = nevr.rsplit('-', 3)
+ e,v = ev.split(':', 2)
+ txmbrs = self.install(name=n,
+ epoch=e, version=v, release=r, arch=a)
+ else:
+ assert basecmd == 'install', basecmd
+ txmbrs = self.install(pattern=arg)
except yum.Errors.InstallError:
self.verbose_logger.log(yum.logginglevels.INFO_2,
_('No package %s%s%s available.'),
diff --git a/docs/yum.8 b/docs/yum.8
index 499da41..f36d382 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -97,6 +97,11 @@ like localinstall\&. If the name doesn't match a package, then package
"provides" are searched (Eg. "_sqlitecache.so()(64bit)") as are
filelists (Eg. "/usr/bin/yum"). Also note that for filelists, wildcards will
match multiple packages\&.
+
+Because install does a lot of work to make it as easy as possible to use, there
+are also a few specific install commands "\fBinstall-n\fP", "\fBinstall-na\fP"
+and "\fBinstall-nevra\fP". These only work on package names, and do not process
+wildcards etc.
.IP
.IP "\fBupdate\fP"
If run without any packages, update will update every currently
diff --git a/yum/__init__.py b/yum/__init__.py
index b07bbb2..2c9a3da 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4088,7 +4088,7 @@ class YumBase(depsolve.Depsolve):
be run if it will update the given package to the given
version. For example, if the package foo-1-2 is installed,::
- updatePkgs(["foo-1-2], update_to=False)
+ updatePkgs(["foo-1-2"], update_to=False)
will work identically to::
updatePkgs(["foo"])
diff --git a/yumcommands.py b/yumcommands.py
index 172c40d..a3e50d2 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -290,7 +290,7 @@ class InstallCommand(YumCommand):
:return: a list containing the names of this command
"""
- return ['install']
+ return ['install', 'install-n', 'install-na', 'install-nevra']
def getUsage(self):
"""Return a usage string for this command.
@@ -337,7 +337,7 @@ class InstallCommand(YumCommand):
"""
self.doneCommand(base, _("Setting up Install Process"))
try:
- return base.installPkgs(extcmds)
+ return base.installPkgs(extcmds, basecmd=basecmd)
except yum.Errors.YumBaseError, e:
return 1, [str(e)]
commit cf6decb0a54bd7309217a52c288a27b87c3cadaa
Author: James Antill <james at and.org>
Date: Mon Nov 14 16:26:01 2011 -0500
Extend the output of listTrans details for quiet mode, and not assumyes.
diff --git a/output.py b/output.py
index be4e4d9..daa5eef 100755
--- a/output.py
+++ b/output.py
@@ -1254,6 +1254,13 @@ class YumOutput:
locsize = 0
insize = 0
error = False
+
+ def _call_log(*args):
+ if self.verbose_logger.isEnabledFor(yum.logginglevels.INFO_1):
+ self.verbose_logger.log(logginglevels.INFO_1, *args)
+ elif self.conf.assumeno or not self.conf.assumeyes:
+ self.logger.warn(logginglevels.INFO_1, *args)
+
for pkg in packages:
# Just to be on the safe side, if for some reason getting
# the package size fails, log the error and don't report download
@@ -1282,15 +1289,12 @@ class YumOutput:
if (not error):
if locsize:
- self.verbose_logger.log(logginglevels.INFO_1, _("Total size: %s"),
- self.format_number(totsize))
+ _call_log(_("Total size: %s"), self.format_number(totsize))
if locsize != totsize:
- self.verbose_logger.log(logginglevels.INFO_1, _("Total download size: %s"),
- self.format_number(totsize - locsize))
+ _call_log(_("Total download size: %s"),
+ self.format_number(totsize - locsize))
if installonly:
- self.verbose_logger.log(logginglevels.INFO_1,
- _("Installed size: %s"),
- self.format_number(insize))
+ _call_log(_("Installed size: %s"), self.format_number(insize))
def reportRemoveSize(self, packages):
"""Report the total size of packages being removed.
@@ -1311,9 +1315,14 @@ class YumOutput:
self.logger.error(_('There was an error calculating installed size'))
break
if (not error):
- self.verbose_logger.log(logginglevels.INFO_1,
- _("Installed size: %s"),
- self.format_number(totsize))
+ if self.verbose_logger.isEnabledFor(yum.logginglevels.INFO_1):
+ self.verbose_logger.log(logginglevels.INFO_1,
+ _("Installed size: %s"),
+ self.format_number(totsize))
+ elif self.conf.assumeno or not self.conf.assumeyes:
+ self.logger.warn(logginglevels.INFO_1,
+ _("Installed size: %s"),
+ self.format_number(totsize))
def listTransaction(self):
"""Return a string representation of the transaction in an
commit d9437513f4fc17bd5522388ebab76dc60dba0d1e
Author: James Antill <james at and.org>
Date: Thu Aug 11 12:35:52 2011 -0400
Add massive hack to work around rpm-python size braindamage. BZ 704600.
diff --git a/yum/packages.py b/yum/packages.py
index f72c068..f287fba 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1283,6 +1283,13 @@ class YumAvailablePackage(PackageObject, RpmBase):
return misc.to_utf8(msg)
+# HACK: This is completely retarded. Don't blame me, someone just fix
+# rpm-python already. This is almost certainly not all of the problems,
+# but w/e.
+def _rpm_long_size_hack(hdr, size):
+ """ Rpm returns None, for certain sizes. And has a "longsize" for the real
+ values. """
+ return hdr[size] or hdr['long' + size]
# This is a tweak on YumAvailablePackage() and is a base class for packages
# which are actual rpms.
@@ -1310,8 +1317,8 @@ class YumHeaderPackage(YumAvailablePackage):
self.pkgid = self.hdr[rpm.RPMTAG_SHA1HEADER]
if not self.pkgid:
self.pkgid = "%s.%s" %(self.hdr['name'], self.hdr['buildtime'])
- self.packagesize = self.hdr['archivesize']
- self.installedsize = self.hdr['size']
+ self.packagesize = _rpm_long_size_hack(self.hdr, 'archivesize')
+ self.installedsize = _rpm_long_size_hack(self.hdr, 'size')
self.__mode_cache = {}
self.__prcoPopulated = False
@@ -1459,7 +1466,7 @@ class YumHeaderPackage(YumAvailablePackage):
raise NotImplementedError()
def _size(self):
- return self.hdr['size']
+ return _rpm_long_size_hack(self.hdr, 'size')
def _is_pre_req(self, flag):
"""check the flags for a requirement, return 1 or 0 whether or not requires
commit 5b56bc6f0ee85fe8ad87d8e17033713a0fa78fea
Author: James Antill <james at and.org>
Date: Mon Nov 2 17:05:07 2009 -0500
Highlight the running kernel specially
diff --git a/output.py b/output.py
index 46168aa..e213b43 100755
--- a/output.py
+++ b/output.py
@@ -588,6 +588,7 @@ class YumOutput:
...also highlight_na can be passed, and we'll highlight
pkgs with (names, arch) in that set."""
+ kern_pkgtup = yum.misc.get_running_kernel_pkgtup(self.ts)
if outputType in ['list', 'info']:
thingslisted = 0
if len(lst) > 0:
@@ -596,7 +597,8 @@ class YumOutput:
for pkg in sorted(lst):
key = (pkg.name, pkg.arch)
highlight = False
- if False: pass
+ if pkg.pkgtup == kern_pkgtup:
+ highlight = highlight_modes.get('kern','bold,underline')
elif key not in highlight_na:
highlight = highlight_modes.get('not in', 'normal')
elif pkg.verEQ(highlight_na[key]):
diff --git a/yum/config.py b/yum/config.py
index 2ae7e89..16f828e 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -686,11 +686,13 @@ class YumConf(StartupConf):
color_list_installed_newer = Option('bold,yellow')
color_list_installed_reinstall = Option('normal')
color_list_installed_extra = Option('bold,red')
+ color_list_installed_running_kernel = Option('bold,underline')
color_list_available_upgrade = Option('bold,blue')
color_list_available_downgrade = Option('dim,cyan')
color_list_available_reinstall = Option('bold,underline,green')
color_list_available_install = Option('normal')
+ color_list_available_running_kernel = Option('bold,underline')
color_update_installed = Option('normal')
color_update_local = Option('bold')
diff --git a/yumcommands.py b/yumcommands.py
index 1451a36..5204b30 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -288,6 +288,7 @@ class InfoCommand(YumCommand):
local_pkgs[(po.name, po.arch)] = po
# Output the packages:
+ kern = base.conf.color_list_installed_running_kernel
clio = base.conf.color_list_installed_older
clin = base.conf.color_list_installed_newer
clir = base.conf.color_list_installed_reinstall
@@ -295,7 +296,9 @@ class InfoCommand(YumCommand):
rip = base.listPkgs(ypl.installed, _('Installed Packages'), basecmd,
highlight_na=update_pkgs, columns=columns,
highlight_modes={'>' : clio, '<' : clin,
+ 'kern' : kern,
'=' : clir, 'not in' : clie})
+ kern = base.conf.color_list_available_running_kernel
clau = base.conf.color_list_available_upgrade
clad = base.conf.color_list_available_downgrade
clar = base.conf.color_list_available_reinstall
@@ -303,6 +306,7 @@ class InfoCommand(YumCommand):
rap = base.listPkgs(ypl.available, _('Available Packages'), basecmd,
highlight_na=inst_pkgs, columns=columns,
highlight_modes={'<' : clau, '>' : clad,
+ 'kern' : kern,
'=' : clar, 'not in' : clai})
rep = base.listPkgs(ypl.extras, _('Extra Packages'), basecmd,
columns=columns)
More information about the Yum-commits
mailing list