[yum-commits] Branch 'yum-3_2_X' - 5 commits - cli.py docs/yum.conf.5 yum/config.py yum/__init__.py yum/rpmsack.py

James Antill james at osuosl.org
Thu Jul 14 18:21:10 UTC 2011


 cli.py          |   14 ++++++++++----
 docs/yum.conf.5 |   16 +++++++++++++---
 yum/__init__.py |    5 +++++
 yum/config.py   |    6 +++++-
 yum/rpmsack.py  |    6 ++++--
 5 files changed, 37 insertions(+), 10 deletions(-)

New commits:
commit cd0c1f7284dd7d13aa38694108eeea3d81d9ab91
Author: James Antill <james at and.org>
Date:   Thu Jul 14 14:21:03 2011 -0400

    Document the removal change for alwaysprompt.

diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index d069f06..3e229ea 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -128,9 +128,11 @@ Command-line option: \fB\--assumeno\fP
 \fBalwaysprompt\fR
 Either `1' or `0'. Without this option, yum will not prompt for confirmation
 when the list of packages to be installed exactly matches those given on the
-command line. Unless \fBassumeyes\fR is enabled, it will still prompt for
-package removal, or when additional packages need to be installed to fulfill
-dependencies. Default is `1'.
+command line. Unless \fBassumeyes\fR is enabled, it will still prompt when
+additional packages need to be installed to fulfill dependencies. Note that
+older versions of yum would also always prompt for package removal, and that is
+no longer true.
+Default is `1'.
 .br
 
 .IP
commit e902a6859fb22c85e4954f199d4b72c965ddab31
Author: James Antill <james at and.org>
Date:   Thu Jul 14 11:37:29 2011 -0400

    Add --assumeno which does the opposite of --assumeyes.

diff --git a/cli.py b/cli.py
index c69ec3b..7d332c1 100644
--- a/cli.py
+++ b/cli.py
@@ -25,7 +25,7 @@ import sys
 import time
 import random
 import logging
-from optparse import OptionParser,OptionGroup
+from optparse import OptionParser,OptionGroup,SUPPRESS_HELP
 import rpm
 
 from weakref import proxy as weakref
@@ -491,7 +491,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         
         # confirm with user
         if self._promptWanted():
-            if not self.userconfirm():
+            if self.conf.assumeno or not self.userconfirm():
                 self.verbose_logger.info(_('Exiting on user Command'))
                 return -1
 
@@ -1535,7 +1535,10 @@ class YumOptionParser(OptionParser):
                 
             # Handle remaining options
             if opts.assumeyes:
-                self.base.conf.assumeyes =1
+                self.base.conf.assumeyes = 1
+            if opts.assumeno:
+                self.base.conf.assumeno  = 1
+                self.base.conf.assumeyes = 0
 
             #  Instead of going cache-only for a non-root user, try to use a
             # user writable cachedir. If that fails fall back to cache-only.
@@ -1712,6 +1715,10 @@ class YumOptionParser(OptionParser):
                         help=_("verbose operation"))
         group.add_option("-y", "--assumeyes", dest="assumeyes",
                 action="store_true", help=_("answer yes for all questions"))
+        group.add_option("--assumeno", dest="assumeno",
+                action="store_true", help=_("answer no for all questions"))
+        group.add_option("--nodeps", dest="assumeno", # easter egg :)
+                action="store_true", help=SUPPRESS_HELP)
         group.add_option("--version", action="store_true", 
                 help=_("show Yum version and exit"))
         group.add_option("--installroot", help=_("set install root"), 
diff --git a/docs/yum.conf.5 b/docs/yum.conf.5
index 515aa73..d069f06 100644
--- a/docs/yum.conf.5
+++ b/docs/yum.conf.5
@@ -117,6 +117,14 @@ critical actions. Default is `0' (do prompt).
 Command-line option: \fB\-y\fP
 
 .IP
+\fBassumeno\fR
+Either `1' or `0'. If yum would prompt for confirmation of critical actions, 
+assume the user chose no. This is basically the same as doing "echo | yum ..."
+but is a bit more usable. Default is `0' (do prompt).
+.br
+Command-line option: \fB\--assumeno\fP
+
+.IP
 \fBalwaysprompt\fR
 Either `1' or `0'. Without this option, yum will not prompt for confirmation
 when the list of packages to be installed exactly matches those given on the
diff --git a/yum/__init__.py b/yum/__init__.py
index e9bc1f9..8951cdc 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -4729,6 +4729,8 @@ class YumBase(depsolve.Depsolve):
                     rc = False
                     if self.conf.assumeyes:
                         rc = True
+                    elif self.conf.assumeno:
+                        rc = False
                         
                     # grab the .sig/.asc for the keyurl, if it exists
                     # if it does check the signature on the key
@@ -4823,6 +4825,9 @@ class YumBase(depsolve.Depsolve):
                     rc = False
                     if self.conf.assumeyes:
                         rc = True
+                    elif self.conf.assumeno:
+                        rc = False
+
                     elif callback:
                         rc = callback({"repo": repo, "userid": info['userid'],
                                         "hexkeyid": info['hexkeyid'], "keyurl": keyurl,
diff --git a/yum/config.py b/yum/config.py
index dca13fa..dbf1784 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -664,6 +664,7 @@ class YumConf(StartupConf):
     tsflags = ListOption()
 
     assumeyes = BoolOption(False)
+    assumeno  = BoolOption(False)
     alwaysprompt = BoolOption(True)
     exactarch = BoolOption(True)
     tolerant = BoolOption(True)
commit 9b71caf771c9ef8ccb4143673b63c5002510c4f1
Author: James Antill <james at and.org>
Date:   Thu Jul 14 11:33:04 2011 -0400

    Allow remove to use alwaysprompt/etc. logic.

diff --git a/cli.py b/cli.py
index 6056d38..c69ec3b 100644
--- a/cli.py
+++ b/cli.py
@@ -1400,7 +1400,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         #  package wasn't explictly given on the command line
         for txmbr in self.tsInfo.getMembers():
             if txmbr.isDep or \
-                   txmbr.ts_state == 'e' or \
                    txmbr.name not in self.extcmds:
                 return True
         
commit 95692640d1ab3ff6bf3f09136a555fc2af2247d5
Author: James Antill <james at and.org>
Date:   Wed Jul 13 13:31:47 2011 -0400

    Give a message about weird rpmdb release provides problems.

diff --git a/yum/config.py b/yum/config.py
index cb7ed57..dca13fa 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -1028,7 +1028,10 @@ def _getsysver(installroot, distroverpkg):
     if idx.count() == 0:
         releasever = '$releasever'
     else:
-        hdr = idx.next()
+        try:
+            hdr = idx.next()
+        except StopIteration:
+            raise Errors.YumBaseError("Error: rpmdb failed release provides. Try: rpm --rebuilddb")
         releasever = hdr['version']
         del hdr
     del idx
commit aa7ac06acf3b8f26f79f6f75079fa19802e11bc8
Author: James Antill <james at and.org>
Date:   Wed Jul 13 10:43:58 2011 -0400

    When we call _deal_with_bad_rpmdbcache(), due to a package ... show the pkg.

diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index 9717912..ef6fbd5 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -375,7 +375,8 @@ class RPMDBPackageSack(PackageSackBase):
             pkg = self.searchNevra(n, e, v, r, a)
             if not pkg:
                 # Wibble?
-                self._deal_with_bad_rpmdbcache("dCDPT(pkg checksums)")
+                self._deal_with_bad_rpmdbcache("dCDPT(pkg checksums): %s" %
+                                               txmbr)
                 continue
 
             pkg = pkg[0]
@@ -1013,7 +1014,8 @@ class RPMDBPackageSack(PackageSackBase):
             (n, a, e, v, r) = pkgtup
             pkg = self.searchNevra(n, e, v, r, a)
             if not pkg:
-                self._deal_with_bad_rpmdbcache("pkg checksums")
+                self._deal_with_bad_rpmdbcache("pkg checksums: %s-%s:%s-%s.%s" %
+                                               (n, e, v, r, a))
                 continue
             pkg = pkg[0]
             (T, D) = checksum_data[pkgtup]


More information about the Yum-commits mailing list