Accepting request 636715 from home:darix:playground

- obsolete cron sub package on systemd machines

- use %license

- dropped non suse support
  - added etckeeper-set-package-manager.patch: set the package
    manager via a patch now that we only care about suse
- bzr support:
  - disable for now as it would force the whole package to be
    python2 bound. you can reenable it when building with
    --with=bzr or set the options in your prjconf:
    %define _with_bzr 1
    Macros:
    %_with_bzr 1
    :Macros
  - change bzr support to be in a subpackage if enabled
- build with python3 when not building with bzr support
  - patch shebang line in the zypper plugin to match that
- build the whole package as noarch if we don't build with python
  as we are just packaging a bunch of shell scripts
- move bash completion to a sub package, which is recommended to
  keep the default working, BR and Require the bash-completion
  package for path ownership
- downgrade to git-core so we only have the minimal git for small
  installs on servers
- no longer build the cron support on systemd machines. the systemd
  timer is more powerful and should be used instead.
- when uninstalling we should also disable and stop the systemd
  timer
- only ship the documentation files that are also shipped in the

OBS-URL: https://build.opensuse.org/request/show/636715
OBS-URL: https://build.opensuse.org/package/show/utilities/etckeeper?expand=0&rev=19
This commit is contained in:
Mitsutoshi NAKANO 2018-09-24 06:11:23 +00:00 committed by Git OBS Bridge
parent 16d8acb8f1
commit 6dbe44dd82
3 changed files with 152 additions and 79 deletions

View File

@ -0,0 +1,18 @@
Index: etckeeper-1.18.8/etckeeper.conf
===================================================================
--- etckeeper-1.18.8.orig/etckeeper.conf
+++ etckeeper-1.18.8/etckeeper.conf
@@ -33,11 +33,11 @@ DARCS_COMMIT_OPTIONS="-a"
# The high-level package manager that's being used.
# (apt, pacman, pacman-g2, yum, dnf, zypper, apk etc)
-HIGHLEVEL_PACKAGE_MANAGER=apt
+HIGHLEVEL_PACKAGE_MANAGER=zypper
# The low-level package manager that's being used.
# (dpkg, rpm, pacman, pacmatic, pacman-g2, apk etc)
-LOWLEVEL_PACKAGE_MANAGER=dpkg
+LOWLEVEL_PACKAGE_MANAGER=rpm
# To push each commit to a remote, put the name of the remote here.
# (eg, "origin" for git). Space-separated lists of multiple remotes

View File

@ -1,3 +1,44 @@
-------------------------------------------------------------------
Thu Sep 13 07:34:35 UTC 2018 - Marcus Rueckert <mrueckert@suse.de>
- obsolete cron sub package on systemd machines
-------------------------------------------------------------------
Thu Sep 13 07:29:24 UTC 2018 - Marcus Rueckert <mrueckert@suse.de>
- use %license
-------------------------------------------------------------------
Wed Sep 12 23:31:38 UTC 2018 - Marcus Rueckert <mrueckert@suse.de>
- dropped non suse support
- added etckeeper-set-package-manager.patch: set the package
manager via a patch now that we only care about suse
- bzr support:
- disable for now as it would force the whole package to be
python2 bound. you can reenable it when building with
--with=bzr or set the options in your prjconf:
%define _with_bzr 1
Macros:
%_with_bzr 1
:Macros
- change bzr support to be in a subpackage if enabled
- build with python3 when not building with bzr support
- patch shebang line in the zypper plugin to match that
- build the whole package as noarch if we don't build with python
as we are just packaging a bunch of shell scripts
- move bash completion to a sub package, which is recommended to
keep the default working, BR and Require the bash-completion
package for path ownership
- downgrade to git-core so we only have the minimal git for small
installs on servers
- no longer build the cron support on systemd machines. the systemd
timer is more powerful and should be used instead.
- when uninstalling we should also disable and stop the systemd
timer
- only ship the documentation files that are also shipped in the
debian package
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Sep 11 07:34:30 UTC 2018 - ecsos@opensuse.org Tue Sep 11 07:34:30 UTC 2018 - ecsos@opensuse.org

View File

@ -19,9 +19,20 @@
# #
# see https://en.opensuse.org/openSUSE:Packaging_Python#Compatibility_with_older_distributions # this would pull python2
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %bcond_with bzr
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %bcond_without systemd
%if %{with bzr}
%define python_versioned python
%define python_args PYTHON_INSTALL_OPTS="--prefix=%{_prefix} --install-purelib=%{python_sitearch}"
%else
%define python_versioned python3
%define python_args %{nil}
%endif
%define make_args systemddir=%{_unitdir} PYTHON=%{python_versioned} %{python_args}
Name: etckeeper Name: etckeeper
Version: 1.18.8 Version: 1.18.8
Release: 0 Release: 0
@ -31,30 +42,38 @@ Group: System/Management
Source: https://git.joeyh.name/index.cgi/etckeeper.git/snapshot/%{name}-%{version}.tar.gz Source: https://git.joeyh.name/index.cgi/etckeeper.git/snapshot/%{name}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM etckeeper-avoid-packagelist.patch gh#joeyh/etckeeper#17 bkbin005@rinku.zaq.ne.jp -- add AVOID_PACKAGELIST # PATCH-FIX-UPSTREAM etckeeper-avoid-packagelist.patch gh#joeyh/etckeeper#17 bkbin005@rinku.zaq.ne.jp -- add AVOID_PACKAGELIST
Patch0: etckeeper-avoid-packagelist.patch Patch0: etckeeper-avoid-packagelist.patch
Patch1: etckeeper-set-package-manager.patch
Url: http://etckeeper.branchable.com/ Url: http://etckeeper.branchable.com/
BuildRoot: %{_tmppath}/%{name}-%{version}-build %if ! %{with bzr}
%define LPM rpm BuildArch: noarch
Requires: python-base >= 2.7
BuildRequires: make
# added for bzr 2014-07-10 bkbin005@rinku.zaq.ne.jp
BuildRequires: bzr
BuildRequires: python-devel
%if 0%{?suse_version}
# modified 2014-07-09 bkbin005@rinku.zaq.ne.jp
# Users should be able to select VCS.
Recommends: git
Recommends: %{name}-cron = %{version}-%{release}
Recommends: %{name}-zypp-plugin = %{version}-%{release}
BuildRequires: libzypp
%define HPM zypper
%else
BuildRequires: yum
Requires: %{name}-cron = %{version}-%{release}
Requires: %{name}-yum-plugin = %{version}-%{release}
%define HPM yum
%endif %endif
BuildRequires: %{python_versioned}-devel
%if 0%{suse_version} >= 1500
BuildRequires: bash-completion-devel
%else
BuildRequires: bash-completion
%endif
BuildRequires: make
# for the path ownership
BuildRequires: %{python_versioned}-zypp-plugin
BuildRequires: libzypp
BuildRequires: systemd-rpm-macros
%if %{with bzr}
BuildRequires: bzr
%endif
Recommends: git-core
Recommends: %{name}-bash-completion = %{version}-%{release}
Recommends: %{name}-zypp-plugin = %{version}-%{release}
%if %{with bzr}
Recommends: %{name}-bzr = %{version}-%{release}
%endif
%if %{with systemd}
%{?systemd_requires} %{?systemd_requires}
Obsoletes: %{name}-cron = %{version}-%{release}
%else
Recommends: %{name}-cron = %{version}-%{release}
%endif
%description %description
The etckeeper program is a tool to let /etc be stored in a git, The etckeeper program is a tool to let /etc be stored in a git,
@ -65,118 +84,113 @@ is important for /etc, such as the permissions of /etc/shadow. It is
quite modular and configurable, while also being simple to use if you quite modular and configurable, while also being simple to use if you
understand the basics of working with version control. understand the basics of working with version control.
%if ! %{with systemd}
%package cron %package cron
Summary: The etckeeper cron function Summary: The etckeeper cron function
Group: System/Management Group: System/Management
Requires: etckeeper = %{version}-%{release} Requires: etckeeper = %{version}-%{release}
Provides: etckeeper:%{_sysconfdir}/cron.daily/etckeeper Provides: etckeeper:%{_sysconfdir}/cron.daily/etckeeper
%if 0%{?suse_version}
Requires: cron Requires: cron
%else
Requires: crontabs
%endif
%description cron %description cron
The etckeeper-cron calls etckeeper from cron. The etckeeper-cron calls etckeeper from cron.
%endif
%if 0%{?suse_version}
%package zypp-plugin %package zypp-plugin
Summary: The etckeeper integration function with ZYpp Summary: The etckeeper integration function with ZYpp
Group: System/Management Group: System/Management
Requires: %{python_versioned}-zypp-plugin
Requires: etckeeper = %{version}-%{release} Requires: etckeeper = %{version}-%{release}
Requires: zypp-plugin-python
BuildRequires: zypp-plugin-python
Obsoletes: etckeeper-pkgmanager-collabo < %{version}-%{release} Obsoletes: etckeeper-pkgmanager-collabo < %{version}-%{release}
Provides: etckeeper-pkgmanager-collabo = %{version}-%{release} Provides: etckeeper-pkgmanager-collabo = %{version}-%{release}
Provides: etckeeper:%{_prefix}/lib/zypp/plugins/commit/zypper-etckeeper.py Provides: etckeeper:%{_prefix}/lib/zypp/plugins/commit/zypper-etckeeper.py
%description zypp-plugin %description zypp-plugin
The etckeeper-zypp-plugin calls etckeeper from ZYpp. The etckeeper-zypp-plugin calls etckeeper from ZYpp.
%else
%package yum-plugin %if %{with bzr}
Summary: The etckeeper integration function with YUM %package bzr
Summary: The etckeeper integration function with bzr
Group: System/Management Group: System/Management
Requires: etckeeper = %{version}-%{release} Requires: etckeeper = %{version}-%{release}
Obsoletes: etckeeper-pkgmanager-collabo Requires: %{python_versioned}-base
Provides: etckeeper-pkgmanager-collabo = %{version}-%{release} %description bzr
Provides: etckeeper:%{_sysconfdir}/yum/pluginconf.d/etckeeper.conf The etckeeper integration function with bzr
%description yum-plugin
The etckeeper-zypp-plugin calls etckeeper from YUM.
%endif %endif
%package bash-completion
Summary: The bash completion for etckeeper
Group: System/Management
Requires: etckeeper = %{version}-%{release}
Requires: bash-completion
%description bash-completion
The bash completion for etckeeper.
%prep %prep
%setup -q %setup -q
%patch0 -p1 %patch0 -p1
%patch1 -p1
%__perl -pi -e '
s|^(\s*)(HIGHLEVEL_PACKAGE_MANAGER)=.+|$1$2=%{HPM}|;
s|^(\s*)(LOWLEVEL_PACKAGE_MANAGER)=.+|$1$2=%{LPM}|;
s|^(\s*)(VCS)=.+|$1$2=git|;
' ./etckeeper.conf
# rpmlint
find -type f -name ".gitignore" -delete
rm -f ./doc/todo/.mdwn
# use %%{_unitdir} for rpm-based distros
sed -i 's:systemddir=/lib/systemd/system:systemddir=%{_unitdir}:g' Makefile
%build %build
make %{?_smp_mflags} find -type f -name ".gitignore" -delete
rm -f ./doc/todo/.mdwn
rm README.md
cp -a doc/README.mdwn README.md
perl -p -i -e 's|%{_bindir}/python|%{_bindir}/%{python_versioned}|g' zypper-etckeeper.py
make %{?_smp_mflags} %{make_args}
%install %install
make \ make install DESTDIR="%{buildroot}" %{make_args} \
DESTDIR="%{buildroot}" \ %if ! %{with systemd}
PYTHON_INSTALL_OPTS="--prefix=%{_prefix} --install-purelib=%{python_sitearch}" \
install
install -D debian/cron.daily "%{buildroot}/etc/cron.daily/%{name}" install -D debian/cron.daily "%{buildroot}/etc/cron.daily/%{name}"
%endif
mkdir %{buildroot}%{_sbindir} mkdir %{buildroot}%{_sbindir}
ln -s ../bin/%{name} %{buildroot}%{_sbindir}/%{name} ln -s ../bin/%{name} %{buildroot}%{_sbindir}/%{name}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name} ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
%pre %pre
%service_add_pre etckeeper.service %service_add_pre etckeeper.timer etckeeper.service
%preun %preun
%service_del_preun etckeeper.service %service_del_preun etckeeper.timer etckeeper.service
%post %post
%service_add_post etckeeper.service %service_add_post etckeeper.timer etckeeper.service
%postun %postun
%service_del_postun etckeeper.service %service_del_postun etckeeper.timer etckeeper.service
%files %files
%doc GPL README.md doc %doc README.md
%{_unitdir}/etckeeper* %license GPL
%{_unitdir}/etckeeper.timer
%{_unitdir}/etckeeper.service
%{_bindir}/etckeeper %{_bindir}/etckeeper
%{_sbindir}/*etckeeper %{_sbindir}/etckeeper
%dir %{_datadir}/bash-completion %{_sbindir}/rcetckeeper
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/etckeeper
%dir %{_sysconfdir}/etckeeper %dir %{_sysconfdir}/etckeeper
%dir %{_sysconfdir}/etckeeper/*.d
%{_sysconfdir}/etckeeper/daily %{_sysconfdir}/etckeeper/daily
%config(noreplace) %{_sysconfdir}/etckeeper/etckeeper.conf %config(noreplace) %{_sysconfdir}/etckeeper/etckeeper.conf
%dir %{_sysconfdir}/etckeeper/*.d
%config %{_sysconfdir}/etckeeper/*.d/* %config %{_sysconfdir}/etckeeper/*.d/*
%doc %{_mandir}/man8/etckeeper.8* %{_mandir}/man8/etckeeper.8*
%{python_sitearch}/bzrlib/plugins/%{name}/
%{python_sitearch}/bzr_%{name}-*.egg-info
%if ! %{with systemd}
%files cron %files cron
%config(noreplace) %{_sysconfdir}/cron.daily/etckeeper %config(noreplace) %{_sysconfdir}/cron.daily/etckeeper
%endif
%files bash-completion
%{_datadir}/bash-completion/completions/etckeeper
%if 0%{?suse_version}
%files zypp-plugin %files zypp-plugin
%{_prefix}/lib/zypp/plugins/commit/zypper-etckeeper.py %{_prefix}/lib/zypp/plugins/commit/zypper-etckeeper.py
%else
%files yum-plugin %if %{with bzr}
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/etckeeper.conf %files bzr
%{_prefix}/lib/yum-plugins/etckeeper.* %{python_sitearch}/bzrlib/plugins/%{name}/
%{python_sitearch}/bzr_%{name}-*.egg-info
%endif %endif
%changelog %changelog