From b9681c288e2fac68b3c2fa89f17ea07944094bfb Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Dec 08 2008 16:18:55 +0000 Subject: new head patch --- diff --git a/yum-HEAD.patch b/yum-HEAD.patch index 60ab889..a64ddaa 100644 --- a/yum-HEAD.patch +++ b/yum-HEAD.patch @@ -1,5 +1,5 @@ diff --git a/cli.py b/cli.py -index ff4c7d6..69dea6c 100644 +index ff4c7d6..e3a4161 100644 --- a/cli.py +++ b/cli.py @@ -398,6 +398,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput): @@ -29,7 +29,19 @@ index ff4c7d6..69dea6c 100644 # close things self.verbose_logger.log(yum.logginglevels.INFO_1, self.postTransactionOutput()) -@@ -657,7 +661,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput): +@@ -519,8 +523,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput): + # always_output is a wart due to update/remove not producing the + # same output. + matches = self.doPackageLists(patterns=[arg], ignore_case=False) +- if matches.installed: # Found a match so ignore +- return ++ if (matches.installed or (not matches.available and ++ self.returnInstalledPackagesByDep(arg))): ++ return # Found a match so ignore + hibeg = self.term.MODE['bold'] + hiend = self.term.MODE['normal'] + if matches.available: +@@ -657,7 +662,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput): return 2, [_('Package(s) to install')] return 0, [_('Nothing to do')] @@ -38,7 +50,7 @@ index ff4c7d6..69dea6c 100644 """Returns packages lists based on arguments on the cli.returns a GenericHolder instance with the following lists defined: available = list of packageObjects -@@ -666,18 +670,32 @@ class YumBaseCli(yum.YumBase, output.YumOutput): +@@ -666,18 +671,32 @@ class YumBaseCli(yum.YumBase, output.YumOutput): extras = list of packageObjects obsoletes = tuples of packageObjects (obsoleting, installed) recent = list of packageObjects @@ -72,7 +84,7 @@ index ff4c7d6..69dea6c 100644 # This is mostly leftover from when patterns didn't exist # FIXME: However when returnPackages() has already been run, we -@@ -699,6 +717,13 @@ class YumBaseCli(yum.YumBase, output.YumOutput): +@@ -699,6 +718,13 @@ class YumBaseCli(yum.YumBase, output.YumOutput): ypl.extras = _shrinklist(ypl.extras, extcmds) ypl.obsoletes = _shrinklist(ypl.obsoletes, extcmds) @@ -86,7 +98,7 @@ index ff4c7d6..69dea6c 100644 return ypl def search(self, args): -@@ -843,8 +868,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput): +@@ -843,8 +869,12 @@ class YumBaseCli(yum.YumBase, output.YumOutput): if len(userlist) > 0: if userlist[0] == 'hidden': uservisible=0 @@ -100,7 +112,7 @@ index ff4c7d6..69dea6c 100644 if len(installed) > 0: self.verbose_logger.log(yum.logginglevels.INFO_2, -@@ -1079,6 +1108,22 @@ class YumOptionParser(OptionParser): +@@ -1079,6 +1109,22 @@ class YumOptionParser(OptionParser): if opts.showdupesfromrepos: self.base.conf.showdupesfromrepos = True @@ -123,7 +135,7 @@ index ff4c7d6..69dea6c 100644 if opts.disableexcludes: disable_excludes = self._splitArg(opts.disableexcludes) else: -@@ -1224,6 +1269,8 @@ class YumOptionParser(OptionParser): +@@ -1224,6 +1270,8 @@ class YumOptionParser(OptionParser): metavar='[plugin]') self.add_option("--skip-broken", action="store_true", dest="skipbroken", help=_("skip packages with depsolving problems")) @@ -133,10 +145,28 @@ index ff4c7d6..69dea6c 100644 diff --git a/docs/yum.8 b/docs/yum.8 -index 4ebd19d..641899d 100644 +index 4ebd19d..e31ce0f 100644 --- a/docs/yum.8 +++ b/docs/yum.8 -@@ -262,6 +262,11 @@ Configuration Option: \fBobsoletes\fP +@@ -87,7 +87,8 @@ will ensure that all dependencies are satisfied\&. If no package + matches the given package name(s), they are assumed to be a shell glob + and any matches are then installed\&. + +-If the \-\-obsoletes flag is present \fByum\fP will include package ++If the main obsoletes configure option is true (default) or the \-\-obsoletes ++flag is present \fByum\fP will include package + obsoletes in its calculations - this makes it better for distro\-version + changes, for example: upgrading from somelinux 8.0 to somelinux 9. + .IP +@@ -97,6 +98,7 @@ be applied without running it interactively. Returns exit value of 100 if + there are packages available for an update. Also returns a list of the pkgs + to be updated in list format. Returns 0 if no packages are available for + update. Returns 1 if an error occured. ++Running in verbose mode also shows obsoletes. + .IP + .IP "\fBupgrade\fP" + Is the same as the update command with the \-\-obsoletes flag set. See update +@@ -262,6 +264,11 @@ Configuration Option: \fBobsoletes\fP Exclude a specific package by name or glob from updates on all repositories. Configuration Option: \fBexclude\fP .br @@ -149,10 +179,18 @@ index 4ebd19d..641899d 100644 Disable the excludes defined in your config files. Takes one of three options: .br diff --git a/docs/yum.conf.5 b/docs/yum.conf.5 -index 40148a6..901f6b4 100644 +index 40148a6..15462b7 100644 --- a/docs/yum.conf.5 +++ b/docs/yum.conf.5 -@@ -305,6 +305,59 @@ Can be set to 'all' or 'best'. All means install all possible arches for any pac +@@ -124,6 +124,7 @@ Default is `0'. + This option only has affect during an \fBupdate\fR. It enables yum's + obsoletes processing logic. Useful when doing distribution level upgrades. See + also the yum \fBupgrade\fR command documentation for more details (yum(8)). ++Default is `true'. + .br + Command-line option: \fB\-\-obsoletes\fP + +@@ -305,6 +306,59 @@ Can be set to 'all' or 'best'. All means install all possible arches for any pac want to install. Therefore yum install foo will install foo.i386 and foo.x86_64 on x86_64, if it is available. Best means install the best arch for this platform, only. @@ -215,7 +253,7 @@ index 40148a6..901f6b4 100644 diff --git a/output.py b/output.py old mode 100644 new mode 100755 -index 502aa4b..4f7a6cf +index 502aa4b..b6bd005 --- a/output.py +++ b/output.py @@ -39,6 +39,7 @@ from yum.rpmtrans import RPMBaseCallback @@ -778,6 +816,15 @@ index 502aa4b..4f7a6cf self.verbose_logger.log(logginglevels.INFO_2, msg) +@@ -1099,7 +1216,7 @@ class YumCliRPMCallBack(RPMBaseCallback): + + def __init__(self): + RPMBaseCallback.__init__(self) +- self.lastmsg = None ++ self.lastmsg = to_unicode("") + self.lastpackage = None # name of last package we looked at + self.output = logging.getLogger("yum.verbose.cli").isEnabledFor(logginglevels.INFO_2) + @@ -1125,10 +1242,10 @@ class YumCliRPMCallBack(RPMBaseCallback): percent = (te_current*100L)/te_total @@ -18802,6 +18849,18 @@ index 20dc426..bb32159 100644 #: ../output.py:351 msgid "Is this ok [y/N]: " +diff --git a/rpmUtils/updates.py b/rpmUtils/updates.py +index f348ae9..16f733b 100644 +--- a/rpmUtils/updates.py ++++ b/rpmUtils/updates.py +@@ -54,6 +54,7 @@ class Updates: + self.updating_dict = {} + #debug, ignore me + self.debug = 0 ++ self.obsoletes = {} + + def _delFromDict(self, dict_, keys, value): + for key in keys: diff --git a/shell.py b/shell.py index 4c490e8..97bd963 100644 --- a/shell.py @@ -19388,7 +19447,7 @@ index d92f533..cea9110 100644 self.logger.critical(_('Config Error: %s'), e) sys.exit(1) diff --git a/yum/__init__.py b/yum/__init__.py -index 04f2aac..1f03840 100644 +index 04f2aac..681ddc7 100644 --- a/yum/__init__.py +++ b/yum/__init__.py @@ -665,7 +665,10 @@ class YumBase(depsolve.Depsolve): @@ -19671,9 +19730,36 @@ index 04f2aac..1f03840 100644 def install(self, po=None, **kwargs): """try to mark for install the item specified. Uses provided package object, if available. If not it uses the kwargs and gets the best -@@ -2446,8 +2566,16 @@ class YumBase(depsolve.Depsolve): - self.install(po=obsoleting_pkg) +@@ -2421,6 +2541,16 @@ class YumBase(depsolve.Depsolve): + tx_return.extend(txmbrs) 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. ++ obsoleting_pkg = self._test_loop(po, self._pkg2obspkg) ++ if obsoleting_pkg is not None: ++ self.verbose_logger.warning(_('Package %s is obsoleted by %s, trying to install %s instead'), ++ po.name, obsoleting_pkg.name, obsoleting_pkg) ++ self.install(po=obsoleting_pkg) ++ continue ++ + # make sure it's not already installed + if self.rpmdb.contains(po=po): + if not self.tsInfo.getMembersWithState(po.pkgtup, TS_REMOVE_STATES): +@@ -2436,18 +2566,17 @@ class YumBase(depsolve.Depsolve): + tx_return.extend(txmbrs) + 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. +- obsoleting_pkg = self._test_loop(po, self._pkg2obspkg) +- if obsoleting_pkg is not None: +- self.verbose_logger.warning(_('Package %s is obsoleted by %s, trying to install %s instead'), +- po.name, obsoleting_pkg.name, obsoleting_pkg) +- self.install(po=obsoleting_pkg) +- continue - txmbr = self.tsInfo.addInstall(po) - tx_return.append(txmbr) @@ -19690,7 +19776,27 @@ index 04f2aac..1f03840 100644 return tx_return -@@ -2605,12 +2733,7 @@ class YumBase(depsolve.Depsolve): +@@ -2557,6 +2686,19 @@ class YumBase(depsolve.Depsolve): + instpkgs.extend(e) + instpkgs.extend(m) + ++ if u: ++ depmatches = [] ++ arg = u[0] ++ try: ++ depmatches = self.returnInstalledPackagesByDep(arg) ++ except yum.Errors.YumBaseError, e: ++ self.logger.critical(_('%s') % e) ++ ++ if not depmatches: ++ self.logger.critical(_('No Match for argument: %s') % arg) ++ else: ++ instpkgs.extend(depmatches) ++ + # if we can't find an installed package then look at available pkgs + if not instpkgs: + (e, m, u) = self.pkgSack.matchPackageNames([kwargs['pattern']]) +@@ -2605,12 +2747,7 @@ class YumBase(depsolve.Depsolve): for installed_pkg in instpkgs: for obsoleting in self.up.obsoleted_dict.get(installed_pkg.pkgtup, []): obsoleting_pkg = self.getPackageObject(obsoleting) @@ -19704,7 +19810,7 @@ index 04f2aac..1f03840 100644 for available_pkg in availpkgs: for obsoleted in self.up.obsoleting_dict.get(available_pkg.pkgtup, []): obsoleted_pkg = self.getInstalledPackageObject(obsoleted) -@@ -2626,12 +2749,23 @@ class YumBase(depsolve.Depsolve): +@@ -2626,12 +2763,23 @@ class YumBase(depsolve.Depsolve): for installed_pkg in instpkgs: for updating in self.up.updatesdict.get(installed_pkg.pkgtup, []): @@ -19730,7 +19836,7 @@ index 04f2aac..1f03840 100644 if requiringPo: txmbr.setAsDep(requiringPo) tx_return.append(txmbr) -@@ -3184,7 +3318,8 @@ class YumBase(depsolve.Depsolve): +@@ -3184,7 +3332,8 @@ class YumBase(depsolve.Depsolve): if msgs: retmsgs = [_('ERROR with rpm_check_debug vs depsolve:')] retmsgs.extend(msgs) @@ -19765,9 +19871,18 @@ index ee9f187..6820c64 100755 %s diff --git a/yum/config.py b/yum/config.py -index 03123a9..ffd70b3 100644 +index 03123a9..2219605 100644 --- a/yum/config.py +++ b/yum/config.py +@@ -637,7 +637,7 @@ class YumConf(StartupConf): + # FIXME: rename gpgcheck to pkgs_gpgcheck + gpgcheck = BoolOption(__pkgs_gpgcheck_default__) + repo_gpgcheck = BoolOption(__repo_gpgcheck_default__) +- obsoletes = BoolOption(False) ++ obsoletes = BoolOption(True) + showdupesfromrepos = BoolOption(False) + enabled = BoolOption(True) + enablegroups = BoolOption(True) @@ -667,7 +667,23 @@ class YumConf(StartupConf): # all == install any/all arches you can # best == use the 'best arch' for the system @@ -20121,10 +20236,24 @@ index 86f3ce2..bcc895e + sys.exit(0) + out(arg) diff --git a/yum/metalink.py b/yum/metalink.py -index 5a57511..c478e0e 100755 +index 5a57511..ff36393 100755 --- a/yum/metalink.py +++ b/yum/metalink.py -@@ -179,7 +179,10 @@ class MetaLinkRepoMD: +@@ -135,9 +135,12 @@ class MetaLinkURL: + + self.url = elem.text + self.preference = int(elem.get("preference", -1)) +- self.protocol = elem.get("protocol") ++ self.protocol = elem.get("type") # This is the "std" attribute name + self.location = elem.get("location") + ++ if self.protocol is None: # Try for the old MM protocol attribute ++ self.protocol = elem.get("protocol") ++ + def __str__(self): + return """\ + URL: %s +@@ -179,7 +182,10 @@ class MetaLinkRepoMD: self.mirrors = [] if not os.path.exists(filename): raise MetaLinkRepoErrorParseFail, "File %s does not exist" %filename @@ -20136,6 +20265,126 @@ index 5a57511..c478e0e 100755 for elem in root.findall(__ML_FILE_ELEMENT__): name = elem.get('name') +diff --git a/yum/misc.py b/yum/misc.py +index 801fc0f..108283b 100644 +--- a/yum/misc.py ++++ b/yum/misc.py +@@ -177,15 +177,14 @@ class Checksums: + Length and the result(s) when complete. """ + + def __init__(self, checksums=None, ignore_missing=False): +- self._checksums = checksums +- if self._checksums is None: +- self._checksums = ['sha256'] ++ if checksums is None: ++ checksums = ['sha256'] + self._sumalgos = [] + self._sumtypes = [] + self._len = 0 + + done = set() +- for sumtype in self._checksums: ++ for sumtype in checksums: + if sumtype in done: + continue + +@@ -198,6 +197,8 @@ class Checksums: + done.add(sumtype) + self._sumtypes.append(sumtype) + self._sumalgos.append(sumalgo) ++ if not done: ++ raise MiscError, 'Error Checksumming, no valid checksum type' + + def __len__(self): + return self._len +@@ -218,9 +219,22 @@ class Checksums: + ret[sumtype] = sumdata.hexdigest() + return ret + +- def hexdigest(self, checksum): ++ def hexdigest(self, checksum=None): ++ if checksum is None: ++ checksum = self._sumtypes[0] + return self.hexdigests()[checksum] + ++ def digests(self): ++ ret = {} ++ for sumtype, sumdata in zip(self._sumtypes, self._sumalgos): ++ ret[sumtype] = sumdata.digest() ++ return ret ++ ++ def digest(self, checksum=None): ++ if checksum is None: ++ checksum = self._sumtypes[0] ++ return self.digests()[checksum] ++ + + class AutoFileChecksums: + """ Generate checksum(s), on given file/fileobject. Pretending to be a file +diff --git a/yum/packages.py b/yum/packages.py +index 48dfc8d..acfb9f0 100644 +--- a/yum/packages.py ++++ b/yum/packages.py +@@ -978,7 +978,9 @@ class YumHeaderPackage(YumAvailablePackage): + self.ver = self.version + self.rel = self.release + self.pkgtup = (self.name, self.arch, self.epoch, self.version, self.release) +- self.summary = misc.share_data(self.hdr['summary'].replace('\n', '')) ++ # Summaries "can be" empty, which rpm return [], see BZ 473239, *sigh* ++ self.summary = self.hdr['summary'] or '' ++ self.summary = misc.share_data(self.summary.replace('\n', '')) + self.description = misc.share_data(self.hdr['description']) + self.pkgid = self.hdr[rpm.RPMTAG_SHA1HEADER] + if not self.pkgid: +diff --git a/yum/pgpmsg.py b/yum/pgpmsg.py +index 35a7801..04ab346 100644 +--- a/yum/pgpmsg.py ++++ b/yum/pgpmsg.py +@@ -13,7 +13,26 @@ + ##You should have received a copy of the GNU General Public License + ##along with this program; if not, write to the Free Software + ##Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +-import struct, time, cStringIO, base64, types, md5, sha ++import struct, time, cStringIO, base64, types ++ ++# We use this so that we can work on python-2.4 and python-2.6, and thus. ++# use import md5/import sha on the older one and import hashlib on the newer. ++# Stupid deprecation warnings. ++try: ++ import hashlib ++except ImportError: ++ # Python-2.4.z ... gah! ++ import sha ++ import md5 ++ class hashlib: ++ ++ @staticmethod ++ def new(algo): ++ if algo == 'md5': ++ return md5.new() ++ if algo == 'sha1': ++ return sha.new() ++ raise ValueError, "Bad checksum type" + + debug = None + +@@ -378,14 +397,14 @@ class public_key(pgp_packet) : + # otherwise calculate it now and cache it + # v3 and v4 are calculated differently + if self.version == 3 : +- h = md5.new() ++ h = hashlib.new('md5') + h.update(pack_long(self.pk_rsa_mod)) + h.update(pack_long(self.pk_rsa_exp)) + self.fingerprint_ = h.digest() + elif self.version == 4 : + # we hash what would be the whole PGP message containing + # the pgp certificate +- h = sha.new() ++ h = hashlib.new('sha1') + h.update('\x99') + # we need to has the length of the packet as well + buf = self.serialize() diff --git a/yum/plugins.py b/yum/plugins.py index 82efdee..287fba7 100644 --- a/yum/plugins.py @@ -20159,19 +20408,31 @@ index 82efdee..287fba7 100644 if hasattr(self.base, 'term'): width = self.base.term.columns diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py -index 7ff7d9a..76c9a41 100644 +index 7ff7d9a..21fec5a 100644 --- a/yum/sqlitesack.py +++ b/yum/sqlitesack.py -@@ -34,7 +34,7 @@ import sqlutils +@@ -34,7 +34,8 @@ import sqlutils import constants import operator import time -from yum.misc import seq_max_split +from yum.misc import seq_max_split, to_utf8 ++import sys def catchSqliteException(func): """This decorator converts sqlite exceptions into RepoError""" -@@ -205,8 +205,8 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase): +@@ -42,7 +43,9 @@ def catchSqliteException(func): + try: + return func(*args, **kwargs) + except sqlutils.sqlite.Error, e: +- if hasattr(e, "message"): ++ # 2.4.x requires this, but 2.6.x complains about even hasattr() ++ # of e.message ... *sigh* ++ if sys.hexversion < 0x02050000: + raise Errors.RepoError, str(e.message) + raise Errors.RepoError, str(e) + +@@ -205,8 +208,8 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase): # Failure mode is much less of a problem. for ob in cur: c_date = ob['date'] diff --git a/yum.spec b/yum.spec index 4ff0495..fc5dbd7 100644 --- a/yum.spec +++ b/yum.spec @@ -3,7 +3,7 @@ Summary: RPM installer/updater Name: yum Version: 3.2.20 -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2+ Group: System Environment/Base Source0: http://yum.baseurl.org/download/3.2/%{name}-%{version}.tar.gz @@ -13,7 +13,6 @@ Patch0: installonlyn-enable.patch Patch1: yum-mirror-priority.patch Patch2: yum-manpage-files.patch Patch3: yum-multilib-policy-best.patch -Patch4: yum-3.2.20-obsoletes-dict-fix.patch # Patches from 3.2.X HEAD Patch101: yum-HEAD.patch @@ -59,7 +58,6 @@ can notify you when they are available via email, syslog or dbus. %patch1 -p0 %patch2 -p0 %patch3 -p0 -%patch4 -p1 %patch101 -p1 @@ -110,6 +108,9 @@ rm -rf $RPM_BUILD_ROOT %dir /usr/lib/yum-plugins %changelog +* Mon Dec 8 2008 Seth Vidal - 3.2.20-7 +- merge patch from upstream and remove now old obsoletes patch + * Thu Dec 04 2008 Jesse Keating - 3.2.20-6 - Add patch from upstream to fix cases where obsoletes are disabled. (jantill)