URL: https://github.com/freeipa/freeipa/pull/233
Author: pspacek
 Title: #233: Build phase 6: %install cleanup
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/233/head:pr233
git checkout pr233
From 66ce562f3146e7febddc8241ad2cf51986f3d6b3 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Thu, 10 Nov 2016 12:07:03 +0100
Subject: [PATCH 1/4] Build: move client directory handling from SPEC to
 Makefile.am

This is next step towards fully functional make install.

https://fedorahosted.org/freeipa/ticket/6418
---
 client/Makefile.am | 3 +++
 freeipa.spec.in    | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/client/Makefile.am b/client/Makefile.am
index 0a451e5..45abdf6 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -122,3 +122,6 @@ MAINTAINERCLEANFILES =		\
 	version.m4		\
 	$(NULL)
 
+install-data-hook:
+	$(INSTALL) -d -D -m 755 $(DESTDIR)$(IPA_SYSCONF_DIR)/nssdb
+	$(INSTALL) -d -D -m 755 $(DESTDIR)$(localstatedir)/lib/ipa-client/sysrestore
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 7dbbf87..4e39b3c 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -804,11 +804,8 @@ touch %{buildroot}%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
 mkdir -p %{buildroot}/%{_localstatedir}/lib/ipa/backup
 %endif # ONLY_CLIENT
 
-mkdir -p %{buildroot}%{_sysconfdir}/ipa/
 /bin/touch %{buildroot}%{_sysconfdir}/ipa/default.conf
 /bin/touch %{buildroot}%{_sysconfdir}/ipa/ca.crt
-mkdir -p %{buildroot}%{_sysconfdir}/ipa/nssdb
-mkdir -p %{buildroot}/%{_localstatedir}/lib/ipa-client/sysrestore
 
 %if ! %{ONLY_CLIENT}
 mkdir -p %{buildroot}%{_sysconfdir}/cron.d

From 5bdde096b0d8443fd4c40b8d146530dbf06b63d1 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Thu, 10 Nov 2016 12:45:26 +0100
Subject: [PATCH 2/4] Build: move server directory handling from SPEC to
 Makefile.am

This is next step towards fully functional make install.

https://fedorahosted.org/freeipa/ticket/6418
---
 freeipa.spec.in     |  8 --------
 install/Makefile.am | 11 +++++------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 4e39b3c..68fc2bc 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -741,8 +741,6 @@ sed -i -e'1s/python\(3\|$\)/python2/' %{buildroot}%{_bindir}/ipa
 
 %find_lang %{gettext_domain}
 
-mkdir -p %{buildroot}%{_usr}/share/ipa
-
 %if ! %{ONLY_CLIENT}
 # Remove .la files from libtool - we don't want to package
 # these files
@@ -793,7 +791,6 @@ mkdir -p %{buildroot}%{_usr}/share/ipa/html/
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/krb.js
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/krb5.ini
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/krbrealm.con
-mkdir -p %{buildroot}%{_initrddir}
 
 # Web UI plugin dir
 mkdir -p %{buildroot}%{_usr}/share/ipa/ui/js/plugins
@@ -801,7 +798,6 @@ mkdir -p %{buildroot}%{_usr}/share/ipa/ui/js/plugins
 mkdir -p %{buildroot}%{_libdir}/krb5/plugins/libkrb5
 touch %{buildroot}%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
 
-mkdir -p %{buildroot}/%{_localstatedir}/lib/ipa/backup
 %endif # ONLY_CLIENT
 
 /bin/touch %{buildroot}%{_sysconfdir}/ipa/default.conf
@@ -818,10 +814,6 @@ mkdir -p %{buildroot}%{_sysconfdir}/cron.d
     sed -e 's,\.py.*$,.*,g' | sort -u | \
     sed -e 's,\./,%%{python_sitelib}/ipatests/,g' ) >tests-python.list
 
-mkdir -p %{buildroot}%{_sysconfdir}/ipa/custodia
-
-mkdir -p %{buildroot}%{_usr}/share/ipa/schema.d
-
 %endif # ONLY_CLIENT
 
 
diff --git a/install/Makefile.am b/install/Makefile.am
index 2dcd927..0dca193 100644
--- a/install/Makefile.am
+++ b/install/Makefile.am
@@ -19,12 +19,11 @@ SUBDIRS =			\
 	$(NULL)
 
 install-exec-local:
-	mkdir -p $(DESTDIR)$(localstatedir)/lib/ipa/sysrestore
-	chmod 700 $(DESTDIR)$(localstatedir)/lib/ipa/sysrestore
-	mkdir -p $(DESTDIR)$(localstatedir)/lib/ipa/sysupgrade
-	chmod 700 $(DESTDIR)$(localstatedir)/lib/ipa/sysupgrade
-	mkdir -p $(DESTDIR)$(localstatedir)/lib/ipa/pki-ca
-	chmod 755 $(DESTDIR)$(localstatedir)/lib/ipa/pki-ca
+	$(INSTALL) -d -D -m 700 $(DESTDIR)$(IPA_SYSCONF_DIR)/custodia
+	$(INSTALL) -d -D -m 700 $(DESTDIR)$(localstatedir)/lib/ipa/backup
+	$(INSTALL) -d -D -m 700 $(DESTDIR)$(localstatedir)/lib/ipa/sysrestore
+	$(INSTALL) -d -D -m 700 $(DESTDIR)$(localstatedir)/lib/ipa/sysupgrade
+	$(INSTALL) -d -D -m 755 $(DESTDIR)$(localstatedir)/lib/ipa/pki-ca
 
 uninstall-local:
 	-rmdir $(DESTDIR)$(localstatedir)/lib/ipa/sysrestore

From 88ed0655561efd8852f4c842a47182ae3b16515c Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Thu, 10 Nov 2016 14:39:59 +0100
Subject: [PATCH 3/4] Build: move web UI file installation from SPEC to
 Makefile.am

This is next step towards fully functional make install.

https://fedorahosted.org/freeipa/ticket/6418
---
 freeipa.spec.in          | 19 -------------------
 install/html/Makefile.am | 14 ++++++++++++++
 install/ui/Makefile.am   |  3 +++
 3 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 68fc2bc..45d2896 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -763,28 +763,12 @@ rm %{buildroot}/%{plugin_dir}/libtopology.la
 rm %{buildroot}/%{_libdir}/krb5/plugins/kdb/ipadb.la
 rm %{buildroot}/%{_libdir}/samba/pdb/ipasam.la
 
-# Some user-modifiable HTML files are provided. Move these to /etc
-# and link back.
-mkdir -p %{buildroot}/%{_sysconfdir}/ipa/html
-mkdir %{buildroot}%{_usr}/share/ipa/html/
-ln -s ../../../..%{_sysconfdir}/ipa/html/ffconfig.js \
-    %{buildroot}%{_usr}/share/ipa/html/ffconfig.js
-ln -s ../../../..%{_sysconfdir}/ipa/html/ffconfig_page.js \
-    %{buildroot}%{_usr}/share/ipa/html/ffconfig_page.js
-ln -s ../../../..%{_sysconfdir}/ipa/html/ssbrowser.html \
-    %{buildroot}%{_usr}/share/ipa/html/ssbrowser.html
-ln -s ../../../..%{_sysconfdir}/ipa/html/unauthorized.html \
-    %{buildroot}%{_usr}/share/ipa/html/unauthorized.html
-ln -s ../../../..%{_sysconfdir}/ipa/html/browserconfig.html \
-    %{buildroot}%{_usr}/share/ipa/html/browserconfig.html
-
 # So we can own our Apache configuration
 mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d/
 /bin/touch %{buildroot}%{_sysconfdir}/httpd/conf.d/ipa.conf
 /bin/touch %{buildroot}%{_sysconfdir}/httpd/conf.d/ipa-kdc-proxy.conf
 /bin/touch %{buildroot}%{_sysconfdir}/httpd/conf.d/ipa-pki-proxy.conf
 /bin/touch %{buildroot}%{_sysconfdir}/httpd/conf.d/ipa-rewrite.conf
-mkdir -p %{buildroot}%{_usr}/share/ipa/html/
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/ca.crt
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/kerberosauth.xpi
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/krb.con
@@ -792,9 +776,6 @@ mkdir -p %{buildroot}%{_usr}/share/ipa/html/
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/krb5.ini
 /bin/touch %{buildroot}%{_usr}/share/ipa/html/krbrealm.con
 
-# Web UI plugin dir
-mkdir -p %{buildroot}%{_usr}/share/ipa/ui/js/plugins
-
 mkdir -p %{buildroot}%{_libdir}/krb5/plugins/libkrb5
 touch %{buildroot}%{_libdir}/krb5/plugins/libkrb5/winbind_krb5_locator.so
 
diff --git a/install/html/Makefile.am b/install/html/Makefile.am
index c487f9f..33f4d49 100644
--- a/install/html/Makefile.am
+++ b/install/html/Makefile.am
@@ -16,3 +16,17 @@ EXTRA_DIST =                            \
 MAINTAINERCLEANFILES =                  \
         *~                              \
         Makefile.in
+
+# Default user-modifiable HTML files are installed into /etc.
+# /usr points to these modifiable files in /etc
+# This is ugly but we do not have time to change it right now.
+# Relative paths must be used to ensure that symlinks created in buildroot
+# work after installation.
+htmldatadir = $(datarootdir)/ipa/html
+install-data-hook:
+	$(INSTALL) -d -D -m 755 $(DESTDIR)$(htmldatadir)
+	for FILE in $(app_DATA); do				\
+		$(LN_S) --force --relative			\
+			$(DESTDIR)$(appdir)/$${FILE}		\
+			$(DESTDIR)$(htmldatadir)/$${FILE};	\
+	done
diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am
index 18fb9b4..c81eceb 100644
--- a/install/ui/Makefile.am
+++ b/install/ui/Makefile.am
@@ -34,3 +34,6 @@ MAINTAINERCLEANFILES =                  \
         *~                              \
         Makefile.in
 	$(NULL)
+
+install-data-hook:
+	$(INSTALL) -d -m 755 $(DESTDIR)$(appdir)/js/plugins

From 86baa916d15c11eb0ddde26a0e4027415d95cdb3 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Fri, 11 Nov 2016 12:21:58 +0100
Subject: [PATCH 4/4] Build: document what should be in %install section of
 SPEC file

https://fedorahosted.org/freeipa/ticket/6418
---
 freeipa.spec.in | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/freeipa.spec.in b/freeipa.spec.in
index 45d2896..b552dcd 100644
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -702,6 +702,14 @@ make %{?_smp_mflags} client-check VERBOSE=yes LIBDIR=%{_libdir}
 
 
 %install
+# Please put as much logic as possible into make install. It allows:
+# - easier porting to other distributions
+# - rapid devel & install cycle using make install
+#   (instead of full RPM build and installation each time)
+#
+# All files and directories created by spec install should be marked as ghost.
+# (These are typically configuration files created by IPA installer.)
+# All other artifacts should be created by make install.
 %make_install
 # remove files which are useful only for make uninstall
 find %{buildroot} -wholename '*/site-packages/*/install_files.txt' -exec rm {} \;
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to