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