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