fixes for Fedora and RHEL, dropped bzr and python dependencies

OBS-URL: https://build.opensuse.org/package/show/utilities/etckeeper?expand=0&rev=2
This commit is contained in:
Pascal Bleser 2013-08-10 13:04:08 +00:00 committed by Git OBS Bridge
parent 5076315eaa
commit a17e396eeb

View File

@ -24,14 +24,21 @@ Group: System/Management
License: GPL-2.0+ License: GPL-2.0+
BuildRoot: %{_tmppath}/build-%{name}-%{version} BuildRoot: %{_tmppath}/build-%{name}-%{version}
BuildRequires: make BuildRequires: make
BuildRequires: python-devel
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%py_requires
Requires: git >= 1.6.1 Requires: git >= 1.6.1
BuildRequires: git >= 1.6.1 BuildRequires: git >= 1.6.1
BuildRequires: bzr %if 0%{?suse_version}
BuildRequires: libzypp BuildRequires: libzypp
%define HPM zypper
%define LPM rpm
%else
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: yum
%define HPM yum
%define LPM rpm
%else
%{error:Unsupported}
%endif
%endif
Requires: cron Requires: cron
%if 0%{?suse_version} >= 1120 %if 0%{?suse_version} >= 1120
BuildArch: noarch BuildArch: noarch
@ -49,18 +56,6 @@ understand the basics of working with version control.
%prep %prep
%setup -q -n "%{name}" %setup -q -n "%{name}"
%if 0%{?suse_version}
%define HPM zypper
%define LPM rpm
%else
%if 0%{?fedora}
%define HPM yum
%define LPM rpm
%else
%{error:"Unsupported distribution"}
%endif
%endif
%__perl -pi -e ' %__perl -pi -e '
s|^(\s*)(HIGHLEVEL_PACKAGE_MANAGER)=.+|$1$2=%{HPM}|; s|^(\s*)(HIGHLEVEL_PACKAGE_MANAGER)=.+|$1$2=%{HPM}|;
s|^(\s*)(LOWLEVEL_PACKAGE_MANAGER)=.+|$1$2=%{LPM}|; s|^(\s*)(LOWLEVEL_PACKAGE_MANAGER)=.+|$1$2=%{LPM}|;
@ -71,17 +66,21 @@ s|^(\s*)(VCS)=.+|$1$2=git|;
make %{?_smp_mflags} make %{?_smp_mflags}
%install %install
make \ make \
DESTDIR="%{buildroot}" \ DESTDIR="%{buildroot}" \
PYTHON_INSTALL_OPTS="--prefix=%{_prefix} --root=%{buildroot} --record-rpm=$PWD/files.lst" \ PYTHON_INSTALL_OPTS="--prefix=%{_prefix} --root=%{buildroot}" \
install install
# who cares about bzr...
rm -rf "%{buildroot}%{_prefix}/lib"/python*
install -D debian/cron.daily "%{buildroot}/etc/cron.daily/%{name}" install -D debian/cron.daily "%{buildroot}/etc/cron.daily/%{name}"
%clean %clean
%{?buildroot:%__rm -rf "%{buildroot}"} %{?buildroot:%__rm -rf "%{buildroot}"}
%files -f files.lst %files
%defattr(-,root,root) %defattr(-,root,root)
%doc GPL TODO README %doc GPL TODO README
%{_bindir}/etckeeper %{_bindir}/etckeeper
@ -90,7 +89,13 @@ install -D debian/cron.daily "%{buildroot}/etc/cron.daily/%{name}"
%config(noreplace) %{_sysconfdir}/etckeeper/etckeeper.conf %config(noreplace) %{_sysconfdir}/etckeeper/etckeeper.conf
%dir %{_sysconfdir}/etckeeper/*.d %dir %{_sysconfdir}/etckeeper/*.d
%config %{_sysconfdir}/etckeeper/*.d/* %config %{_sysconfdir}/etckeeper/*.d/*
%if 0%{?suse_version}
%{_prefix}/lib/zypp/plugins/commit/zypper-etckeeper.py %{_prefix}/lib/zypp/plugins/commit/zypper-etckeeper.py
%endif
%if 0%{?fedora} || 0%{?rhel}
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/etckeeper.conf
%{_prefix}/lib/yum-plugins/etckeeper.*
%endif
%doc %{_mandir}/man8/etckeeper.8* %doc %{_mandir}/man8/etckeeper.8*
%config %{_sysconfdir}/bash_completion.d/etckeeper %config %{_sysconfdir}/bash_completion.d/etckeeper