diff --git a/yum-HEAD.patch b/yum-HEAD.patch index 2aa76fa..709dd33 100644 --- a/yum-HEAD.patch +++ b/yum-HEAD.patch @@ -456,7 +456,7 @@ index c8116ee..3520912 100644 List all available and installed packages\&. .IP "\fByum list available [glob_exp1] [\&.\&.\&.]\fP" diff --git a/docs/yum.conf.5 b/docs/yum.conf.5 -index 521ffed..ff24099 100644 +index 521ffed..69b601d 100644 --- a/docs/yum.conf.5 +++ b/docs/yum.conf.5 @@ -22,21 +22,25 @@ repository/server. There should be one or more repository sections. @@ -709,7 +709,7 @@ index 521ffed..ff24099 100644 Enable bandwidth throttling for downloads. This option can be expressed as a absolute data rate in bytes/sec. An SI prefix (k, M or G) may be appended to the bandwidth value (eg. `5.5k' is 5.5 kilobytes/sec, `2M' is 2 Megabytes/sec). -@@ -212,47 +245,58 @@ the maximum available bandwidth. +@@ -212,47 +245,78 @@ the maximum available bandwidth. Set to `0' to disable bandwidth throttling. This is the default. @@ -724,6 +724,26 @@ index 521ffed..ff24099 100644 -.IP \fBcommands\fR +.IP ++\fBsslcacert \fR ++Path to the directory containing the databases of the certificate authorities ++yum should use to verify ssl certificates. Defaults to none - uses system ++default ++ ++.IP ++\fBsslverify \fR ++Boolean - should yum verify ssl certificates/hosts at all. Defaults to True ++ ++.IP ++\fBsslclientcert \fR ++Path to the ssl client certificate yum should use to connect to repos/remote sites ++Defaults to none. ++ ++.IP ++\fBsslclientkey \fR ++Path to the ssl client key yum should use to connect to repos/remote sites ++Defaults to none. ++ ++.IP +\fBcommands\fR List of functional commands to run if no functional commands are specified on the command line (eg. "update foo bar baz quux"). None of the short options @@ -782,7 +802,7 @@ index 521ffed..ff24099 100644 Time (in seconds) after which the metadata will expire. So that if the current metadata downloaded is less than this many seconds old then yum will not update the metadata against the repository. If you find that -@@ -265,7 +309,8 @@ never expire. Note that when using a metalink file the metalink must always +@@ -265,7 +329,8 @@ never expire. Note that when using a metalink file the metalink must always be newer than the metadata for the repository, due to the validation, so this timeout also applies to the metalink file. @@ -792,7 +812,7 @@ index 521ffed..ff24099 100644 Time (in seconds) after which the mirrorlist locally cached will expire. If the current mirrorlist is less than this many seconds old then yum will not download another copy of the mirrorlist, it has the same extra format -@@ -273,12 +318,13 @@ as metadata_expire. +@@ -273,12 +338,13 @@ as metadata_expire. If you find that yum is not downloading the mirrorlists as often as you would like lower the value of this option. @@ -808,7 +828,7 @@ index 521ffed..ff24099 100644 metadata is corrupt in any way yum will revert to the previous metadata. `instant' - Just download the new metadata index, this is roughly what yum -@@ -295,7 +341,7 @@ This file also tends to be significantly smaller than most others. +@@ -295,7 +361,7 @@ This file also tends to be significantly smaller than most others. `group:main' - With the primary and updateinfo download the filelists metadata and the group metadata. The filelists data is required for operations like @@ -817,7 +837,7 @@ index 521ffed..ff24099 100644 group data is used in some graphical clients and for group operations like "yum grouplist Base". -@@ -303,91 +349,106 @@ group data is used in some graphical clients and for group operations like +@@ -303,91 +369,106 @@ group data is used in some graphical clients and for group operations like not listed above is the other metadata, which contains the changelog information which is used by yum-changelog. This is what "yum makecache" uses. @@ -948,7 +968,7 @@ index 521ffed..ff24099 100644 The colorization/highlighting for packages in the "updates list" which need to be downloaded. The updates list is what is printed when you run "yum update", "yum list updates", "yum list obsoletes" and "yum check-update". -@@ -397,7 +458,8 @@ See color_list_installed_older for possible values. +@@ -397,7 +478,8 @@ See color_list_installed_older for possible values. .SH "[repository] OPTIONS" .LP The repository section(s) take the following form: @@ -958,7 +978,7 @@ index 521ffed..ff24099 100644 [repositoryid] .br name=Some name for this repository -@@ -405,13 +467,16 @@ name=Some name for this repository +@@ -405,13 +487,16 @@ name=Some name for this repository baseurl=url://path/to/repository/ .br @@ -978,7 +998,7 @@ index 521ffed..ff24099 100644 Must be a URL to the directory where the yum repository's `repodata' directory lives. Can be an http://, ftp:// or file:// URL. You can specify multiple URLs in one baseurl statement. The best way to do this is like this: -@@ -434,7 +499,8 @@ you've been warned. +@@ -434,7 +519,8 @@ you've been warned. You can use HTTP basic auth by prepending "user:password@" to the server name in the baseurl line. For example: "baseurl=http://user:passwd@example.com/". @@ -988,7 +1008,7 @@ index 521ffed..ff24099 100644 Specifies a URL to a metalink file for the repomd.xml, a list of mirrors for the entire repository are generated by converting the mirrors for the repomd.xml file to a baseurl. The metalink file also contains the latest -@@ -446,7 +512,8 @@ below, can be used with this option. This option disables the mirrorlist option. +@@ -446,7 +532,8 @@ below, can be used with this option. This option disables the mirrorlist option. As a special hack is the mirrorlist URL contains the word "metalink" then the value of mirrorlist is copied to metalink (if metalink is not set). @@ -998,7 +1018,7 @@ index 521ffed..ff24099 100644 Specifies a URL to a file containing a list of baseurls. This can be used instead of or with the \fBbaseurl\fR option. Substitution variables, described below, can be used with this option. -@@ -454,19 +521,23 @@ As a special hack is the mirrorlist URL contains the word "metalink" then the +@@ -454,19 +541,23 @@ As a special hack is the mirrorlist URL contains the word "metalink" then the value of mirrorlist is copied to metalink (if metalink is not set). @@ -1027,7 +1047,7 @@ index 521ffed..ff24099 100644 option is used if yum needs a public key to verify a package and the required key hasn't been imported into the RPM database. If this option is set, yum will automatically import the key from the specified URL. You will be prompted before -@@ -476,21 +547,25 @@ Multiple URLs may be specified here in the same manner as the \fBbaseurl\fR +@@ -476,21 +567,25 @@ Multiple URLs may be specified here in the same manner as the \fBbaseurl\fR option (above). If a GPG key is required to install a package from a repository, all keys specified for that repository will be installed. @@ -1057,7 +1077,7 @@ index 521ffed..ff24099 100644 Either `roundrobin' or `priority'. `roundrobin' randomly selects a URL out of -@@ -502,50 +577,62 @@ sequentially. +@@ -502,50 +597,84 @@ sequentially. \fBfailovermethod\fR defaults to `roundrobin' if not specified. @@ -1096,6 +1116,28 @@ index 521ffed..ff24099 100644 repository. -.IP \fBmetadata_expire \fR ++ ++.IP ++\fBsslcacert \fR ++Overrides the \fBsslcacert\fR option from the [main] section for this ++repository. ++ ++.IP ++\fBsslverify \fR ++Overrides the \fBsslverify\fR option from the [main] section for this ++repository. ++ ++.IP ++\fBsslclientcert \fR ++Overrides the \fBsslclientcert\fR option from the [main] section for this ++repository. ++ ++.IP ++\fBsslclientkey \fR ++Overrides the \fBsslclientkey\fR option from the [main] section for this ++repository. ++ ++ +.IP +\fBmetadata_expire \fR Overrides the \fBmetadata_expire\fR option from the [main] section for this @@ -1132,7 +1174,7 @@ index 521ffed..ff24099 100644 relative cost of accessing this repository. Useful for weighing one repo's packages as greater/less than any other. defaults to 1000 -@@ -568,20 +655,24 @@ configuration files. They are available in the values of several options +@@ -568,20 +697,24 @@ configuration files. They are available in the values of several options including \fBname\fR, \fBbaseurl\fR and \fBcommands\fB. .LP @@ -1162,7 +1204,7 @@ index 521ffed..ff24099 100644 the same name. If the shell environment variable does not exist then the configuration file variable will not be replaced. diff --git a/output.py b/output.py -index 7803275..60c1dcf 100755 +index 7803275..2299a9c 100755 --- a/output.py +++ b/output.py @@ -141,10 +141,6 @@ class YumTerm: @@ -1205,16 +1247,17 @@ index 7803275..60c1dcf 100755 else: print key % item print '\n\n' -@@ -902,7 +902,7 @@ class YumOutput: +@@ -902,8 +902,7 @@ class YumOutput: def listTransaction(self): """returns a string rep of the transaction in an easy-to-read way.""" - self.tsInfo.makelists() +- out = u"" + self.tsInfo.makelists(True, True) - out = u"" pkglist_lines = [] data = {'n' : {}, 'v' : {}, 'r' : {}} -@@ -938,6 +938,8 @@ class YumOutput: + a_wid = 0 # Arch can't get "that big" ... so always use the max. +@@ -938,6 +937,8 @@ class YumOutput: for (action, pkglist) in [(_('Installing'), self.tsInfo.installed), (_('Updating'), self.tsInfo.updated), (_('Removing'), self.tsInfo.removed), @@ -1223,7 +1266,18 @@ index 7803275..60c1dcf 100755 (_('Installing for dependencies'), self.tsInfo.depinstalled), (_('Updating for dependencies'), self.tsInfo.depupdated), (_('Removing for dependencies'), self.tsInfo.depremoved)]: -@@ -963,7 +965,7 @@ class YumOutput: +@@ -955,7 +956,9 @@ class YumOutput: + + pkglist_lines.append((action, lines)) + +- if data['n']: ++ if not data['n']: ++ return u'' ++ else: + data = [data['n'], {}, data['v'], data['r'], {}] + columns = [1, a_wid, 1, 1, 5] + columns = self.calcColumns(data, indent=" ", columns=columns, +@@ -963,7 +966,7 @@ class YumOutput: (n_wid, a_wid, v_wid, r_wid, s_wid) = columns assert s_wid == 5 @@ -1232,7 +1286,7 @@ index 7803275..60c1dcf 100755 %s %s %s -@@ -971,7 +973,7 @@ class YumOutput: +@@ -971,7 +974,7 @@ class YumOutput: self.fmtColumns(((_('Package'), -n_wid), (_('Arch'), -a_wid), (_('Version'), -v_wid), (_('Repository'), -r_wid), (_('Size'), s_wid)), u" "), @@ -1241,7 +1295,7 @@ index 7803275..60c1dcf 100755 for (action, lines) in pkglist_lines: if lines: -@@ -989,21 +991,33 @@ class YumOutput: +@@ -989,21 +992,33 @@ class YumOutput: totalmsg = totalmsg + msg if lines: @@ -1285,7 +1339,7 @@ index 7803275..60c1dcf 100755 def postTransactionOutput(self): out = '' -@@ -1125,7 +1139,8 @@ Remove %5.5s Package(s) +@@ -1125,7 +1140,8 @@ Remove %5.5s Package(s) # to exit. # Where "interupt (ctrl-c) again" and "two" are highlighted. msg = _(""" @@ -1295,7 +1349,7 @@ index 7803275..60c1dcf 100755 """) % (hibeg, hiend, hibeg, delta_exit_str, hiend) self.verbose_logger.log(logginglevels.INFO_2, msg) elif now - self._last_interrupt < delta_exit_chk: -@@ -1146,6 +1161,8 @@ Remove %5.5s Package(s) +@@ -1146,6 +1162,8 @@ Remove %5.5s Package(s) tl = urlgrabber.progress.TerminalLine(8) self.verbose_logger.log(logginglevels.INFO_2, "-" * tl.rest()) dl_time = time.time() - download_start_timestamp @@ -18985,8 +19039,8 @@ index 22e1334..b8a0b67 100644 # This file is distributed under the same license as the yum package. # Göran Uddeborg , 2009. # --# $Id: yum-HEAD.patch,v 1.29 2009/08/18 18:54:54 skvidal Exp $ -+# $Id: yum-HEAD.patch,v 1.29 2009/08/18 18:54:54 skvidal Exp $ +-# $Id: yum-HEAD.patch,v 1.30 2009/08/31 20:52:07 skvidal Exp $ ++# $Id: yum-HEAD.patch,v 1.30 2009/08/31 20:52:07 skvidal Exp $ # msgid "" msgstr "" @@ -21240,9 +21294,18 @@ index 22e1334..b8a0b67 100644 #: ../rpmUtils/oldUtils.py:174 msgid "Got an empty Header, something has gone wrong" diff --git a/rpmUtils/arch.py b/rpmUtils/arch.py -index e88cbde..b493b6a 100644 +index e88cbde..d22782b 100644 --- a/rpmUtils/arch.py +++ b/rpmUtils/arch.py +@@ -291,7 +291,7 @@ def getCanonX86_64Arch(arch): + if vendor is None: + return arch + +- if vendor.find("Authentic AMD") != -1: ++ if vendor.find("Authentic AMD") != -1 or vendor.find("AuthenticAMD") != -1: + return "amd64" + if vendor.find("GenuineIntel") != -1: + return "ia32e" @@ -380,3 +380,41 @@ def getBaseArch(myarch=None): return basearch @@ -21323,10 +21386,10 @@ index 0e04194..a925027 100644 os.close(fdno) return hdr diff --git a/rpmUtils/updates.py b/rpmUtils/updates.py -index 0e697bc..3ce1eba 100644 +index 0e697bc..f2d43f8 100644 --- a/rpmUtils/updates.py +++ b/rpmUtils/updates.py -@@ -48,7 +48,12 @@ class Updates: +@@ -48,10 +48,15 @@ class Updates: self.myarch = rpmUtils.arch.canonArch # set this if you want to # test on some other arch # otherwise leave it alone @@ -21338,17 +21401,66 @@ index 0e697bc..3ce1eba 100644 + # make some dicts from installed and available self.installdict = self.makeNADict(self.installed, 1) - self.availdict = self.makeNADict(self.available, 1) -@@ -291,7 +296,7 @@ class Updates: - newpkgs = [] +- self.availdict = self.makeNADict(self.available, 1) ++ self.availdict = self.makeNADict(self.available, 0) # Done in doUpdate + + # holder for our updates dict + self.updatesdict = {} +@@ -288,19 +293,10 @@ class Updates: + # make the new ones a list b/c while we _shouldn't_ + # have multiple updaters, we might and well, it needs + # to be solved one way or the other +- newpkgs = [] newpkgs = self.availdict - archlist = rpmUtils.arch.getArchList(self.myarch) + archlist = self._archlist for (n, a) in newpkgs.keys(): - # remove stuff not in our archdict - # high log here -@@ -408,14 +413,14 @@ class Updates: +- # remove stuff not in our archdict +- # high log here +- if a is None: +- for (arch, e,v,r) in newpkgs[(n, a)]: +- if arch not in archlist: +- newpkgs[(n, a)].remove((arch, e,v,r)) +- continue +- + if a not in archlist: + # high log here + del newpkgs[(n, a)] +@@ -309,19 +305,12 @@ class Updates: + # remove the older stuff - if we're doing an update we only want the + # newest evrs + for (n, a) in newpkgs: +- if a is None: +- continue +- + (new_e,new_v,new_r) = self.returnNewest(newpkgs[(n, a)]) +- for (e, v, r) in newpkgs[(n, a)]: ++ for (e, v, r) in newpkgs[(n, a)][:]: + if (new_e, new_v, new_r) != (e, v, r): + newpkgs[(n, a)].remove((e, v, r)) + +- + for (n, a) in newpkgs: +- if a is None: # the None archs are only for lookups +- continue +- + # simple ones - look for exact matches or older stuff + if self.installdict.has_key((n, a)): + for (rpm_e, rpm_v, rpm_r) in self.installdict[(n, a)]: +@@ -337,6 +326,11 @@ class Updates: + except ValueError: + pass + ++ # Now we add the (n, None) entries back... ++ for na in newpkgs.keys(): ++ all_arches = map(lambda x: (na[1], x[0], x[1], x[2]), newpkgs[na]) ++ newpkgs.setdefault((na[0], None), []).extend(all_arches) ++ + # get rid of all the empty dict entries: + for nakey in newpkgs.keys(): + if len(newpkgs[nakey]) == 0: +@@ -408,14 +402,14 @@ class Updates: # however, we do want to descend x86_64->noarch, sadly. archlists = [] @@ -21994,6 +22106,22 @@ index 9cab5f9..cadc28b 100644 self.depsolver._pkgSack.addPackage(po) self.depsolver.basecmd = args[0] +diff --git a/test/yum-pylintrc b/test/yum-pylintrc +index f7aee50..bb9339a 100644 +--- a/test/yum-pylintrc ++++ b/test/yum-pylintrc +@@ -80,9 +80,9 @@ disable-msg-cat=C,R + # W1001: *Use of "property" on an old style class* + # W0221: *Arguments number differs from %s method* + # W0703: *Catch "Exception"* +-# W1010: *Exception doesn't inherit from standard "Exception" class* (give false positives on ex. KeyboardInterrupt) ++# W0710: *Exception doesn't inherit from standard "Exception" class* (give false positives on ex. KeyboardInterrupt) + # W0631: *Using possibly undefined loop variable %r* (Gives to many false positives) +-disable-msg=E1101,F0401,W0704,W0612,W0212,W0613,W0602,W0511,W0401,W0614,W0232,W0201,W0603,W0621,W0142,W0102,W0105,W0702,W0231,E0202,W0622,W0403,W0223,W0104,W1001,W0221,W0703,W1010,W0631 ++disable-msg=E1101,F0401,W0704,W0612,W0212,W0613,W0602,W0511,W0401,W0614,W0232,W0201,W0603,W0621,W0142,W0102,W0105,W0702,W0231,E0202,W0622,W0403,W0223,W0104,W1001,W0221,W0703,W0710,W0631 + + + [REPORTS] diff --git a/test/yum-release-i18n-test.sh b/test/yum-release-i18n-test.sh index 33f5491..93ddcb3 100755 --- a/test/yum-release-i18n-test.sh @@ -22028,7 +22156,7 @@ index 322765e..6f0ffe4 100644 pass diff --git a/yum/__init__.py b/yum/__init__.py -index 6378cdc..0df32a3 100644 +index 6378cdc..97e38c3 100644 --- a/yum/__init__.py +++ b/yum/__init__.py @@ -36,18 +36,14 @@ import yum.i18n @@ -22455,7 +22583,30 @@ index 6378cdc..0df32a3 100644 best.append('noarch') for pkg in pkgs: if pkg.arch in best: -@@ -2416,7 +2456,7 @@ class YumBase(depsolve.Depsolve): +@@ -2355,15 +2395,20 @@ class YumBase(depsolve.Depsolve): + """Pass in a generic [build]require string and this function will + pass back the best(or first) package it finds providing that dep.""" + ++ # we get all sorts of randomness here ++ errstring = depstring ++ if type(depstring) not in types.StringTypes: ++ errtring = str(depstring) ++ + try: + pkglist = self.returnPackagesByDep(depstring) + except Errors.YumBaseError: +- raise Errors.YumBaseError, _('No Package found for %s') % depstring ++ raise Errors.YumBaseError, _('No Package found for %s') % errstring + + ps = ListPackageSack(pkglist) + result = self._bestPackageFromList(ps.returnNewestByNameArch()) + if result is None: +- raise Errors.YumBaseError, _('No Package found for %s') % depstring ++ raise Errors.YumBaseError, _('No Package found for %s') % errstring + + return result + +@@ -2416,7 +2461,7 @@ class YumBase(depsolve.Depsolve): multilib to singlelib packages""" returnlist = [] @@ -22464,7 +22615,7 @@ index 6378cdc..0df32a3 100644 multiLib = [] singleLib = [] noarch = [] -@@ -2425,7 +2465,7 @@ class YumBase(depsolve.Depsolve): +@@ -2425,7 +2470,7 @@ class YumBase(depsolve.Depsolve): continue elif po.arch in ("noarch"): noarch.append(po) @@ -22473,7 +22624,7 @@ index 6378cdc..0df32a3 100644 multiLib.append(po) else: singleLib.append(po) -@@ -2466,6 +2506,14 @@ class YumBase(depsolve.Depsolve): +@@ -2466,6 +2511,14 @@ class YumBase(depsolve.Depsolve): return returnlist @@ -22488,7 +22639,7 @@ index 6378cdc..0df32a3 100644 def _pkg2obspkg(self, po): """ Given a package return the package it's obsoleted by and so we should install instead. Or None if there isn't one. """ -@@ -2538,10 +2586,18 @@ class YumBase(depsolve.Depsolve): +@@ -2538,10 +2591,18 @@ class YumBase(depsolve.Depsolve): def _find_obsoletees(self, po): """ Return the pkgs. that are obsoleted by the po we pass in. """ @@ -22511,7 +22662,7 @@ index 6378cdc..0df32a3 100644 def _add_prob_flags(self, *flags): """ Add all of the passed flags to the tsInfo.probFilterFlags array. """ -@@ -2614,14 +2670,14 @@ class YumBase(depsolve.Depsolve): +@@ -2614,14 +2675,14 @@ class YumBase(depsolve.Depsolve): # only do these things if we're multilib @@ -22528,7 +22679,7 @@ index 6378cdc..0df32a3 100644 best.append('noarch') for pkg in pkgs: if pkg.arch in best: -@@ -2658,6 +2714,8 @@ class YumBase(depsolve.Depsolve): +@@ -2658,6 +2719,8 @@ class YumBase(depsolve.Depsolve): ignore_case=False) if 'name' in kwargs: pkgs = self.rpmdb.searchNevra(name=kwargs['name']) @@ -22537,7 +22688,7 @@ index 6378cdc..0df32a3 100644 # Warning here does "weird" things when doing: # yum --disablerepo='*' install '*' # etc. ... see RHBZ#480402 -@@ -2693,9 +2751,23 @@ class YumBase(depsolve.Depsolve): +@@ -2693,9 +2756,23 @@ class YumBase(depsolve.Depsolve): # at which point ignore everything. obsoleting_pkg = self._test_loop(po, self._pkg2obspkg) if obsoleting_pkg is not None: @@ -22564,7 +22715,19 @@ index 6378cdc..0df32a3 100644 continue # make sure it's not already installed -@@ -2744,7 +2816,7 @@ class YumBase(depsolve.Depsolve): +@@ -2730,6 +2807,11 @@ class YumBase(depsolve.Depsolve): + self._add_prob_flags(rpm.RPMPROB_FILTER_REPLACEPKG, + rpm.RPMPROB_FILTER_REPLACENEWFILES, + rpm.RPMPROB_FILTER_REPLACEOLDFILES) ++ # Yum needs the remove to happen before we allow the ++ # install of the same version. But rpm doesn't like that ++ # as it then has an install which removes the old version ++ # and a remove, which also tries to remove the old version. ++ self.tsInfo.remove(ipkg.pkgtup) + break + if ipkg.verGT(po): + self._add_prob_flags(rpm.RPMPROB_FILTER_OLDPACKAGE) +@@ -2744,7 +2826,7 @@ class YumBase(depsolve.Depsolve): else: txmbr = self.tsInfo.addInstall(po) tx_return.append(txmbr) @@ -22573,7 +22736,7 @@ index 6378cdc..0df32a3 100644 return tx_return def _check_new_update_provides(self, opkg, npkg): -@@ -2753,6 +2825,7 @@ class YumBase(depsolve.Depsolve): +@@ -2753,6 +2835,7 @@ class YumBase(depsolve.Depsolve): too, to the latest version. """ oprovs = set(opkg.returnPrco('provides')) nprovs = set(npkg.returnPrco('provides')) @@ -22581,7 +22744,7 @@ index 6378cdc..0df32a3 100644 for prov in oprovs.difference(nprovs): reqs = self.tsInfo.getRequires(*prov) for pkg in reqs: -@@ -2760,10 +2833,11 @@ class YumBase(depsolve.Depsolve): +@@ -2760,10 +2843,11 @@ class YumBase(depsolve.Depsolve): if not npkg.inPrcoRange('provides', req): naTup = (pkg.name, pkg.arch) for pkg in self.pkgSack.returnNewestByNameArch(naTup): @@ -22595,7 +22758,7 @@ index 6378cdc..0df32a3 100644 """ We return True if there is a newer package already in the transaction. If there is an older one, we remove it (and update any deps. that aren't satisfied by the newer pkg) and return False so -@@ -2777,8 +2851,9 @@ class YumBase(depsolve.Depsolve): +@@ -2777,8 +2861,9 @@ class YumBase(depsolve.Depsolve): else: for ntxmbr in self.tsInfo.getMembers(po.pkgtup): self.tsInfo.remove(ntxmbr.po.pkgtup) @@ -22607,7 +22770,7 @@ index 6378cdc..0df32a3 100644 if count: found = True else: -@@ -2810,6 +2885,9 @@ class YumBase(depsolve.Depsolve): +@@ -2810,6 +2895,9 @@ class YumBase(depsolve.Depsolve): for (obsoleting, installed) in obsoletes: obsoleting_pkg = self.getPackageObject(obsoleting) @@ -22617,7 +22780,20 @@ index 6378cdc..0df32a3 100644 installed_pkg = self.rpmdb.searchPkgTuple(installed)[0] txmbr = self.tsInfo.addObsoleting(obsoleting_pkg, installed_pkg) self.tsInfo.addObsoleted(installed_pkg, obsoleting_pkg) -@@ -2949,11 +3027,20 @@ class YumBase(depsolve.Depsolve): +@@ -2861,7 +2949,11 @@ class YumBase(depsolve.Depsolve): + # Always look for available packages, it doesn't seem to do any + # harm (apart from some time). And it fixes weird edge cases where + # "update a" (which requires a new b) is different from "update b" +- m =self.pkgSack.returnNewestByNameArch(patterns=[kwargs['pattern']]) ++ try: ++ pats = [kwargs['pattern']] ++ m = self.pkgSack.returnNewestByNameArch(patterns=pats) ++ except Errors.PackageSackError: ++ m = [] + availpkgs.extend(m) + + if not availpkgs and not instpkgs: +@@ -2949,11 +3041,20 @@ class YumBase(depsolve.Depsolve): tx_return.append(txmbr) for available_pkg in availpkgs: @@ -22639,7 +22815,7 @@ index 6378cdc..0df32a3 100644 self.verbose_logger.log(logginglevels.DEBUG_2, _('Not Updating Package that is already updated: %s.%s %s:%s-%s'), updated) -@@ -2979,7 +3066,8 @@ class YumBase(depsolve.Depsolve): +@@ -2979,7 +3080,8 @@ class YumBase(depsolve.Depsolve): if self.tsInfo.isObsoleted(ipkg.pkgtup): self.verbose_logger.log(logginglevels.DEBUG_2, _('Not Updating Package that is already obsoleted: %s.%s %s:%s-%s'), ipkg.pkgtup) @@ -22649,7 +22825,7 @@ index 6378cdc..0df32a3 100644 self.verbose_logger.log(logginglevels.DEBUG_2, _('Not Updating Package that is already updated: %s.%s %s:%s-%s'), ipkg.pkgtup) elif ipkg.verLT(available_pkg): -@@ -2987,12 +3075,6 @@ class YumBase(depsolve.Depsolve): +@@ -2987,12 +3089,6 @@ class YumBase(depsolve.Depsolve): if requiringPo: txmbr.setAsDep(requiringPo) tx_return.append(txmbr) @@ -22662,7 +22838,7 @@ index 6378cdc..0df32a3 100644 return tx_return -@@ -3065,7 +3147,6 @@ class YumBase(depsolve.Depsolve): +@@ -3065,7 +3161,6 @@ class YumBase(depsolve.Depsolve): # append it to self.localPackages # check if it can be installed or updated based on nevra versus rpmdb # don't import the repos until we absolutely need them for depsolving @@ -22670,7 +22846,7 @@ index 6378cdc..0df32a3 100644 tx_return = [] installpkgs = [] updatepkgs = [] -@@ -3085,7 +3166,7 @@ class YumBase(depsolve.Depsolve): +@@ -3085,7 +3180,7 @@ class YumBase(depsolve.Depsolve): # do this: but it's not a config file sort of thing # FIXME: Should add noarch, yum localinstall works ... # just rm this method? @@ -22679,7 +22855,7 @@ index 6378cdc..0df32a3 100644 self.logger.critical(_('Cannot add package %s to transaction. Not a compatible architecture: %s'), pkg, po.arch) return tx_return -@@ -3110,8 +3191,8 @@ class YumBase(depsolve.Depsolve): +@@ -3110,8 +3205,8 @@ class YumBase(depsolve.Depsolve): updatepkgs.append((po, installed_pkg)) elif po.verEQ(installed_pkg): if (po.arch != installed_pkg.arch and @@ -22690,7 +22866,7 @@ index 6378cdc..0df32a3 100644 installpkgs.append(po) else: donothingpkgs.append(po) -@@ -3148,7 +3229,20 @@ class YumBase(depsolve.Depsolve): +@@ -3148,7 +3243,20 @@ class YumBase(depsolve.Depsolve): for po in donothingpkgs: self.verbose_logger.log(logginglevels.INFO_2, _('%s: does not update installed package.'), po.localpath) @@ -22712,7 +22888,7 @@ index 6378cdc..0df32a3 100644 return tx_return def reinstallLocal(self, pkg, po=None): -@@ -3171,7 +3265,7 @@ class YumBase(depsolve.Depsolve): +@@ -3171,7 +3279,7 @@ class YumBase(depsolve.Depsolve): self.verbose_logger.log(logginglevels.INFO_2, _('Examining %s: %s'), po.localpath, po) @@ -22721,7 +22897,7 @@ index 6378cdc..0df32a3 100644 self.logger.critical(_('Cannot add package %s to transaction. Not a compatible architecture: %s'), pkg, po.arch) return [] -@@ -3197,14 +3291,18 @@ class YumBase(depsolve.Depsolve): +@@ -3197,14 +3305,18 @@ class YumBase(depsolve.Depsolve): rpm.RPMPROB_FILTER_REPLACEOLDFILES) tx_mbrs = [] @@ -22743,7 +22919,7 @@ index 6378cdc..0df32a3 100644 #FIXME future - if things in the rpm transaction handling get # a bit finer-grained, then we should allow reinstalls of kernels # for now, banned and dropped. -@@ -3222,16 +3320,17 @@ class YumBase(depsolve.Depsolve): +@@ -3222,16 +3334,17 @@ class YumBase(depsolve.Depsolve): if isinstance(po, YumLocalPackage): members = self.install(po=po) else: @@ -22765,7 +22941,7 @@ index 6378cdc..0df32a3 100644 tx_mbrs.extend(new_members) return tx_mbrs -@@ -3255,7 +3354,7 @@ class YumBase(depsolve.Depsolve): +@@ -3255,7 +3368,7 @@ class YumBase(depsolve.Depsolve): self.verbose_logger.log(logginglevels.INFO_2, _('Examining %s: %s'), po.localpath, po) @@ -22774,7 +22950,7 @@ index 6378cdc..0df32a3 100644 self.logger.critical(_('Cannot add package %s to transaction. Not a compatible architecture: %s'), pkg, po.arch) return [] -@@ -3385,14 +3484,11 @@ class YumBase(depsolve.Depsolve): +@@ -3385,14 +3498,11 @@ class YumBase(depsolve.Depsolve): na = (po.name, po.arch) if na not in downgrade_apkgs: continue @@ -22792,7 +22968,7 @@ index 6378cdc..0df32a3 100644 return tx_return -@@ -3596,6 +3692,36 @@ class YumBase(depsolve.Depsolve): +@@ -3596,6 +3706,36 @@ class YumBase(depsolve.Depsolve): def _limit_installonly_pkgs(self): @@ -22829,7 +23005,7 @@ index 6378cdc..0df32a3 100644 if self.conf.installonly_limit < 1 : return -@@ -3612,9 +3738,9 @@ class YumBase(depsolve.Depsolve): +@@ -3612,9 +3752,9 @@ class YumBase(depsolve.Depsolve): if (m.name == instpkg or instpkg in m.po.provides_names) \ and m.ts_state in ('i', 'u'): installed = self.rpmdb.searchNevra(name=m.name) @@ -22840,7 +23016,7 @@ index 6378cdc..0df32a3 100644 for po in installed: if (po.version, po.release) == (cur_kernel_v, cur_kernel_r): # don't remove running -@@ -3714,6 +3840,15 @@ class YumBase(depsolve.Depsolve): +@@ -3714,6 +3854,15 @@ class YumBase(depsolve.Depsolve): _('Running rpm_check_debug')) msgs = self._run_rpm_check_debug() if msgs: @@ -22856,7 +23032,7 @@ index 6378cdc..0df32a3 100644 retmsgs = [_('ERROR with rpm_check_debug vs depsolve:')] retmsgs.extend(msgs) retmsgs.append(_('Please report this error at %s') -@@ -3828,3 +3963,19 @@ class YumBase(depsolve.Depsolve): +@@ -3828,3 +3977,19 @@ class YumBase(depsolve.Depsolve): self.repos.enableRepo(newrepo.id) return newrepo @@ -23162,10 +23338,18 @@ index 1f406bb..c7f5f83 100755 pass diff --git a/yum/misc.py b/yum/misc.py -index 7d4ee61..ab92b78 100644 +index 7d4ee61..68ab9e4 100644 --- a/yum/misc.py +++ b/yum/misc.py -@@ -24,13 +24,13 @@ except ImportError: +@@ -10,6 +10,7 @@ import base64 + import struct + import re + import errno ++import Errors + import pgpmsg + import tempfile + import glob +@@ -24,13 +25,13 @@ except ImportError: gpgme = None try: import hashlib @@ -23181,7 +23365,22 @@ index 7d4ee61..ab92b78 100644 _default_checksums = ['sha1'] class hashlib: -@@ -815,7 +815,7 @@ def setup_locale(override_codecs=True, override_time=False): +@@ -629,8 +630,13 @@ def bunzipFile(source,dest): + break + + if not data: break +- destination.write(data) + ++ try: ++ destination.write(data) ++ except (OSError, IOError), e: ++ msg = "Error writing to file %s: %s" % (dest, str(e)) ++ raise Errors.MiscError, msg ++ + destination.close() + s_fn.close() + +@@ -815,7 +821,7 @@ def setup_locale(override_codecs=True, override_time=False): def get_my_lang_code(): @@ -23191,7 +23390,7 @@ index 7d4ee61..ab92b78 100644 mylang = 'C' else: diff --git a/yum/packageSack.py b/yum/packageSack.py -index f405217..b71356a 100644 +index f405217..3716410 100644 --- a/yum/packageSack.py +++ b/yum/packageSack.py @@ -25,6 +25,30 @@ import fnmatch @@ -23261,7 +23460,17 @@ index f405217..b71356a 100644 def returnNewestByNameArch(self, naTup=None, patterns=None, ignore_case=False): """return list of newest packages based on name, arch matching -@@ -397,6 +450,20 @@ class MetaSack(PackageSackBase): +@@ -390,13 +443,29 @@ class MetaSack(PackageSackBase): + + + def returnPackages(self, repoid=None, patterns=None, ignore_case=False): +- """return list of all packages, takes optional repoid""" ++ """Returns a list of packages. Note that the packages are ++ always filtered to those matching the patterns/case. An optional ++ repoid allows you to easily get data for a specific repo. """ + if not repoid: + return self._computeAggregateListResult("returnPackages", + None, patterns, ignore_case) return self.sacks[repoid].returnPackages(patterns=patterns, ignore_case=ignore_case) @@ -23282,8 +23491,20 @@ index f405217..b71356a 100644 def returnNewestByNameArch(self, naTup=None, patterns=None, ignore_case=False): """return list of newest packages based on name, arch matching +@@ -691,10 +760,7 @@ class PackageSack(PackageSackBase): + repoid = obj.repoid + (name, arch, epoch, ver, rel) = obj.pkgtup + +- if self.compatarchs: +- if self.compatarchs.has_key(arch): +- self._addToDictAsList(self.pkgsByRepo, repoid, obj) +- else: ++ if not self.compatarchs or arch in self.compatarchs: + self._addToDictAsList(self.pkgsByRepo, repoid, obj) + if self.indexesBuilt: + self._addPackageToIndex(obj) diff --git a/yum/packages.py b/yum/packages.py -index e3a12f2..99ff538 100644 +index e3a12f2..9a56fc4 100644 --- a/yum/packages.py +++ b/yum/packages.py @@ -27,8 +27,8 @@ import re @@ -23351,7 +23572,38 @@ index e3a12f2..99ff538 100644 def doepoch(self): tmpepoch = self.hdr['epoch'] -@@ -1386,8 +1392,14 @@ class YumInstalledPackage(YumHeaderPackage): +@@ -1154,24 +1160,13 @@ class YumHeaderPackage(YumAvailablePackage): + if not self.__mode_cache.has_key(mode): + self.__mode_cache[mode] = stat.S_ISDIR(mode) + ++ fkey = 'file' + if self.__mode_cache[mode]: +- if not self.files.has_key('dir'): +- self.files['dir'] = [] +- self.files['dir'].append(fn) +- else: +- if flag is None: +- if not self.files.has_key('file'): +- self.files['file'] = [] +- self.files['file'].append(fn) +- else: +- if (flag & 64): +- if not self.files.has_key('ghost'): +- self.files['ghost'] = [] +- self.files['ghost'].append(fn) +- continue +- if not self.files.has_key('file'): +- self.files['file'] = [] +- self.files['file'].append(fn) ++ fkey = 'dir' ++ elif flag is not None and (flag & 64): ++ fkey = 'ghost' ++ self.files.setdefault(fkey, []).append(fn) ++ + self._loadedfiles = True + + def returnFileEntries(self, ftype='file'): +@@ -1386,8 +1381,14 @@ class YumInstalledPackage(YumHeaderPackage): # stat my_st = os.lstat(fn) my_st_size = my_st.st_size @@ -23368,7 +23620,7 @@ index e3a12f2..99ff538 100644 if mode < 0: # Stupid rpm, should be unsigned value but is signed ... -@@ -1481,7 +1493,10 @@ class YumInstalledPackage(YumHeaderPackage): +@@ -1481,7 +1482,10 @@ class YumInstalledPackage(YumHeaderPackage): if gen_csum and my_csum != csum and have_prelink: # This is how rpm -V works, try and if that fails try # again with prelink. @@ -23380,7 +23632,7 @@ index e3a12f2..99ff538 100644 # er.read(1024 * 1024) # Try and get most of the stderr fp = _CountedReadFile(fp) my_csum = misc.checksum(csum_type, fp) -@@ -1548,9 +1563,9 @@ class YumLocalPackage(YumHeaderPackage): +@@ -1548,9 +1552,9 @@ class YumLocalPackage(YumHeaderPackage): try: hdr = rpmUtils.miscutils.hdrFromPackage(ts, self.localpath) @@ -23494,7 +23746,7 @@ index 5d9a343..32d3426 100644 def getExcludePkgList(self): excludeList = self.getAttribute('exclude') diff --git a/yum/rpmsack.py b/yum/rpmsack.py -index 5189b18..c3c7265 100644 +index 5189b18..fbeb9b3 100644 --- a/yum/rpmsack.py +++ b/yum/rpmsack.py @@ -25,7 +25,7 @@ from rpmUtils.transaction import initReadOnlyTransaction @@ -23546,7 +23798,17 @@ index 5189b18..c3c7265 100644 def returnNewestByName(self, name=None): if not name: -@@ -332,6 +336,32 @@ class RPMDBPackageSack(PackageSackBase): +@@ -319,6 +323,9 @@ class RPMDBPackageSack(PackageSackBase): + return False + + def returnPackages(self, repoid=None, patterns=None, ignore_case=False): ++ """Returns a list of packages. Note that the packages are ++ always filtered to those matching the patterns/case. repoid is ++ ignored, and is just here for compatibility with non-rpmdb sacks. """ + if not self._completely_loaded: + rpats = self._compile_patterns(patterns, ignore_case) + for hdr, idx in self._all_packages(): +@@ -332,6 +339,32 @@ class RPMDBPackageSack(PackageSackBase): pkgobjlist = pkgobjlist[0] + pkgobjlist[1] return pkgobjlist @@ -23579,7 +23841,7 @@ index 5189b18..c3c7265 100644 @staticmethod def _find_search_fields(fields, searchstrings, hdr): count = 0 -@@ -419,8 +449,7 @@ class RPMDBPackageSack(PackageSackBase): +@@ -419,8 +452,7 @@ class RPMDBPackageSack(PackageSackBase): def _search(self, name=None, epoch=None, ver=None, rel=None, arch=None): @@ -23589,7 +23851,7 @@ index 5189b18..c3c7265 100644 pkgtup = (name, arch, epoch, ver, rel) if self._tup2pkg.has_key(pkgtup): return [self._tup2pkg[pkgtup]] -@@ -735,6 +764,9 @@ class RPMDBAdditionalDataPackage(object): +@@ -735,6 +767,9 @@ class RPMDBAdditionalDataPackage(object): def _read(self, attr): attr = _sanitize(attr) @@ -23599,7 +23861,7 @@ index 5189b18..c3c7265 100644 if attr in self._read_cached_data: return self._read_cached_data[attr] -@@ -751,7 +783,7 @@ class RPMDBAdditionalDataPackage(object): +@@ -751,7 +786,7 @@ class RPMDBAdditionalDataPackage(object): def _delete(self, attr): """remove the attribute file""" @@ -23608,7 +23870,7 @@ index 5189b18..c3c7265 100644 fn = self._mydir + '/' + attr if attr in self._read_cached_data: del self._read_cached_data[attr] -@@ -776,18 +808,20 @@ class RPMDBAdditionalDataPackage(object): +@@ -776,18 +811,20 @@ class RPMDBAdditionalDataPackage(object): else: object.__delattr__(self, attr) @@ -23631,8 +23893,22 @@ index 5189b18..c3c7265 100644 self._delete(item) try: os.rmdir(self._mydir) +diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py +index 806fd25..053b272 100644 +--- a/yum/rpmtrans.py ++++ b/yum/rpmtrans.py +@@ -510,6 +510,9 @@ class RPMTransaction: + # right behavior should be + + def _scriptError(self, bytes, total, h): ++ if not isinstance(h, types.TupleType): ++ # fun with install/erase transactions, see rhbz#484729 ++ h = (h, None) + hdr, rpmloc = h[0], h[1] + remove_hdr = False # if we're in a clean up/remove then hdr will not be an rpm.hdr + if not isinstance(hdr, rpm.hdr): diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py -index 7d87e0b..3f9dc37 100644 +index 7d87e0b..b6c14c5 100644 --- a/yum/sqlitesack.py +++ b/yum/sqlitesack.py @@ -36,6 +36,7 @@ import operator @@ -23764,7 +24040,23 @@ index 7d87e0b..3f9dc37 100644 class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase): def __init__(self, repo, db_obj): self.prco = { 'obsoletes': (), -@@ -144,9 +259,10 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase): +@@ -103,13 +218,9 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase): + except (IndexError, KeyError): + pass + +- for item in ['pkgId']: +- try: +- setattr(self, item, db_obj[item]) +- except (IndexError, KeyError): +- pass +- + try: ++ self.pkgId = db_obj['pkgId'] ++ + checksum_type = _share_data(db_obj['checksum_type']) + check_sum = (checksum_type, db_obj['pkgId'], True) + self._checksums = [ check_sum ] +@@ -144,9 +255,10 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase): 'checksum_value' : 'pkgId', } @@ -23777,7 +24069,7 @@ index 7d87e0b..3f9dc37 100644 dbname = varname if db2simplemap.has_key(varname): -@@ -291,15 +407,22 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -291,15 +403,22 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): self.primarydb = {} self.filelistsdb = {} self.otherdb = {} @@ -23801,7 +24093,7 @@ index 7d87e0b..3f9dc37 100644 @catchSqliteException def _sql_MD(self, MD, repo, sql, *args): -@@ -315,6 +438,18 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -315,6 +434,18 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): sql = "SELECT count(pkgId) FROM packages" return self._sql_MD('primary', repo, sql).fetchone()[0] @@ -23820,7 +24112,7 @@ index 7d87e0b..3f9dc37 100644 def __len__(self): # First check if everything is excluded all_excluded = True -@@ -325,12 +460,12 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -325,14 +456,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if all_excluded: return 0 @@ -23834,9 +24126,11 @@ index 7d87e0b..3f9dc37 100644 - return len(self.pkgobjlist) - exclude_num - pkg_num = 0 - sql = "SELECT count(pkgId) FROM packages" +- sql = "SELECT count(pkgId) FROM packages" for repo in self.primarydb: -@@ -344,7 +479,10 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): + pkg_num += self._sql_MD_pkg_num('primary', repo) + return pkg_num - exclude_num +@@ -344,7 +474,10 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): del self._memoize_provides if hasattr(self, 'pkgobjlist'): del self.pkgobjlist @@ -23847,7 +24141,7 @@ index 7d87e0b..3f9dc37 100644 self._search_cache = { 'provides' : { }, 'requires' : { }, -@@ -364,7 +502,11 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -364,7 +497,11 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): self.otherdb = {} self.excludes = {} self._excludes = set() @@ -23859,7 +24153,7 @@ index 7d87e0b..3f9dc37 100644 yumRepo.YumPackageSack.close(self) -@@ -376,6 +518,18 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -376,6 +513,18 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): def _checkIndexes(self, failure='error'): return @@ -23878,7 +24172,7 @@ index 7d87e0b..3f9dc37 100644 # Remove a package # Because we don't want to remove a package from the database we just # add it to the exclude list -@@ -383,7 +537,10 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -383,7 +532,10 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if not self.excludes.has_key(obj.repo): self.excludes[obj.repo] = {} self.excludes[obj.repo][obj.pkgId] = 1 @@ -23890,7 +24184,7 @@ index 7d87e0b..3f9dc37 100644 def _delAllPackages(self, repo): """ Exclude all packages from the repo. """ -@@ -392,6 +549,8 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -392,6 +544,8 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): del self.excludes[repo] if repo in self._key2pkg: del self._key2pkg[repo] @@ -23899,7 +24193,7 @@ index 7d87e0b..3f9dc37 100644 def _excluded(self, repo, pkgId): if repo in self._all_excludes: -@@ -408,42 +567,192 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -408,42 +562,195 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): return (repo, pkgKey) in self._excludes @@ -23924,6 +24218,9 @@ index 7d87e0b..3f9dc37 100644 + self._delPackageRK(repo, pkgKey) return True + ++ if not self._pkgExcluder: ++ return False ++ + data = {'n' : n.lower(), 'pkgtup' : (n, a, e, v, r), 'marked' : False} + e = e.lower() + v = v.lower() @@ -24106,7 +24403,7 @@ index 7d87e0b..3f9dc37 100644 def addDict(self, repo, datatype, dataobj, callback=None): if self.added.has_key(repo): if datatype in self.added[repo]: -@@ -481,8 +790,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -481,8 +788,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): """ Takes a cursor and maps the pkgKey rows into a list of packages. """ if pkgs is None: pkgs = [] for ob in cur: @@ -24115,7 +24412,30 @@ index 7d87e0b..3f9dc37 100644 if have_data: pkg = self._packageByKeyData(repo, ob['pkgKey'], ob) else: -@@ -539,10 +846,16 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -528,6 +833,22 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): + return skip_all + + @catchSqliteException ++ def _search_primary_files(self, name): ++ querytype = 'glob' ++ if not misc.re_glob(name): ++ querytype = '=' ++ results = [] ++ ++ for (rep,cache) in self.primarydb.items(): ++ if rep in self._all_excludes: ++ continue ++ cur = cache.cursor() ++ executeSQL(cur, "select DISTINCT pkgKey from files where name %s ?" % querytype, (name,)) ++ self._sql_pkgKey2po(rep, cur, results) ++ ++ return misc.unique(results) ++ ++ @catchSqliteException + def searchFiles(self, name, strict=False): + """search primary if file will be in there, if not, search filelists, use globs, if possible""" + +@@ -539,16 +860,28 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): # if so, just use those for the lookup glob = True @@ -24132,7 +24452,19 @@ index 7d87e0b..3f9dc37 100644 # Take off the trailing slash to act like rpm if name[-1] == '/': -@@ -566,41 +879,53 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): + name = name[:-1] + + pkgs = [] ++ ++ # ultra simple optimization ++ if misc.re_primary_filename(name): ++ if not misc.re_glob(dirname): # is the dirname a glob? ++ return self._search_primary_files(name) ++ + if len(self.filelistsdb) == 0: + # grab repo object from primarydb and force filelists population in this sack using repo + # sack.populate(repo, mdtype, callback, cacheonly) +@@ -566,41 +899,53 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if pri_pkgs != fil_pkgs: raise Errors.RepoError @@ -24202,7 +24534,7 @@ index 7d87e0b..3f9dc37 100644 self._sql_pkgKey2po(rep, cur, pkgs) -@@ -676,8 +1001,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -676,8 +1021,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): cur = cache.cursor() executeSQL(cur, totalstring) for ob in cur: @@ -24211,7 +24543,7 @@ index 7d87e0b..3f9dc37 100644 pkg = self._packageByKey(rep, ob['pkgKey']) if pkg is None: continue -@@ -704,16 +1027,12 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -704,16 +1047,12 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): obsoletes.flags as oflags\ from obsoletes,packages where obsoletes.pkgKey = packages.pkgKey") for ob in cur: @@ -24231,7 +24563,7 @@ index 7d87e0b..3f9dc37 100644 (n,f,e,v,r) = ( _share_data(ob['oname']), _share_data(ob['oflags']), _share_data(ob['oepoch']), -@@ -817,8 +1136,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -817,8 +1156,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if rpmUtils.miscutils.rangeCompare(req, val): tmp.setdefault(pkgkey, []).append(val) for pkgKey, hits in tmp.iteritems(): @@ -24240,7 +24572,7 @@ index 7d87e0b..3f9dc37 100644 pkg = self._packageByKey(rep, pkgKey) if pkg is None: continue -@@ -840,8 +1157,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -840,8 +1177,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if rpmUtils.miscutils.rangeCompare(req, val): tmp.setdefault(x['pkgKey'], []).append(val) for pkgKey, hits in tmp.iteritems(): @@ -24249,16 +24581,32 @@ index 7d87e0b..3f9dc37 100644 pkg = self._packageByKey(rep, pkgKey) if pkg is None: continue -@@ -869,8 +1184,6 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): - cur = cache.cursor() - executeSQL(cur, "select DISTINCT pkgKey from files where name = ?", (name,)) - for ob in cur: +@@ -862,20 +1197,10 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): + return result + + # If it is a filename, search the primary.xml file info +- for (rep,cache) in self.primarydb.items(): +- if rep in self._all_excludes: +- continue +- +- cur = cache.cursor() +- executeSQL(cur, "select DISTINCT pkgKey from files where name = ?", (name,)) +- for ob in cur: - if self._pkgKeyExcluded(rep, ob['pkgKey']): - continue - pkg = self._packageByKey(rep, ob['pkgKey']) - if pkg is None: - continue -@@ -892,23 +1205,25 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +- pkg = self._packageByKey(rep, ob['pkgKey']) +- if pkg is None: +- continue +- result[pkg] = [(name, None, None)] +- self._search_cache[prcotype][req] = result ++ ++ for pkg in self._search_primary_files(name): ++ result[pkg] = [(name, None, None)] ++ self._search_cache[prcotype][req] = result + return result + + def getProvides(self, name, flags=None, version=(None, None, None)): +@@ -892,23 +1217,25 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if self._skip_all(): return [] @@ -24295,7 +24643,7 @@ index 7d87e0b..3f9dc37 100644 pat_sqls = [] qsql = """select pkgId,pkgKey,name,epoch,version,release,arch -@@ -919,10 +1234,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -919,10 +1246,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): for (repo, cache) in self.primarydb.items(): cur = cache.cursor() @@ -24310,7 +24658,19 @@ index 7d87e0b..3f9dc37 100644 return returnList @catchSqliteException -@@ -1129,16 +1447,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -951,10 +1281,7 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): + return results + + # If it is a filename, search the primary.xml file info +- for (rep,cache) in self.primarydb.items(): +- cur = cache.cursor() +- executeSQL(cur, "select DISTINCT pkgKey from files where name %s ?" % querytype, (name,)) +- self._sql_pkgKey2po(rep, cur, results) ++ results.extend(self._search_primary_files(name)) + + # if its in the primary.xml files then skip the other check + if misc.re_primary_filename(name) and not glob: +@@ -1129,16 +1456,13 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): unmatched = misc.unique(unmatched) return exactmatch, matched, unmatched @@ -24330,7 +24690,7 @@ index 7d87e0b..3f9dc37 100644 fields = ['name', 'sql_nameArch', 'sql_nameVerRelArch', 'sql_nameVer', 'sql_nameVerRel', 'sql_envra', 'sql_nevra'] -@@ -1158,12 +1473,22 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -1158,12 +1482,22 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): patterns = self._sql_esc_glob(patterns) else: tmp = [] @@ -24353,7 +24713,7 @@ index 7d87e0b..3f9dc37 100644 for (repo,cache) in self.primarydb.items(): if (repoid == None or repoid == repo.id): -@@ -1184,15 +1509,33 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -1184,45 +1518,97 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): if pat_sqls: qsql = _FULL_PARSE_QUERY_BEG + " OR ".join(pat_sqls) executeSQL(cur, qsql, pat_data) @@ -24394,7 +24754,12 @@ index 7d87e0b..3f9dc37 100644 return returnList def returnPackages(self, repoid=None, patterns=None, ignore_case=False): -@@ -1203,26 +1546,59 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): + """Returns a list of packages, only containing nevra information. The +- packages are processed for excludes. Note that patterns is just +- a hint, we are free it ignore it. """ ++ packages are processed for excludes. Note that the packages are ++ always filtered to those matching the patterns/case. """ + if self._skip_all(): return [] @@ -24433,7 +24798,8 @@ index 7d87e0b..3f9dc37 100644 + def simplePkgList(self, patterns=None, ignore_case=False): + """Returns a list of pkg tuples (n, a, e, v, r), optionally from a -+ single repoid. """ ++ single repoid. Note that the packages are always filtered to those ++ matching the patterns/case. """ + + if self._skip_all(): + return [] @@ -24460,7 +24826,7 @@ index 7d87e0b..3f9dc37 100644 @catchSqliteException def searchNevra(self, name=None, epoch=None, ver=None, rel=None, arch=None): """return list of pkgobjects matching the nevra requested""" -@@ -1231,6 +1607,18 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): +@@ -1231,6 +1617,18 @@ class YumSqlitePackageSack(yumRepo.YumPackageSack): returnList = [] @@ -24480,7 +24846,7 @@ index 7d87e0b..3f9dc37 100644 empty = True for arg in (name, epoch, ver, rel, arch): diff --git a/yum/transactioninfo.py b/yum/transactioninfo.py -index 05820fa..84dbb4b 100644 +index 05820fa..be772e5 100644 --- a/yum/transactioninfo.py +++ b/yum/transactioninfo.py @@ -63,6 +63,8 @@ class TransactionData: @@ -24501,7 +24867,7 @@ index 05820fa..84dbb4b 100644 """returns lists of transaction Member objects based on mode: updated, installed, erased, obsoleted, depupdated, depinstalled deperased""" -@@ -256,8 +258,18 @@ class TransactionData: +@@ -256,6 +258,8 @@ class TransactionData: self.depremoved = [] self.depinstalled = [] self.depupdated = [] @@ -24509,24 +24875,14 @@ index 05820fa..84dbb4b 100644 + self.downgraded = [] self.failed = [] -+ if include_reinstall: -+ pkgtups = {'up' : set(), 'in' : set(), 'rm' : set()} -+ for txmbr in self.getMembers(): -+ if txmbr.output_state in (TS_INSTALL, TS_TRUEINSTALL): -+ pkgtups['in'].add(txmbr.po.pkgtup) -+ if txmbr.output_state == TS_ERASE: -+ pkgtups['rm'].add(txmbr.po.pkgtup) -+ for txmbr in self.getMembers(): - if txmbr.output_state == TS_UPDATE: - if txmbr.isDep: -@@ -265,7 +277,15 @@ class TransactionData: +@@ -265,7 +269,15 @@ class TransactionData: else: self.updated.append(txmbr) - elif txmbr.output_state == TS_INSTALL or txmbr.output_state == TS_TRUEINSTALL: + elif txmbr.output_state in (TS_INSTALL, TS_TRUEINSTALL): -+ if include_reinstall and txmbr.po.pkgtup in pkgtups['rm']: ++ if include_reinstall and self.rpmdb.contains(po=txmbr.po): + self.reinstalled.append(txmbr) + continue + @@ -24537,20 +24893,17 @@ index 05820fa..84dbb4b 100644 if txmbr.groups: for g in txmbr.groups: if g not in self.instgroups: -@@ -276,6 +296,12 @@ class TransactionData: +@@ -276,6 +288,9 @@ class TransactionData: self.installed.append(txmbr) elif txmbr.output_state == TS_ERASE: -+ if include_reinstall and txmbr.po.pkgtup in pkgtups['in']: -+ continue -+ + if include_downgrade and txmbr.downgraded_by: + continue + for g in txmbr.groups: if g not in self.instgroups: self.removedgroups.append(g) -@@ -368,6 +394,23 @@ class TransactionData: +@@ -368,6 +383,23 @@ class TransactionData: self.add(txmbr) return txmbr @@ -24574,7 +24927,7 @@ index 05820fa..84dbb4b 100644 def addUpdated(self, po, updating_po): """adds a package as being updated by another pkg takes a packages object and returns a TransactionMember Object""" -@@ -544,6 +587,8 @@ class TransactionMember: +@@ -544,6 +576,8 @@ class TransactionMember: self.obsoleted_by = [] self.updates = [] self.updated_by = [] @@ -25132,3 +25485,16 @@ index 706d908..bd73d0c 100644 + if extcmds: + vcmd = extcmds[0] + return vcmd in ('available', 'all') +diff --git a/yummain.py b/yummain.py +index 281d0fc..964975b 100755 +--- a/yummain.py ++++ b/yummain.py +@@ -46,6 +46,8 @@ def main(args): + def exIOError(e): + if e.errno == 32: + logger.critical(_('\n\nExiting on Broken Pipe')) ++ else: ++ logger.critical(_('\n\n%s') % str(e)) + if unlock(): return 200 + return 1 + diff --git a/yum.spec b/yum.spec index 523bc05..47eddcb 100644 --- a/yum.spec +++ b/yum.spec @@ -3,7 +3,7 @@ Summary: RPM installer/updater Name: yum Version: 3.2.23 -Release: 14%{?dist} +Release: 15%{?dist} License: GPLv2+ Group: System Environment/Base Source0: http://yum.baseurl.org/download/3.2/%{name}-%{version}.tar.gz @@ -106,6 +106,9 @@ rm -rf $RPM_BUILD_ROOT %dir /usr/lib/yum-plugins %changelog +* Mon Aug 31 2009 Seth Vidal - 3.2.23-15 +- one more head update - fixes some fairly ugly but kind of minor bugs + * Tue Aug 18 2009 Seth Vidal - 3.2.23-14 - update to latest head pre 3.2.24 - add requirement on python-urlgrabber 3.9.0 and up