]> git.pld-linux.org Git - packages/etckeeper.git/blobdiff - etckeeper.spec
move bzr hook to bzr subpackage
[packages/etckeeper.git] / etckeeper.spec
index 060450d269df2885800b5d3e534afe97e8d0e8a7..adfa0024370415e0a116b5bd2184cbd201bdd3d4 100644 (file)
@@ -1,30 +1,44 @@
 # TODO:
 # - Subpackages for yum and apt plugins
-# - Subpackages for backends (git, etc)
-# - Write PLD %pre and %post macros that trigger pre-install and post-install runs
-# - %{py_sitescriptdir}/bzrlib/plugins also created by qbzr package?
+# - Subpackages for backends (darcs, git, hg)
 Summary:       Store /etc in a SCM system (git, mercurial, bzr or darcs)
 Name:          etckeeper
-Version:       0.64
-Release:       0.3
-License:       GPL v2
+Version:       1.9
+Release:       1
+License:       GPL v2+
 Group:         Applications/System
-Source0:       http://ftp.debian.org/debian/pool/main/e/etckeeper/%{name}_%{version}.tar.gz
-# Source0-md5: ddd3229028df8da9af03ec8128cebc9b
+Source0:       https://github.com/joeyh/etckeeper/archive/%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 1f4d27f35dc527cca075353c766a8023
+Source1:       poldek.sh
+Patch1:                use-libdir.patch
+Patch2:                update-ignore.patch
 URL:           http://kitenet.net/~joey/code/etckeeper/
 BuildRequires: bzr
 BuildRequires: rpm-pythonprov
 BuildRequires: rpmbuild(macros) >= 1.219
 BuildRequires: sed >= 4.0
-Requires:      perl
-Requires:      python-modules
-Suggests:      %{name}-bash-completions
+Requires:      findutils
+Requires:      mktemp
+Requires:      perl-base
+Requires:      sed >= 4.0
+%if "%{pld_release}" != "ac"
+Requires:      poldek >= 0.30.0-1.rc7.4
+%endif
 Suggests:      %{name}-bzr
+Suggests:      bash-completion-%{name}
 Suggests:      git-core >= 1.6.1-1
 Obsoletes:     yum-etckeeper
+%if "%{pld_release}" != "ac"
 BuildArch:     noarch
+%endif
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%if "%{pld_release}" != "ac"
+%define                _poldeklibdir   %{_prefix}/lib/poldek
+%else
+%define                _poldeklibdir   %{_libdir}/poldek
+%endif
+
 %description
 The etckeeper program is a tool to let /etc be stored in a git,
 mercurial, bzr or darcs repository. It hooks into APT to automatically
@@ -62,25 +76,35 @@ Obsoletes:  etckeeper-bash-completions
 Bash completion routines for etckeeper.
 
 %prep
-%setup -q -n %{name}
+%setup -q
+%patch1 -p1
+%patch2 -p1
 %{__sed} -i -e '
        s|HIGHLEVEL_PACKAGE_MANAGER=apt|HIGHLEVEL_PACKAGE_MANAGER=poldek|;
        s|LOWLEVEL_PACKAGE_MANAGER=dpkg|LOWLEVEL_PACKAGE_MANAGER=rpm|;
 ' %{name}.conf
 
+# cleanup backups after patching
+find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
+
 %build
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/cron.daily,%{_localstatedir}/cache/%{name}}
+install -d $RPM_BUILD_ROOT{/etc/cron.daily,%{_sysconfdir}/%{name},%{_localstatedir}/cache/%{name},%{_poldeklibdir}}
 %{__make} install \
+       etcdir=/lib \
        LOWLEVEL_PACKAGE_MANAGER=rpm \
        HIGHLEVEL_PACKAGE_MANAGER=poldek \
        INSTALL="install -p" \
        DESTDIR=$RPM_BUILD_ROOT
 
+mv $RPM_BUILD_ROOT{/lib,%{_sysconfdir}}/%{name}/%{name}.conf
+mv $RPM_BUILD_ROOT{/lib/bash_completion.d,/etc}
+
 install -p debian/cron.daily $RPM_BUILD_ROOT/etc/cron.daily/%{name}
+install -p %{SOURCE1} $RPM_BUILD_ROOT%{_poldeklibdir}/%{name}.sh
 
 %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
 %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
@@ -89,35 +113,51 @@ install -p debian/cron.daily $RPM_BUILD_ROOT/etc/cron.daily/%{name}
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%if 0
 %post
-if [ $1 -gt 1 ] ; then
+if [ $1 -gt 1 ]; then
        %{_bindir}/%{name} update-ignore
 fi
-%endif
+
+%triggerin -- poldek
+# add our hook as "pm command"
+if [ -f /etc/poldek/poldek.conf ] && ! grep -q '^pm command = %{_poldeklibdir}/%{name}.sh' /etc/poldek/poldek.conf; then
+       %{__sed} -i -re 's,#?(pm command =).*,\1 %{_poldeklibdir}/%{name}.sh,' /etc/poldek/poldek.conf
+fi
+
+%triggerun -- poldek
+# remove our hook as "pm command"
+if [ "$1" -eq 0 ] && [ -f /etc/poldek/poldek.conf ]; then
+       %{__sed} -i -re 's,^pm command = %{_poldeklibdir}/%{name}.sh,#&,' /etc/poldek/poldek.conf
+fi
 
 %files
 %defattr(644,root,root,755)
 %doc INSTALL TODO README
 %dir %{_sysconfdir}/%{name}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/%{name}.conf
-%dir %{_sysconfdir}/%{name}/*.d
-%attr(755,root,root) %{_sysconfdir}/%{name}/*.d/[0-9]*
-%{_sysconfdir}/%{name}/*.d/README
-
+%dir /lib/%{name}
+%dir /lib/%{name}/*.d
+%attr(755,root,root) /lib/%{name}/*.d/[0-9]*
+/lib/%{name}/*.d/README
 %attr(755,root,root) /etc/cron.daily/%{name}
 %attr(755,root,root) %{_bindir}/%{name}
 %{_mandir}/man8/%{name}.8*
-
+%attr(755,root,root) %{_poldeklibdir}/%{name}.sh
 %dir %attr(750,root,root) %{_localstatedir}/cache/%{name}
 
+# subpackages
+%exclude /lib/etckeeper/commit.d/30bzr-add
+
 %files bzr
 %defattr(644,root,root,755)
+/lib/etckeeper/commit.d/30bzr-add
 %dir %{py_sitescriptdir}/bzrlib
 %dir %{py_sitescriptdir}/bzrlib/plugins
 %dir %{py_sitescriptdir}/bzrlib/plugins/%{name}
 %{py_sitescriptdir}/bzrlib/plugins/%{name}/*.py[co]
+%if "%{pld_release}" != "ac"
 %{py_sitescriptdir}/bzr_etckeeper-*.egg-info
+%endif
 
 %files -n bash-completion-%{name}
 %defattr(644,root,root,755)
This page took 0.064115 seconds and 4 git commands to generate.