[yum] update to latest HEAD

Zdeněk Pavlas zpavlas at fedoraproject.org
Tue Jan 15 13:56:10 UTC 2013


commit 271f7c7952d56217f43a9ac23be7591aa32e3535
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Tue Jan 15 14:55:54 2013 +0100

    update to latest HEAD

 yum-HEAD.patch |  308 ++++++++++++++++++++++++--------------------------------
 yum.spec       |   57 +++--------
 2 files changed, 148 insertions(+), 217 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index 9a66d9a..8617fb0 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -150334,7 +150334,7 @@ index ced6ba0..28fdd70
              return_code = self.doTransaction()
 diff --git a/yum-cron/Makefile b/yum-cron/Makefile
 new file mode 100644
-index 0000000..1a68a3c
+index 0000000..0b68d37
 --- /dev/null
 +++ b/yum-cron/Makefile
 @@ -0,0 +1,15 @@
@@ -150351,7 +150351,7 @@ index 0000000..1a68a3c
 +# Install yum-update.cron as 0yum-update.cron so it runs before items like
 +# manpage update, mlocate, and prelink
 +	install -D -m 755 yum-update.cron.sh $(DESTDIR)/etc/cron.daily/0yum-update.cron
-+	install -D -m 755 yum-cron.sysvinit $(DESTDIR)/etc/rc.d/init.d/yum-cron
++	install -D -m 644 yum-cron.service $(DESTDIR)/usr/lib/systemd/system/yum-cron.service
 +	install -D -m 755 yum-cron.py $(DESTDIR)/usr/sbin/yum-cron
 diff --git a/yum-cron/TODO b/yum-cron/TODO
 new file mode 100644
@@ -151502,117 +151502,22 @@ index 0000000..8f6286b
 +
 +if __name__ == "__main__":
 +    main()
-diff --git a/yum-cron/yum-cron.sysvinit b/yum-cron/yum-cron.sysvinit
-new file mode 100755
-index 0000000..7b44d5e
+diff --git a/yum-cron/yum-cron.service b/yum-cron/yum-cron.service
+new file mode 100644
+index 0000000..534d9b0
 --- /dev/null
-+++ b/yum-cron/yum-cron.sysvinit
-@@ -0,0 +1,105 @@
-+#!/bin/bash
-+#
-+# yum-cron      Enable or disable scheduled yum system updates.
-+#
-+# chkconfig:	- 50 01
-+#
-+# description:  This controls whether yum-cron runs. If this service is \
-+#               off, the yum-cron scripts in /etc/cron.daily exit \
-+#               immediately; otherwise, they download and/or apply package \
-+#               updates as configured in /etc/yum/yum-cron.conf.
-+# processname:  yum-cron
-+#
-+
-+# source function library
-+. /etc/rc.d/init.d/functions
-+lockfile=/var/lock/subsys/yum-cron
-+
-+# This is generated by /usr/sbin/yum-cron and will exist when that script
-+# is running and not otherwise.
-+pidfile=/var/lock/yum-cron.pid
-+SERVICE_WAITS=yes
-+
-+RETVAL=0
-+
-+start() {
-+	echo -n $"Enabling scheduled yum updates: "
-+	# The cron script exits silently if this file doesn't exist.
-+	touch "$lockfile" && success || failure
-+	RETVAL=$?
-+	echo
-+}
-+
-+stop() {
-+        # Disabling this is just removing the so-called lock file.  But we
-+        # also have logic to delay shutdown if a transaction is in-progress.
-+        # All that affects is the exit of _this_ script, which may be
-+        # waited on by other things in the shutdown process.
-+	echo -n $"Disabling scheduled yum updates: "
-+	if [ "$SERVICE_WAITS" = "yes" ]; then
-+	  # if SERVICE_WAITS is yes, we check for an active pid
-+	  # file and recheck in 5 second increments up to 
-+	  # SERVICE_WAIT_TIME before continuing.
-+          if (set -o noclobber; ! echo "$$" > $pidfile ) 2>/dev/null; then
-+            # yum-cron has the lock. Read the pid, and wait and then loop
-+            # until it's done.
-+            activepid="$(< $pidfile)" 2>/dev/null
-+            if [ $? != 0 ]; then 
-+              echo; echo -n $"Stale yum-cron lock ignored. "
-+            else
-+              echo; echo -n $"Waiting for in-progress yum transaction"
-+              end=$( expr $( date +%s ) + ${SERVICE_WAIT_TIME:-300} )
-+              while checkpid $activepid 2>/dev/null ; do
-+                echo -n "."
-+                if [ $( date +%s ) -gt $end ]; then
-+                  echo -n " Timed out. "
-+                  break
-+                fi
-+                sleep 5
-+              done
-+            fi
-+          else
-+            # we got the lock. we don't really want it; remove and move on.
-+            rm -f "$pidfile"
-+          fi
-+	fi
-+	rm -f "$lockfile" && success || failure
-+	RETVAL=$?
-+	echo
-+}
-+
-+restart() {
-+	stop
-+	start
-+}
-+
-+case "$1" in
-+  start)
-+	start
-+	;;
-+  stop) 
-+	stop
-+	;;
-+  restart|force-reload)
-+	restart
-+	;;
-+  reload)
-+	;;
-+  condrestart)
-+	[ -f "$lockfile" ] && restart
-+	;;
-+  status)
-+	if [ -f $lockfile ]; then
-+		echo $"Scheduled yum updates are enabled."
-+		RETVAL=0
-+	else
-+		echo $"Scheduled yum updates are disabled."
-+		RETVAL=3
-+	fi
-+	;;
-+  *)
-+	echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
-+	exit 1
-+esac
-+
-+exit $RETVAL
++++ b/yum-cron/yum-cron.service
+@@ -0,0 +1,10 @@
++[Unit]
++Description=Run automatic yum updates as a cron job
++
++[Service]
++Type=simple
++ExecStart=/bin/touch /var/lock/subsys/yum-cron
++ExecStop=/bin/rm -f /var/lock/subsys/yum-cron
++
++[Install]
++WantedBy=multi-user.target
 diff --git a/yum-cron/yum-update.cron.sh b/yum-cron/yum-update.cron.sh
 new file mode 100755
 index 0000000..06dee5f
@@ -152185,7 +152090,7 @@ index 1ce4720..25e3022
      gobject.threads_init()
      dbus.glib.threads_init()
 diff --git a/yum.spec b/yum.spec
-index abd203f..d7568db 100644
+index abd203f..c3e065b 100644
 --- a/yum.spec
 +++ b/yum.spec
 @@ -1,24 +1,53 @@
@@ -152298,16 +152203,23 @@ index abd203f..d7568db 100644
  Requires(postun): /sbin/service
  
  
-@@ -72,7 +113,7 @@ can notify you when they are available via email, syslog or dbus.
+@@ -72,29 +113,56 @@ can notify you when they are available via email, syslog or dbus.
  %package cron
  Summary: Files needed to run yum updates as a cron job
  Group: System Environment/Base
 -Requires: yum >= 3.0 vixie-cron crontabs yum-plugin-downloadonly findutils
+-Requires(post): /sbin/chkconfig
+-Requires(post): /sbin/service
+-Requires(preun): /sbin/chkconfig
+-Requires(preun): /sbin/service
+-Requires(postun): /sbin/service
 +Requires: yum >= 3.0 cronie crontabs findutils
- Requires(post): /sbin/chkconfig
- Requires(post): /sbin/service
- Requires(preun): /sbin/chkconfig
-@@ -83,18 +124,46 @@ Requires(postun): /sbin/service
++BuildRequires: systemd-units
++Requires(post): systemd
++Requires(preun): systemd
++Requires(postun): systemd
+ 
+ %description cron
  These are the files needed to run yum updates as a cron job.
  Install this package if you want auto yum updates nightly via cron.
  
@@ -152356,7 +152268,7 @@ index abd203f..d7568db 100644
  
  # Ghost files:
  mkdir -p $RPM_BUILD_ROOT/var/lib/yum/history
-@@ -102,12 +171,18 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/yum/plugins
+@@ -102,12 +170,18 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/yum/plugins
  mkdir -p $RPM_BUILD_ROOT/var/lib/yum/yumdb
  touch $RPM_BUILD_ROOT/var/lib/yum/uuid
  
@@ -152375,7 +152287,7 @@ index abd203f..d7568db 100644
  %post updatesd
  /sbin/chkconfig --add yum-updatesd
  /sbin/service yum-updatesd condrestart >/dev/null 2>&1
-@@ -119,6 +194,7 @@ if [ $1 = 0 ]; then
+@@ -119,67 +193,45 @@ if [ $1 = 0 ]; then
   /sbin/service yum-updatesd stop >/dev/null 2>&1
  fi
  exit 0
@@ -152383,7 +152295,49 @@ index abd203f..d7568db 100644
  
  
  %post cron
-@@ -165,21 +241,30 @@ exit 0
+-# Make sure chkconfig knows about the service
+-/sbin/chkconfig --add yum-cron
+-# if an upgrade:
+-if [ "$1" -ge "1" ]; then
+-# if there's a /etc/rc.d/init.d/yum file left, assume that there was an
+-# older instance of yum-cron which used this naming convention.  Clean 
+-# it up, do a conditional restart
+- if [ -f /etc/init.d/yum ]; then 
+-# was it on?
+-  /sbin/chkconfig yum
+-  RETVAL=$?
+-  if [ $RETVAL = 0 ]; then
+-# if it was, stop it, then turn on new yum-cron
+-   /sbin/service yum stop 1> /dev/null 2>&1
+-   /sbin/service yum-cron start 1> /dev/null 2>&1
+-   /sbin/chkconfig yum-cron on
+-  fi
+-# remove it from the service list
+-  /sbin/chkconfig --del yum
+- fi
+-fi 
+-exit 0
++%systemd_post yum-cron.service
+ 
+ %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
+-exit 0
++%systemd_preun yum-cron.service
+ 
+ %postun cron
+-# If there's a yum-cron package left after uninstalling one, do a
+-# conditional restart of the service
+-if [ "$1" -ge "1" ]; then
+- /sbin/service yum-cron condrestart 1> /dev/null 2>&1
+-fi
+-exit 0
++%systemd_postun_with_restart yum-cron.service
+ 
  
  
  %files -f %{name}.lang
@@ -152419,7 +152373,7 @@ index abd203f..d7568db 100644
  %dir /var/cache/yum
  %dir /var/lib/yum
  %ghost /var/lib/yum/uuid
-@@ -188,20 +273,21 @@ exit 0
+@@ -188,20 +240,21 @@ exit 0
  %ghost /var/lib/yum/yumdb
  %{_mandir}/man*/yum.*
  %{_mandir}/man*/yum-shell*
@@ -152435,13 +152389,14 @@ index abd203f..d7568db 100644
 -%{_sysconfdir}/cron.daily/0yum.cron
 -%config(noreplace) %{_sysconfdir}/yum/yum-daily.yum
 -%config(noreplace) %{_sysconfdir}/yum/yum-weekly.yum
-+%{_sysconfdir}/cron.daily/0yum-update.cron
-+%config(noreplace) %{_sysconfdir}/yum/yum-cron.conf
- %{_sysconfdir}/rc.d/init.d/yum-cron
+-%{_sysconfdir}/rc.d/init.d/yum-cron
 -%config(noreplace) %{_sysconfdir}/sysconfig/yum-cron
 -
 -
 -
++%{_sysconfdir}/cron.daily/0yum-update.cron
++%config(noreplace) %{_sysconfdir}/yum/yum-cron.conf
++%{_unitdir}/yum-cron.service
 +%{_sbindir}/yum-cron
 +%{_mandir}/man*/yum-cron.*
  
@@ -152449,7 +152404,7 @@ index abd203f..d7568db 100644
  %files updatesd
  %defattr(-, root, root)
  %config(noreplace) %{_sysconfdir}/yum/yum-updatesd.conf
-@@ -210,8 +296,12 @@ exit 0
+@@ -210,8 +263,12 @@ exit 0
  %{_datadir}/yum-cli/yumupd.py*
  %{_sbindir}/yum-updatesd
  %{_mandir}/man*/yum-updatesd*
@@ -152490,7 +152445,7 @@ index c1af4ad..e3e3956 100644
      pass
      
 diff --git a/yum/__init__.py b/yum/__init__.py
-index 99039e0..abed04d 100644
+index 99039e0..10a5477 100644
 --- a/yum/__init__.py
 +++ b/yum/__init__.py
 @@ -21,6 +21,7 @@ The Yum RPM software updater.
@@ -153462,7 +153417,8 @@ index 99039e0..abed04d 100644
          except OSError, msg:
              if not msg.errno == errno.EEXIST: 
                  # Whoa. What the heck happened?
-                 errmsg = _('Could not create lock at %s: %s ') % (filename, str(msg))
+-                errmsg = _('Could not create lock at %s: %s ') % (filename, str(msg))
++                errmsg = _('Could not create lock at %s: %s ') % (filename, exception2msg(msg))
                  raise Errors.LockError(msg.errno, errmsg, int(contents))
              return 0
 -        else:
@@ -161324,7 +161280,7 @@ index 2cb1acb..d719be8 100644
          for pkg in un['pkglist']:
              for filedata in pkg['packages']:
 diff --git a/yum/yumRepo.py b/yum/yumRepo.py
-index e5e9ece..4f5f7a6 100644
+index e5e9ece..02778dd 100644
 --- a/yum/yumRepo.py
 +++ b/yum/yumRepo.py
 @@ -20,10 +20,12 @@ import time
@@ -161392,7 +161348,7 @@ index e5e9ece..4f5f7a6 100644
              if item == 'metadata':
                  mydbtype = 'primary_db'
                  mymdtype = 'primary'
-@@ -162,25 +182,37 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -162,25 +182,39 @@ class YumPackageSack(packageSack.PackageSack):
                  continue
  
              if self._check_db_version(repo, mydbtype):
@@ -161415,6 +161371,8 @@ index e5e9ece..4f5f7a6 100644
 -                            db_un_fn = misc.decompress(db_fn)
 -                            misc.unlink_f(db_fn)
 -                            db_un_fn = self._check_uncompressed_db(repo, mydbtype)
++                        # unlink the decompressed file, we know it's not valid
++                        misc.unlink_f(repo.cachedir +'/gen/%s.sqlite' % mydbtype)
 +                        db_un_fn = self._check_uncompressed_db_gen(repo,
 +                                                                   mydbtype)
 +                    if not db_un_fn: # Shouldn't happen?
@@ -161438,7 +161396,7 @@ index e5e9ece..4f5f7a6 100644
                  xmldata = repo.repoXML.getData(mymdtype)
                  (ctype, csum) = xmldata.checksum
                  dobj = repo_cache_function(xml, csum)
-@@ -193,6 +225,25 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -193,6 +227,25 @@ class YumPackageSack(packageSack.PackageSack):
          # get rid of all this stuff we don't need now
          del repo.cacheHandler
  
@@ -161464,7 +161422,7 @@ index e5e9ece..4f5f7a6 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 +252,11 @@ class YumPackageSack(packageSack.PackageSack):
+@@ -201,9 +254,11 @@ class YumPackageSack(packageSack.PackageSack):
          compressed_fn = repo.cachedir + '/' + fname
          db_un_fn = misc.decompress(compressed_fn, fn_only=True)
  
@@ -161477,7 +161435,7 @@ index e5e9ece..4f5f7a6 100644
          if os.path.exists(db_un_fn):
              if skip_old_DBMD_check and repo._using_old_MD:
                  return db_un_fn
-@@ -260,10 +313,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -260,10 +315,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,
@@ -161490,7 +161448,7 @@ index e5e9ece..4f5f7a6 100644
          self.failure_obj = None
          self.mirror_failure_obj = None
          self.interrupt_callback = None
-@@ -285,6 +339,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -285,6 +341,7 @@ class YumRepository(Repository, config.RepoConf):
  
          self._grabfunc = None
          self._grab = None
@@ -161498,7 +161456,7 @@ index e5e9ece..4f5f7a6 100644
  
      def __cmp__(self, other):
          """ Sort yum repos. by cost, and then by alphanumeric on their id. """
-@@ -311,6 +366,37 @@ class YumRepository(Repository, config.RepoConf):
+@@ -311,6 +368,37 @@ class YumRepository(Repository, config.RepoConf):
          return self._sack
      sack = property(_getSack)
  
@@ -161536,7 +161494,7 @@ index e5e9ece..4f5f7a6 100644
      def close(self):
          if self._sack is not None:
              self.sack.close()
-@@ -350,6 +436,10 @@ class YumRepository(Repository, config.RepoConf):
+@@ -350,6 +438,10 @@ class YumRepository(Repository, config.RepoConf):
          return thisdata.location
  
      def __str__(self):
@@ -161547,7 +161505,7 @@ index e5e9ece..4f5f7a6 100644
          return self.id
  
      def _checksum(self, sumtype, file, CHUNK=2**16, checksum_can_fail=False,
-@@ -378,7 +468,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',
@@ -161556,7 +161514,7 @@ index e5e9ece..4f5f7a6 100644
          for attr in dir(self):
              if attr.startswith('_'):
                  continue
-@@ -422,7 +512,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, \
@@ -161565,7 +161523,7 @@ index e5e9ece..4f5f7a6 100644
  
      def doProxyDict(self):
          if self._proxy_dict:
-@@ -431,25 +521,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_', '')
@@ -161599,7 +161557,7 @@ index e5e9ece..4f5f7a6 100644
  
          if proxy_string is not None:
              self._proxy_dict['http'] = proxy_string
-@@ -483,13 +566,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,
@@ -161631,7 +161589,7 @@ index e5e9ece..4f5f7a6 100644
                               failure_callback=self.mirror_failure_obj)
  
      def _default_grabopts(self, cache=True):
-@@ -499,6 +599,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,
@@ -161639,7 +161597,7 @@ index e5e9ece..4f5f7a6 100644
                   'http_headers': tuple(self.__headersListFromDict(cache=cache)),
                   'ssl_verify_peer': self.sslverify,
                   'ssl_verify_host': self.sslverify,
-@@ -561,7 +662,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)
  
@@ -161648,7 +161606,7 @@ index e5e9ece..4f5f7a6 100644
              self._dirSetupMkdir_p(dir)
  
          # persistdir is really root-only but try the make anyway and just
-@@ -714,15 +815,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)
@@ -161668,7 +161626,7 @@ index e5e9ece..4f5f7a6 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 +850,22 @@ class YumRepository(Repository, config.RepoConf):
+@@ -749,9 +852,22 @@ class YumRepository(Repository, config.RepoConf):
                                                                value),
                               fdel=lambda self: setattr(self, "_metalink", None))
  
@@ -161692,7 +161650,7 @@ index e5e9ece..4f5f7a6 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 +882,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, \
@@ -161701,7 +161659,7 @@ index e5e9ece..4f5f7a6 100644
  
          if self.cache == 1:
              if os.path.exists(local): # FIXME - we should figure out a way
-@@ -778,7 +892,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,
  
@@ -161710,7 +161668,7 @@ index e5e9ece..4f5f7a6 100644
  
          if url:
              (scheme, netloc, path, query, fragid) = urlparse.urlsplit(url)
-@@ -796,6 +910,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,))
  
@@ -161727,7 +161685,7 @@ index e5e9ece..4f5f7a6 100644
          if url and scheme != "media":
              ugopts = self._default_grabopts(cache=cache)
              ug = URLGrabber(progress_obj = self.callback,
-@@ -815,14 +939,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -815,14 +941,11 @@ class YumRepository(Repository, config.RepoConf):
                                      range=(start, end),
                                      )
              except URLGrabError, e:
@@ -161744,7 +161702,7 @@ index e5e9ece..4f5f7a6 100644
  
  
          else:
-@@ -835,19 +956,18 @@ class YumRepository(Repository, config.RepoConf):
+@@ -835,19 +958,18 @@ class YumRepository(Repository, config.RepoConf):
                                             reget = reget,
                                             checkfunc=checkfunc,
                                             http_headers=headers,
@@ -161770,7 +161728,7 @@ index e5e9ece..4f5f7a6 100644
          remote = package.relativepath
          local = package.localPkg()
          basepath = package.basepath
-@@ -857,15 +977,30 @@ class YumRepository(Repository, config.RepoConf):
+@@ -857,15 +979,30 @@ class YumRepository(Repository, config.RepoConf):
                  return local
              misc.unlink_f(local)
  
@@ -161802,7 +161760,7 @@ index e5e9ece..4f5f7a6 100644
      def getHeader(self, package, checkfunc = None, reget = 'simple',
              cache = True):
  
-@@ -991,7 +1126,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -991,7 +1128,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):
@@ -161811,7 +161769,7 @@ index e5e9ece..4f5f7a6 100644
          if self.cache or self.metadataCurrent():
              return True
          return False
-@@ -1020,7 +1155,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1020,7 +1157,7 @@ class YumRepository(Repository, config.RepoConf):
              if grab_can_fail:
                  return None
              raise Errors.RepoError, 'Error downloading file %s: %s' % (local, e)
@@ -161820,7 +161778,7 @@ index e5e9ece..4f5f7a6 100644
              misc.unlink_f(tfname)
              if grab_can_fail:
                  return None
-@@ -1047,7 +1182,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1047,7 +1184,7 @@ class YumRepository(Repository, config.RepoConf):
                  parse_can_fail = 'old_repo_XML' in self._oldRepoMDData
              if parse_can_fail:
                  return None
@@ -161829,7 +161787,7 @@ index e5e9ece..4f5f7a6 100644
  
      def _saveOldRepoXML(self, local):
          """ If we have an older repomd.xml file available, save it out. """
-@@ -1074,7 +1209,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1074,7 +1211,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:
@@ -161838,7 +161796,7 @@ index e5e9ece..4f5f7a6 100644
  
          if 'old_repo_XML' not in self._oldRepoMDData:
              self._oldRepoMDData = {}
-@@ -1260,6 +1395,9 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1260,6 +1397,9 @@ class YumRepository(Repository, config.RepoConf):
          return True
  
      def _check_db_version(self, mdtype, repoXML=None):
@@ -161848,7 +161806,7 @@ index e5e9ece..4f5f7a6 100644
          if repoXML is None:
              repoXML = self.repoXML
          if mdtype in repoXML.repoData:
-@@ -1277,11 +1415,11 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1277,11 +1417,11 @@ class YumRepository(Repository, config.RepoConf):
              return None
  
          if not file_check:
@@ -161863,7 +161821,7 @@ index e5e9ece..4f5f7a6 100644
              if not os.path.exists(local):
                  local = misc.decompress(local, fn_only=True)
                  compressed = True
-@@ -1302,6 +1440,17 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1302,6 +1442,17 @@ class YumRepository(Repository, config.RepoConf):
              into the delete list, this means metadata can change filename
              without us leaking it. """
  
@@ -161881,7 +161839,7 @@ index e5e9ece..4f5f7a6 100644
          def _mdtype_eq(omdtype, odata, nmdtype, ndata):
              """ Check if two returns from _get_mdtype_data() are equal. """
              if ndata is None:
-@@ -1321,6 +1470,14 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1321,6 +1472,14 @@ class YumRepository(Repository, config.RepoConf):
              return True
  
          all_mdtypes = self.retrieved.keys()
@@ -161896,7 +161854,7 @@ index e5e9ece..4f5f7a6 100644
          if mdtypes is None:
              mdtypes = all_mdtypes
  
-@@ -1333,8 +1490,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1333,8 +1492,7 @@ class YumRepository(Repository, config.RepoConf):
  
          # Inited twice atm. ... sue me
          self._oldRepoMDData['new_MD_files'] = []
@@ -161906,7 +161864,7 @@ index e5e9ece..4f5f7a6 100644
          for mdtype in all_mdtypes:
              (nmdtype, ndata) = self._get_mdtype_data(mdtype)
  
-@@ -1371,43 +1527,16 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1371,43 +1529,16 @@ class YumRepository(Repository, config.RepoConf):
              # No old repomd data, but we might still have uncompressed MD
              if self._groupCheckDataMDValid(ndata, nmdtype, mdtype):
                  continue
@@ -161955,7 +161913,7 @@ index e5e9ece..4f5f7a6 100644
  
      def _groupLoadRepoXML(self, text=None, mdtypes=None):
          """ Retrieve the new repomd.xml from the repository, then check it
-@@ -1421,7 +1550,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1421,7 +1552,7 @@ class YumRepository(Repository, config.RepoConf):
              self._commonRetrieveDataMD(mdtypes)
  
      def _mdpolicy2mdtypes(self):
@@ -161964,7 +161922,7 @@ index e5e9ece..4f5f7a6 100644
                       'group:primary' : ['primary'],
                       'group:small'   : ["primary", "updateinfo"],
                       'group:main'    : ["primary", "group", "filelists",
-@@ -1436,6 +1565,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1436,6 +1567,7 @@ class YumRepository(Repository, config.RepoConf):
          if not mdtypes or 'group:all' in mdtypes:
              mdtypes = None
          else:
@@ -161972,7 +161930,7 @@ index e5e9ece..4f5f7a6 100644
              mdtypes = sorted(list(mdtypes))
          return mdtypes
  
-@@ -1446,17 +1576,12 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1446,17 +1578,12 @@ class YumRepository(Repository, config.RepoConf):
          except KeyboardInterrupt:
              self._revertOldRepoXML() # Undo metadata cookie?
              raise
@@ -161992,7 +161950,7 @@ index e5e9ece..4f5f7a6 100644
          return self._repoXML
  
  
-@@ -1480,7 +1605,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1480,7 +1607,7 @@ class YumRepository(Repository, config.RepoConf):
                  result = self._getFile(relative='repodata/repomd.xml.asc',
                                         copy_local=1,
                                         local = sigfile,
@@ -162001,7 +161959,7 @@ index e5e9ece..4f5f7a6 100644
                                         reget=None,
                                         checkfunc=None,
                                         cache=self.http_caching == 'all',
-@@ -1514,7 +1639,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1514,7 +1641,7 @@ class YumRepository(Repository, config.RepoConf):
          return self._checkMD(fn, mdtype, openchecksum)
  
      def _checkMD(self, fn, mdtype, openchecksum=False,
@@ -162010,7 +161968,7 @@ index e5e9ece..4f5f7a6 100644
          """ Internal function, use .checkMD() from outside yum. """
  
          thisdata = data # So the argument name is nicer
-@@ -1537,6 +1662,18 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1537,6 +1664,18 @@ class YumRepository(Repository, config.RepoConf):
          if size is not None:
              size = int(size)
  
@@ -162029,7 +161987,7 @@ index e5e9ece..4f5f7a6 100644
          try: # get the local checksum
              l_csum = self._checksum(r_ctype, file, datasize=size)
          except Errors.RepoError, e:
-@@ -1551,15 +1688,13 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1551,15 +1690,13 @@ class YumRepository(Repository, config.RepoConf):
                  return None
              raise URLGrabError(-1, 'Metadata file does not match checksum')
  
@@ -162046,7 +162004,7 @@ index e5e9ece..4f5f7a6 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 +1715,19 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1580,15 +1717,19 @@ class YumRepository(Repository, config.RepoConf):
                  try:
                      self.checkMD(local, mdtype)
                  except URLGrabError, e:
@@ -162067,7 +162025,7 @@ index e5e9ece..4f5f7a6 100644
  
          if (os.path.exists(local) or
              self._preload_md_from_system_cache(os.path.basename(local))):
-@@ -1597,8 +1736,10 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1597,8 +1738,10 @@ class YumRepository(Repository, config.RepoConf):
                  return local # it's the same return the local one
  
          try:
@@ -162080,7 +162038,7 @@ index e5e9ece..4f5f7a6 100644
              if thisdata.size is None:
                  reget = None
              else:
-@@ -1613,8 +1754,9 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1613,8 +1756,9 @@ class YumRepository(Repository, config.RepoConf):
                                    checkfunc=checkfunc, 
                                    text=text,
                                    cache=self.http_caching == 'all',
@@ -162092,7 +162050,7 @@ index e5e9ece..4f5f7a6 100644
              if retrieve_can_fail:
                  return None
              raise
-@@ -1622,9 +1764,8 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1622,9 +1766,8 @@ class YumRepository(Repository, config.RepoConf):
              if retrieve_can_fail:
                  return None
              raise Errors.RepoError, \
@@ -162103,7 +162061,7 @@ index e5e9ece..4f5f7a6 100644
              return local
  
  
-@@ -1646,13 +1787,21 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1646,13 +1789,21 @@ class YumRepository(Repository, config.RepoConf):
  
      def getGroups(self):
          """gets groups and returns group file path for the repository, if there
@@ -162128,7 +162086,7 @@ index e5e9ece..4f5f7a6 100644
          self._callbacks_changed = True
  
      def setFailureObj(self, failure_obj):
-@@ -1681,7 +1830,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1681,7 +1832,7 @@ class YumRepository(Repository, config.RepoConf):
                  print "Could not read mirrorlist %s, error was \n%s" %(url, e)
                  content = []
              for line in content:
@@ -162137,7 +162095,7 @@ index e5e9ece..4f5f7a6 100644
                      continue
                  mirror = line.rstrip() # no more trailing \n's
                  mirror = mirror.replace('$ARCH', '$BASEARCH')
-@@ -1713,7 +1862,7 @@ class YumRepository(Repository, config.RepoConf):
+@@ -1713,7 +1864,7 @@ class YumRepository(Repository, config.RepoConf):
              ugopts = self._default_grabopts()
              try:
                  fo = urlgrabber.grabber.urlopen(url, **ugopts)
@@ -162146,7 +162104,7 @@ index e5e9ece..4f5f7a6 100644
                  print "Could not retrieve mirrorlist %s error was\n%s: %s" % (url, e.args[0], misc.to_unicode(e.args[1]))
                  fo = None
  
-@@ -1877,7 +2026,7 @@ def getMirrorList(mirrorlist, pdict = None):
+@@ -1877,7 +2028,7 @@ def getMirrorList(mirrorlist, pdict = None):
  
      try:
          fo = urlresolver.urlopen(url, proxies=pdict)
diff --git a/yum.spec b/yum.spec
index 4a0cd5f..5f6d76a 100644
--- a/yum.spec
+++ b/yum.spec
@@ -18,7 +18,7 @@
 Summary: RPM package installer/updater/manager
 Name: yum
 Version: 3.4.3
-Release: 51%{?dist}
+Release: 52%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz
@@ -124,11 +124,10 @@ can notify you when they are available via email, syslog or dbus.
 Summary: Files needed to run yum updates as a cron job
 Group: System Environment/Base
 Requires: yum >= 3.0 cronie crontabs findutils
-Requires(post): /sbin/chkconfig
-Requires(post): /sbin/service
-Requires(preun): /sbin/chkconfig
-Requires(preun): /sbin/service
-Requires(postun): /sbin/service
+BuildRequires: systemd-units
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 
 %description cron
 These are the files needed to run yum updates as a cron job.
@@ -216,45 +215,13 @@ exit 0
 
 
 %post cron
-# Make sure chkconfig knows about the service
-/sbin/chkconfig --add yum-cron
-# if an upgrade:
-if [ "$1" -ge "1" ]; then
-# if there's a /etc/rc.d/init.d/yum file left, assume that there was an
-# older instance of yum-cron which used this naming convention.  Clean 
-# it up, do a conditional restart
- if [ -f /etc/init.d/yum ]; then 
-# was it on?
-  /sbin/chkconfig yum
-  RETVAL=$?
-  if [ $RETVAL = 0 ]; then
-# if it was, stop it, then turn on new yum-cron
-   /sbin/service yum stop 1> /dev/null 2>&1
-   /sbin/service yum-cron start 1> /dev/null 2>&1
-   /sbin/chkconfig yum-cron on
-  fi
-# remove it from the service list
-  /sbin/chkconfig --del yum
- fi
-fi 
-exit 0
+%systemd_post yum-cron.service
 
 %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
-exit 0
+%systemd_preun yum-cron.service
 
 %postun cron
-# If there's a yum-cron package left after uninstalling one, do a
-# conditional restart of the service
-if [ "$1" -ge "1" ]; then
- /sbin/service yum-cron condrestart 1> /dev/null 2>&1
-fi
-exit 0
+%systemd_postun_with_restart yum-cron.service
 
 
 
@@ -301,7 +268,7 @@ exit 0
 %doc COPYING
 %{_sysconfdir}/cron.daily/0yum-update.cron
 %config(noreplace) %{_sysconfdir}/yum/yum-cron.conf
-%{_sysconfdir}/rc.d/init.d/yum-cron
+%{_unitdir}/yum-cron.service
 %{_sbindir}/yum-cron
 %{_mandir}/man*/yum-cron.*
 
@@ -317,6 +284,12 @@ exit 0
 %endif
 
 %changelog
+* Tue Jan 15 2013 Zdeněk Pavlas <zpavlas at redhat.com> - 3.4.3-52
+- update to latest HEAD
+- _lock(): yet another exception2msg fix.  BZ 895060
+- use yum-cron.service.  BZ 893593
+- YumRepo.populate(): always decompresses new database
+
 * Wed Jan  9 2013 Zdeněk Pavlas <zpavlas at redhat.com> - 3.4.3-51
 - update to latest HEAD
 - Include langpacks when reading and writing comps. BZ 879030


More information about the scm-commits mailing list