Skip to content

Commit ec0b292

Browse files
Refactor: packaging: kill automake and move build steps from crmsh.spec into Makefile
1 parent 2a474f1 commit ec0b292

File tree

6 files changed

+82
-182
lines changed

6 files changed

+82
-182
lines changed

Makefile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
DESTDIR ?= /
2+
datadir ?= /usr/share
3+
confdir ?= /etc
4+
localstatedir ?= /var
5+
tmpfilesdir ?= /lib/tmpfiles.d
6+
mandir ?= /$(datadir)/man
7+
fwdefdir ?= /usr/lib/firewalld/services
8+
9+
PYTHON ?= python3
10+
11+
.PHONY: all install uninstall
12+
13+
all: non-python
14+
15+
install: install-non-python
16+
17+
uninstall: uninstall-non-python uninstall-python
18+
19+
.PHONY: non-python manpages html-docs python
20+
21+
non-python: manpages html-docs
22+
23+
manpages: doc/crm.8 doc/crmsh_crm_report.8
24+
25+
html-docs: doc/crm.8.html doc/crmsh_crm_report.8.html doc/profiles.html
26+
27+
%.8: %.8.adoc
28+
a2x -f manpage $<
29+
30+
%.html: %.adoc
31+
asciidoc --unsafe --backend=xhtml11 $<
32+
33+
python:
34+
$(PYTHON) -m pip wheel .
35+
36+
.PHONY: install-non-python uninstall-non-python install-python uninstall-python
37+
38+
install-non-python: non-python
39+
# additional directories
40+
install -d -m0770 $(DESTDIR)$(localstatedir)/cache/crm
41+
install -d -m0770 $(DESTDIR)$(localstatedir)/log/crmsh
42+
install -d -m0755 $(DESTDIR)${tmpfilesdir}
43+
# install configuration
44+
install -Dm0644 -t $(DESTDIR)$(confdir)/crm etc/{crm.conf,profiles.yml}
45+
install -m0644 crmsh.tmpfiles.d.conf $(DESTDIR)$(tmpfilesdir)/crmsh.conf
46+
# install manpages
47+
install -Dpm0644 -t $(DESTDIR)$(mandir)/man8 doc/*.8
48+
install -Dpm0644 -t $(DESTDIR)$(datadir)/crmsh/ doc/crm.8.adoc
49+
# install data
50+
for d in $$(cat data-manifest); do \
51+
if [ -x "$$d" ] ; then mode="0755" ; else mode="0644" ; fi; \
52+
install -D -m "$${mode}" "$$d" $(DESTDIR)$(datadir)/crmsh/"$$d"; \
53+
done
54+
$(RM) -r $(DESTDIR)$(datadir)/crmsh/tests
55+
mv $(DESTDIR)$(datadir)/crmsh/test $(DESTDIR)$(datadir)/crmsh/tests
56+
install -p test/testcases/xmlonly.sh $(DESTDIR)$(datadir)/crmsh/tests/testcases/configbasic-xml.filter
57+
install -Dm0644 contrib/bash_completion.sh $(DESTDIR)$(datadir)/bash-completion/completions/crm
58+
if [ -n "$(fwdefdir)" ]; then \
59+
install -Dm0644 high-availability.xml $(DESTDIR)$(fwdefdir)/high-availability.xml; \
60+
fi
61+
62+
install-python: python
63+
$(PYTHON) -m pip install --break-system-packages --prefix /usr --no-index --find-links ./ crmsh
64+
65+
uninstall-non-python:
66+
$(RM) -r $(DESTDIR)$(confdir)/crm
67+
$(RM) -r $(DESTDIR)$(localstatedir)/cache/crm
68+
$(RM) -r $(DESTDIR)$(localstatedir)/log/crm
69+
$(RM) -r $(DESTDIR)$(datadir)/crmsh
70+
$(RM) -r $(DESTDIR)$(datadir)/bash-completion/completions/crm
71+
$(RM) $(DESTDIR)$(fwdefdir)/high-availability.xml
72+
$(RM) $(DESTDIR)$(tmpfilesdir)/crmsh.conf
73+
74+
uninstall-python:
75+
$(PYTHON) -m pip uninstall --yes crmsh

Makefile.am

Lines changed: 0 additions & 102 deletions
This file was deleted.

autogen.sh

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -80,43 +80,21 @@ do
8080
fi
8181
done
8282

83-
for command in automake14 automake-1.4 automake15 automake-1.5 automake17 automake-1.7 automake19 automake-1.9 automake-1.11 automake
84-
do
85-
if
86-
testProgram $command
87-
then
88-
: OK $pkg is installed
89-
automake=$command
90-
aclocal=`echo "$automake" | sed -e 's/automake/aclocal/'`
91-
fi
92-
done
93-
9483
if [ -z $autoconf ]; then
9584
echo You must have autoconf installed to compile the crmsh package.
9685
echo Download the appropriate package for your system,
9786
echo or get the source tarball at: $gnu/autoconf/
9887
exit 1
99-
100-
elif [ -z $automake ]; then
101-
echo You must have automake installed to compile the crmsh package.
102-
echo Download the appropriate package for your system,
103-
echo or get the source tarball at: $gnu/automake/
104-
exit 1
105-
10688
fi
10789

10890
# Create local copies so that the incremental updates will work.
109-
rm -f ./autoconf ./automake ./autoheader
91+
rm -f ./autoconf ./autoheader
11092
ln -s `which $autoconf` ./autoconf
111-
ln -s `which $automake` ./automake
11293
ln -s `which $autoheader` ./autoheader
11394

11495
printf "$autoconf:\t"
11596
$autoconf --version | head -n 1
11697

117-
printf "$automake:\t"
118-
$automake --version | head -n 1
119-
12098
arch=`uname -s`
12199
# Disable the errors on FreeBSD until a fix can be found.
122100
if [ ! "$arch" = "FreeBSD" ]; then
@@ -134,9 +112,6 @@ fi
134112
echo $aclocal $ACLOCAL_FLAGS
135113
$aclocal $ACLOCAL_FLAGS
136114

137-
echo $automake --add-missing --include-deps --copy
138-
$automake --add-missing --include-deps --copy
139-
140115
echo $autoconf
141116
$autoconf
142117

configure.ac

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,19 @@ AC_ARG_WITH(daemon-user,
3030
[ CRM_DAEMON_USER="$withval" ],
3131
[ CRM_DAEMON_USER="hacluster" ])
3232

33-
AM_INIT_AUTOMAKE([no-define foreign])
34-
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
3533
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE_NAME")
3634
AC_DEFINE_UNQUOTED(VERSION, "$PACKAGE_VERSION")
3735

38-
dnl automake >= 1.11 offers --enable-silent-rules for suppressing the output from
39-
dnl normal compilation. When a failure occurs, it will then display the full
40-
dnl command line
41-
dnl Wrap in m4_ifdef to avoid breaking on older platforms
42-
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES])
43-
4436
AC_SUBST(OCF_ROOT_DIR)
4537
AC_SUBST(CRM_DAEMON_USER)
4638

4739
CRM_CACHE_DIR=${localstatedir}/cache/crm
4840
AC_DEFINE_UNQUOTED(CRM_CACHE_DIR,"$CRM_CACHE_DIR", Where crm shell keeps the cache)
4941
AC_SUBST(CRM_CACHE_DIR)
5042

51-
AM_PATH_PYTHON([3])
5243
AC_PATH_PROGS(ASCIIDOC, asciidoc)
5344

54-
AM_CONDITIONAL(BUILD_ASCIIDOC, test x"${ASCIIDOC}" != x"")
55-
56-
AC_CONFIG_FILES(Makefile \
57-
etc/crm.conf \
45+
AC_CONFIG_FILES(etc/crm.conf \
5846
version \
5947
crmsh.spec \
6048
)

crmsh.spec.in

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,7 @@ sed -i -e '1{\@^#!%{_bindir}/python3@d}' crmsh/report/core.py
172172
%pyproject_wheel
173173
%endif
174174

175-
# Generate manpages
176-
for manpg in doc/crm{,sh_crm_report}.8.adoc ; do
177-
a2x -f manpage $manpg
178-
done
179-
180-
for docad in doc/crm{,sh_crm_report}.8.adoc ; do
181-
asciidoc --unsafe --backend=xhtml11 $docad
182-
done
175+
make all
183176

184177
%if %{with regression_tests}
185178
tox
@@ -190,48 +183,19 @@ fi
190183
%endif
191184

192185
%install
193-
# make DESTDIR=%%{buildroot} docdir=%%{crmsh_docdir} install
194186
%if 0%{?suse_version}
195187
%python3_pyproject_install
196188
%else
197189
%pyproject_install
198190
%endif
199191

200-
# additional directories
201-
install -d -m0770 %{buildroot}%{_localstatedir}/cache/crm
202-
install -d -m0770 %{buildroot}%{_localstatedir}/log/crmsh
203-
install -d -m0755 %{buildroot}%{_tmpfilesdir}
204-
205-
# install configuration
206-
install -Dm0644 -t %{buildroot}%{_sysconfdir}/crm etc/{crm.conf,profiles.yml}
207-
install -m0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf
208-
209-
# install manpages
210-
install -Dpm0644 -t %{buildroot}%{_mandir}/man8 doc/*.8
211-
install -Dpm0644 -t %{buildroot}%{_datadir}/crmsh/ doc/crm.8.adoc
212-
213-
# install data
214-
for d in $(cat data-manifest); do
215-
if [ -x $d ] ; then mode="0755" ; else mode="0644" ; fi
216-
install -D -m $mode $d %{buildroot}%{_datadir}/crmsh/$d
217-
done
218-
mv %{buildroot}%{_datadir}/crmsh/test{,s}
219-
install -p test/testcases/xmlonly.sh \
220-
%{buildroot}%{_datadir}/crmsh/tests/testcases/configbasic-xml.filter
221-
222-
install -Dm0644 contrib/bash_completion.sh \
223-
%{buildroot}%{_datadir}/bash-completion/completions/crm
192+
make DESTDIR=%{buildroot} tmpfilesdir=%{_tmpfilesdir} fwdefdir=%{_fwdefdir} install
224193

225194
if [ -f %{buildroot}%{_bindir}/crm ]; then
226-
install -Dm0755 %{buildroot}%{_bindir}/crm %{buildroot}%{_sbindir}/crm
227-
rm %{buildroot}%{_bindir}/crm
195+
install -d %{buildroot}%{_sbindir}/
196+
mv %{buildroot}%{_bindir}/crm %{buildroot}%{_sbindir}/crm
228197
fi
229198

230-
%if %{use_firewalld}
231-
install -Dm0644 high-availability.xml \
232-
%{buildroot}%{_fwdefdir}/high-availability.xml
233-
%endif
234-
235199
%if 0%{?suse_version}
236200
%fdupes %{buildroot}
237201
%endif

test/run-functional-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ deploy_ha_node() {
190190
else
191191
podman_security=""
192192
fi
193-
make_cmd="cd $PROJECT_INSIDE;./autogen.sh && ./configure --prefix /usr && make install && make install-crmconfDATA prefix= && cp /usr/bin/crm /usr/sbin"
193+
make_cmd="cd $PROJECT_INSIDE;./autogen.sh && ./configure --prefix /usr && make install install-python && cp /usr/bin/crm /usr/sbin"
194194

195195
info "Deploying \"$node_name\"..."
196196
podman run --rm -d $podman_options $podman_capabilties $podman_security $CONTAINER_IMAGE

0 commit comments

Comments
 (0)