[yum-commits] Branch 'yum-3_2_X' - 14 commits - cli.py docs/yum.conf.5 output.py yumcommands.py yum/config.py yum-cron/yum-cron.sh yum-cron/yum-cron.sysvinit yum-cron/yum-update.cron.sh yum/history.py yum/__init__.py
James Antill
james at osuosl.org
Wed Aug 24 14:01:26 UTC 2011
cli.py | 94 +++++++++++++++++++++++++++++++++++---------
docs/yum.conf.5 | 6 ++
output.py | 39 ++++++++++++++----
yum-cron/yum-cron.sh | 70 +++++++++++++++-----------------
yum-cron/yum-cron.sysvinit | 65 ++++++++++++++++--------------
yum-cron/yum-update.cron.sh | 7 +++
yum/__init__.py | 2
yum/config.py | 10 +++-
yum/history.py | 10 +++-
yumcommands.py | 6 +-
10 files changed, 208 insertions(+), 101 deletions(-)
New commits:
commit dd4b6685e1ae3130227e1b49103865ea69801665
Author: Matthew Miller <mattdm at mattdm.org>
Date: Tue Aug 23 16:50:46 2011 -0400
Minor changes to PIDFILE handling.
At Marko Myllynen's suggestion, remove a redundant rm -f. Also, check
that PIDFILE gets set to _something_.
diff --git a/yum-cron/yum-cron.sh b/yum-cron/yum-cron.sh
index dcf8620..e300fa7 100755
--- a/yum-cron/yum-cron.sh
+++ b/yum-cron/yum-cron.sh
@@ -11,7 +11,6 @@
# it without changing that.
PIDFILE=/var/lock/yum-cron.pid
-
# This is the home of the yum scripts which power the various actions the
# yum-cron system performs.
SCRIPTDIR=/usr/share/yum-cron/
@@ -31,6 +30,13 @@ if [[ ! -r $YUMSCRIPT ]]; then
exit 1
fi
+# This must be set above. But there a couple of places where horrible
+# things might happen if it's unset, so, let's check.
+if [[ -z "$PIDFILE" ]]; then
+ echo "Error! \$PIDFILE variable must be set in yum-cron."
+ exit 1
+fi
+
# Read the settings from our config file.
if [[ -f /etc/sysconfig/yum-cron ]]; then
source /etc/sysconfig/yum-cron
@@ -86,7 +92,7 @@ else
exec $0 "$@"
else
# Remove lockfiles more than a day old -- they must be stale.
- find $PIDFILE -type f -name 'yum-cron.pid' -amin +1440 -exec rm -f $PIDFILE \;
+ find $PIDFILE -type f -amin +1440 -exec rm -f $PIDFILE \;
# If it's still there, it *wasn't* too old. Bail!
if [[ -f $PIDFILE ]]; then
# Lock is valid and OTHERPID is active -- exit, we're locked!
@@ -94,9 +100,7 @@ else
exit 0
else
# Lock was invalid. Restart.
- echo "yum-cron: removing stale lock belonging to stale PID ${OTHERPID}" >&2
- rm -f $PIDFILE
- echo "yum-cron: restarting myself" >&2
+ echo "yum-cron: removed stale lock belonging to PID ${OTHERPID}; restarting." >&2
exec $0 "$@"
fi
fi
commit 3d3665d76c5910bc2c4016b220c597c69e2ba562
Author: Matthew Miller <mattdm at mattdm.org>
Date: Tue Aug 23 16:50:45 2011 -0400
rename YUMTMP to more accurate YUMOUTPUT
diff --git a/yum-cron/yum-cron.sh b/yum-cron/yum-cron.sh
index 2806538..dcf8620 100755
--- a/yum-cron/yum-cron.sh
+++ b/yum-cron/yum-cron.sh
@@ -45,13 +45,13 @@ fi
# This holds the output from the "meat" of this script, so that it can
# be nicely mailed to the configured destination when we're done.
-YUMTMP=$(mktemp /var/run/yum-cron.XXXXXX)
-touch $YUMTMP
-[[ -x /sbin/restorecon ]] && /sbin/restorecon $YUMTMP
+YUMOUTPUT=$(mktemp /var/run/yum-cron.XXXXXX)
+touch $YUMOUTPUT
+[[ -x /sbin/restorecon ]] && /sbin/restorecon $YUMOUTPUT
# Here is the gigantic block of lockfile logic.
#
-# Note: the lockfile code doesn't currently try and use YUMTMP to email
+# Note: the lockfile code doesn't currently try and use YUMOUTPUT to email
# messages nicely, so this gets handled by normal cron error mailing.
#
@@ -151,16 +151,16 @@ fi
;;
esac
-} >> $YUMTMP 2>&1
+} >> $YUMOUTPUT 2>&1
if [[ ! -z "$MAILTO" && -x /bin/mail ]]; then
# If MAILTO is set, use mail command for prettier output.
- [[ -s "$YUMTMP" ]] && \
- mail -s "System update: $SYSTEMNAME" $MAILTO < $YUMTMP && \
- rm -f $YUMTMP
+ [[ -s "$YUMOUTPUT" ]] && \
+ mail -s "System update: $SYSTEMNAME" $MAILTO < $YUMOUTPUT && \
+ rm -f $YUMOUTPUT
else
# The default behavior is to use cron's internal mailing of output.
- cat $YUMTMP && rm -f $YUMTMP
+ cat $YUMOUTPUT && rm -f $YUMOUTPUT
fi
exit 0
commit 5883c19b99a46c8228b5a7bf093612dd3030f5db
Author: Matthew Miller <mattdm at mattdm.org>
Date: Tue Aug 23 16:50:44 2011 -0400
Only remove YUMTMP if we actually finish and send it.
If the script dies or we don't send successfully, leave it around for
possible diagnostics.
diff --git a/yum-cron/yum-cron.sh b/yum-cron/yum-cron.sh
index c90c6e9..2806538 100755
--- a/yum-cron/yum-cron.sh
+++ b/yum-cron/yum-cron.sh
@@ -62,7 +62,7 @@ touch $YUMTMP
if (set -o noclobber; echo "$$" > $PIDFILE) 2>/dev/null; then
# We got the lock. So now, set a trap to clean up locks and the output
# tempfile when the script exits or is killed.
- trap "{ rm -f $PIDFILE; rm -f $YUMTMP; exit 255; }" INT TERM EXIT
+ trap "rm -f $PIDFILE" INT TERM EXIT
else
# Lock failed -- check if a running process exists.
# First, if there's no PID file in the lock directory, something bad has
@@ -155,11 +155,12 @@ fi
if [[ ! -z "$MAILTO" && -x /bin/mail ]]; then
# If MAILTO is set, use mail command for prettier output.
- [[ -s "$YUMTMP" ]] && mail -s "System update: $SYSTEMNAME" $MAILTO < $YUMTMP
+ [[ -s "$YUMTMP" ]] && \
+ mail -s "System update: $SYSTEMNAME" $MAILTO < $YUMTMP && \
+ rm -f $YUMTMP
else
# The default behavior is to use cron's internal mailing of output.
- cat $YUMTMP
+ cat $YUMTMP && rm -f $YUMTMP
fi
-rm -f $YUMTMP
exit 0
commit e8dd5c2011be69436916ac5ad3a7aacc254354af
Author: Matthew Miller <mattdm at mattdm.org>
Date: Tue Aug 23 16:50:43 2011 -0400
Rework yum-cron.sysvinit to only use the single lock file.
This now uses noclobber on a file rather than mkdir plus a pid file under
that, to avoid a race condition pointed out by Marko Myllynen.
It also removes the separate TSLOCK/tslock file, since the sleep is now
separated into the cron script -- leaving the main pid lock effectively the
same as the old tslock.
diff --git a/yum-cron/yum-cron.sh b/yum-cron/yum-cron.sh
index d549471..c90c6e9 100755
--- a/yum-cron/yum-cron.sh
+++ b/yum-cron/yum-cron.sh
@@ -6,12 +6,10 @@
# /etc/sysconfig/yum-cron.
-# These are used by /etc/init.d/yum-cron on shutdown to protect against
+# This is used by /etc/init.d/yum-cron on shutdown to protect against
# abruptly shutting down mid-transaction. Therefore, you shouldn't change
-# them without changing that.
-LOCKDIR=/var/lock/yum-cron.lock
-PIDFILE=$LOCKDIR/pidfile
-TSLOCK=$LOCKDIR/ts.lock
+# it without changing that.
+PIDFILE=/var/lock/yum-cron.pid
# This is the home of the yum scripts which power the various actions the
@@ -56,26 +54,24 @@ touch $YUMTMP
# Note: the lockfile code doesn't currently try and use YUMTMP to email
# messages nicely, so this gets handled by normal cron error mailing.
#
-
-# We use mkdir for the lockfile, as this will test for and if possible
-# create the lock in one atomic action. (So there's no race condition.)
-if mkdir $LOCKDIR 2>/dev/null; then
- # Store the current process ID in the lock directory so we can check for
- # staleness later.
- echo "$$" >"${PIDFILE}"
- # And, clean up locks and tempfile when the script exits or is killed.
- trap "{ rm -f $PIDFILE $TSLOCK; rmdir $LOCKDIR 2>/dev/null; rm -f $YUMTMP; exit 255; }" INT TERM EXIT
+
+# We use noclobber for the pidfile, as this will test for and if possible
+# create the file in one atomic action. (So there's no race condition.) The
+# current process ID is stored in the file so we can check for staleness
+# later.
+if (set -o noclobber; echo "$$" > $PIDFILE) 2>/dev/null; then
+ # We got the lock. So now, set a trap to clean up locks and the output
+ # tempfile when the script exits or is killed.
+ trap "{ rm -f $PIDFILE; rm -f $YUMTMP; exit 255; }" INT TERM EXIT
else
# Lock failed -- check if a running process exists.
# First, if there's no PID file in the lock directory, something bad has
- # happened. We can't know the process name, so, clean up the old lockdir
- # and restart.
+ # happened. We can't know the process name, so, restart.
if [[ ! -f $PIDFILE ]]; then
- rm -rf "${LOCKDIR}"
- echo "yum-cron: no lock PID, clearing and restarting myself" >&2
+ echo "yum-cron: no lock PID, restarting myself" >&2
exec $0 "$@"
fi
- OTHERPID="$(cat "${PIDFILE}")"
+ OTHERPID="$(< $PIDFILE)" 2>/dev/null
# if cat wasn't able to read the file anymore, another instance probably is
# about to remove the lock -- exit, we're *still* locked
if [[ $? != 0 ]]; then
@@ -85,12 +81,12 @@ else
if ! kill -0 $OTHERPID &>/dev/null; then
# Lock is stale. Remove it and restart.
echo "yum-cron: removing stale lock of nonexistant PID ${OTHERPID}" >&2
- rm -rf "${LOCKDIR}"
+ rm -f $PIDFILE
echo "yum-cron: restarting myself" >&2
exec $0 "$@"
else
# Remove lockfiles more than a day old -- they must be stale.
- find $LOCKDIR -type f -name 'pidfile' -amin +1440 -exec rm -rf $LOCKDIR \;
+ find $PIDFILE -type f -name 'yum-cron.pid' -amin +1440 -exec rm -f $PIDFILE \;
# If it's still there, it *wasn't* too old. Bail!
if [[ -f $PIDFILE ]]; then
# Lock is valid and OTHERPID is active -- exit, we're locked!
@@ -99,6 +95,7 @@ else
else
# Lock was invalid. Restart.
echo "yum-cron: removing stale lock belonging to stale PID ${OTHERPID}" >&2
+ rm -f $PIDFILE
echo "yum-cron: restarting myself" >&2
exec $0 "$@"
fi
@@ -121,8 +118,6 @@ fi
# Note that in all cases, yum is updated first, and then
# everything else.
if [[ "$CHECK_ONLY" == "yes" ]]; then
- # TSLOCK is used by the safe-shutdown code in the init script.
- touch $TSLOCK
/usr/bin/yum $YUM_PARAMETER -e 0 -d 0 -y check-update 1> /dev/null 2>&1
case $? in
1) exit 1;;
@@ -138,7 +133,6 @@ fi
# Don't run if we can't access the repos -- if this is set,
# and there's a problem, we exit silently (but return an error
# code).
- touch $TSLOCK
/usr/bin/yum $YUM_PARAMETER -e 0 -d 0 check-update 2>&-
case $? in
1) exit 1;;
@@ -148,7 +142,6 @@ fi
esac
else
# and here's the "just do it".
- touch $TSLOCK
/usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d ${DEBUG_LEVEL:-0} -y update yum
/usr/bin/yum $YUM_PARAMETER -e ${ERROR_LEVEL:-0} -d ${DEBUG_LEVEL:-0} -y shell $YUMSCRIPT
fi
diff --git a/yum-cron/yum-cron.sysvinit b/yum-cron/yum-cron.sysvinit
index 084dd32..ee531c6 100755
--- a/yum-cron/yum-cron.sysvinit
+++ b/yum-cron/yum-cron.sysvinit
@@ -18,48 +18,53 @@
test -f /etc/sysconfig/yum-cron && . /etc/sysconfig/yum-cron
lockfile=/var/lock/subsys/yum-cron
-tslock=/var/lock/yum-cron.lock/ts.lock
-yumcronpid=/var/lock/yum-cron.lock/pidfile
+
+# This is generated by /usr/sbin/yum-cron and will exist when that script
+# is running and not otherwise.
+pidfile=/var/lock/yum-cron.pid
RETVAL=0
start() {
echo -n $"Enabling scheduled yum updates: "
+ # The cron script exits silently if this file doesn't exist.
touch "$lockfile" && success || failure
RETVAL=$?
echo
}
stop() {
+ # Disabling this is just removing the so-called lock file. But we
+ # also have logic to delay shutdown if a transaction is in-progress.
+ # All that affects is the exit of _this_ script, which may be
+ # waited on by other things in the shutdown process.
echo -n $"Disabling scheduled yum updates: "
- if [ -f "$yumcronpid" -a "$SERVICE_WAITS" = "yes" ]; then
- yum_done=0
- if [ ! -f $tslock ]; then
- # No transaction yet in progress, just kill it
- kill `cat $yumcronpid > /dev/null 2>&1` > /dev/null 2>&1
- yum_done=1
- fi
- if [ $yum_done -eq 0 ]; then
- echo -n $"Waiting for in-progress yum transaction "
- if [ -z "$SERVICE_WAIT_TIME" ]; then
- SERVICE_WAIT_TIME=300
- fi
- start=`date +%s`
- end=`expr $start + $SERVICE_WAIT_TIME`
- while [ `date +%s` -le $end ]
- do
- sleep 5
- if [ ! -f "$tslock" ]; then
- yum_done=1
- break
- fi
- done
- if [ $yum_done -eq 1 ]; then
- echo -n " ok "
- else
- echo -n " failed "
- fi
- fi
+ if [ "$SERVICE_WAITS" = "yes" ]; then
+ # if SERVICE_WAITS is yes, we check for an active pid
+ # file and recheck in 5 second increments up to
+ # SERVICE_WAIT_TIME before continuing.
+ if (set -o noclobber; ! echo "$$" > $pidfile ) 2>/dev/null; then
+ # yum-cron has the lock. Read the pid, and wait and then loop
+ # until it's done.
+ activepid="$(< $pidfile)" 2>/dev/null
+ if [ $? != 0 ]; then
+ echo; echo -n $"Stale yum-cron lock ignored. "
+ else
+ echo; echo -n $"Waiting for in-progress yum transaction"
+ end=$( expr $( date +%s ) + ${SERVICE_WAIT_TIME:-300} )
+ while checkpid $activepid 2>/dev/null ; do
+ echo -n "."
+ if [ $( date +%s ) -gt $end ]; then
+ echo -n " Timed out. "
+ break
+ fi
+ sleep 5
+ done
+ fi
+ else
+ # we got the lock. we don't really want it; remove and move on.
+ rm -f "$pidfile"
+ fi
fi
rm -f "$lockfile" && success || failure
RETVAL=$?
diff --git a/yum-cron/yum-update.cron.sh b/yum-cron/yum-update.cron.sh
index c439ad3..b9edddf 100755
--- a/yum-cron/yum-update.cron.sh
+++ b/yum-cron/yum-update.cron.sh
@@ -24,5 +24,12 @@ fi
# the setting in the sysconfig file.
[[ $RANDOMWAIT -gt 0 ]] && sleep $(( $RANDOM % ($RANDOMWAIT * 60) + 1 ))
+# Double-check to make sure that we're still supposed to be
+# active after the random wait.
+if [[ ! -f /var/lock/subsys/yum-cron ]]; then
+ exit 0
+fi
+
+
# Action!
exec /usr/sbin/yum-cron update
commit e5c5fa85480691819999c35f2c4cb55dd408c983
Author: James Antill <james at and.org>
Date: Tue Aug 23 13:30:51 2011 -0400
Check the installed pkg. before the remote one, so we get deps. tree right.
diff --git a/cli.py b/cli.py
index 9c89a37..a1e0e03 100755
--- a/cli.py
+++ b/cli.py
@@ -768,6 +768,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
return uret
for txmbr in txmbrs:
+ for rtxmbr, T in txmbr.relatedto:
+ ret += _pkg2ups(rtxmbr)
ret += _pkg2ups(txmbr.po)
return ret
commit ae96a41365893799e77a19ba0ab708789587c104
Author: James Antill <james at and.org>
Date: Tue Aug 23 13:12:55 2011 -0400
Separate out dep. pkgs from pkgs. in trans. summary.
diff --git a/output.py b/output.py
index db64eff..eefcd69 100755
--- a/output.py
+++ b/output.py
@@ -1417,19 +1417,37 @@ class YumOutput:
Transaction Summary
%s
""") % ('=' * self.term.columns))
- for action, count in (
- (_('Install'), len(self.tsInfo.installed) + len(self.tsInfo.depinstalled)),
- (_('Upgrade'), len(self.tsInfo.updated) + len(self.tsInfo.depupdated)),
- (_('Remove'), len(self.tsInfo.removed) + len(self.tsInfo.depremoved)),
- (_('Reinstall'), len(self.tsInfo.reinstalled)),
- (_('Downgrade'), len(self.tsInfo.downgraded)),
- (_('Skipped (dependency problems)'), len(self.skipped_packages)),
- (_('Not installed'), len(self._not_found_i.values())),
- (_('Not available'), len(self._not_found_a.values())),
+ for action, count, depcount in (
+ (_('Install'), len(self.tsInfo.installed),
+ len(self.tsInfo.depinstalled)),
+ (_('Upgrade'), len(self.tsInfo.updated),
+ len(self.tsInfo.depupdated)),
+ (_('Remove'), len(self.tsInfo.removed),
+ len(self.tsInfo.depremoved)),
+ (_('Reinstall'), len(self.tsInfo.reinstalled), 0),
+ (_('Downgrade'), len(self.tsInfo.downgraded), 0),
+ (_('Skipped (dependency problems)'), len(self.skipped_packages), 0),
+ (_('Not installed'), len(self._not_found_i.values()), 0),
+ (_('Not available'), len(self._not_found_a.values()), 0),
):
- if count: out.append('%-9s %5d %s\n' % (
- action, count, P_('Package', 'Packages', count),
- ))
+ msg_pkgs = P_('Package', 'Packages', count)
+ if depcount:
+ msg_deppkgs = P_('Dependent package', 'Dependent packages',
+ depcount)
+ max_msg_pkgs = utf8_width(_('Package'))
+ max_msg_pkgs2 = utf8_width(_('Packages'))
+ if max_msg_pkgs2 > max_msg_pkgs:
+ max_msg_pkgs = max_msg_pkgs2
+ if count:
+ msg = '%-9s %5d %-*s (+%5d %s)\n'
+ out.append(msg % (action, count, max_msg_pkgs, msg_pkgs,
+ depcount, msg_deppkgs))
+ else:
+ msg = '%-9s %5s %-*s ( %5d %s)\n'
+ out.append(msg % (action, '', max_msg_pkgs, '',
+ depcount, msg_deppkgs))
+ elif count:
+ out.append('%-9s %5d %s\n' % (action, count, msg_pkgs))
return ''.join(out)
def postTransactionOutput(self):
commit ccf1fec38c924afbe4e8a994b88df51dc043c02c
Author: James Antill <james at and.org>
Date: Tue Aug 23 12:56:57 2011 -0400
Remove JDBG line.
diff --git a/cli.py b/cli.py
index 9f2c282..9c89a37 100755
--- a/cli.py
+++ b/cli.py
@@ -768,7 +768,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
return uret
for txmbr in txmbrs:
- print "JDBG:", txmbr
ret += _pkg2ups(txmbr.po)
return ret
commit 4367a898192201b3a358b1fe0cf247a64ea49e11
Author: James Antill <james at and.org>
Date: Tue Aug 23 12:53:14 2011 -0400
Add summary data for skipped/not installed/available.
diff --git a/output.py b/output.py
index 00e0e6f..db64eff 100755
--- a/output.py
+++ b/output.py
@@ -1423,6 +1423,9 @@ Transaction Summary
(_('Remove'), len(self.tsInfo.removed) + len(self.tsInfo.depremoved)),
(_('Reinstall'), len(self.tsInfo.reinstalled)),
(_('Downgrade'), len(self.tsInfo.downgraded)),
+ (_('Skipped (dependency problems)'), len(self.skipped_packages)),
+ (_('Not installed'), len(self._not_found_i.values())),
+ (_('Not available'), len(self._not_found_a.values())),
):
if count: out.append('%-9s %5d %s\n' % (
action, count, P_('Package', 'Packages', count),
commit 2b39cc921381c80e4788a120d78b5a91e3c3d987
Merge: ff4864d e8575af
Author: James Antill <james at and.org>
Date: Tue Aug 23 11:58:30 2011 -0400
Merge branch 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum into yum-3_2_X
* 'yum-3_2_X' of ssh://yum.baseurl.org/srv/projects/yum/git/yum:
update all the translations
commit ff4864df84170063ab0572a4453e7db03c52c153
Author: James Antill <james at and.org>
Date: Fri Aug 19 16:27:18 2011 -0400
Add upgrade_requirements_on_install config. Based on idea by Michael Schwendt.
The idea is that sometimes you want to say "make sure the entire
dep. tree for package XYZ is at the latest version". This affects
install/upgrade/update/upgrade-to/reinstall. yum command only.
diff --git a/cli.py b/cli.py
index ca75464..9f2c282 100755
--- a/cli.py
+++ b/cli.py
@@ -737,6 +737,42 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
", ".join(matches))
self.verbose_logger.log(yum.logginglevels.INFO_2, msg)
+ def _install_upgraded_requires(self, txmbrs):
+ """Go through the given txmbrs, and for any to be installed packages
+ look for their installed deps. and try to upgrade them, if the
+ configuration is set. Returning any new transaction members to be
+ isntalled.
+
+ :param txmbrs: a list of :class:`yum.transactioninfo.TransactionMember` objects
+ :return: a list of :class:`yum.transactioninfo.TransactionMember` objects
+ """
+
+ if not self.conf.upgrade_requirements_on_install:
+ return []
+
+ ret = []
+ done = set()
+ def _pkg2ups(pkg, reqpo=None):
+ if pkg.name in done:
+ return []
+ if reqpo is None:
+ reqpo = pkg
+
+ done.add(pkg.name)
+
+ uret = []
+ for req in pkg.requires:
+ for npkg in self.returnInstalledPackagesByDep(req):
+ uret += self.update(pattern=npkg.name, requiringPo=reqpo)
+ uret += _pkg2ups(npkg, reqpo=reqpo)
+ return uret
+
+ for txmbr in txmbrs:
+ print "JDBG:", txmbr
+ ret += _pkg2ups(txmbr.po)
+
+ return ret
+
def installPkgs(self, userlist):
"""Attempt to take the user specified list of packages or
wildcards and install them, or if they are installed, update
@@ -767,11 +803,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
for arg in userlist:
if (arg.endswith('.rpm') and (yum.misc.re_remote_url(arg) or
os.path.exists(arg))):
- self.localInstall(filelist=[arg])
+ txmbrs = self.installLocal(arg)
+ self._install_upgraded_requires(txmbrs)
continue # it was something on disk and it ended in rpm
# no matter what we don't go looking at repos
try:
- self.install(pattern=arg)
+ txmbrs = self.install(pattern=arg)
except yum.Errors.InstallError:
self.verbose_logger.log(yum.logginglevels.INFO_2,
_('No package %s%s%s available.'),
@@ -780,6 +817,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
self._maybeYouMeant(arg)
else:
done = True
+ self._install_upgraded_requires(txmbrs)
if len(self.tsInfo) > oldcount:
change = len(self.tsInfo) - oldcount
return 2, [P_('%d package to install', '%d packages to install', change) % change]
@@ -820,21 +858,19 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
else:
# go through the userlist - look for items that are local rpms. If we find them
- # pass them off to localInstall() and then move on
+ # pass them off to installLocal() and then move on
localupdates = []
for item in userlist:
if (item.endswith('.rpm') and (yum.misc.re_remote_url(item) or
os.path.exists(item))):
- localupdates.append(item)
-
- if len(localupdates) > 0:
- self.localInstall(filelist=localupdates, updateonly=1)
- for item in localupdates:
- userlist.remove(item)
-
- for arg in userlist:
- if not self.update(pattern=arg, update_to=update_to):
- self._checkMaybeYouMeant(arg)
+ txmbrs = self.installLocal(item, updateonly=1)
+ self._install_upgraded_requires(txmbrs)
+ continue
+
+ txmbrs = self.update(pattern=item, update_to=update_to)
+ self._install_upgraded_requires(txmbrs)
+ if not txmbrs:
+ self._checkMaybeYouMeant(item)
if len(self.tsInfo) > oldcount:
change = len(self.tsInfo) - oldcount
@@ -1041,12 +1077,13 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
for arg in userlist:
if (arg.endswith('.rpm') and (yum.misc.re_remote_url(arg) or
os.path.exists(arg))):
- self.reinstallLocal(arg)
+ txmbrs = self.reinstallLocal(arg)
+ self._install_upgraded_requires(txmbrs)
continue # it was something on disk and it ended in rpm
# no matter what we don't go looking at repos
try:
- self.reinstall(pattern=arg)
+ txmbrs = self.reinstall(pattern=arg)
except yum.Errors.ReinstallRemoveError:
self._checkMaybeYouMeant(arg, always_output=False)
except yum.Errors.ReinstallInstallError, e:
@@ -1062,6 +1099,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
except yum.Errors.ReinstallError, e:
assert False, "Shouldn't happen, but just in case"
self.verbose_logger.log(yum.logginglevels.INFO_2, e)
+ else:
+ self._install_upgraded_requires(txmbrs)
+
if len(self.tsInfo) > oldcount:
change = len(self.tsInfo) - oldcount
return 2, [P_('%d package to reinstall', '%d packages to reinstall', change) % change]
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 7272aba..607e9fc 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -616,6 +616,12 @@ package's dependencies. If any of them are no longer required by any other
package then also mark them to be removed.
Boolean (1, 0, True, False, yes,no) Defaults to False
+.IP
+\fBupgrade_requirements_on_install \fR
+When installing/reinstalling/upgrading packages go through each package's
+installed dependencies and check for an update.
+Boolean (1, 0, True, False, yes,no) Defaults to False
+
.SH "[repository] OPTIONS"
diff --git a/yum/config.py b/yum/config.py
index e4674d1..ef1b9e1 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -839,6 +839,7 @@ class YumConf(StartupConf):
clean_requirements_on_remove = BoolOption(False)
+ upgrade_requirements_on_install = BoolOption(False)
history_list_view = SelectionOption('single-user-commands',
('single-user-commands', 'users',
commit ce610cac3b0afcab326cf23ebe293f530489f413
Author: James Antill <james at and.org>
Date: Fri Aug 19 16:39:44 2011 -0400
Don't traceback on --setopt=foo and --setopt=foo=1=1.
diff --git a/cli.py b/cli.py
index 00374d8..ca75464 100755
--- a/cli.py
+++ b/cli.py
@@ -173,8 +173,18 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
mainopts = yum.misc.GenericHolder()
mainopts.items = []
+ bad_setopt_tm = []
+ bad_setopt_ne = []
+
for item in setopts:
- k,v = item.split('=')
+ vals = item.split('=')
+ if len(vals) > 2:
+ bad_setopt_tm.append(item)
+ continue
+ if len(vals) < 2:
+ bad_setopt_ne.append(item)
+ continue
+ k,v = vals
period = k.find('.')
if period != -1:
repo = k[:period]
@@ -190,7 +200,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
self.main_setopts = mainopts
self.repo_setopts = repoopts
-
+
+ return bad_setopt_tm, bad_setopt_ne
def getOptionsConfig(self, args):
"""Parse command line arguments, and set up :attr:`self.conf` and
@@ -210,7 +221,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
opts.verbose = False
# go through all the setopts and set the global ones
- self._parseSetOpts(opts.setopts)
+ bad_setopt_tm, bad_setopt_ne = self._parseSetOpts(opts.setopts)
if self.main_setopts:
for opt in self.main_setopts.items:
@@ -240,6 +251,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
pc.releasever = opts.releasever
self.conf
+ for item in bad_setopt_tm:
+ msg = "Setopt argument has multiple values: %s"
+ self.logger.warning(msg % item)
+ for item in bad_setopt_ne:
+ msg = "Setopt argument has no value: %s"
+ self.logger.warning(msg % item)
# now set all the non-first-start opts from main from our setopts
if self.main_setopts:
for opt in self.main_setopts.items:
commit 74732cb4341a97efbedb9cc9aa818c92d548b4e5
Author: James Antill <james at and.org>
Date: Fri Aug 19 12:47:20 2011 -0400
Fix return values from sync_anydb_key()
diff --git a/yum/history.py b/yum/history.py
index 6449708..a9b12cf 100644
--- a/yum/history.py
+++ b/yum/history.py
@@ -1313,7 +1313,9 @@ class YumHistory:
val = getattr(ipkg, attr, None)
if val is None:
continue
- self._save_anydb_key(ipkg, "rpm", attr, val)
+ if not self._save_anydb_key(ipkg, "rpm", attr, val):
+ return False
+ return True
def _save_yumdb(self, ipkg):
""" Save all the data for yumdb for this installed pkg, assumes
@@ -1322,7 +1324,9 @@ class YumHistory:
val = ipkg.yumdb_info.get(attr)
if val is None:
continue
- self._save_anydb_key(ipkg, "yum", attr, val)
+ if not self._save_anydb_key(ipkg, "yum", attr, val):
+ return False
+ return True
def _wipe_anydb(self, pkg, db):
""" Delete all the data for rpmdb/yumdb for this installed pkg. """
diff --git a/yumcommands.py b/yumcommands.py
index d9c70f3..2ab9a28 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -2452,8 +2452,10 @@ class HistoryCommand(YumCommand):
continue
print "Syncing rpm/yum DB data for:", ipkg, "...",
- base.history.sync_alldb(ipkg)
- print "Done."
+ if base.history.sync_alldb(ipkg):
+ print "Done."
+ else:
+ print "FAILED."
def doCheck(self, base, basecmd, extcmds):
"""Verify that conditions are met so that this command can
commit 755f4f71426b3a25375bc25d3373395ece7b0b4a
Author: James Antill <james at and.org>
Date: Fri Aug 19 12:27:11 2011 -0400
Convert rpm/yumdb values to unicode, or python/sqlite will die. BZ 730365.
diff --git a/yum/history.py b/yum/history.py
index c91c33a..6449708 100644
--- a/yum/history.py
+++ b/yum/history.py
@@ -1295,7 +1295,7 @@ class YumHistory:
sql = """INSERT INTO pkg_%(db)sdb (pkgtupid, %(db)sdb_key, %(db)sdb_val)
VALUES (?, ?, ?)""" % {'db' : db}
- executeSQL(cur, sql, (pid, attr, val))
+ executeSQL(cur, sql, (pid, attr, to_unicode(val)))
for row in cur:
return row[0]
commit bc5dc00fc5ec3431378145a0f4a001359eb307b8
Author: James Antill <james at and.org>
Date: Thu Aug 18 11:28:02 2011 -0400
Don't look for the releasever, if we are overridding it. BZ 727966.
diff --git a/yum/__init__.py b/yum/__init__.py
index 5bbf079..5fb7c00 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -321,7 +321,7 @@ class YumBase(depsolve.Depsolve):
# Try the old default
fn = '/etc/yum.conf'
- startupconf = config.readStartupConfig(fn, root)
+ startupconf = config.readStartupConfig(fn, root, releasever)
startupconf.arch = arch
startupconf.basearch = self.arch.basearch
if uuid:
diff --git a/yum/config.py b/yum/config.py
index b0fd4f8..e4674d1 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -943,7 +943,7 @@ class VersionGroupConf(BaseConfig):
run_with_packages = BoolOption(False)
-def readStartupConfig(configfile, root):
+def readStartupConfig(configfile, root, releasever=None):
"""Parse Yum's main configuration file and return a
:class:`StartupConf` instance. This is required in order to
access configuration settings required as Yum starts up.
@@ -974,8 +974,13 @@ def readStartupConfig(configfile, root):
raise Errors.ConfigError("All plugin search paths must be absolute")
# Stuff this here to avoid later re-parsing
startupconf._parser = parser
+
# setup the release ver here
- startupconf.releasever = _getsysver(startupconf.installroot, startupconf.distroverpkg)
+ if releasever is None:
+ releasever = _getsysver(startupconf.installroot,
+ startupconf.distroverpkg)
+ startupconf.releasever = releasever
+
uuidfile = '%s/%s/uuid' % (startupconf.installroot, startupconf.persistdir)
startupconf.uuid = get_uuid(uuidfile)
More information about the Yum-commits
mailing list