diff --git a/yum-HEAD.patch b/yum-HEAD.patch index 49709e7..aeacfe2 100644 --- a/yum-HEAD.patch +++ b/yum-HEAD.patch @@ -194602,7 +194602,7 @@ index aaa4f25..a2c5135 100755 continue diff --git a/yum/misc.py b/yum/misc.py -index 2f6ddfe..bb84815 100644 +index 2f6ddfe..aae13c2 100644 --- a/yum/misc.py +++ b/yum/misc.py @@ -5,9 +5,11 @@ Assorted utility functions for yum. @@ -194906,7 +194906,7 @@ index 2f6ddfe..bb84815 100644 return out -@@ -1123,12 +1157,12 @@ def repo_gen_decompress(filename, generated_name, cached=False): +@@ -1123,13 +1157,14 @@ def repo_gen_decompress(filename, generated_name, cached=False): """ This is a wrapper around decompress, where we work out a cached generated name, and use check_timestamps. filename _must_ be from a repo. and generated_name is the type of the file. """ @@ -194916,16 +194916,19 @@ index 2f6ddfe..bb84815 100644 - os.makedirs(dest, mode=0755) - dest += '/' + generated_name - return decompress(filename, dest=dest, check_timestamps=True,fn_only=cached) +- + dest = os.path.dirname(filename) + '/gen/' + generated_name -+ ret = decompress(filename, dest=dest, check_timestamps=True,fn_only=cached) ++ try: ++ return decompress(filename, dest=dest, check_timestamps=True) ++ except IOError, e: ++ if cached and e.errno == errno.EACCES: ++ return None ++ raise + -+ if cached and ret and not os.path.exists(ret): -+ return None -+ return ret - def read_in_items_from_dot_dir(thisglob, line_as_list=True): """takes a glob of a dir (like /etc/foo.d/*.foo) -@@ -1175,3 +1209,22 @@ def cElementTree_xmlparse(filename): + returns a list of all the lines in all the files matching +@@ -1175,3 +1210,22 @@ def cElementTree_xmlparse(filename): """ Lazily load/run: cElementTree.parse """ _cElementTree_import() return __cached_cElementTree.parse(filename) @@ -197943,7 +197946,7 @@ index 0000000..1cc207f + return txmbrs + diff --git a/yum/yumRepo.py b/yum/yumRepo.py -index e5e9ece..3a85578 100644 +index e5e9ece..53c0ab2 100644 --- a/yum/yumRepo.py +++ b/yum/yumRepo.py @@ -20,10 +20,12 @@ import time @@ -198373,7 +198376,17 @@ index e5e9ece..3a85578 100644 return opts def _getgrabfunc(self): -@@ -561,7 +727,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -531,9 +697,6 @@ class YumRepository(Repository, config.RepoConf): + if os.path.exists(dpath) and os.path.isdir(dpath): + return + +- if self.cache: +- raise Errors.RepoError, "Cannot access repository dir %s" % dpath +- + try: + os.makedirs(dpath, mode=0755) + except OSError, e: +@@ -561,7 +724,7 @@ class YumRepository(Repository, config.RepoConf): cookie = self.cachedir + '/' + self.metadata_cookie_fn self.setAttribute('_dir_setup_metadata_cookie', cookie) @@ -198382,7 +198395,7 @@ index e5e9ece..3a85578 100644 self._dirSetupMkdir_p(dir) # persistdir is really root-only but try the make anyway and just -@@ -714,15 +880,15 @@ class YumRepository(Repository, config.RepoConf): +@@ -714,15 +877,15 @@ class YumRepository(Repository, config.RepoConf): local = self.metalink_filename + '.tmp' if not self._metalinkCurrent(): url = misc.to_utf8(self.metalink) @@ -198402,7 +198415,7 @@ index e5e9ece..3a85578 100644 raise Errors.RepoError, msg # Now, we have an old usable metalink, so we can't move to # a newer repomd.xml ... or checksums won't match. -@@ -749,9 +915,22 @@ class YumRepository(Repository, config.RepoConf): +@@ -749,9 +912,22 @@ class YumRepository(Repository, config.RepoConf): value), fdel=lambda self: setattr(self, "_metalink", None)) @@ -198426,7 +198439,7 @@ index e5e9ece..3a85578 100644 """retrieve file from the mirrorgroup for the repo relative to local, optionally get range from start to end, also optionally retrieve from a specific baseurl""" -@@ -768,7 +947,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -768,7 +944,7 @@ class YumRepository(Repository, config.RepoConf): if local is None or relative is None: raise Errors.RepoError, \ @@ -198435,7 +198448,7 @@ index e5e9ece..3a85578 100644 if self.cache == 1: if os.path.exists(local): # FIXME - we should figure out a way -@@ -778,7 +957,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -778,7 +954,7 @@ class YumRepository(Repository, config.RepoConf): raise Errors.RepoError, \ "Caching enabled but no local cache of %s from %s" % (local, @@ -198444,7 +198457,7 @@ index e5e9ece..3a85578 100644 if url: (scheme, netloc, path, query, fragid) = urlparse.urlsplit(url) -@@ -796,6 +975,16 @@ class YumRepository(Repository, config.RepoConf): +@@ -796,6 +972,16 @@ class YumRepository(Repository, config.RepoConf): except Errors.MediaError, e: verbose_logger.log(logginglevels.DEBUG_2, "Error getting package from media; falling back to url %s" %(e,)) @@ -198461,7 +198474,7 @@ index e5e9ece..3a85578 100644 if url and scheme != "media": ugopts = self._default_grabopts(cache=cache) ug = URLGrabber(progress_obj = self.callback, -@@ -815,14 +1004,9 @@ class YumRepository(Repository, config.RepoConf): +@@ -815,14 +1001,9 @@ class YumRepository(Repository, config.RepoConf): range=(start, end), ) except URLGrabError, e: @@ -198479,7 +198492,7 @@ index e5e9ece..3a85578 100644 else: -@@ -835,19 +1019,19 @@ class YumRepository(Repository, config.RepoConf): +@@ -835,19 +1016,19 @@ class YumRepository(Repository, config.RepoConf): reget = reget, checkfunc=checkfunc, http_headers=headers, @@ -198506,7 +198519,7 @@ index e5e9ece..3a85578 100644 remote = package.relativepath local = package.localPkg() basepath = package.basepath -@@ -857,15 +1041,30 @@ class YumRepository(Repository, config.RepoConf): +@@ -857,15 +1038,30 @@ class YumRepository(Repository, config.RepoConf): return local misc.unlink_f(local) @@ -198538,7 +198551,7 @@ index e5e9ece..3a85578 100644 def getHeader(self, package, checkfunc = None, reget = 'simple', cache = True): -@@ -933,7 +1132,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -933,7 +1129,7 @@ class YumRepository(Repository, config.RepoConf): self._metadataCurrent = False return self._metadataCurrent @@ -198547,7 +198560,7 @@ index e5e9ece..3a85578 100644 """check if any file is older than a certain amount of time. Used for the cachecookie and the mirrorlist return True if w/i the expiration time limit -@@ -943,6 +1142,24 @@ class YumRepository(Repository, config.RepoConf): +@@ -943,6 +1139,24 @@ class YumRepository(Repository, config.RepoConf): file. If any of them are newer then invalidate the cache """ @@ -198572,7 +198585,7 @@ index e5e9ece..3a85578 100644 # -1 is special and should never get refreshed if expiration_time == -1 and os.path.exists(myfile): return True -@@ -991,7 +1208,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -991,7 +1205,7 @@ class YumRepository(Repository, config.RepoConf): def _cachingRepoXML(self, local): """ Should we cache the current repomd.xml """ if self.cache and not os.path.exists(local): @@ -198581,7 +198594,7 @@ index e5e9ece..3a85578 100644 if self.cache or self.metadataCurrent(): return True return False -@@ -1020,7 +1237,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1020,7 +1234,7 @@ class YumRepository(Repository, config.RepoConf): if grab_can_fail: return None raise Errors.RepoError, 'Error downloading file %s: %s' % (local, e) @@ -198590,7 +198603,7 @@ index e5e9ece..3a85578 100644 misc.unlink_f(tfname) if grab_can_fail: return None -@@ -1047,7 +1264,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1047,7 +1261,7 @@ class YumRepository(Repository, config.RepoConf): parse_can_fail = 'old_repo_XML' in self._oldRepoMDData if parse_can_fail: return None @@ -198599,7 +198612,7 @@ index e5e9ece..3a85578 100644 def _saveOldRepoXML(self, local): """ If we have an older repomd.xml file available, save it out. """ -@@ -1074,7 +1291,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1074,7 +1288,7 @@ class YumRepository(Repository, config.RepoConf): # We still want the old data, so we don't download twice. So we # pretend everything is good until the revert. if not self.timestamp_check: @@ -198608,7 +198621,7 @@ index e5e9ece..3a85578 100644 if 'old_repo_XML' not in self._oldRepoMDData: self._oldRepoMDData = {} -@@ -1250,7 +1467,6 @@ class YumRepository(Repository, config.RepoConf): +@@ -1250,7 +1464,6 @@ class YumRepository(Repository, config.RepoConf): self._revertOldRepoXML() return False @@ -198616,7 +198629,7 @@ index e5e9ece..3a85578 100644 if caching: return False # Skip any work. -@@ -1260,6 +1476,9 @@ class YumRepository(Repository, config.RepoConf): +@@ -1260,6 +1473,9 @@ class YumRepository(Repository, config.RepoConf): return True def _check_db_version(self, mdtype, repoXML=None): @@ -198626,7 +198639,7 @@ index e5e9ece..3a85578 100644 if repoXML is None: repoXML = self.repoXML if mdtype in repoXML.repoData: -@@ -1277,11 +1496,11 @@ class YumRepository(Repository, config.RepoConf): +@@ -1277,11 +1493,11 @@ class YumRepository(Repository, config.RepoConf): return None if not file_check: @@ -198641,7 +198654,7 @@ index e5e9ece..3a85578 100644 if not os.path.exists(local): local = misc.decompress(local, fn_only=True) compressed = True -@@ -1302,6 +1521,17 @@ class YumRepository(Repository, config.RepoConf): +@@ -1302,6 +1518,17 @@ class YumRepository(Repository, config.RepoConf): into the delete list, this means metadata can change filename without us leaking it. """ @@ -198659,7 +198672,7 @@ index e5e9ece..3a85578 100644 def _mdtype_eq(omdtype, odata, nmdtype, ndata): """ Check if two returns from _get_mdtype_data() are equal. """ if ndata is None: -@@ -1321,6 +1551,14 @@ class YumRepository(Repository, config.RepoConf): +@@ -1321,6 +1548,14 @@ class YumRepository(Repository, config.RepoConf): return True all_mdtypes = self.retrieved.keys() @@ -198674,7 +198687,7 @@ index e5e9ece..3a85578 100644 if mdtypes is None: mdtypes = all_mdtypes -@@ -1332,9 +1570,8 @@ class YumRepository(Repository, config.RepoConf): +@@ -1332,9 +1567,8 @@ class YumRepository(Repository, config.RepoConf): self._oldRepoMDData['old_MD_files'] = reverts # Inited twice atm. ... sue me @@ -198686,7 +198699,7 @@ index e5e9ece..3a85578 100644 for mdtype in all_mdtypes: (nmdtype, ndata) = self._get_mdtype_data(mdtype) -@@ -1371,43 +1608,16 @@ class YumRepository(Repository, config.RepoConf): +@@ -1371,43 +1605,16 @@ class YumRepository(Repository, config.RepoConf): # No old repomd data, but we might still have uncompressed MD if self._groupCheckDataMDValid(ndata, nmdtype, mdtype): continue @@ -198702,9 +198715,7 @@ index e5e9ece..3a85578 100644 - if len(downloading_with_size) == 1: - downloading_no_size.extend(downloading_with_size) - downloading_with_size = [] -+ def _commonRetrieveDataMD_done(self, downloading): -+ """ Uncompress the downloaded metadata """ - +- - remote_size = 0 - local_size = 0 - for (ndata, nmdtype) in downloading_with_size: # Get total size... @@ -198721,7 +198732,9 @@ index e5e9ece..3a85578 100644 - if not self._retrieveMD(nmdtype, retrieve_can_fail=True): - self._revertOldRepoXML() - return False -- ++ def _commonRetrieveDataMD_done(self, downloading): ++ """ Uncompress the downloaded metadata """ + - for (ndata, nmdtype) in downloading_with_size + downloading_no_size: + for (ndata, nmdtype) in downloading: local = self._get_mdtype_fname(ndata, False) @@ -198736,7 +198749,7 @@ index e5e9ece..3a85578 100644 def _groupLoadRepoXML(self, text=None, mdtypes=None): """ Retrieve the new repomd.xml from the repository, then check it -@@ -1421,7 +1631,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1421,7 +1628,7 @@ class YumRepository(Repository, config.RepoConf): self._commonRetrieveDataMD(mdtypes) def _mdpolicy2mdtypes(self): @@ -198745,7 +198758,7 @@ index e5e9ece..3a85578 100644 'group:primary' : ['primary'], 'group:small' : ["primary", "updateinfo"], 'group:main' : ["primary", "group", "filelists", -@@ -1436,6 +1646,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1436,6 +1643,7 @@ class YumRepository(Repository, config.RepoConf): if not mdtypes or 'group:all' in mdtypes: mdtypes = None else: @@ -198753,7 +198766,7 @@ index e5e9ece..3a85578 100644 mdtypes = sorted(list(mdtypes)) return mdtypes -@@ -1446,17 +1657,12 @@ class YumRepository(Repository, config.RepoConf): +@@ -1446,17 +1654,12 @@ class YumRepository(Repository, config.RepoConf): except KeyboardInterrupt: self._revertOldRepoXML() # Undo metadata cookie? raise @@ -198773,7 +198786,7 @@ index e5e9ece..3a85578 100644 return self._repoXML -@@ -1480,7 +1686,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1480,7 +1683,7 @@ class YumRepository(Repository, config.RepoConf): result = self._getFile(relative='repodata/repomd.xml.asc', copy_local=1, local = sigfile, @@ -198782,7 +198795,7 @@ index e5e9ece..3a85578 100644 reget=None, checkfunc=None, cache=self.http_caching == 'all', -@@ -1508,6 +1714,18 @@ class YumRepository(Repository, config.RepoConf): +@@ -1508,6 +1711,18 @@ class YumRepository(Repository, config.RepoConf): raise URLGrabError(-1, 'repomd.xml does not match metalink for %s' % self) @@ -198801,7 +198814,7 @@ index e5e9ece..3a85578 100644 def checkMD(self, fn, mdtype, openchecksum=False): """check the metadata type against its checksum""" -@@ -1537,6 +1755,16 @@ class YumRepository(Repository, config.RepoConf): +@@ -1537,6 +1752,16 @@ class YumRepository(Repository, config.RepoConf): if size is not None: size = int(size) @@ -198818,7 +198831,7 @@ index e5e9ece..3a85578 100644 try: # get the local checksum l_csum = self._checksum(r_ctype, file, datasize=size) except Errors.RepoError, e: -@@ -1545,21 +1773,20 @@ class YumRepository(Repository, config.RepoConf): +@@ -1545,21 +1770,20 @@ class YumRepository(Repository, config.RepoConf): raise URLGrabError(-3, 'Error performing checksum') if l_csum == r_csum: @@ -198842,30 +198855,40 @@ index e5e9ece..3a85578 100644 """ Internal function, use .retrieveMD() from outside yum. """ # Note that this can raise Errors.RepoMDError if mdtype doesn't exist # for this repo. -@@ -1580,15 +1807,19 @@ class YumRepository(Repository, config.RepoConf): - try: - self.checkMD(local, mdtype) - except URLGrabError, e: -+ if retrieve_can_fail: -+ return None - raise Errors.RepoError, \ - "Caching enabled and local cache: %s does not match checksum" % local - else: - return local +@@ -1575,37 +1799,38 @@ class YumRepository(Repository, config.RepoConf): + # got it, move along + return local - else: # ain't there - raise -+ if retrieve_can_fail: -+ return None - raise Errors.RepoError, \ - "Caching enabled but no local cache of %s from %s" % (local, +- if self.cache == 1: +- if os.path.exists(local): +- try: +- self.checkMD(local, mdtype) +- except URLGrabError, e: +- raise Errors.RepoError, \ +- "Caching enabled and local cache: %s does not match checksum" % local +- else: +- return local +- +- else: # ain't there - raise +- raise Errors.RepoError, \ +- "Caching enabled but no local cache of %s from %s" % (local, - self) -+ self.ui_id) - +- if (os.path.exists(local) or self._preload_md_from_system_cache(os.path.basename(local))): -@@ -1597,15 +1828,22 @@ class YumRepository(Repository, config.RepoConf): + if self._checkMD(local, mdtype, check_can_fail=True): + self.retrieved[mdtype] = 1 return local # it's the same return the local one ++ if self.cache == 1: ++ if retrieve_can_fail: ++ return None ++ if os.path.exists(local): ++ msg = "Caching enabled and local cache: %s does not match checksum" % local ++ else: ++ msg = "Caching enabled but no local cache of %s from %s" % (local, self.ui_id) ++ raise Errors.RepoError, msg ++ try: - checkfunc = (self.checkMD, (mdtype,), {}) - text = "%s/%s" % (self.id, mdtype) @@ -198891,7 +198914,7 @@ index e5e9ece..3a85578 100644 local = self._getFile(relative=remote, local=local, copy_local=1, -@@ -1613,8 +1851,9 @@ class YumRepository(Repository, config.RepoConf): +@@ -1613,8 +1838,9 @@ class YumRepository(Repository, config.RepoConf): checkfunc=checkfunc, text=text, cache=self.http_caching == 'all', @@ -198903,7 +198926,7 @@ index e5e9ece..3a85578 100644 if retrieve_can_fail: return None raise -@@ -1622,9 +1861,8 @@ class YumRepository(Repository, config.RepoConf): +@@ -1622,9 +1848,8 @@ class YumRepository(Repository, config.RepoConf): if retrieve_can_fail: return None raise Errors.RepoError, \ @@ -198914,7 +198937,7 @@ index e5e9ece..3a85578 100644 return local -@@ -1646,13 +1884,21 @@ class YumRepository(Repository, config.RepoConf): +@@ -1646,13 +1871,21 @@ class YumRepository(Repository, config.RepoConf): def getGroups(self): """gets groups and returns group file path for the repository, if there @@ -198939,7 +198962,7 @@ index e5e9ece..3a85578 100644 self._callbacks_changed = True def setFailureObj(self, failure_obj): -@@ -1681,7 +1927,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1681,7 +1914,7 @@ class YumRepository(Repository, config.RepoConf): print "Could not read mirrorlist %s, error was \n%s" %(url, e) content = [] for line in content: @@ -198948,7 +198971,7 @@ index e5e9ece..3a85578 100644 continue mirror = line.rstrip() # no more trailing \n's mirror = mirror.replace('$ARCH', '$BASEARCH') -@@ -1701,7 +1947,8 @@ class YumRepository(Repository, config.RepoConf): +@@ -1701,7 +1934,8 @@ class YumRepository(Repository, config.RepoConf): fo = None cacheok = False @@ -198958,7 +198981,7 @@ index e5e9ece..3a85578 100644 cacheok = True fo = open(self.mirrorlist_file, 'r') url = 'file://' + self.mirrorlist_file # just to keep self._readMirrorList(fo,url) happy -@@ -1713,7 +1960,7 @@ class YumRepository(Repository, config.RepoConf): +@@ -1713,7 +1947,7 @@ class YumRepository(Repository, config.RepoConf): ugopts = self._default_grabopts() try: fo = urlgrabber.grabber.urlopen(url, **ugopts) @@ -198967,7 +198990,7 @@ index e5e9ece..3a85578 100644 print "Could not retrieve mirrorlist %s error was\n%s: %s" % (url, e.args[0], misc.to_unicode(e.args[1])) fo = None -@@ -1740,7 +1987,11 @@ class YumRepository(Repository, config.RepoConf): +@@ -1740,7 +1974,11 @@ class YumRepository(Repository, config.RepoConf): if os.path.exists(destfn): if os.stat(fn)[stat.ST_CTIME] <= os.stat(destfn)[stat.ST_CTIME]: return False @@ -198980,7 +199003,7 @@ index e5e9ece..3a85578 100644 return True def _preload_file_from_system_cache(self, filename, subdir='', -@@ -1877,7 +2128,7 @@ def getMirrorList(mirrorlist, pdict = None): +@@ -1877,7 +2115,7 @@ def getMirrorList(mirrorlist, pdict = None): try: fo = urlresolver.urlopen(url, proxies=pdict) diff --git a/yum.spec b/yum.spec index 0f83158..9e41f42 100644 --- a/yum.spec +++ b/yum.spec @@ -41,7 +41,7 @@ BuildRequires: bash-completion Summary: RPM package installer/updater/manager Name: yum Version: 3.4.3 -Release: 101%{?dist} +Release: 102%{?dist} License: GPLv2+ Group: System Environment/Base Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz @@ -403,6 +403,9 @@ exit 0 %endif %changelog +* Thu Jul 18 2013 Zdenek Pavlas - 3.4.3-102 +- Preload from root cache when --cacheonly. BZ 830523, 903631 + * Tue Jul 16 2013 Zdenek Pavlas - 3.4.3-101 - Update to latest HEAD. - Get correct rpmdb path from rpm configuration