diff --git a/SOURCES/BZ-1410234-downloadonly-unlink-tmp-files.patch b/SOURCES/BZ-1410234-downloadonly-unlink-tmp-files.patch new file mode 100644 index 0000000..79e7e3c --- /dev/null +++ b/SOURCES/BZ-1410234-downloadonly-unlink-tmp-files.patch @@ -0,0 +1,78 @@ +diff -up yum-3.4.3/yum/drpm.py.orig yum-3.4.3/yum/drpm.py +--- yum-3.4.3/yum/drpm.py.orig 2019-03-27 16:55:57.846748074 +0100 ++++ yum-3.4.3/yum/drpm.py 2019-03-27 16:56:28.012138396 +0100 +@@ -270,7 +270,11 @@ class DeltaInfo: + # done with drpm file, unlink when local + if po.localpath.startswith(po.repo.pkgdir): + os.unlink(po.localpath) +- po.localpath = po.rpm.localpath # for --downloadonly ++ # rename the rpm if --downloadonly ++ if po.rpm.localpath.endswith('.tmp'): ++ rpmfile = po.rpm.localpath.rsplit('.', 2)[0] ++ os.rename(po.rpm.localpath, rpmfile) ++ po.rpm.localpath = rpmfile + num += 1 + + # when blocking, one is enough +diff -up yum-3.4.3/yum/__init__.py.orig yum-3.4.3/yum/__init__.py +--- yum-3.4.3/yum/__init__.py.orig 2019-03-27 16:55:58.035750519 +0100 ++++ yum-3.4.3/yum/__init__.py 2019-03-27 16:56:28.012138396 +0100 +@@ -2435,6 +2435,8 @@ much more problems). + errors = {} + def adderror(po, msg): + errors.setdefault(po, []).append(msg) ++ if po.localpath.endswith('.tmp'): ++ misc.unlink_f(po.localpath) # won't resume this.. + + # We close the history DB here because some plugins (presto) use + # threads. And sqlite really doesn't like threads. And while I don't +@@ -2546,6 +2548,10 @@ much more problems). + + def checkfunc(obj, po=po): + self.verifyPkg(obj, po, 1) ++ if po.localpath.endswith('.tmp'): ++ rpmfile = po.localpath.rsplit('.', 2)[0] ++ os.rename(po.localpath, rpmfile) ++ po.localpath = rpmfile + local_size[0] += po.size + if hasattr(urlgrabber.progress, 'text_meter_total_size'): + urlgrabber.progress.text_meter_total_size(remote_size, +@@ -2584,29 +2590,21 @@ much more problems). + except Errors.RepoError, e: + adderror(po, exception2msg(e)) + if async: +- urlgrabber.grabber.parallel_wait() ++ try: ++ urlgrabber.grabber.parallel_wait() ++ except KeyboardInterrupt: ++ for po in remote_pkgs: ++ if po.localpath.endswith('.tmp'): ++ misc.unlink_f(po.localpath) ++ elif isinstance(po, DeltaPackage) and po.rpm.localpath.endswith('.tmp'): ++ misc.unlink_f(po.rpm.localpath) ++ raise + presto.dequeue_all() + presto.wait() + + if hasattr(urlgrabber.progress, 'text_meter_total_size'): + urlgrabber.progress.text_meter_total_size(0) + +- if downloadonly: +- for po in remote_pkgs: +- if not po.localpath.endswith('.tmp'): +- # file:// repos don't "download" +- continue +- if po in errors: +- # we may throw away partial file here- but we don't lock, +- # so can't rename tempfile to rpmfile safely +- misc.unlink_f(po.localpath) +- else: +- # verifyPkg() didn't complain, so (potentially) +- # overwriting another copy should not be a problem +- rpmfile = po.localpath.rsplit('.', 2)[0] +- os.rename(po.localpath, rpmfile) +- po.localpath = rpmfile +- + fatal = False + for po in errors: + if not isinstance(po, DeltaPackage): diff --git a/SOURCES/BZ-1510491-fixup-yumdb-validator.patch b/SOURCES/BZ-1510491-fixup-yumdb-validator.patch new file mode 100644 index 0000000..44fa932 --- /dev/null +++ b/SOURCES/BZ-1510491-fixup-yumdb-validator.patch @@ -0,0 +1,34 @@ +commit 61cacc3c79c356a3c3a910b0c5ddd12cfaaa20e5 +Author: Michal Domonkos +Date: Mon Nov 6 11:07:38 2017 +0100 + + BZ 1510491 + + Fix from_repo yumdb validator for local pkgs + +diff --git a/yum/rpmsack.py b/yum/rpmsack.py +index e810e2f9..19b9ab35 100644 +--- a/yum/rpmsack.py ++++ b/yum/rpmsack.py +@@ -1731,6 +1731,12 @@ class RPMDBAdditionalData(object): + + pass + ++def _validate_from_repo(value): ++ if value and value[0] == '/': ++ # Local package; chop the slash as it's not a valid repoid char ++ value = value[1:] ++ return misc.validate_repoid(value) is None ++ + class RPMDBAdditionalDataPackage(object): + + # We do auto hardlink on these attributes +@@ -1744,7 +1750,7 @@ class RPMDBAdditionalDataPackage(object): + # Validate these attributes when they are read from a file + _validators = { + # Fixes BZ 1234967 +- 'from_repo': lambda repoid: misc.validate_repoid(repoid) is None, ++ 'from_repo': _validate_from_repo, + } + + def __init__(self, conf, pkgdir, yumdb_cache=None): diff --git a/SOURCES/BZ-1600383-save-ts-no-str-concat.patch b/SOURCES/BZ-1600383-save-ts-no-str-concat.patch new file mode 100644 index 0000000..73e3875 --- /dev/null +++ b/SOURCES/BZ-1600383-save-ts-no-str-concat.patch @@ -0,0 +1,109 @@ +diff -up yum-3.4.3/yum/__init__.py.orig yum-3.4.3/yum/__init__.py +--- yum-3.4.3/yum/__init__.py.orig 2019-03-27 16:56:28.012138396 +0100 ++++ yum-3.4.3/yum/__init__.py 2019-03-27 16:58:37.176809731 +0100 +@@ -6890,24 +6890,24 @@ much more problems). + + self._ts_save_file = filename + +- msg = "%s\n" % self.rpmdb.simpleVersion(main_only=True)[0] +- msg += "%s\n" % self.ts.getTsFlags() ++ msg = ["%s\n" % self.rpmdb.simpleVersion(main_only=True)[0], ++ "%s\n" % self.ts.getTsFlags()] + + if self.tsInfo._pkgSack is None: # Transactions have pkgSack? +- msg += "1\n" ++ msg += ["1\n"] + else: +- msg += "%s\n" % (len(self.repos.listEnabled()) + 1) ++ msg += ["%s\n" % (len(self.repos.listEnabled()) + 1)] + for r in self.repos.listEnabled(): +- msg += "%s:%s:%s\n" % (r.id, len(r.sack), r.repoXML.revision) ++ msg += ["%s:%s:%s\n" % (r.id, len(r.sack), r.repoXML.revision)] + + # Save what we think the future rpmdbv will be. +- msg += "%s:%s\n" % ('installed', self.tsInfo.futureRpmDBVersion()) ++ msg += ["%s:%s\n" % ('installed', self.tsInfo.futureRpmDBVersion())] + +- msg += "%s\n" % len(self.tsInfo.getMembers()) ++ msg += ["%s\n" % len(self.tsInfo.getMembers())] + for txmbr in self.tsInfo.getMembers(): +- msg += txmbr._dump() ++ msg += [txmbr._dump()] + try: +- f.write(msg) ++ f.write(''.join(msg)) + f.close() + except (IOError, OSError), e: + self._ts_save_file = None +diff -up yum-3.4.3/yum/transactioninfo.py.orig yum-3.4.3/yum/transactioninfo.py +--- yum-3.4.3/yum/transactioninfo.py.orig 2019-03-27 16:55:57.905748837 +0100 ++++ yum-3.4.3/yum/transactioninfo.py 2019-03-27 16:58:37.178809757 +0100 +@@ -873,44 +873,47 @@ class TransactionMember: + return "<%s : %s (%s)>" % (self.__class__.__name__, str(self),hex(id(self))) + + def _dump(self): +- msg = "mbr: %s,%s,%s,%s,%s %s\n" % (self.name, self.arch, self.epoch, +- self.version, self.release, self.current_state) +- msg += " repo: %s\n" % self.po.repo.id +- msg += " ts_state: %s\n" % self.ts_state +- msg += " output_state: %s\n" % self.output_state +- msg += " isDep: %s\n" % bool(self.isDep) +- msg += " reason: %s\n" % self.reason +- #msg += " process: %s\n" % self.process +- msg += " reinstall: %s\n" % bool(self.reinstall) ++ msg = ["mbr: %s,%s,%s,%s,%s %s\n" % ++ (self.name, self.arch, self.epoch, self.version, self.release, ++ self.current_state), ++ " repo: %s\n" % self.po.repo.id, ++ " ts_state: %s\n" % self.ts_state, ++ " output_state: %s\n" % self.output_state, ++ " isDep: %s\n" % bool(self.isDep), ++ " reason: %s\n" % self.reason, ++ # " process: %s\n" % self.process, ++ " reinstall: %s\n" % bool(self.reinstall)] + + if self.relatedto: +- msg += " relatedto:" ++ msg += [" relatedto:"] + for (po, rel) in self.relatedto: + pkgorigin = 'a' + if isinstance(po, YumInstalledPackage): + pkgorigin = 'i' +- msg += " %s,%s,%s,%s,%s@%s:%s" % (po.name, po.arch, po.epoch, +- po.version, po.release, pkgorigin, rel) +- msg += "\n" ++ msg += [" %s,%s,%s,%s,%s@%s:%s" % ++ (po.name, po.arch, po.epoch, po.version, po.release, ++ pkgorigin, rel)] ++ msg += ["\n"] + + for lst in ['depends_on', 'obsoletes', 'obsoleted_by', 'downgrades', + 'downgraded_by', 'updates', 'updated_by']: + thislist = getattr(self, lst) + if thislist: +- msg += " %s:" % lst ++ msg += [" %s:" % lst] + for po in thislist: + pkgorigin = 'a' + if isinstance(po, YumInstalledPackage): + pkgorigin = 'i' +- msg += " %s,%s,%s,%s,%s@%s" % (po.name, po.arch, po.epoch, +- po.version, po.release, pkgorigin) +- msg += "\n" ++ msg += [" %s,%s,%s,%s,%s@%s" % ++ (po.name, po.arch, po.epoch, po.version, ++ po.release, pkgorigin)] ++ msg += ["\n"] + + if self.groups: +- msg += " groups: %s\n" % ' '.join(self.groups) ++ msg += [" groups: %s\n" % ' '.join(self.groups)] + if self.environments: +- msg += " environments: %s\n" % ' '.join(self.environments) ++ msg += [" environments: %s\n" % ' '.join(self.environments)] + if self.repopkg: +- msg += " repopkg: %s\n" % self.repopkg ++ msg += [" repopkg: %s\n" % self.repopkg] + +- return msg ++ return ''.join(msg) diff --git a/SOURCES/BZ-1645173-clean-all-disk-usage-fixes.patch b/SOURCES/BZ-1645173-clean-all-disk-usage-fixes.patch new file mode 100644 index 0000000..17266e1 --- /dev/null +++ b/SOURCES/BZ-1645173-clean-all-disk-usage-fixes.patch @@ -0,0 +1,144 @@ +diff -up yum-3.4.3/cli.py.orig yum-3.4.3/cli.py +--- yum-3.4.3/cli.py.orig 2019-03-27 16:55:58.034750506 +0100 ++++ yum-3.4.3/cli.py 2019-03-27 16:57:54.515257711 +0100 +@@ -1740,6 +1740,7 @@ class YumBaseCli(yum.YumBase, output.Yum + paths = glob.glob(cacheglob + '/*') + table = ([], [], [], []) # (enabled, disabled, untracked, other) + repos = self.repos.repos ++ empty = True + for path in paths: + base = os.path.basename(path) + if os.path.isdir(path): +@@ -1750,18 +1751,29 @@ class YumBaseCli(yum.YumBase, output.Yum + col = 0 + else: + col = 1 +- # Recursively gather all files in this repodir +- files = yum.misc.getFileList(path, '', []) + else: + # Ordinary file (such as timedhosts) + col = 3 +- files = [path] +- usage = sum(map(os.path.getsize, files)) +- if usage > 0: +- table[col].append((usage, path)) ++ usage = yum.misc.disk_usage(path) ++ if not usage: ++ continue ++ table[col].append((usage, path)) ++ # Detect any uncleaned data. ++ # ++ # We never remove directories or any unrecognized repodata ++ # files, so there always will be a few kilobytes left behind. ++ # To avoid a constant false alarm, let's ignore such files if ++ # they are really tiny (such as "productid"). The easiest way ++ # is to look at "usage" as it covers both directories and ++ # files. Given that a typical cleaned repodir (4K) consists of ++ # the gen/ (4K) and packages/ (4K) subdirs and possibly the ++ # productid file (8K), let's "round" it up to 64K and use that ++ # as our threshold. ++ if col < 3 and usage > 64*1024: ++ empty = False + + # Print the table (verbose mode only) +- lines = [_('Disk usage of %s after cleanup:') % cacheglob] ++ lines = [_('Disk usage under %s after cleanup:') % cacheglob] + headers = ('enabled repos', 'disabled repos', 'untracked repos', + 'other data') + totals = [0, 0, 0, 0] +@@ -1783,12 +1795,11 @@ class YumBaseCli(yum.YumBase, output.Yum + msg = '\n'.join(lines) + self.verbose_logger.log(yum.logginglevels.DEBUG_3, msg) + +- # Print a short hint for leftover repos specifically (non-verbose +- # mode only) +- total = sum(totals[:3]) +- if self.conf.debuglevel == 6 or not total: ++ # Print a short hint if leftover repos are found (non-verbose mode ++ # only). ++ if empty or self.conf.debuglevel == 6: + return code, [] +- total = self.format_number(total) ++ total = self.format_number(sum(totals[:3])) + if total[-1] == ' ': + total = total[:-1] + 'bytes' + msg = (_('Other repos take up %s of disk space ' +diff -up yum-3.4.3/docs/yum.8.orig yum-3.4.3/docs/yum.8 +--- yum-3.4.3/docs/yum.8.orig 2019-03-27 16:55:58.034750506 +0100 ++++ yum-3.4.3/docs/yum.8 2019-03-27 16:57:54.515257711 +0100 +@@ -1032,35 +1032,13 @@ Or: \fByum list available 'foo* + .SH "CLEAN OPTIONS" + The following are the ways which you can invoke \fByum\fP in clean mode. + +-Note that these commands only operate on files in currently enabled +-repositories. +-If you use substitution variables (such as $releasever) in your \fBcachedir\fP +-configuration, the operation is further restricted to the current values of +-those variables. +- +-For fine-grained control over what is being cleaned, you can use +-\fB\-\-enablerepo\fP, \fB\-\-disablerepo\fP and \fB\-\-releasever\fP as +-desired. +-Note, however, that you cannot use \fB\-\-releasever='*'\fP to do the cleaning +-for all values previously used. +-Also note that untracked (no longer configured) repositories will not be +-automatically cleaned. +- +-To purge the entire cache in one go, the easiest way is to delete the files +-manually. +-Depending on your \fBcachedir\fP configuration, this usually means treating any +-variables as shell wildcards and recursively removing matching directories. +-For example, if your \fBcachedir\fP is /var/cache/yum/$basearch/$releasever, +-then the whole /var/cache/yum directory has to be removed. +-If you do this, \fByum\fP will rebuild the cache as required the next time it +-is run (this may take a while). +- +-As a convenience, when you run \fByum clean all\fP, a recursive lookup will be +-done to detect any repositories not cleaned due to the above restrictions. +-If some are found, a message will be printed stating how much disk space they +-occupy and thus how much you can reclaim by cleaning them. +-If you also supply \fB\-\-verbose\fP, a more detailed breakdown will be +-printed. ++Note that these commands only operate on the currently enabled repositories ++within the current \fBcachedir\fR (that is, with any substitution variables ++such as $releasever expanded to their runtime values). ++To clean specific repositories, use \fB\-\-enablerepo\fP, \fB\-\-disablerepo\fP ++or \fB\-\-releasever\fP accordingly. ++Note, however, that untracked (no longer configured) repositories cannot be ++cleaned this way; they have to be removed manually. + + .IP "\fByum clean expire-cache\fP" + Eliminate the local data saying when the metadata and mirrorlists were downloaded for each repo. This means yum will revalidate the cache for each repo. next time it is used. However if the cache is still valid, nothing significant was deleted. +@@ -1090,6 +1068,13 @@ Tell any enabled plugins to eliminate th + + .IP "\fByum clean all\fP" + Does all of the above. ++As a convenience, if this command does not result in a completely empty cache ++due to the restrictions outlined at the beginning of this section, a message ++will be printed, saying how much disk space can be reclaimed by cleaning the ++remaining repos manually. ++For this purpose, a repo is considered clean when its disk usage doesn't exceed ++64KB (that is to account for directory entries and tiny metadata files such as ++"productid" that are never cleaned). + + .SH "EXAMPLES" + .PP +diff -up yum-3.4.3/yum/misc.py.orig yum-3.4.3/yum/misc.py +--- yum-3.4.3/yum/misc.py.orig 2019-03-27 16:55:58.010750196 +0100 ++++ yum-3.4.3/yum/misc.py 2019-03-27 16:57:54.515257711 +0100 +@@ -1252,3 +1252,15 @@ def validate_repoid(repoid): + return char + else: + return None ++ ++def disk_usage(path): ++ """Return disk usage of the given filename, recursively for dirs.""" ++ def usage(path): ++ return os.stat(path).st_blocks * 512 ++ total = usage(path) ++ if not os.path.isdir(path): ++ return total ++ for root, dirs, files in os.walk(path): ++ paths = (os.path.join(root, entry) for entry in dirs + files) ++ total += sum(usage(path) for path in paths) ++ return total diff --git a/SOURCES/centos-branding-yum.patch b/SOURCES/centos-branding-yum.patch deleted file mode 100644 index f100222..0000000 --- a/SOURCES/centos-branding-yum.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff -uNrp yum-3.4.3.orig/yum/constants.py yum-3.4.3/yum/constants.py ---- yum-3.4.3.orig/yum/constants.py 2018-01-30 11:17:56.961899488 +0000 -+++ yum-3.4.3/yum/constants.py 2018-01-30 11:41:57.421866122 +0000 -@@ -123,22 +123,22 @@ REPO_PROBLEM_PACKAGE=5 - - - ERRORS_TO_KBASE_ARTICLES = { -- 404: """To address this issue please refer to the below knowledge base article -+ 404: """To address this issue please refer to the below wiki article - --https://access.redhat.com/articles/1320623 -+https://wiki.centos.org/yum-errors - --If above article doesn't help to resolve this issue please open a ticket with Red Hat Support. -+If above article doesn't help to resolve this issue please use https://bugs.centos.org/. - """, -- 403: """To address this issue please refer to the below knowledge base article -+ 403: """To address this issue please refer to the below wiki article - --https://access.redhat.com/solutions/69319 -+https://wiki.centos.org/yum-errors - --If above article doesn't help to resolve this issue please open a ticket with Red Hat Support. -+If above article doesn't help to resolve this issue please use https://bugs.centos.org/. - """, -- 60: """It was impossible to connect to the Red Hat servers. -+ 60: """It was impossible to connect to the CentOS servers. - This could mean a connectivity issue in your environment, such as the requirement to configure a proxy, - or a transparent proxy that tampers with TLS security, or an incorrect system clock. --Please collect information about the specific failure that occurs in your environment, --using the instructions in: https://access.redhat.com/solutions/1527033 and open a ticket with Red Hat Support. -+You can try to solve this issue by using the instructions on https://wiki.centos.org/yum-errors -+If above article doesn't help to resolve this issue please use https://bugs.centos.org/. - """ --} -\ No newline at end of file -+} diff --git a/SOURCES/yum.conf.centos b/SOURCES/yum.conf.centos deleted file mode 100644 index 367126f..0000000 --- a/SOURCES/yum.conf.centos +++ /dev/null @@ -1,26 +0,0 @@ -[main] -cachedir=/var/cache/yum/$basearch/$releasever -keepcache=0 -debuglevel=2 -logfile=/var/log/yum.log -exactarch=1 -obsoletes=1 -gpgcheck=1 -plugins=1 -installonly_limit=5 -bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum -distroverpkg=centos-release - - -# This is the default, if you make this bigger yum won't see if the metadata -# is newer on the remote and so you'll "gain" the bandwidth of not having to -# download the new metadata and "pay" for it by yum not having correct -# information. -# It is esp. important, to have correct metadata, for distributions like -# Fedora which don't keep old packages around. If you don't like this checking -# interupting your command line usage, it's much better to have something -# manually check the metadata once an hour (yum-updatesd will do this). -# metadata_expire=90m - -# PUT YOUR REPOS HERE OR IN separate files named file.repo -# in /etc/yum.repos.d diff --git a/SPECS/yum.spec b/SPECS/yum.spec index 819642a..248fd25 100644 --- a/SPECS/yum.spec +++ b/SPECS/yum.spec @@ -32,11 +32,11 @@ Summary: RPM package installer/updater/manager Name: yum Version: 3.4.3 -Release: 161%{?dist} +Release: 163%{?dist} License: GPLv2+ Group: System Environment/Base Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz -Source1: yum.conf.centos +Source1: yum.conf.fedora Source2: yum-updatesd.conf.fedora Patch1: yum-distro-configs.patch Patch5: geode-arch.patch @@ -168,8 +168,11 @@ Patch314: BZ-1481220-print-disk-usage-on-yum-clean-all.patch Patch315: BZ-1480065-depsolve-filter-conflicting-provider.patch Patch316: BZ-1506890-logrotate-change-size-to-maxsize.patch -#CentOS Branding -Patch1000: centos-branding-yum.patch +# rhel-7.7 +Patch340: BZ-1410234-downloadonly-unlink-tmp-files.patch +Patch341: BZ-1645173-clean-all-disk-usage-fixes.patch +Patch342: BZ-1600383-save-ts-no-str-concat.patch +Patch343: BZ-1510491-fixup-yumdb-validator.patch URL: http://yum.baseurl.org/ BuildArchitectures: noarch @@ -188,7 +191,6 @@ BuildRequires: pygpgme # End of CheckRequires Conflicts: pirut < 1.1.4 Requires: python >= 2.4 -Requires: yum-plugin-fastestmirror Requires: rpm-python, rpm >= 0:4.11.3-22 Requires: python-iniparse Requires: python-sqlite @@ -422,7 +424,11 @@ Install this package if you want auto yum updates nightly via cron. %patch315 -p1 %patch316 -p1 -%patch1000 -p1 +# rhel-7.7 +%patch340 -p1 +%patch341 -p1 +%patch342 -p1 +%patch343 -p1 # Do distro config. changes after everything else. %patch1 -p1 @@ -654,13 +660,17 @@ exit 0 %endif %changelog -* Tue Oct 30 2018 CentOS Sources - 3.4.3-161.el7.centos -- CentOS yum config -- use the CentOS bug tracker url -- retain installonly limit of 5 -- ensure distrover is always from centos-release -- Make yum require yum-plugin-fastestmirror -- add centos-branding-yum.patch +* Wed May 17 2019 Michal Domonkos - 3.4.3-163 +- Fix from_repo yumdb validator for local pkgs +- Resolves: bug#1510491 + +* Wed Mar 27 2019 Michal Domonkos - 3.4.3-162 +- downloadonly: unlink .tmp files on ctrl-c +- Resolves: bug#1410234 +- Fix calculation of uncleaned disk space after "yum clean all" +- Resolves: bug#1645173 +- Speed up depsolving in Anaconda for large transactions +- Resolves: bug#1600383 * Wed Aug 15 2018 Michal Domonkos - 3.4.3-161 - Improve retry logic for gpg keys