[yum] update to latest HEAD.
James Antill
james at fedoraproject.org
Wed Feb 20 00:21:32 UTC 2013
commit 582d254634a576677a9d6b561ffecc53312fc936
Author: James Antill <james at and.org>
Date: Tue Feb 19 19:20:55 2013 -0500
update to latest HEAD.
- Add cache-reqs.
- Fixup specfile for Fedora <= 18 usage.
BZ-803346-no-only-update.patch | 113 -------------
yum-HEAD.patch | 341 ++++++++++++++++++++++++++++------------
yum.spec | 105 ++++++++++---
3 files changed, 324 insertions(+), 235 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index 283c78e..9bfe5d8 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -3667,7 +3667,7 @@ index c60fa08..0000000
-ts run
-exit
diff --git a/etc/yum.bash b/etc/yum.bash
-index f1e06e8..ac06316 100644
+index f1e06e8..d741ff9 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -1,53 +1,17 @@
@@ -3695,13 +3695,17 @@ index f1e06e8..ac06316 100644
- COMPREPLY+=( $( ${yum:-yum} -d 0 -C list $1 "$2*" 2>/dev/null | \
- sed -ne 1d -e 's/[[:space:]].*//p' ) )
- fi
--}
--
++ local IFS=$'\n'
++ COMPREPLY+=( $(
++ /usr/share/yum-cli/completion-helper.py -d 0 -C "$@" 2>/dev/null ) )
+ }
+
-# arguments:
-# 1 = argument to "yum repolist" (enabled, disabled etc)
-# 2 = current word to be completed
-_yum_repolist()
--{
++_yum_list()
+ {
- # TODO: add -d 0 when http://yum.baseurl.org/ticket/29 is fixed
- # (for now --noplugins is used to get rid of "Loaded plugins: ...")
- # Drop first ("repo id repo name") and last ("repolist: ...") rows -
@@ -3710,17 +3714,13 @@ index f1e06e8..ac06316 100644
- $( compgen -W "$( ${yum:-yum} --noplugins -C repolist $1 2>/dev/null | \
- sed -ne '/^repo\s\{1,\}id/d' -e '/^repolist:/d' \
- -e 's/[[:space:]].*//p' )" -- "$2" ) )
-+ local IFS=$'\n'
-+ COMPREPLY+=( $(
-+ /usr/share/yum-cli/completion-helper.py -d 0 -C "$@" 2>/dev/null ) )
- }
-
+-}
+-
-# arguments:
-# 1 = argument to "yum grouplist" (usually empty (""), or hidden)
-# 2 = current word to be completed
-_yum_grouplist()
-+_yum_list()
- {
+-{
- local IFS=$'\n'
- # TODO: add -d 0 when http://yum.baseurl.org/ticket/29 is fixed
- COMPREPLY=( $( compgen -W "$( ${yum:-yum} -C grouplist $1 "$2*" \
@@ -3819,7 +3819,7 @@ index f1e06e8..ac06316 100644
- check-update|grouplist|makecache|provides|whatprovides|resolvedep|\
- search)
-+ check-update|makecache|resolvedep|search)
++ check-update|makecache|resolvedep)
return 0
;;
@@ -3929,7 +3929,7 @@ index f1e06e8..ac06316 100644
;;
esac
return 0
-@@ -288,42 +286,61 @@ _yum()
+@@ -288,42 +286,66 @@ _yum()
;;
install)
@@ -3976,6 +3976,11 @@ index f1e06e8..ac06316 100644
return 0
;;
++ search)
++ [[ $prev == $cmd ]] && COMPREPLY=( $( compgen -W 'all' -- "$cur" ) )
++ return 0
++ ;;
++
shell)
- [ "$prev" = "$cmd" ] && \
+ [[ $prev == $cmd ]] && \
@@ -3998,7 +4003,7 @@ index f1e06e8..ac06316 100644
COMPREPLY=( $( compgen -W 'all installed available nogroups
grouplist groupinfo' -- "$cur" ) )
return 0
-@@ -337,7 +354,11 @@ _yum()
+@@ -337,7 +359,11 @@ _yum()
$split && return 0
@@ -174204,26 +174209,35 @@ index ced6ba0..28fdd70
return_code = self.doTransaction()
diff --git a/yum-cron/Makefile b/yum-cron/Makefile
new file mode 100644
-index 0000000..27fcdfd
+index 0000000..812bea2
--- /dev/null
+++ b/yum-cron/Makefile
-@@ -0,0 +1,17 @@
+@@ -0,0 +1,26 @@
+UNITDIR=/lib/systemd/system
+
++INIT=systemd
++
+all:
+ echo "Nothing to do"
+
+clean:
+ rm -f *~
+
-+install:
++install: install-$(INIT)
++
++install-systemd: install-common
++ install -D -m 644 yum-cron.service $(DESTDIR)/$(UNITDIR)/yum-cron.service
++
++install-sysv: install-common
++ install -D -m 755 yum-cron.sysvinit $(DESTDIR)/etc/rc.d/init.d/yum-cron
++
++install-common:
+ mkdir -p $(DESTDIR)/etc/cron.daily
+ mkdir -p $(DESTDIR)/etc/rc.d/init.d
+ mkdir -p $(DESTDIR)/usr/sbin
+# 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 644 yum-cron.service $(DESTDIR)/$(UNITDIR)/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
@@ -175391,6 +175405,120 @@ index 0000000..82f3e6b
+
+[Install]
+WantedBy=multi-user.target
+diff --git a/yum-cron/yum-cron.sysvinit b/yum-cron/yum-cron.sysvinit
+new file mode 100644
+index 0000000..ee531c6
+--- /dev/null
++++ b/yum-cron/yum-cron.sysvinit
+@@ -0,0 +1,108 @@
++#!/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/sysconfig/yum-cron.
++# processname: yum-cron
++# config: /etc/yum/yum-daily.yum
++#
++
++# source function library
++. /etc/rc.d/init.d/functions
++
++test -f /etc/sysconfig/yum-cron && . /etc/sysconfig/yum-cron
++
++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
++
++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
diff --git a/yum-cron/yum-update.cron.sh b/yum-cron/yum-update.cron.sh
new file mode 100755
index 0000000..06dee5f
@@ -175963,20 +176091,25 @@ index 1ce4720..25e3022
gobject.threads_init()
dbus.glib.threads_init()
diff --git a/yum.spec b/yum.spec
-index abd203f..734f0a7 100644
+index abd203f..d0b8f21 100644
--- a/yum.spec
+++ b/yum.spec
-@@ -1,24 +1,61 @@
+@@ -1,24 +1,66 @@
-Summary: RPM installer/updater
+%define move_yum_conf_back 1
+%define auto_sitelib 1
+%define yum_updatesd 0
+%define disable_check 0
-+%define yum_cron 1
++%define yum_cron_systemd 1
++
++%if 0%{?rhel} <= 6
++# rhel-6 doesn't have the systemd stuff...
++%define yum_cron_systemd 0
++%endif
+
-+%if 0%{?rhel} == 6
-+# rhel-6 doesn't have the systemd stuff, so won't build...
-+%define yum_cron 0
++%if 0%{?fedora} <= 18
++# yum in Fedora <= 18 doesn't use systemd unit files...
++%define yum_cron_systemd 0
+%endif
+
+%if %{auto_sitelib}
@@ -176034,7 +176167,7 @@ index abd203f..734f0a7 100644
Conflicts: rpm >= 5-0
# Zif is a re-implementation of yum in C, however:
#
-@@ -34,18 +71,28 @@ Conflicts: rpm >= 5-0
+@@ -34,18 +76,28 @@ Conflicts: rpm >= 5-0
# zif experts).
#
# ...so we have two sane choices: i) Conflict with it. 2) Stop developing yum.
@@ -176070,7 +176203,7 @@ index abd203f..734f0a7 100644
%description
Yum is a utility that can check for and automatically download and
-@@ -58,9 +105,11 @@ Group: Applications/System
+@@ -58,9 +110,11 @@ Group: Applications/System
Requires: yum = %{version}-%{release}
Requires: dbus-python
Requires: pygobject2
@@ -176084,36 +176217,37 @@ index abd203f..734f0a7 100644
Requires(postun): /sbin/service
-@@ -68,20 +117,21 @@ Requires(postun): /sbin/service
+@@ -68,33 +122,74 @@ Requires(postun): /sbin/service
yum-updatesd provides a daemon which checks for available updates and
can notify you when they are available via email, syslog or dbus.
-
-+%if %{yum_cron}
%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
++%if %{yum_cron_systemd}
+BuildRequires: systemd-units
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
++%else
+ Requires(post): /sbin/chkconfig
+ Requires(post): /sbin/service
+ Requires(preun): /sbin/chkconfig
+ Requires(preun): /sbin/service
+ Requires(postun): /sbin/service
++%endif
%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.
-+%endif
-+
++
%prep
%setup -q
-@@ -89,12 +139,38 @@ Install this package if you want auto yum updates nightly via cron.
+
%build
make
@@ -176128,7 +176262,15 @@ index abd203f..734f0a7 100644
-make DESTDIR=$RPM_BUILD_ROOT install
-# install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/yum/yum.conf
-# install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/cron.daily/yum.cron
-+make DESTDIR=$RPM_BUILD_ROOT UNITDIR=%{_unitdir} install
++
++%if %{yum_cron_systemd}
++INIT=systemd
++%else
++INIT=sysv
++%endif
++
++make DESTDIR=$RPM_BUILD_ROOT UNITDIR=%{_unitdir} INIT=$INIT install
++
+install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/yum.conf
+mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d $RPM_BUILD_ROOT/%{yum_pluginslib}
+mkdir -p $RPM_BUILD_ROOT/%{yum_pluginsshare}
@@ -176155,7 +176297,7 @@ index abd203f..734f0a7 100644
# Ghost files:
mkdir -p $RPM_BUILD_ROOT/var/lib/yum/history
-@@ -102,12 +178,27 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/yum/plugins
+@@ -102,12 +197,26 @@ 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
@@ -176166,13 +176308,12 @@ index abd203f..734f0a7 100644
+
%find_lang %name
-+%if ! %{yum_cron}
-+# Remove the yum-cron stuff to make rpmbuild happy..
++%if %{yum_cron_systemd}
++# Remove the yum-cron sysV stuff to make rpmbuild happy..
++rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/yum-cron
++%else
++# Remove the yum-cron systemd stuff to make rpmbuild happy..
+rm -f $RPM_BUILD_ROOT/%{_unitdir}/yum-cron.service
-+rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/0yum-update.cron
-+rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/yum/yum-cron.conf
-+rm -f $RPM_BUILD_ROOT/%{_sbindir}/yum-cron
-+rm -f $RPM_BUILD_ROOT/%{_mandir}/man*/yum-cron.*
+%endif
+
%clean
@@ -176183,44 +176324,16 @@ index abd203f..734f0a7 100644
%post updatesd
/sbin/chkconfig --add yum-updatesd
/sbin/service yum-updatesd condrestart >/dev/null 2>&1
-@@ -119,67 +210,61 @@ if [ $1 = 0 ]; then
+@@ -119,9 +228,29 @@ if [ $1 = 0 ]; then
/sbin/service yum-updatesd stop >/dev/null 2>&1
fi
exit 0
+-
+%endif
--
-+%if %{yum_cron}
%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
-
--%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
++
++%if %{yum_cron_systemd}
+#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.
@@ -176232,25 +176345,49 @@ index abd203f..734f0a7 100644
+
+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
--
--%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
-
++fi
++fi
++
+# Also note:
+# systemctl list-unit-files | fgrep yum-cron
-+
-+%preun cron
++%else
++# SYSV init post cron
+ # Make sure chkconfig knows about the service
+ /sbin/chkconfig --add yum-cron
+ # if an upgrade:
+@@ -144,8 +273,13 @@ if [ "$1" -ge "1" ]; then
+ fi
+ fi
+ exit 0
++%endif
+
+ %preun cron
++%if %{yum_cron_systemd}
+%systemd_preun yum-cron.service
-+
-+%postun cron
++%else
++# SYSV init 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
+@@ -153,33 +287,48 @@ if [ $1 = 0 ]; then
+ /sbin/service yum-cron stop 1> /dev/null 2>&1
+ fi
+ exit 0
++%endif
+
+ %postun cron
++%if %{yum_cron_systemd}
+%systemd_postun_with_restart yum-cron.service
++%else
++# SYSV init 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
+-
+%endif
@@ -176287,41 +176424,41 @@ index abd203f..734f0a7 100644
%dir /var/cache/yum
%dir /var/lib/yum
%ghost /var/lib/yum/uuid
-@@ -188,20 +273,23 @@ exit 0
+@@ -188,20 +337,25 @@ exit 0
%ghost /var/lib/yum/yumdb
%{_mandir}/man*/yum.*
%{_mandir}/man*/yum-shell*
+-
+# plugin stuff
+%dir %{_sysconfdir}/yum/pluginconf.d
+%dir %{yum_pluginslib}
+%dir %{yum_pluginsshare}
--
-+%if %{yum_cron}
%files cron
%defattr(-,root,root)
%doc COPYING
-%{_sysconfdir}/cron.daily/0yum.cron
-%config(noreplace) %{_sysconfdir}/yum/yum-daily.yum
-%config(noreplace) %{_sysconfdir}/yum/yum-weekly.yum
--%{_sysconfdir}/rc.d/init.d/yum-cron
++%{_sysconfdir}/cron.daily/0yum-update.cron
++%config(noreplace) %{_sysconfdir}/yum/yum-cron.conf
++%if %{yum_cron_systemd}
++%{_unitdir}/yum-cron.service
++%else
+ %{_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
++%endif
+%{_sbindir}/yum-cron
+%{_mandir}/man*/yum-cron.*
-+%endif
-+
+
+%if %{yum_updatesd}
%files updatesd
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/yum/yum-updatesd.conf
-@@ -210,8 +298,12 @@ exit 0
+@@ -210,8 +364,12 @@ exit 0
%{_datadir}/yum-cli/yumupd.py*
%{_sbindir}/yum-updatesd
%{_mandir}/man*/yum-updatesd*
diff --git a/yum.spec b/yum.spec
index 8b4e6c0..ddff56b 100644
--- a/yum.spec
+++ b/yum.spec
@@ -2,11 +2,16 @@
%define auto_sitelib 1
%define yum_updatesd 0
%define disable_check 1
-%define yum_cron 1
+%define yum_cron_systemd 1
-%if 0%{?rhel} == 6
-# rhel-6 doesn't have the systemd stuff, so won't build...
-%define yum_cron 0
+%if 0%{?rhel} <= 6
+# rhel-6 doesn't have the systemd stuff...
+%define yum_cron_systemd 0
+%endif
+
+%if 0%{?fedora} <= 18
+# yum in Fedora <= 18 doesn't use systemd unit files...
+%define yum_cron_systemd 0
%endif
%if %{auto_sitelib}
@@ -24,7 +29,7 @@
Summary: RPM package installer/updater/manager
Name: yum
Version: 3.4.3
-Release: 61%{?dist}
+Release: 62%{?dist}
License: GPLv2+
Group: System Environment/Base
Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz
@@ -35,7 +40,6 @@ Patch4: no-more-exactarchlist.patch
Patch5: geode-arch.patch
Patch6: yum-HEAD.patch
Patch7: yum-ppc64-preferred.patch
-Patch8: BZ-803346-no-only-update.patch
Patch20: yum-manpage-files.patch
Patch21: yum-completion-helper.patch
@@ -127,20 +131,26 @@ Requires(postun): /sbin/service
yum-updatesd provides a daemon which checks for available updates and
can notify you when they are available via email, syslog or dbus.
-%if %{yum_cron}
%package cron
Summary: Files needed to run yum updates as a cron job
Group: System Environment/Base
Requires: yum >= 3.0 cronie crontabs findutils
+%if %{yum_cron_systemd}
BuildRequires: systemd-units
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
+%else
+Requires(post): /sbin/chkconfig
+Requires(post): /sbin/service
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+Requires(postun): /sbin/service
+%endif
%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.
-%endif
%prep
@@ -149,7 +159,6 @@ Install this package if you want auto yum updates nightly via cron.
%patch5 -p1
%patch6 -p1
%patch7 -p1
-%patch8 -p1
%patch20 -p1
%patch21 -p1
%patch1 -p1
@@ -165,7 +174,15 @@ make check
%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
-make DESTDIR=$RPM_BUILD_ROOT UNITDIR=%{_unitdir} install
+
+%if %{yum_cron_systemd}
+INIT=systemd
+%else
+INIT=sysv
+%endif
+
+make DESTDIR=$RPM_BUILD_ROOT UNITDIR=%{_unitdir} INIT=$INIT install
+
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/yum.conf
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/yum/pluginconf.d $RPM_BUILD_ROOT/%{yum_pluginslib}
mkdir -p $RPM_BUILD_ROOT/%{yum_pluginsshare}
@@ -203,13 +220,12 @@ chmod +x $RPM_BUILD_ROOT/%{python_sitelib}/rpmUtils/*.py
%find_lang %name
-%if ! %{yum_cron}
-# Remove the yum-cron stuff to make rpmbuild happy..
+%if %{yum_cron_systemd}
+# Remove the yum-cron sysV stuff to make rpmbuild happy..
+rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/yum-cron
+%else
+# Remove the yum-cron systemd stuff to make rpmbuild happy..
rm -f $RPM_BUILD_ROOT/%{_unitdir}/yum-cron.service
-rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/cron.daily/0yum-update.cron
-rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/yum/yum-cron.conf
-rm -f $RPM_BUILD_ROOT/%{_sbindir}/yum-cron
-rm -f $RPM_BUILD_ROOT/%{_mandir}/man*/yum-cron.*
%endif
%clean
@@ -230,9 +246,9 @@ fi
exit 0
%endif
-%if %{yum_cron}
%post cron
+%if %{yum_cron_systemd}
#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.
@@ -249,12 +265,58 @@ fi
# Also note:
# systemctl list-unit-files | fgrep yum-cron
+%else
+# SYSV init 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
+%endif
%preun cron
+%if %{yum_cron_systemd}
%systemd_preun yum-cron.service
+%else
+# SYSV init 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
+%endif
%postun cron
+%if %{yum_cron_systemd}
%systemd_postun_with_restart yum-cron.service
+%else
+# SYSV init 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
%endif
@@ -296,16 +358,18 @@ fi
%dir %{yum_pluginslib}
%dir %{yum_pluginsshare}
-%if %{yum_cron}
%files cron
%defattr(-,root,root)
%doc COPYING
%{_sysconfdir}/cron.daily/0yum-update.cron
%config(noreplace) %{_sysconfdir}/yum/yum-cron.conf
+%if %{yum_cron_systemd}
%{_unitdir}/yum-cron.service
+%else
+%{_sysconfdir}/rc.d/init.d/yum-cron
+%endif
%{_sbindir}/yum-cron
%{_mandir}/man*/yum-cron.*
-%endif
%if %{yum_updatesd}
%files updatesd
@@ -319,9 +383,10 @@ fi
%endif
%changelog
-* Tue Feb 18 2013 James Antill <james at fedoraproject.org> - 3.4.3-61
+* Tue Feb 18 2013 James Antill <james at fedoraproject.org> - 3.4.3-62
- update to latest HEAD.
- Add cache-reqs.
+- Fixup specfile for Fedora <= 18 usage.
* Mon Feb 18 2013 James Antill <james at fedoraproject.org> - 3.4.3-60
- update to latest HEAD.
More information about the scm-commits
mailing list