[Freeipa-devel] [freeipa PR#226][synchronized] Build refactoring phase 5

2016-11-11 Thread pspacek
   URL: https://github.com/freeipa/freeipa/pull/226
Author: pspacek
 Title: #226: Build refactoring phase 5
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/226/head:pr226
git checkout pr226
From 426cb96d11776215fca9aea144482087e4bef244 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 15:42:30 +0100
Subject: [PATCH 1/7] Build: remove unused and redundant code from configure.ac
 and po/Makefile.in

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac   | 4 
 po/Makefile.in | 1 -
 2 files changed, 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e82c62..5646cb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,9 +17,6 @@ AC_HEADER_STDC
 
 AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
 
-AC_SUBST(VERSION)
-AC_SUBST([INSTALL_DATA], ['$(INSTALL) -m 644 -p'])
-
 dnl ---
 dnl - Check for NSPR/NSS
 dnl ---
@@ -359,7 +356,6 @@ AC_ARG_WITH([vendor-suffix],
 [VENDOR_SUFFIX=${withval}],
 	[VENDOR_SUFFIX=""])
 
-dnl TODO: IPA_VENDOR_RELEASE
 AC_SUBST([API_VERSION], [IPA_API_VERSION])
 AC_SUBST([DATA_VERSION], [IPA_DATA_VERSION])
 AC_SUBST([NUM_VERSION], [IPA_NUM_VERSION])
diff --git a/po/Makefile.in b/po/Makefile.in
index b42d8fc..0ab449c 100644
--- a/po/Makefile.in
+++ b/po/Makefile.in
@@ -5,7 +5,6 @@ datadir = ${datarootdir}
 localedir = ${datarootdir}/locale
 
 INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL@ -m 644
 AWK = @AWK@
 SED = @SED@
 MKDIR_P = @MKDIR_P@

From 30997f510be880339face8656343536705e5d359 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:15:19 +0100
Subject: [PATCH 2/7] Build: IPA_VERSION_IS_GIT_SNAPSHOT checks if source
 directory is Git repo

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index 5646cb0..1b672fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -350,6 +350,17 @@ AC_MSG_RESULT([${IPAPLATFORM}])
 dnl ---
 dnl Version information from VERSION.m4 and command line
 dnl ---
+dnl Are we in source tree?
+AM_CONDITIONAL([IS_GIT_SNAPSHOT], [test "IPA_VERSION_IS_GIT_SNAPSHOT" == "yes"])
+AM_COND_IF([IS_GIT_SNAPSHOT], [
+	AC_MSG_CHECKING([if source directory is a Git reposistory])
+	if test ! -d "${srcdir}/.git"; then
+		AC_MSG_ERROR([Git reposistory is required by VERSION.m4 IPA_VERSION_IS_GIT_SNAPSHOT but not found])
+	else
+		AC_MSG_RESULT([yes])
+	fi
+])
+
 AC_ARG_WITH([vendor-suffix],
 AS_HELP_STRING([--with-vendor-suffix=STRING],
 			   [Vendor string used by package system, e.g. "-1.fc24"]),

From 4ad2581cbbd97f180cc19af8f746df378a595284 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:21:51 +0100
Subject: [PATCH 3/7] Build: use POSIX 1003.1-1988 (ustar) file format for tar
 archives

Default format used by Autotools limits length of paths to
99 characters. This is not enough for tarballs with Git snapshots.

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1b672fb..53d5dab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_INIT([freeipa],
 
 AC_CONFIG_HEADERS([config.h])
 
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([foreign 1.9 tar-ustar])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
 
 AC_PROG_CC_C99

From 535bb2c18bc2b977d3b836743e88a8f6d80654c4 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:16:45 +0100
Subject: [PATCH 4/7] Build: IPA_VERSION_IS_GIT_SNAPSHOT re-generates version
 number on RPM build

This is a huge hack. rpms target will touch VERSION.m4 file. This change
is then detected by automake Makefiles which subsequently re-execute configure
and make.

We have to workaround fact that variables in new make targets
(executed after new configure) are different than original ones.

Also, we have to 'bake-in' precise snapshot version from Git to
VERSION.m4 inside of RPM tarball so the RPM does not depend on git
anymore.

All this magic slows build down a bit.
Do not enable IPA_VERSION_IS_GIT_SNAPSHOT if you want fastest possible builds.

The option IPA_VERSION_IS_GIT_SNAPSHOT is now enabled by default as it
was before we started the build system refactoring effort.

https://fedorahosted.org/freeipa/ticket/6418
---
 .gitignore   |  2 ++
 Makefile.am  | 51 +--
 VERSION.m4   | 24 ++--
 configure.ac |  1 +
 4 files changed, 62 insertions(+), 16 deletions(-)

diff --git a/.gitignore 

[Freeipa-devel] [freeipa PR#226][synchronized] Build refactoring phase 5

2016-11-10 Thread pspacek
   URL: https://github.com/freeipa/freeipa/pull/226
Author: pspacek
 Title: #226: Build refactoring phase 5
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/226/head:pr226
git checkout pr226
From 74b3f612e34cea48c66cfb536a7ff9da18442f30 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 15:42:30 +0100
Subject: [PATCH 1/7] Build: remove unused and redundant code from configure.ac
 and po/Makefile.in

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac   | 4 
 po/Makefile.in | 1 -
 2 files changed, 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e82c62..5646cb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,9 +17,6 @@ AC_HEADER_STDC
 
 AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
 
-AC_SUBST(VERSION)
-AC_SUBST([INSTALL_DATA], ['$(INSTALL) -m 644 -p'])
-
 dnl ---
 dnl - Check for NSPR/NSS
 dnl ---
@@ -359,7 +356,6 @@ AC_ARG_WITH([vendor-suffix],
 [VENDOR_SUFFIX=${withval}],
 	[VENDOR_SUFFIX=""])
 
-dnl TODO: IPA_VENDOR_RELEASE
 AC_SUBST([API_VERSION], [IPA_API_VERSION])
 AC_SUBST([DATA_VERSION], [IPA_DATA_VERSION])
 AC_SUBST([NUM_VERSION], [IPA_NUM_VERSION])
diff --git a/po/Makefile.in b/po/Makefile.in
index b42d8fc..0ab449c 100644
--- a/po/Makefile.in
+++ b/po/Makefile.in
@@ -5,7 +5,6 @@ datadir = ${datarootdir}
 localedir = ${datarootdir}/locale
 
 INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL@ -m 644
 AWK = @AWK@
 SED = @SED@
 MKDIR_P = @MKDIR_P@

From 14fc15929512ee5e3554c1b397e8845d59de839e Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:15:19 +0100
Subject: [PATCH 2/7] Build: IPA_VERSION_IS_GIT_SNAPSHOT checks if source
 directory is Git repo

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index 5646cb0..1b672fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -350,6 +350,17 @@ AC_MSG_RESULT([${IPAPLATFORM}])
 dnl ---
 dnl Version information from VERSION.m4 and command line
 dnl ---
+dnl Are we in source tree?
+AM_CONDITIONAL([IS_GIT_SNAPSHOT], [test "IPA_VERSION_IS_GIT_SNAPSHOT" == "yes"])
+AM_COND_IF([IS_GIT_SNAPSHOT], [
+	AC_MSG_CHECKING([if source directory is a Git reposistory])
+	if test ! -d "${srcdir}/.git"; then
+		AC_MSG_ERROR([Git reposistory is required by VERSION.m4 IPA_VERSION_IS_GIT_SNAPSHOT but not found])
+	else
+		AC_MSG_RESULT([yes])
+	fi
+])
+
 AC_ARG_WITH([vendor-suffix],
 AS_HELP_STRING([--with-vendor-suffix=STRING],
 			   [Vendor string used by package system, e.g. "-1.fc24"]),

From 65dda782d50191b85979668294b79d409f77bbb0 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:21:51 +0100
Subject: [PATCH 3/7] Build: use POSIX 1003.1-1988 (ustar) file format for tar
 archives

Default format used by Autotools limits length of paths to
99 characters. This is not enough for tarballs with Git snapshots.

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1b672fb..53d5dab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_INIT([freeipa],
 
 AC_CONFIG_HEADERS([config.h])
 
-AM_INIT_AUTOMAKE([foreign])
+AM_INIT_AUTOMAKE([foreign 1.9 tar-ustar])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
 
 AC_PROG_CC_C99

From 424f3505a55e28d0045f3ef35b64caad84da81e4 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:16:45 +0100
Subject: [PATCH 4/7] Build: IPA_VERSION_IS_GIT_SNAPSHOT re-generates version
 number on RPM build

This is a huge hack. rpms target will touch VERSION.m4 file. This change
is then detected by automake Makefiles which subsequently re-execute configure
and make.

We have to workaround fact that variables in new make targets
(executed after new configure) are different than original ones.

Also, we have to 'bake-in' precise snapshot version from Git to
VERSION.m4 inside of RPM tarball so the RPM does not depend on git
anymore.

All this magic slows build down.
If you want quick builds, do not enable IPA_VERSION_IS_GIT_SNAPSHOT.

https://fedorahosted.org/freeipa/ticket/6418
---
 .gitignore   |  2 ++
 Makefile.am  | 46 ++
 VERSION.m4   | 22 +-
 configure.ac |  1 +
 4 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index e1a42d6..de61aff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,8 @@ build/
 compile
 test-driver
 freeipa-*.tar.gz
+.tarball_name

[Freeipa-devel] [freeipa PR#226][synchronized] Build refactoring phase 5

2016-11-10 Thread pspacek
   URL: https://github.com/freeipa/freeipa/pull/226
Author: pspacek
 Title: #226: Build refactoring phase 5
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/226/head:pr226
git checkout pr226
From 212d059cc208a1bba32255867c6d7b8deaad8b6c Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 13:34:04 +0100
Subject: [PATCH 1/8] Build: fix make clean to remove build artifacts from
 top-level directory

make lint and make dist were generating files which were not removed by
make clean.

https://fedorahosted.org/freeipa/ticket/6418
---
 Makefile.am | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index ffa5de2..031aef4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,11 @@
 SUBDIRS = asn1 util client contrib daemons init install ipaclient ipalib ipaplatform ipapython ipaserver ipatests po
 
-MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo
+MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo \
+		   ignore_import_errors.pyc ignore_import_errors.pyo \
+		   ipasetup.pyc ipasetup.pyo \
+		   lite-server.pyc lite-server.pyo \
+		   pylint_plugins.pyc pylint_plugins.pyo \
+		   $(TARBALL)
 
 # user-facing scripts
 dist_bin_SCRIPTS = ipa
@@ -25,6 +30,11 @@ EXTRA_DIST = .mailmap \
 	 pylintrc \
 	 pytest.ini
 
+clean-local:
+	rm -rf "$(RPMBUILD)"
+	rm -rf "$(top_builddir)/dist"
+	rm -rf "$(top_srcdir)/__pycache__"
+
 # convenience targets for RPM build
 RPMBUILD ?= $(abs_builddir)/rpmbuild
 TARBALL = $(PACKAGE)-$(VERSION).tar.gz

From cb2084eba47bc7608375c2060716a2a8fbf06c29 Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 15:42:30 +0100
Subject: [PATCH 2/8] Build: remove unused and redundant code from configure.ac
 and po/Makefile.in

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac   | 4 
 po/Makefile.in | 1 -
 2 files changed, 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6e82c62..5646cb0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,9 +17,6 @@ AC_HEADER_STDC
 
 AM_CONDITIONAL([HAVE_GCC], [test "$ac_cv_prog_gcc" = yes])
 
-AC_SUBST(VERSION)
-AC_SUBST([INSTALL_DATA], ['$(INSTALL) -m 644 -p'])
-
 dnl ---
 dnl - Check for NSPR/NSS
 dnl ---
@@ -359,7 +356,6 @@ AC_ARG_WITH([vendor-suffix],
 [VENDOR_SUFFIX=${withval}],
 	[VENDOR_SUFFIX=""])
 
-dnl TODO: IPA_VENDOR_RELEASE
 AC_SUBST([API_VERSION], [IPA_API_VERSION])
 AC_SUBST([DATA_VERSION], [IPA_DATA_VERSION])
 AC_SUBST([NUM_VERSION], [IPA_NUM_VERSION])
diff --git a/po/Makefile.in b/po/Makefile.in
index b42d8fc..0ab449c 100644
--- a/po/Makefile.in
+++ b/po/Makefile.in
@@ -5,7 +5,6 @@ datadir = ${datarootdir}
 localedir = ${datarootdir}/locale
 
 INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL@ -m 644
 AWK = @AWK@
 SED = @SED@
 MKDIR_P = @MKDIR_P@

From 3347f58b656b86a5a22150fd8198d831867d5bbc Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:15:19 +0100
Subject: [PATCH 3/8] Build: IPA_VERSION_IS_GIT_SNAPSHOT checks if source
 directory is Git repo

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index 5646cb0..1b672fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -350,6 +350,17 @@ AC_MSG_RESULT([${IPAPLATFORM}])
 dnl ---
 dnl Version information from VERSION.m4 and command line
 dnl ---
+dnl Are we in source tree?
+AM_CONDITIONAL([IS_GIT_SNAPSHOT], [test "IPA_VERSION_IS_GIT_SNAPSHOT" == "yes"])
+AM_COND_IF([IS_GIT_SNAPSHOT], [
+	AC_MSG_CHECKING([if source directory is a Git reposistory])
+	if test ! -d "${srcdir}/.git"; then
+		AC_MSG_ERROR([Git reposistory is required by VERSION.m4 IPA_VERSION_IS_GIT_SNAPSHOT but not found])
+	else
+		AC_MSG_RESULT([yes])
+	fi
+])
+
 AC_ARG_WITH([vendor-suffix],
 AS_HELP_STRING([--with-vendor-suffix=STRING],
 			   [Vendor string used by package system, e.g. "-1.fc24"]),

From e21452024c91dacfa5ea9aa6e1e9a5b56710cc0b Mon Sep 17 00:00:00 2001
From: Petr Spacek 
Date: Wed, 9 Nov 2016 16:21:51 +0100
Subject: [PATCH 4/8] Build: use POSIX 1003.1-1988 (ustar) file format for tar
 archives

Default format used by Autotools limits length of paths to
99 characters. This is not enough for tarballs with Git snapshots.

https://fedorahosted.org/freeipa/ticket/6418
---
 configure.ac | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1b672fb..53d5dab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_INIT([freeipa],
 
 AC_CONFIG_HEADERS([config.h])