File yum.spec of Package yum

#
# spec file for package yum (Version 3.2.25)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           yum
BuildRequires:  dbus-1 intltool python-devel
Version:        3.2.25
Release:        5
Summary:        RPM installer/updater
Group:          System/Packages
License:        GPLv2+
Url:            http://linux.duke.edu/yum/
Source:         %{name}-%{version}.tar.bz2
Source1:        %{name}.conf
Source2:        %{name}-updatesd.init
Patch0:         %{name}-3.2.6-epoch_workaround.patch
Patch1:         yum-3.2.25-license-to-confirm.patch
Patch2:         yum-3.2.25-suse-changelogs.patch
Patch3:         yum-3.2.25-suse-missing-tags.patch
Patch4:         yum-3.2.25-disable-annoying-debug-info.patch
Patch5:         yum-3.2.25-add-sourcerpm-for-old-yum.patch
Patch6:         yum-3.2.25-add-lib-cpp-file.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       rpm >= 4.4.0
Requires:       rpm-python
Requires:       yum-metadata-parser >= 1.1.0
Requires:       python-gpgme
Requires:       python-iniparse
%if %{suse_version} <= 1010
Requires:       python-elementtree
%else
Requires:       python-xml
%endif
%py_requires
PreReq:         coreutils
Requires:       yum-common = %{version}-%{release}

%description
Yum is a utility that can check for and automatically download and
install updated RPM packages. Dependencies are obtained and downloaded
automatically prompting the user as necessary.



Authors:
--------
    Seth Vidal <skvidal@phy.duke.edu>

%package updatesd
License:        GPLv2+
Summary:        YUM update notification daemon
Group:          System/Packages
Requires:       yum = %{version}-%{release}
Requires:       dbus-1-python
Requires:       python-gobject2
PreReq:         %insserv_prereq

%description updatesd
yum-updatesd provides a daemon which checks for available updates and
can notify you when they are available via email, syslog or dbus.



Authors:
--------
    Seth Vidal <skvidal@phy.duke.edu>

%package common
License:        GPLv2+
Summary:        YUM update notification daemon
Group:          System/Packages
Requires:       dbus-1-python
Requires:       python-gobject2
Requires:       python-urlgrabber
PreReq:         %insserv_prereq

%description common
Common libraries for YUM based programs

Authors:
--------
    Seth Vidal <skvidal@phy.duke.edu>

%prep
%setup -q
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6

%ifnarch %{ix86}
for i in rpmUtils yum
do
  pushd $i
  sed -e "s/lib/%{_lib}/" Makefile > Makefile.new
  mv Makefile.new Makefile
  popd
done
%endif

%build
make

%install
make DESTDIR=%{buildroot} install
install -m 644 %{SOURCE1} %{buildroot}/etc/yum/yum.conf

# install custom init script
%{__mkdir_p} %{buildroot}/etc/init.d
install -m 755 %{SOURCE2} %{buildroot}/etc/init.d/yum-updatesd
# remove the original one
rm %{buildroot}/etc/rc.d/init.d/yum-updatesd
rm -rf %{buildroot}/etc/rc.d

mkdir -p %{buildroot}/%{_sysconfdir}/yum/pluginconf.d/ %{buildroot}/usr/lib/yum-plugins/
%find_lang %{name}

%postun updatesd
%restart_on_update yum-updatesd
%insserv_cleanup

%preun updatesd
%stop_on_removal yum-updatesd

%post 
# if we are upgrading from older distros the config should be moved
# to the new place
CONFD="/etc/yum"
OCONF="/etc/yum.conf"
NCONF="${CONFD}/yum.conf"
NCONFB="${CONFD}/yum.conf.rpmsave"
if [ -e "$OCONF" ] ; then
#
# in worst case we will get:
# /etc/yum/yum.conf         - the old /etc/yum.conf
# /etc/yum/yum.conf.rpmnew  - the config of the newly installed package.
# /etc/yum/yum.conf.rpmsave - the old /etc/yum/yum.conf
#
    if [ ! -d "$CONFD" ] ; then 
        mkdir "$CONFD"
    fi
#
# we dont need to handle the case that /etc/yum/yum.conf
# exists. rpm does that for us.
# it creates /etc/yum/yum.conf.rpmnew
#
    if [ -e "$NCONF" ] ; then
        mv "$NCONF" "$NCONFB"
        echo "warning: /etc/yum/yum.conf backed up as /etc/yum/yum.conf.rpmsave" >&2
    fi
    echo "warning: /etc/yum.conf moved to /etc/yum/yum.conf" >&2
    mv "$OCONF" "$NCONF"
fi
# migrate /etc/yum.repos.d to /etc/yum/repos.d/
if [ -d "/etc/yum.repos.d" ] ; then
    if [ ! -d "/etc/yum/repos.d" ] ; then
        mkdir "/etc/yum/repos.d"
    fi
    if [ "/etc/yum.repos.d/*" != '/etc/yum.repos.d/*' ] ; then
    for i in /etc/yum.repos.d/*;
    do
      NCONF="/etc/yum/repos.d/`basename $i`"
      NCONFB="/etc/yum/repos.d/`basename $i`.rpmsave"
      OCONF="/etc/yum.repos.d/`basename $i`"
      if [ -e "$NCONF" ] ; then
          mv "$NCONF" "$NCONFB"
          echo "warning: $NCONF backed up as $NCONFB" >&2
      fi
      echo "warning: $OCONF moved to $NCONF" >&2
      mv "$OCONF" "$NCONF"
    done
    fi
fi

%clean
rm -rf %{buildroot}

%files -f %{name}.lang
%defattr(-, root, root)
%doc README AUTHORS COPYING TODO INSTALL ChangeLog PLUGINS
%dir /var/cache/yum
%dir %{_sysconfdir}/yum
%dir %{_sysconfdir}/yum/repos.d
%dir %{_sysconfdir}/yum/pluginconf.d
%dir %{_sysconfdir}/yum
%dir /usr/lib/yum-plugins
%config(noreplace) %{_sysconfdir}/yum/yum.conf
%config %{_sysconfdir}/logrotate.d/%{name}
%{_mandir}/*/*
%defattr(0755, root, root)
%{_datadir}/yum-cli
%{_bindir}/*
%exclude %{_mandir}/man*/yum-updatesd*

%files common
%defattr(0755, root, root)
%{py_sitedir}/*

%files updatesd
%defattr(-, root, root)
%config(noreplace) %{_sysconfdir}/yum/yum-updatesd.conf
%config %{_sysconfdir}/init.d/yum-updatesd  
%config %{_sysconfdir}/dbus-1/system.d/yum-updatesd.conf
%config(noreplace) %{_sysconfdir}/yum/version-groups.conf
%{_sbindir}/yum-updatesd
%{_mandir}/man*/yum-updatesd*

%changelog
openSUSE Build Service is sponsored by