You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.9 KiB
65 lines
2.9 KiB
6 years ago
|
diff -up yum-3.4.3/yum/yumRepo.py.orig yum-3.4.3/yum/yumRepo.py
|
||
|
--- yum-3.4.3/yum/yumRepo.py.orig 2017-03-10 14:16:36.769105433 +0100
|
||
|
+++ yum-3.4.3/yum/yumRepo.py 2017-03-10 14:16:39.457093071 +0100
|
||
|
@@ -358,6 +358,7 @@ class YumRepository(Repository, config.R
|
||
|
# holder for stuff we've grabbed
|
||
|
self.retrieved = { 'primary':0, 'filelists':0, 'other':0, 'group':0,
|
||
|
'updateinfo':0, 'prestodelta':0}
|
||
|
+ self._preloaded_repomd = False
|
||
|
|
||
|
# callbacks
|
||
|
self.callback = None # for the grabber
|
||
|
@@ -743,7 +744,8 @@ class YumRepository(Repository, config.R
|
||
|
|
||
|
# if we're using a cachedir that's not the system one, copy over these
|
||
|
# basic items from the system one
|
||
|
- self._preload_md_from_system_cache('repomd.xml')
|
||
|
+ if self._preload_md_from_system_cache('repomd.xml'):
|
||
|
+ self._preloaded_repomd = True
|
||
|
self._preload_md_from_system_cache('cachecookie')
|
||
|
self._preload_md_from_system_cache('mirrorlist.txt')
|
||
|
self._preload_md_from_system_cache('metalink.xml')
|
||
|
@@ -1829,6 +1831,12 @@ Insufficient space in download directory
|
||
|
# got it, move along
|
||
|
return local
|
||
|
|
||
|
+ # Having preloaded the repomd means we should first try preloading this
|
||
|
+ # file as well (forcing it this way is only needed when dealing with
|
||
|
+ # simple filenames).
|
||
|
+ if self._preloaded_repomd:
|
||
|
+ misc.unlink_f(local)
|
||
|
+
|
||
|
if (os.path.exists(local) or
|
||
|
self._preload_md_from_system_cache(os.path.basename(local))):
|
||
|
if self._checkMD(local, mdtype, check_can_fail=True):
|
||
|
@@ -1844,6 +1852,20 @@ Insufficient space in download directory
|
||
|
msg = "Caching enabled but no local cache of %s from %s" % (local, self.ui_id)
|
||
|
raise Errors.RepoError, msg
|
||
|
|
||
|
+ # Given the file already exists, is it a partial download of thisdata
|
||
|
+ # that we can try to reget? With unique filenames, that's always.
|
||
|
+ # With simple filenames, use the old expected checksum to verify
|
||
|
+ # (assuming the existing file or part represents the old data but it
|
||
|
+ # usually does).
|
||
|
+ partial = True
|
||
|
+ orepomd = self._oldRepoMDData.get('old_repo_XML')
|
||
|
+ if orepomd is not None:
|
||
|
+ odata = orepomd.repoData.get(mdtype)
|
||
|
+ if odata is not None:
|
||
|
+ ofname = os.path.basename(odata.location[1])
|
||
|
+ partial = (fname != ofname or
|
||
|
+ thisdata.checksum == odata.checksum)
|
||
|
+
|
||
|
try:
|
||
|
def checkfunc(obj):
|
||
|
try:
|
||
|
@@ -1856,7 +1878,7 @@ Insufficient space in download directory
|
||
|
raise
|
||
|
self.retrieved[mdtype] = 1
|
||
|
text = "%s/%s" % (self.ui_id, mdtype)
|
||
|
- if thisdata.size is None:
|
||
|
+ if thisdata.size is None or not partial:
|
||
|
reget = None
|
||
|
else:
|
||
|
reget = 'simple'
|