[yum] update to latest HEAD.
James Antill
james at fedoraproject.org
Fri Feb 8 20:32:18 UTC 2013
commit 226f861751a6606a46335b2101523fe5fd418fbb
Author: James Antill <james at and.org>
Date: Fri Feb 8 15:32:10 2013 -0500
update to latest HEAD.
- Add pyxattr require for origin_urls for everyone.
- Fix yum-cron service file and scriptlets.
- Fix instant broken mirrors problem.
yum-HEAD.patch | 191 ++++++++++++++++++++++++++++++++++++--------------------
yum.spec | 29 ++++++++-
2 files changed, 148 insertions(+), 72 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index af69c51..59127c8 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -175218,15 +175218,16 @@ index 0000000..8f6286b
+ main()
diff --git a/yum-cron/yum-cron.service b/yum-cron/yum-cron.service
new file mode 100644
-index 0000000..534d9b0
+index 0000000..82f3e6b
--- /dev/null
+++ b/yum-cron/yum-cron.service
-@@ -0,0 +1,10 @@
+@@ -0,0 +1,11 @@
+[Unit]
+Description=Run automatic yum updates as a cron job
+
+[Service]
-+Type=simple
++Type=oneshot
++RemainAfterExit=yes
+ExecStart=/bin/touch /var/lock/subsys/yum-cron
+ExecStop=/bin/rm -f /var/lock/subsys/yum-cron
+
@@ -175804,7 +175805,7 @@ index 1ce4720..25e3022
gobject.threads_init()
dbus.glib.threads_init()
diff --git a/yum.spec b/yum.spec
-index abd203f..bad42d1 100644
+index abd203f..7efc4bc 100644
--- a/yum.spec
+++ b/yum.spec
@@ -1,24 +1,55 @@
@@ -176004,7 +176005,7 @@ index abd203f..bad42d1 100644
%post updatesd
/sbin/chkconfig --add yum-updatesd
/sbin/service yum-updatesd condrestart >/dev/null 2>&1
-@@ -119,67 +195,45 @@ if [ $1 = 0 ]; then
+@@ -119,67 +195,61 @@ if [ $1 = 0 ]; then
/sbin/service yum-updatesd stop >/dev/null 2>&1
fi
exit 0
@@ -176034,16 +176035,32 @@ index abd203f..bad42d1 100644
- fi
-fi
-exit 0
-+%systemd_post yum-cron.service
- %preun cron
+-%preun cron
-# if this will be a complete removeal of yum-cron rather than an upgrade,
-# remove the service from chkconfig control
-if [ $1 = 0 ]; then
- /sbin/chkconfig --del yum-cron
- /sbin/service yum-cron stop 1> /dev/null 2>&1
--fi
++#systemd_post yum-cron.service
++# Do this manually because it's a fake service for a cronjob, and cronjobs
++# are default on atm. This may change in the future.
++if [ $1 = 1 ]; then
++ systemctl enable yum-cron >/dev/null 2>&1
++else
++# Note that systemctl preset is being run here ... but _only_ on initial
++# install. So try this...
++
++if [ -f /var/lock/subsys/yum-cron -a -f /etc/rc.d/init.d/yum-cron ]; then
++ systemctl enable yum-cron >/dev/null 2>&1
+ fi
-exit 0
++fi
++
++# Also note:
++# systemctl list-unit-files | fgrep yum-cron
++
++%preun cron
+%systemd_preun yum-cron.service
%postun cron
@@ -176090,7 +176107,7 @@ index abd203f..bad42d1 100644
%dir /var/cache/yum
%dir /var/lib/yum
%ghost /var/lib/yum/uuid
-@@ -188,20 +242,21 @@ exit 0
+@@ -188,20 +258,21 @@ exit 0
%ghost /var/lib/yum/yumdb
%{_mandir}/man*/yum.*
%{_mandir}/man*/yum-shell*
@@ -176121,7 +176138,7 @@ index abd203f..bad42d1 100644
%files updatesd
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/yum/yum-updatesd.conf
-@@ -210,8 +265,12 @@ exit 0
+@@ -210,8 +281,12 @@ exit 0
%{_datadir}/yum-cli/yumupd.py*
%{_sbindir}/yum-updatesd
%{_mandir}/man*/yum-updatesd*
@@ -185307,7 +185324,7 @@ index 2cb1acb..3ac0010 100644
def __unicode__(self):
ret = u''
diff --git a/yum/yumRepo.py b/yum/yumRepo.py
-index e5e9ece..dfcf8f9 100644
+index e5e9ece..efbc42a 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -20,10 +20,12 @@ import time
@@ -185340,7 +185357,7 @@ index e5e9ece..dfcf8f9 100644
current = 0
for pkgid in dataobj:
current += 1
-@@ -121,6 +124,25 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -121,6 +124,26 @@ class YumPackageSack(packageSack.PackageSack):
# umm, wtf?
pass
@@ -185361,12 +185378,13 @@ index e5e9ece..dfcf8f9 100644
+
+ if self._check_db_version(repo, mydbtype):
+ if not self._check_uncompressed_db_gen(repo, mydbtype):
++ # NOTE: No failfunc.
+ repo._retrieveMD(mydbtype, async=True, failfunc=None)
+
def populate(self, repo, mdtype='metadata', callback=None, cacheonly=0):
if mdtype == 'all':
data = ['metadata', 'filelists', 'otherdata']
-@@ -138,8 +160,6 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -138,8 +161,6 @@ class YumPackageSack(packageSack.PackageSack):
if item in self.added[repo]:
continue
@@ -185375,7 +185393,7 @@ index e5e9ece..dfcf8f9 100644
if item == 'metadata':
mydbtype = 'primary_db'
mymdtype = 'primary'
-@@ -162,25 +182,39 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -162,25 +183,39 @@ class YumPackageSack(packageSack.PackageSack):
continue
if self._check_db_version(repo, mydbtype):
@@ -185423,7 +185441,7 @@ index e5e9ece..dfcf8f9 100644
xmldata = repo.repoXML.getData(mymdtype)
(ctype, csum) = xmldata.checksum
dobj = repo_cache_function(xml, csum)
-@@ -193,6 +227,25 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -193,6 +228,25 @@ class YumPackageSack(packageSack.PackageSack):
# get rid of all this stuff we don't need now
del repo.cacheHandler
@@ -185449,7 +185467,7 @@ index e5e9ece..dfcf8f9 100644
def _check_uncompressed_db(self, repo, mdtype):
"""return file name of uncompressed db is good, None if not"""
mydbdata = repo.repoXML.getData(mdtype)
-@@ -201,9 +254,11 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -201,9 +255,11 @@ class YumPackageSack(packageSack.PackageSack):
compressed_fn = repo.cachedir + '/' + fname
db_un_fn = misc.decompress(compressed_fn, fn_only=True)
@@ -185462,7 +185480,7 @@ index e5e9ece..dfcf8f9 100644
if os.path.exists(db_un_fn):
if skip_old_DBMD_check and repo._using_old_MD:
return db_un_fn
-@@ -260,10 +315,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -260,10 +316,11 @@ class YumRepository(Repository, config.RepoConf):
self.copy_local = 0
# holder for stuff we've grabbed
self.retrieved = { 'primary':0, 'filelists':0, 'other':0, 'group':0,
@@ -185475,7 +185493,7 @@ index e5e9ece..dfcf8f9 100644
self.failure_obj = None
self.mirror_failure_obj = None
self.interrupt_callback = None
-@@ -285,6 +341,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -285,6 +342,7 @@ class YumRepository(Repository, config.RepoConf):
self._grabfunc = None
self._grab = None
@@ -185483,7 +185501,7 @@ index e5e9ece..dfcf8f9 100644
def __cmp__(self, other):
""" Sort yum repos. by cost, and then by alphanumeric on their id. """
-@@ -311,6 +368,36 @@ class YumRepository(Repository, config.RepoConf):
+@@ -311,6 +369,36 @@ class YumRepository(Repository, config.RepoConf):
return self._sack
sack = property(_getSack)
@@ -185520,7 +185538,7 @@ index e5e9ece..dfcf8f9 100644
def close(self):
if self._sack is not None:
self.sack.close()
-@@ -350,6 +437,10 @@ class YumRepository(Repository, config.RepoConf):
+@@ -350,6 +438,10 @@ class YumRepository(Repository, config.RepoConf):
return thisdata.location
def __str__(self):
@@ -185531,7 +185549,7 @@ index e5e9ece..dfcf8f9 100644
return self.id
def _checksum(self, sumtype, file, CHUNK=2**16, checksum_can_fail=False,
-@@ -378,7 +469,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -378,7 +470,7 @@ class YumRepository(Repository, config.RepoConf):
'basecachedir', 'http_headers', 'metadata_cookie',
'metadata_cookie_fn', 'quick_enable_disable',
'repoMDFile', 'timestamp_check', 'urls', 'mirrorurls',
@@ -185540,7 +185558,7 @@ index e5e9ece..dfcf8f9 100644
for attr in dir(self):
if attr.startswith('_'):
continue
-@@ -422,7 +513,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -422,7 +514,7 @@ class YumRepository(Repository, config.RepoConf):
on then raise a repo error"""
if len(self._urls) < 1 and not self.mediaid:
raise Errors.RepoError, \
@@ -185549,7 +185567,7 @@ index e5e9ece..dfcf8f9 100644
def doProxyDict(self):
if self._proxy_dict:
-@@ -431,25 +522,18 @@ class YumRepository(Repository, config.RepoConf):
+@@ -431,25 +523,18 @@ class YumRepository(Repository, config.RepoConf):
self._proxy_dict = {} # zap it
proxy_string = None
empty = (None, '_none_', '')
@@ -185583,7 +185601,7 @@ index e5e9ece..dfcf8f9 100644
if proxy_string is not None:
self._proxy_dict['http'] = proxy_string
-@@ -483,13 +567,30 @@ class YumRepository(Repository, config.RepoConf):
+@@ -483,13 +568,30 @@ class YumRepository(Repository, config.RepoConf):
ugopts = self._default_grabopts()
self._grabfunc = URLGrabber(progress_obj=self.callback,
@@ -185615,7 +185633,7 @@ index e5e9ece..dfcf8f9 100644
failure_callback=self.mirror_failure_obj)
def _default_grabopts(self, cache=True):
-@@ -499,6 +600,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -499,6 +601,7 @@ class YumRepository(Repository, config.RepoConf):
'throttle': self.throttle,
'proxies': self.proxy_dict,
'timeout': self.timeout,
@@ -185623,7 +185641,7 @@ index e5e9ece..dfcf8f9 100644
'http_headers': tuple(self.__headersListFromDict(cache=cache)),
'ssl_verify_peer': self.sslverify,
'ssl_verify_host': self.sslverify,
-@@ -561,7 +663,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -561,7 +664,7 @@ class YumRepository(Repository, config.RepoConf):
cookie = self.cachedir + '/' + self.metadata_cookie_fn
self.setAttribute('_dir_setup_metadata_cookie', cookie)
@@ -185632,7 +185650,7 @@ index e5e9ece..dfcf8f9 100644
self._dirSetupMkdir_p(dir)
# persistdir is really root-only but try the make anyway and just
-@@ -714,15 +816,15 @@ class YumRepository(Repository, config.RepoConf):
+@@ -714,15 +817,15 @@ class YumRepository(Repository, config.RepoConf):
local = self.metalink_filename + '.tmp'
if not self._metalinkCurrent():
url = misc.to_utf8(self.metalink)
@@ -185652,7 +185670,7 @@ index e5e9ece..dfcf8f9 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 +851,22 @@ class YumRepository(Repository, config.RepoConf):
+@@ -749,9 +852,22 @@ class YumRepository(Repository, config.RepoConf):
value),
fdel=lambda self: setattr(self, "_metalink", None))
@@ -185676,7 +185694,7 @@ index e5e9ece..dfcf8f9 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 +883,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -768,7 +884,7 @@ class YumRepository(Repository, config.RepoConf):
if local is None or relative is None:
raise Errors.RepoError, \
@@ -185685,7 +185703,7 @@ index e5e9ece..dfcf8f9 100644
if self.cache == 1:
if os.path.exists(local): # FIXME - we should figure out a way
-@@ -778,7 +893,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -778,7 +894,7 @@ class YumRepository(Repository, config.RepoConf):
raise Errors.RepoError, \
"Caching enabled but no local cache of %s from %s" % (local,
@@ -185694,7 +185712,7 @@ index e5e9ece..dfcf8f9 100644
if url:
(scheme, netloc, path, query, fragid) = urlparse.urlsplit(url)
-@@ -796,6 +911,16 @@ class YumRepository(Repository, config.RepoConf):
+@@ -796,6 +912,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,))
@@ -185711,11 +185729,12 @@ index e5e9ece..dfcf8f9 100644
if url and scheme != "media":
ugopts = self._default_grabopts(cache=cache)
ug = URLGrabber(progress_obj = self.callback,
-@@ -815,14 +940,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -815,14 +941,12 @@ class YumRepository(Repository, config.RepoConf):
range=(start, end),
)
except URLGrabError, e:
- errstr = "failed to retrieve %s from %s\nerror was %s" % (relative, self.id, e)
++ self._del_dl_file(local, size)
+ errstr = "failed to retrieve %s from %s\nerror was %s" % (relative, self, e)
if self.mirrorurls:
errstr +="\n You could try running: yum clean expire-cache"
@@ -185728,7 +185747,7 @@ index e5e9ece..dfcf8f9 100644
else:
-@@ -835,19 +957,18 @@ class YumRepository(Repository, config.RepoConf):
+@@ -835,19 +959,19 @@ class YumRepository(Repository, config.RepoConf):
reget = reget,
checkfunc=checkfunc,
http_headers=headers,
@@ -185742,6 +185761,7 @@ index e5e9ece..dfcf8f9 100644
- raise Errors.NoMoreMirrorsRepoError, errstr
- else:
- raise Errors.RepoError, errstr
++ self._del_dl_file(local, size)
+ errstr = "failure: %s from %s: %s" % (relative, self, e)
+ errors = getattr(e, 'errors', None)
+ raise Errors.NoMoreMirrorsRepoError(errstr, errors)
@@ -185754,7 +185774,7 @@ index e5e9ece..dfcf8f9 100644
remote = package.relativepath
local = package.localPkg()
basepath = package.basepath
-@@ -857,15 +978,30 @@ class YumRepository(Repository, config.RepoConf):
+@@ -857,15 +981,30 @@ class YumRepository(Repository, config.RepoConf):
return local
misc.unlink_f(local)
@@ -185786,7 +185806,7 @@ index e5e9ece..dfcf8f9 100644
def getHeader(self, package, checkfunc = None, reget = 'simple',
cache = True):
-@@ -933,7 +1069,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -933,7 +1072,7 @@ class YumRepository(Repository, config.RepoConf):
self._metadataCurrent = False
return self._metadataCurrent
@@ -185795,7 +185815,7 @@ index e5e9ece..dfcf8f9 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 +1079,24 @@ class YumRepository(Repository, config.RepoConf):
+@@ -943,6 +1082,24 @@ class YumRepository(Repository, config.RepoConf):
file. If any of them are newer then invalidate the cache
"""
@@ -185820,7 +185840,7 @@ index e5e9ece..dfcf8f9 100644
# -1 is special and should never get refreshed
if expiration_time == -1 and os.path.exists(myfile):
return True
-@@ -991,7 +1145,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -991,7 +1148,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):
@@ -185829,7 +185849,7 @@ index e5e9ece..dfcf8f9 100644
if self.cache or self.metadataCurrent():
return True
return False
-@@ -1020,7 +1174,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1020,7 +1177,7 @@ class YumRepository(Repository, config.RepoConf):
if grab_can_fail:
return None
raise Errors.RepoError, 'Error downloading file %s: %s' % (local, e)
@@ -185838,7 +185858,7 @@ index e5e9ece..dfcf8f9 100644
misc.unlink_f(tfname)
if grab_can_fail:
return None
-@@ -1047,7 +1201,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1047,7 +1204,7 @@ class YumRepository(Repository, config.RepoConf):
parse_can_fail = 'old_repo_XML' in self._oldRepoMDData
if parse_can_fail:
return None
@@ -185847,7 +185867,7 @@ index e5e9ece..dfcf8f9 100644
def _saveOldRepoXML(self, local):
""" If we have an older repomd.xml file available, save it out. """
-@@ -1074,7 +1228,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1074,7 +1231,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:
@@ -185856,7 +185876,7 @@ index e5e9ece..dfcf8f9 100644
if 'old_repo_XML' not in self._oldRepoMDData:
self._oldRepoMDData = {}
-@@ -1260,6 +1414,9 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1260,6 +1417,9 @@ class YumRepository(Repository, config.RepoConf):
return True
def _check_db_version(self, mdtype, repoXML=None):
@@ -185866,7 +185886,7 @@ index e5e9ece..dfcf8f9 100644
if repoXML is None:
repoXML = self.repoXML
if mdtype in repoXML.repoData:
-@@ -1277,11 +1434,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1277,11 +1437,11 @@ class YumRepository(Repository, config.RepoConf):
return None
if not file_check:
@@ -185881,7 +185901,7 @@ index e5e9ece..dfcf8f9 100644
if not os.path.exists(local):
local = misc.decompress(local, fn_only=True)
compressed = True
-@@ -1302,6 +1459,17 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1302,6 +1462,17 @@ class YumRepository(Repository, config.RepoConf):
into the delete list, this means metadata can change filename
without us leaking it. """
@@ -185899,7 +185919,7 @@ index e5e9ece..dfcf8f9 100644
def _mdtype_eq(omdtype, odata, nmdtype, ndata):
""" Check if two returns from _get_mdtype_data() are equal. """
if ndata is None:
-@@ -1321,6 +1489,14 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1321,6 +1492,14 @@ class YumRepository(Repository, config.RepoConf):
return True
all_mdtypes = self.retrieved.keys()
@@ -185914,7 +185934,7 @@ index e5e9ece..dfcf8f9 100644
if mdtypes is None:
mdtypes = all_mdtypes
-@@ -1333,8 +1509,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1333,8 +1512,7 @@ class YumRepository(Repository, config.RepoConf):
# Inited twice atm. ... sue me
self._oldRepoMDData['new_MD_files'] = []
@@ -185924,7 +185944,7 @@ index e5e9ece..dfcf8f9 100644
for mdtype in all_mdtypes:
(nmdtype, ndata) = self._get_mdtype_data(mdtype)
-@@ -1371,43 +1546,16 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1371,43 +1549,16 @@ class YumRepository(Repository, config.RepoConf):
# No old repomd data, but we might still have uncompressed MD
if self._groupCheckDataMDValid(ndata, nmdtype, mdtype):
continue
@@ -185944,9 +185964,7 @@ index e5e9ece..dfcf8f9 100644
- local_size = 0
- for (ndata, nmdtype) in downloading_with_size: # Get total size...
- remote_size += int(ndata.size)
-+ def _commonRetrieveDataMD_done(self, downloading):
-+ """ Uncompress the downloaded metadata """
-
+-
- for (ndata, nmdtype) in downloading_with_size:
- urlgrabber.progress.text_meter_total_size(remote_size, local_size)
- if not self._retrieveMD(nmdtype, retrieve_can_fail=True):
@@ -185958,7 +185976,9 @@ index e5e9ece..dfcf8f9 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)
@@ -185973,7 +185993,7 @@ index e5e9ece..dfcf8f9 100644
def _groupLoadRepoXML(self, text=None, mdtypes=None):
""" Retrieve the new repomd.xml from the repository, then check it
-@@ -1421,7 +1569,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1421,7 +1572,7 @@ class YumRepository(Repository, config.RepoConf):
self._commonRetrieveDataMD(mdtypes)
def _mdpolicy2mdtypes(self):
@@ -185982,7 +186002,7 @@ index e5e9ece..dfcf8f9 100644
'group:primary' : ['primary'],
'group:small' : ["primary", "updateinfo"],
'group:main' : ["primary", "group", "filelists",
-@@ -1436,6 +1584,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1436,6 +1587,7 @@ class YumRepository(Repository, config.RepoConf):
if not mdtypes or 'group:all' in mdtypes:
mdtypes = None
else:
@@ -185990,7 +186010,7 @@ index e5e9ece..dfcf8f9 100644
mdtypes = sorted(list(mdtypes))
return mdtypes
-@@ -1446,17 +1595,12 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1446,17 +1598,12 @@ class YumRepository(Repository, config.RepoConf):
except KeyboardInterrupt:
self._revertOldRepoXML() # Undo metadata cookie?
raise
@@ -186010,7 +186030,7 @@ index e5e9ece..dfcf8f9 100644
return self._repoXML
-@@ -1480,7 +1624,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1480,7 +1627,7 @@ class YumRepository(Repository, config.RepoConf):
result = self._getFile(relative='repodata/repomd.xml.asc',
copy_local=1,
local = sigfile,
@@ -186019,7 +186039,25 @@ index e5e9ece..dfcf8f9 100644
reget=None,
checkfunc=None,
cache=self.http_caching == 'all',
-@@ -1514,7 +1658,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1508,13 +1655,25 @@ class YumRepository(Repository, config.RepoConf):
+ raise URLGrabError(-1, 'repomd.xml does not match metalink for %s' %
+ self)
+
++ def _del_dl_file(self, local, size):
++ """ Delete a downloaded file if it's the correct size. """
++
++ sd = misc.stat_f(local)
++ if not sd: # File doesn't exist...
++ return
++
++ if size and sd.st_size < size:
++ return # Still more to get...
++
++ # Is the correct size, or too big ... delete it so we'll try again.
++ misc.unlink_f(local)
+
+ def checkMD(self, fn, mdtype, openchecksum=False):
+ """check the metadata type against its checksum"""
return self._checkMD(fn, mdtype, openchecksum)
def _checkMD(self, fn, mdtype, openchecksum=False,
@@ -186028,11 +186066,11 @@ index e5e9ece..dfcf8f9 100644
""" Internal function, use .checkMD() from outside yum. """
thisdata = data # So the argument name is nicer
-@@ -1537,6 +1681,18 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1537,6 +1696,18 @@ class YumRepository(Repository, config.RepoConf):
if size is not None:
size = int(size)
-+ if fast:
++ if fast and skip_old_DBMD_check:
+ fsize = misc.stat_f(file)
+ if fsize is None: # File doesn't exist...
+ return None
@@ -186047,7 +186085,7 @@ index e5e9ece..dfcf8f9 100644
try: # get the local checksum
l_csum = self._checksum(r_ctype, file, datasize=size)
except Errors.RepoError, e:
-@@ -1551,15 +1707,13 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1551,15 +1722,13 @@ class YumRepository(Repository, config.RepoConf):
return None
raise URLGrabError(-1, 'Metadata file does not match checksum')
@@ -186064,7 +186102,7 @@ index e5e9ece..dfcf8f9 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 +1734,19 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1580,15 +1749,19 @@ class YumRepository(Repository, config.RepoConf):
try:
self.checkMD(local, mdtype)
except URLGrabError, e:
@@ -186085,20 +186123,35 @@ index e5e9ece..dfcf8f9 100644
if (os.path.exists(local) or
self._preload_md_from_system_cache(os.path.basename(local))):
-@@ -1597,8 +1755,10 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1597,15 +1770,22 @@ class YumRepository(Repository, config.RepoConf):
return local # it's the same return the local one
try:
- checkfunc = (self.checkMD, (mdtype,), {})
- text = "%s/%s" % (self.id, mdtype)
+ def checkfunc(obj):
-+ self.checkMD(obj, mdtype)
++ try:
++ self.checkMD(obj, mdtype)
++ except URLGrabError:
++ # Don't share MD among mirrors, in theory we could use:
++ # self._del_dl_file(local, int(thisdata.size))
++ # ...but this is safer.
++ misc.unlink_f(obj.filename)
++ raise
+ self.retrieved[mdtype] = 1
+ text = "%s/%s" % (self, mdtype)
if thisdata.size is None:
reget = None
else:
-@@ -1613,8 +1773,9 @@ class YumRepository(Repository, config.RepoConf):
+ reget = 'simple'
+- if os.path.exists(local):
+- if os.stat(local).st_size >= int(thisdata.size):
+- misc.unlink_f(local)
++ self._del_dl_file(local, int(thisdata.size))
+ local = self._getFile(relative=remote,
+ local=local,
+ copy_local=1,
+@@ -1613,8 +1793,9 @@ class YumRepository(Repository, config.RepoConf):
checkfunc=checkfunc,
text=text,
cache=self.http_caching == 'all',
@@ -186110,7 +186163,7 @@ index e5e9ece..dfcf8f9 100644
if retrieve_can_fail:
return None
raise
-@@ -1622,9 +1783,8 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1622,9 +1803,8 @@ class YumRepository(Repository, config.RepoConf):
if retrieve_can_fail:
return None
raise Errors.RepoError, \
@@ -186121,7 +186174,7 @@ index e5e9ece..dfcf8f9 100644
return local
-@@ -1646,13 +1806,21 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1646,13 +1826,21 @@ class YumRepository(Repository, config.RepoConf):
def getGroups(self):
"""gets groups and returns group file path for the repository, if there
@@ -186146,7 +186199,7 @@ index e5e9ece..dfcf8f9 100644
self._callbacks_changed = True
def setFailureObj(self, failure_obj):
-@@ -1681,7 +1849,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1681,7 +1869,7 @@ class YumRepository(Repository, config.RepoConf):
print "Could not read mirrorlist %s, error was \n%s" %(url, e)
content = []
for line in content:
@@ -186155,7 +186208,7 @@ index e5e9ece..dfcf8f9 100644
continue
mirror = line.rstrip() # no more trailing \n's
mirror = mirror.replace('$ARCH', '$BASEARCH')
-@@ -1701,7 +1869,8 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1701,7 +1889,8 @@ class YumRepository(Repository, config.RepoConf):
fo = None
cacheok = False
@@ -186165,7 +186218,7 @@ index e5e9ece..dfcf8f9 100644
cacheok = True
fo = open(self.mirrorlist_file, 'r')
url = 'file://' + self.mirrorlist_file # just to keep self._readMirrorList(fo,url) happy
-@@ -1713,7 +1882,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1713,7 +1902,7 @@ class YumRepository(Repository, config.RepoConf):
ugopts = self._default_grabopts()
try:
fo = urlgrabber.grabber.urlopen(url, **ugopts)
@@ -186174,7 +186227,7 @@ index e5e9ece..dfcf8f9 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 +1909,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1740,7 +1929,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
@@ -186187,7 +186240,7 @@ index e5e9ece..dfcf8f9 100644
return True
def _preload_file_from_system_cache(self, filename, subdir='',
-@@ -1877,7 +2050,7 @@ def getMirrorList(mirrorlist, pdict = None):
+@@ -1877,7 +2070,7 @@ def getMirrorList(mirrorlist, pdict = None):
try:
fo = urlresolver.urlopen(url, proxies=pdict)
diff --git a/yum.spec b/yum.spec
index 3353c38..4ce581f 100644
--- a/yum.spec
+++ b/yum.spec
@@ -18,7 +18,7 @@
Summary: RPM package installer/updater/manager
Name: yum
Version: 3.4.3
-Release: 57%{?dist}
+Release: 58%{?dist}
License: GPLv2+
Group: System Environment/Base
Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz
@@ -58,6 +58,8 @@ Requires: yum-metadata-parser >= 1.1.0
Requires: pygpgme
# rawhide is >= 0.5.3-7.fc18 ... as this is added.
Requires: pyliblzma
+# This is really a suggests, but we have none...
+Requires: pyxattr
Conflicts: rpm >= 5-0
# Zif is a re-implementation of yum in C, however:
@@ -215,7 +217,23 @@ exit 0
%post cron
-%systemd_post yum-cron.service
+
+#systemd_post yum-cron.service
+# Do this manually because it's a fake service for a cronjob, and cronjobs
+# are default on atm. This may change in the future.
+if [ $1 = 1 ]; then
+ systemctl enable yum-cron >/dev/null 2>&1
+else
+# Note that systemctl preset is being run here ... but _only_ on initial
+# install. So try this...
+
+if [ -f /var/lock/subsys/yum-cron -a -f /etc/rc.d/init.d/yum-cron ]; then
+ systemctl enable yum-cron >/dev/null 2>&1
+fi
+fi
+
+# Also note:
+# systemctl list-unit-files | fgrep yum-cron
%preun cron
%systemd_preun yum-cron.service
@@ -284,9 +302,14 @@ exit 0
%endif
%changelog
-* Thu Jan 31 2013 James Antill <james at fedoraproject.org> - 3.4.3-57
+* Fri Feb 8 2013 James Antill <james at fedoraproject.org> - 3.4.3-58
- update to latest HEAD.
- Add pyxattr require for origin_urls for everyone.
+- Fix yum-cron service file and scriptlets.
+- Fix instant broken mirrors problem.
+
+* Thu Jan 31 2013 James Antill <james at fedoraproject.org> - 3.4.3-57
+- update to latest HEAD.
- Fix autoremove foo.
- Speedup/fix repo-pkgs <foo> update with obsoletes.
More information about the scm-commits
mailing list