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 068652de356b6d69d13649da2920c870a97d82c5 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 233f30612e34f76acded8e9d9c86e6425a3b6260 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 | 4 ++++ 2 files changed, 4 insertions(+), 8 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..58d67c6 100644 --- a/install/Makefile.am +++ b/install/Makefile.am @@ -19,6 +19,10 @@ SUBDIRS = \ $(NULL) install-exec-local: + mkdir -p $(DESTDIR)$(IPA_SYSCONF_DIR)/custodia + chmod 700 $(DESTDIR)$(IPA_SYSCONF_DIR)/custodia + mkdir -p $(DESTDIR)$(localstatedir)/lib/ipa/backup + chmod 700 $(DESTDIR)$(localstatedir)/lib/ipa/backup mkdir -p $(DESTDIR)$(localstatedir)/lib/ipa/sysrestore chmod 700 $(DESTDIR)$(localstatedir)/lib/ipa/sysrestore mkdir -p $(DESTDIR)$(localstatedir)/lib/ipa/sysupgrade From 9d45b4095d4f945efe8bf08f3899d2f14d9b2542 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 | 13 +++++++++++++ install/ui/Makefile.am | 3 +++ 3 files changed, 16 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..36fcab0 100644 --- a/install/html/Makefile.am +++ b/install/html/Makefile.am @@ -16,3 +16,16 @@ 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) + RELATIVE_PATH=$$(python -c "import os.path; print(os.path.relpath('$(appdir)', '$(htmldatadir)'))"); \ + for FILE in $(app_DATA); do \ + $(LN_S) --force $${RELATIVE_PATH}/$${FILE} $(DESTDIR)$(htmldatadir)/$${FILE}; \ + done diff --git a/install/ui/Makefile.am b/install/ui/Makefile.am index 18fb9b4..1b8a590 100644 --- a/install/ui/Makefile.am +++ b/install/ui/Makefile.am @@ -34,3 +34,6 @@ MAINTAINERCLEANFILES = \ *~ \ Makefile.in $(NULL) + +install-data-hook: + $(INSTALL) -d -D -m 755 $(DESTDIR)$(appdir)/js/plugins From 0d4d9d79f8f8619a6fbeb118cebc24c9f8977e8e 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/freeipa.spec.in b/freeipa.spec.in index 45d2896..e57fdb1 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -702,6 +702,15 @@ 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) +# +# %install section of SPEC file should handle ONLY packaging specialities. +# All files and directories created by %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