]> git.pld-linux.org Git - packages/etckeeper.git/blob - etckeeper.spec
6d2b9c36216077c262109bd3ab81c862b014f261
[packages/etckeeper.git] / etckeeper.spec
1 # TODO:
2 # - Subpackages for yum and apt plugins
3 # - Subpackages for backends (git, etc)
4 Summary:        Store /etc in a SCM system (git, mercurial, bzr or darcs)
5 Name:           etckeeper
6 Version:        1.1
7 Release:        0.25
8 License:        GPL v2+
9 Group:          Applications/System
10 Source0:        http://ftp.debian.org/debian/pool/main/e/etckeeper/%{name}_%{version}.tar.gz
11 # Source0-md5:  280f75205940f99f8f0295bb8ec3598f
12 Source1:        poldek.sh
13 Patch0:         type-mksh.patch
14 Patch1:         use-libdir.patch
15 URL:            http://kitenet.net/~joey/code/etckeeper/
16 BuildRequires:  bzr
17 BuildRequires:  rpm-pythonprov
18 BuildRequires:  rpmbuild(macros) >= 1.219
19 BuildRequires:  sed >= 4.0
20 Requires:       findutils
21 Requires:       mktemp
22 Requires:       perl-base
23 Requires:       sed >= 4.0
24 %if "%{pld_release}" != "ac"
25 Requires:       poldek >= 0.30.0-1.rc7.4
26 %endif
27 Suggests:       %{name}-bash-completions
28 Suggests:       %{name}-bzr
29 Suggests:       git-core >= 1.6.1-1
30 Obsoletes:      yum-etckeeper
31 %if "%{pld_release}" != "ac"
32 BuildArch:      noarch
33 %endif
34 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
36 %if "%{pld_release}" != "ac"
37 %define         _poldeklibdir   %{_prefix}/lib/poldek
38 %else
39 %define         _poldeklibdir   %{_libdir}/poldek
40 %endif
41
42 %description
43 The etckeeper program is a tool to let /etc be stored in a git,
44 mercurial, bzr or darcs repository. It hooks into APT to automatically
45 commit changes made to /etc during package upgrades. It tracks file
46 metadata that version control systems do not normally support, but
47 that is important for /etc, such as the permissions of /etc/shadow.
48 It's quite modular and configurable, while also being simple to use if
49 you understand the basics of working with version control.
50
51 The default backend is git, if want to use a another backend please
52 install the appropriate tool (mercurial, darcs or bzr). To use bzr as
53 backend, please also install the %{name}-bzr package.
54
55 To start using the package please read
56 %{_docdir}/%{name}-%{version}/README
57
58 %package bzr
59 Summary:        Support for bzr with etckeeper
60 Group:          Applications/System
61 Requires:       %{name} = %{version}-%{release}
62 Requires:       bzr
63
64 %description bzr
65 This package provides a bzr backend for etckeeper, if you want to use
66 etckeeper with bzr backend, install this package.
67
68 %package -n bash-completion-%{name}
69 Summary:        Bash completion routines for %{name}
70 Group:          Applications/Shells
71 Requires:       %{name} = %{version}-%{release}
72 Requires:       bash-completion
73 Obsoletes:      etckeeper-bash-completions
74
75 %description -n bash-completion-%{name}
76 Bash completion routines for etckeeper.
77
78 %prep
79 %setup -qc
80 mv %{name} .tmp
81 mv .tmp/* .
82 %patch0 -p1
83 %patch1 -p1
84 %{__sed} -i -e '
85         s|HIGHLEVEL_PACKAGE_MANAGER=apt|HIGHLEVEL_PACKAGE_MANAGER=poldek|;
86         s|LOWLEVEL_PACKAGE_MANAGER=dpkg|LOWLEVEL_PACKAGE_MANAGER=rpm|;
87 ' %{name}.conf
88
89 # cleanup backups after patching
90 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
91
92 %build
93 %{__make}
94
95 %install
96 rm -rf $RPM_BUILD_ROOT
97 install -d $RPM_BUILD_ROOT{/etc/cron.daily,%{_sysconfdir}/%{name},%{_localstatedir}/cache/%{name},%{_poldeklibdir}}
98 %{__make} install \
99         etcdir=/lib \
100         LOWLEVEL_PACKAGE_MANAGER=rpm \
101         HIGHLEVEL_PACKAGE_MANAGER=poldek \
102         INSTALL="install -p" \
103         DESTDIR=$RPM_BUILD_ROOT
104
105 mv $RPM_BUILD_ROOT{/lib,%{_sysconfdir}}/%{name}/%{name}.conf
106 mv $RPM_BUILD_ROOT{/lib/bash_completion.d,/etc}
107
108 install -p debian/cron.daily $RPM_BUILD_ROOT/etc/cron.daily/%{name}
109 install -p %{SOURCE1} $RPM_BUILD_ROOT%{_poldeklibdir}/%{name}.sh
110
111 %py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
112 %py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
113 %py_postclean
114
115 %clean
116 rm -rf $RPM_BUILD_ROOT
117
118 %post
119 if [ $1 -gt 1 ]; then
120         %{_bindir}/%{name} update-ignore
121 fi
122
123 %triggerin -- poldek
124 # add our hook as "pm command"
125 if [ -f /etc/poldek/poldek.conf ] && ! grep -q '^pm command = %{_poldeklibdir}/%{name}.sh' /etc/poldek/poldek.conf; then
126         %{__sed} -i -re 's,#?(pm command =).*,\1 %{_poldeklibdir}/%{name}.sh,' /etc/poldek/poldek.conf
127 fi
128
129 %triggerun -- poldek
130 # remove our hook as "pm command"
131 if [ "$1" -eq 0 ] && [ -f /etc/poldek/poldek.conf ]; then
132         %{__sed} -i -re 's,^pm command = %{_poldeklibdir}/%{name}.sh,#&,' /etc/poldek/poldek.conf
133 fi
134
135 %files
136 %defattr(644,root,root,755)
137 %doc INSTALL TODO README
138 %dir %{_sysconfdir}/%{name}
139 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/%{name}.conf
140 %dir /lib/%{name}
141 %dir /lib/%{name}/*.d
142 %attr(755,root,root) /lib/%{name}/*.d/[0-9]*
143 /lib/%{name}/*.d/README
144 %attr(755,root,root) /etc/cron.daily/%{name}
145 %attr(755,root,root) %{_bindir}/%{name}
146 %{_mandir}/man8/%{name}.8*
147 %attr(755,root,root) %{_poldeklibdir}/%{name}.sh
148 %dir %attr(750,root,root) %{_localstatedir}/cache/%{name}
149
150 %files bzr
151 %defattr(644,root,root,755)
152 %dir %{py_sitescriptdir}/bzrlib
153 %dir %{py_sitescriptdir}/bzrlib/plugins
154 %dir %{py_sitescriptdir}/bzrlib/plugins/%{name}
155 %{py_sitescriptdir}/bzrlib/plugins/%{name}/*.py[co]
156 %if "%{pld_release}" != "ac"
157 %{py_sitescriptdir}/bzr_etckeeper-*.egg-info
158 %endif
159
160 %files -n bash-completion-%{name}
161 %defattr(644,root,root,755)
162 %{_sysconfdir}/bash_completion.d/%{name}
This page took 0.078611 seconds and 2 git commands to generate.