URL: https://github.com/freeipa/freeipa/pull/268 Author: pspacek Title: #268: Build system must regenerate file when template changes Action: opened
PR body: """ Proper fix for https://fedorahosted.org/freeipa/ticket/6498. This PR obsoletes #251. """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/268/head:pr268 git checkout pr268
From 382a98ba7fbb76aac88b9c64373051f015f3e454 Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Tue, 22 Nov 2016 12:32:27 +0100 Subject: [PATCH 1/5] Build: properly integrate ipa-version.h.in into build system AC_CONFIG_FILES in configure.ac works well only with Makefiles. Other files have to be handled by Makefile.am so depedencies are tracked properly. https://fedorahosted.org/freeipa/ticket/6498 --- configure.ac | 3 ++- daemons/Makefile.am | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b042455..b3d500b 100644 --- a/configure.ac +++ b/configure.ac @@ -373,6 +373,8 @@ AC_SUBST([NUM_VERSION], [IPA_NUM_VERSION]) AC_SUBST(VENDOR_SUFFIX) AC_SUBST([VERSION], [IPA_VERSION]) AC_SUBST([GIT_VERSION], [IPA_GIT_VERSION]) +# used by Makefile.am for files depending on templates +AC_SUBST([CONFIG_STATUS]) dnl --------------------------------------------------------------------------- dnl Finish @@ -507,7 +509,6 @@ AC_CONFIG_FILES([ daemons/ipa-slapi-plugins/ipa-sidgen/Makefile daemons/ipa-slapi-plugins/ipa-range-check/Makefile daemons/ipa-slapi-plugins/topology/Makefile - daemons/ipa-version.h freeipa.spec init/systemd/Makefile init/tmpfilesd/Makefile diff --git a/daemons/Makefile.am b/daemons/Makefile.am index a3d4d1d..2967917 100644 --- a/daemons/Makefile.am +++ b/daemons/Makefile.am @@ -12,10 +12,21 @@ if HAVE_GCC endif export AM_CFLAGS +nodist_noinst_HEADERS = ipa-version.h +noinst_HEADERS = ipa-version.h.in + SUBDIRS = \ + . \ dnssec \ ipa-kdb \ ipa-slapi-plugins \ ipa-sam \ ipa-otpd \ $(NULL) + +ipa-version.h: ipa-version.h.in $(top_builddir)/$(CONFIG_STATUS) + $(AM_V_GEN)sed \ + -e 's|@DATA_VERSION[@]|$(DATA_VERSION)|g' \ + -e 's|@NUM_VERSION[@]|$(NUM_VERSION)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + $< > $@ From d814c408e33f2137c125b6f8bb2a4ed19b81ddc9 Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Tue, 22 Nov 2016 15:45:53 +0100 Subject: [PATCH 2/5] Build: properly integrate freeipa.spec.in into build system AC_CONFIG_FILES in configure.ac works well only with Makefiles. Other files have to be handled by Makefile.am so depedencies are tracked properly. https://fedorahosted.org/freeipa/ticket/6498 --- Makefile.am | 10 +++++++++- configure.ac | 1 - 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8c0c494..424300b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -27,6 +27,7 @@ EXTRA_DIST = .mailmap \ COPYING.openssl \ contrib \ doc \ + freeipa.spec.in \ pylintrc \ pytest.ini @@ -42,6 +43,13 @@ clean-local: rpms _rpms-body srpms _srpms-body RPMBUILD ?= $(abs_builddir)/rpmbuild TARBALL = $(PACKAGE)-$(VERSION).tar.gz + +freeipa.spec: freeipa.spec.in $(top_builddir)/$(CONFIG_STATUS) + $(AM_V_GEN)sed \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + -e 's|@VENDOR_SUFFIX[@]|$(VENDOR_SUFFIX)|g' \ + $< > $@ + rpmroot: mkdir -p $(RPMBUILD)/BUILD mkdir -p $(RPMBUILD)/RPMS @@ -82,7 +90,7 @@ dist-hook: $(VERSION_BAKEIN_TARGET) echo "$(TARBALL)" > $(top_builddir)/.tarball_name echo "$(VERSION)" > $(top_builddir)/.version -_rpms-prep: dist-gzip rpmroot rpmdistdir +_rpms-prep: dist-gzip rpmroot rpmdistdir freeipa.spec cp $(top_builddir)/$$(cat $(top_builddir)/.tarball_name) $(RPMBUILD)/SOURCES/ rm -f $(top_builddir)/.tarball_name diff --git a/configure.ac b/configure.ac index b3d500b..31703ee 100644 --- a/configure.ac +++ b/configure.ac @@ -509,7 +509,6 @@ AC_CONFIG_FILES([ daemons/ipa-slapi-plugins/ipa-sidgen/Makefile daemons/ipa-slapi-plugins/ipa-range-check/Makefile daemons/ipa-slapi-plugins/topology/Makefile - freeipa.spec init/systemd/Makefile init/tmpfilesd/Makefile init/Makefile From be2694a376945701faacb36ce631f60ad2bc496e Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Tue, 22 Nov 2016 16:07:32 +0100 Subject: [PATCH 3/5] Build: properly integrate loader.js into build system AC_CONFIG_FILES in configure.ac works well only with Makefiles. Other files have to be handled by Makefile.am so depedencies are tracked properly. https://fedorahosted.org/freeipa/ticket/6498 --- configure.ac | 1 - install/ui/src/libs/Makefile.am | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 31703ee..568b347 100644 --- a/configure.ac +++ b/configure.ac @@ -526,7 +526,6 @@ AC_CONFIG_FILES([ install/ui/css/Makefile install/ui/src/Makefile install/ui/src/libs/Makefile - install/ui/src/libs/loader.js install/ui/images/Makefile install/ui/build/Makefile install/ui/build/dojo/Makefile diff --git a/install/ui/src/libs/Makefile.am b/install/ui/src/libs/Makefile.am index f5a9e0e..1ee201b 100644 --- a/install/ui/src/libs/Makefile.am +++ b/install/ui/src/libs/Makefile.am @@ -16,6 +16,15 @@ app_DATA = \ nodist_app_DATA = \ loader.js +dist_noinst_DATA = \ + loader.js.in + EXTRA_DIST = \ $(app_DATA) \ $(NULL) + +loader.js: loader.js.in $(top_builddir)/$(CONFIG_STATUS) + $(AM_V_GEN)sed \ + -e 's|@API_VERSION[@]|$(API_VERSION)|g' \ + -e 's|@NUM_VERSION[@]|$(NUM_VERSION)|g' \ + $< > $@ From e20012f52219d1ff45620588d9bb5de589b69cc9 Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Tue, 22 Nov 2016 17:00:04 +0100 Subject: [PATCH 4/5] Build: properly integrate version.py into build system AC_CONFIG_FILES in configure.ac works well only with Makefiles. Other files have to be handled by Makefile.am so depedencies are tracked properly. https://fedorahosted.org/freeipa/ticket/6498 --- configure.ac | 1 - ipapython/Makefile.am | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 568b347..74564e8 100644 --- a/configure.ac +++ b/configure.ac @@ -540,7 +540,6 @@ AC_CONFIG_FILES([ ipalib/Makefile ipaplatform/Makefile ipapython/Makefile - ipapython/version.py ipaserver/Makefile ipasetup.py ipatests/Makefile diff --git a/ipapython/Makefile.am b/ipapython/Makefile.am index 8be72b2..bf2538a 100644 --- a/ipapython/Makefile.am +++ b/ipapython/Makefile.am @@ -1 +1,14 @@ include $(top_srcdir)/Makefile.python.am + +EXTRA_DIST = version.py.in + +all-local: version.py +dist-hook: version.py + +version.py: version.py.in $(top_builddir)/$(CONFIG_STATUS) + $(AM_V_GEN)sed \ + -e 's|@API_VERSION[@]|$(API_VERSION)|g' \ + -e 's|@NUM_VERSION[@]|$(NUM_VERSION)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + -e 's|@VENDOR_SUFFIX[@]|$(VENDOR_SUFFIX)|g' \ + $< > $@ From 6bf003f63d8a874d9d7573738580dbdb4ad437de Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Wed, 23 Nov 2016 14:59:57 +0100 Subject: [PATCH 5/5] Build: properly integrate ipasetup.py into build system AC_CONFIG_FILES in configure.ac works well only with Makefiles. Other files have to be handled by Makefile.am so depedencies are tracked properly. There is a problem that Python sub-directories depend on ipasetup.py which is one level above the sub-directory. This means that depedencies are the other way around that expected. This is being worked around using hack from http://lists.gnu.org/archive/html/automake/2009-03/msg00011.html https://fedorahosted.org/freeipa/ticket/6498 --- Makefile.am | 6 ++++++ Makefile.python.am | 15 ++++++++++----- configure.ac | 1 - 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 424300b..00a9a15 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,11 @@ dist_noinst_SCRIPTS = ignore_import_errors.py \ make-test \ pylint_plugins.py +ipasetup.py: ipasetup.py.in $(CONFIG_STATUS) + $(AM_V_GEN)sed \ + -e 's|@VERSION[@]|$(VERSION)|g' \ + $< > $@ + EXTRA_DIST = .mailmap \ ACI.txt \ API.txt \ @@ -28,6 +33,7 @@ EXTRA_DIST = .mailmap \ contrib \ doc \ freeipa.spec.in \ + ipasetup.py.in \ pylintrc \ pytest.ini diff --git a/Makefile.python.am b/Makefile.python.am index 2d62853..665893f 100644 --- a/Makefile.python.am +++ b/Makefile.python.am @@ -7,13 +7,18 @@ else VERBOSITY="--quiet" endif !VERBOSE_MAKE -all-local: +# hack to handle back-in-the-hierarchy depedency on ipasetup.py +.PHONY: $(top_builddir)/ipasetup.py +$(top_builddir)/ipasetup.py: + (cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ipasetup.py) + +all-local: $(top_builddir)/ipasetup.py cd $(srcdir); $(PYTHON) setup.py \ $(VERBOSITY) \ build \ --build-base "$(abs_builddir)/build" -install-exec-local: +install-exec-local: $(top_builddir)/ipasetup.py $(PYTHON) $(srcdir)/setup.py \ $(VERBOSITY) \ install \ @@ -26,7 +31,7 @@ uninstall-local: cat "$(DESTDIR)$(pkgpythondir)/install_files.txt" | xargs rm -rf rm -rf "$(DESTDIR)$(pkgpythondir)" -clean-local: +clean-local: $(top_builddir)/ipasetup.py $(PYTHON) "$(srcdir)/setup.py" clean --all rm -rf "$(srcdir)/build" "$(srcdir)/dist" "$(srcdir)/MANIFEST" find "$(srcdir)" \ @@ -36,7 +41,7 @@ clean-local: # take list of all Python source files and copy them into distdir # SOURCES.txt does not contain directories so we need to create those -dist-hook: +dist-hook: $(top_builddir)/ipasetup.py $(PYTHON) "$(srcdir)/setup.py" egg_info PYTHON_SOURCES=$$(cat "$(srcdir)/$(pkgname).egg-info/SOURCES.txt") || exit $$?; \ for FILEN in $${PYTHON_SOURCES}; \ @@ -47,6 +52,6 @@ dist-hook: WHEELDISTDIR = $(top_builddir)/dist/wheels .PHONY: bdist_wheel -bdist_wheel: +bdist_wheel: $(top_builddir)/ipasetup.py rm -rf $(WHEELDISTDIR)/$(pkgname)*.whl $(PYTHON) "$(srcdir)/setup.py" bdist_wheel --dist-dir=$(WHEELDISTDIR) diff --git a/configure.ac b/configure.ac index 74564e8..710dedd 100644 --- a/configure.ac +++ b/configure.ac @@ -541,7 +541,6 @@ AC_CONFIG_FILES([ ipaplatform/Makefile ipapython/Makefile ipaserver/Makefile - ipasetup.py ipatests/Makefile ipatests/man/Makefile po/Makefile
-- 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