URL: https://github.com/freeipa/freeipa/pull/268 Author: pspacek Title: #268: Build system must regenerate file when template changes Action: synchronized
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 51b1df22525f97e393cfa7ad63ea88886e268ac0 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/6] 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 8b8f556..c178b12 100644 --- a/configure.ac +++ b/configure.ac @@ -372,6 +372,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 @@ -506,7 +508,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 386b815d306c1b34df159574cd2c16991394fc26 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/6] 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 07e998c..c2826ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,6 +30,7 @@ EXTRA_DIST = .mailmap \ COPYING.openssl \ contrib \ doc \ + freeipa.spec.in \ pylintrc \ pytest.ini @@ -45,6 +46,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 @@ -85,7 +93,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 c178b12..9666997 100644 --- a/configure.ac +++ b/configure.ac @@ -508,7 +508,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 2a7578ccbeb0ce1c3e7d937716964e3cd1128e72 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/6] 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 --- Makefile.am | 8 ++++++-- configure.ac | 1 - install/ui/src/libs/Makefile.am | 9 +++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index c2826ae..ad0ccd3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -158,11 +158,15 @@ pylint: PYTHONPATH=$(top_srcdir) $(PYLINT) \ --rcfile=$(top_srcdir)/pylintrc $${FILES} -.PHONY: jslint jslint-ui jslint-ui-test jslint-html +.PHONY: jslint jslint-ui jslint-ui-test jslint-html \ + $(top_builddir)/install/ui/src/libs/loader.js jslint: jslint-ui jslint-ui-test jslint-html +$(top_builddir)/install/ui/src/libs/loader.js: + (cd $(top_builddir)/install/ui/src/libs && make loader.js) + # create temporary symlinks to allow jslint to find libs/loader.js -jslint-ui: +jslint-ui: $(top_builddir)/install/ui/src/libs/loader.js cd $(top_srcdir)/install/ui; \ $(MKDIR_P) js; \ rm -f js/libs; \ diff --git a/configure.ac b/configure.ac index 9666997..2712452 100644 --- a/configure.ac +++ b/configure.ac @@ -525,7 +525,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 f4519d8ee87155db41d6e2d65da71a5585be8263 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/6] 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 --- Makefile.am | 11 +++++++---- configure.ac | 1 - ipapython/Makefile.am | 13 +++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index ad0ccd3..56521e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -127,11 +127,11 @@ endif WITH_JSLINT lint: acilint apilint $(POLINT_TARGET) $(PYLINT_TARGET) $(JSLINT_TARGET) .PHONY: acilint -acilint: +acilint: $(top_builddir)/ipapython/version.py cd $(srcdir); ./makeaci --validate .PHONY: apilint -apilint: +apilint: $(top_builddir)/ipapython/version.py cd $(srcdir); ./makeapi --validate .PHONY: polint @@ -142,8 +142,11 @@ polint: # folders rpmbuild, freeipa-* and dist. Skip (match, but don't print) .*, # *.in, *~. Finally print all python files, including scripts that do not # have python extension. -.PHONY: pylint -pylint: +.PHONY: pylint $(top_builddir)/ipapython/version.py +$(top_builddir)/ipapython/version.py: + (cd $(top_builddir)/ipapython && make version.py) + +pylint: $(top_builddir)/ipapython/version.py FILES=`find $(top_srcdir) \ -type d -exec test -e '{}/__init__.py' \; -print -prune -o \ -path './rpmbuild' -prune -o \ diff --git a/configure.ac b/configure.ac index 2712452..bcc6281 100644 --- a/configure.ac +++ b/configure.ac @@ -539,7 +539,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 a00e7b132fe1e17cd86c9258e021b7ec3c5e46bc 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/6] 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 | 8 +++++++- Makefile.python.am | 15 ++++++++++----- configure.ac | 1 - 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 56521e4..f9922bb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,6 +21,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 \ @@ -31,6 +36,7 @@ EXTRA_DIST = .mailmap \ contrib \ doc \ freeipa.spec.in \ + ipasetup.py.in \ pylintrc \ pytest.ini @@ -146,7 +152,7 @@ polint: $(top_builddir)/ipapython/version.py: (cd $(top_builddir)/ipapython && make version.py) -pylint: $(top_builddir)/ipapython/version.py +pylint: $(top_builddir)/ipapython/version.py ipasetup.py FILES=`find $(top_srcdir) \ -type d -exec test -e '{}/__init__.py' \; -print -prune -o \ -path './rpmbuild' -prune -o \ 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 bcc6281..66e6e9b 100644 --- a/configure.ac +++ b/configure.ac @@ -540,7 +540,6 @@ AC_CONFIG_FILES([ ipaplatform/Makefile ipapython/Makefile ipaserver/Makefile - ipasetup.py ipatests/Makefile ipatests/man/Makefile po/Makefile.in From 1231c3e47bf0f89ddd7544b2514809b69dfef4f0 Mon Sep 17 00:00:00 2001 From: Petr Spacek <pspa...@redhat.com> Date: Thu, 24 Nov 2016 15:20:39 +0100 Subject: [PATCH 6/6] Build: properly integrate ipa.pot into build system tests i18n.py tests indirectly depend on existence on ipa.pot file. https://fedorahosted.org/freeipa/ticket/6498 --- po/Makefile.hack.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/Makefile.hack.in b/po/Makefile.hack.in index 2f2522b..90727c4 100644 --- a/po/Makefile.hack.in +++ b/po/Makefile.hack.in @@ -26,10 +26,10 @@ clean: mostlyclean test-gettext: $(DOMAIN).pot $(IPA_TEST_I18N) --test-gettext -validate-pot: +validate-pot: $(DOMAIN).pot $(IPA_TEST_I18N) --show-strings --validate-pot $(DOMAIN).pot -validate-po: +validate-po: $(DOMAIN).pot $(IPA_TEST_I18N) --show-strings --validate-po $(POFILES) # forcefully re-generate .pot file and test it
-- 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