From ae1c2086db3efb51341025ae25f9b39060868ac1 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Apr 03 2017 11:08:52 +0000 Subject: Add an option to build ipaserver wheels To create a wheel bundle with ipaserver and its dependencies: make wheel_bundle IPA_SERVER_WHEELS=1 To include additional dependencies: make wheel_bundle IPA_EXTRA_WHEELS=ipatests[webui] Signed-off-by: Christian Heimes Reviewed-By: Martin Basti Reviewed-By: Jan Cholasta --- diff --git a/Makefile.am b/Makefile.am index efa8b73..1989b19 100644 --- a/Makefile.am +++ b/Makefile.am @@ -256,6 +256,17 @@ endif # WITH_JSLINT WHEELDISTDIR = $(top_builddir)/dist/wheels WHEELBUNDLEDIR = $(top_builddir)/dist/bundle +@MK_IFEQ@ ($(IPA_SERVER_WHEELS),1) + IPA_WHEEL_PACKAGES @MK_ASSIGN@ $(IPACLIENT_SUBDIRS) ipaplatform ipaserver + IPA_OMIT_INSTALL @MK_ASSIGN@ 0 +@MK_ELSE@ + IPA_WHEEL_PACKAGES @MK_ASSIGN@ $(IPACLIENT_SUBDIRS) + IPA_OMIT_INSTALL @MK_ASSIGN@ 1 +@MK_ENDIF@ + +# additional wheels for bundle, e.g. IPA_EXTRA_WHEELS="ipatests[webui] pylint" +IPA_EXTRA_WHEELS= + $(WHEELDISTDIR): mkdir -p $(WHEELDISTDIR) @@ -263,19 +274,22 @@ $(WHEELBUNDLEDIR): mkdir -p $(WHEELBUNDLEDIR) bdist_wheel: $(WHEELDISTDIR) - for dir in $(IPACLIENT_SUBDIRS); do \ + rm -f $(foreach item,$(IPA_WHEEL_PACKAGES) ipatests,$(WHEELDISTDIR)/$(item)-*.whl) + export IPA_OMIT_INSTALL=$(IPA_OMIT_INSTALL); \ + for dir in $(IPA_WHEEL_PACKAGES) ipatests; do \ $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \ done wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel .wheelconstraints - rm -f $(foreach item,$(IPACLIENT_SUBDIRS),$(WHEELBUNDLEDIR)/$(item)-*.whl) - $(PYTHON) -m pip wheel \ + rm -f $(foreach item,$(IPA_WHEEL_PACKAGES) ipatests,$(WHEELBUNDLEDIR)/$(item)-*.whl) + @# dbus-python sometimes fails when MAKEFLAGS is set to -j2 or higher + MAKEFLAGS= $(PYTHON) -m pip wheel \ --disable-pip-version-check \ --constraint .wheelconstraints \ --find-links $(WHEELDISTDIR) \ --find-links $(WHEELBUNDLEDIR) \ --wheel-dir $(WHEELBUNDLEDIR) \ - $(IPACLIENT_SUBDIRS) + $(IPA_WHEEL_PACKAGES) $(IPA_EXTRA_WHEELS) wheel_placeholder: $(WHEELDISTDIR) for dir in $(IPA_PLACEHOLDERS); do \ diff --git a/configure.ac b/configure.ac index b006ccc..8f8751a 100644 --- a/configure.ac +++ b/configure.ac @@ -385,6 +385,12 @@ AC_SUBST([GIT_VERSION], [IPA_GIT_VERSION]) # used by Makefile.am for files depending on templates AC_SUBST([CONFIG_STATUS]) +# workaround for syntax clash between make and automake +AC_SUBST([MK_IFEQ], [ifeq]) +AC_SUBST([MK_ELSE], [else]) +AC_SUBST([MK_ENDIF], [endif]) +AC_SUBST([MK_ASSIGN], [=]) + dnl --------------------------------------------------------------------------- dnl Finish dnl --------------------------------------------------------------------------- diff --git a/freeipa.spec.in b/freeipa.spec.in index a6100ec..5214acd 100644 --- a/freeipa.spec.in +++ b/freeipa.spec.in @@ -146,6 +146,7 @@ BuildRequires: python-cffi # Build dependencies for wheel packaging and PyPI upload # %if 0%{with_wheels} +BuildRequires: dbus-glib-devel BuildRequires: python2-twine BuildRequires: python2-wheel %if 0%{?with_python3} diff --git a/ipaserver/plugins/hbactest.py b/ipaserver/plugins/hbactest.py index e156568..9c39b9a 100644 --- a/ipaserver/plugins/hbactest.py +++ b/ipaserver/plugins/hbactest.py @@ -34,7 +34,7 @@ import six try: import pyhbac except ImportError: - pyhbac = None + raise errors.SkipPluginModule(reason=_('pyhbac is not installed.')) if six.PY3: @@ -314,14 +314,6 @@ class hbactest(Command): return host def execute(self, *args, **options): - if pyhbac is None: - raise errors.ValidationError( - name=_('missing pyhbac'), - error=_( - 'pyhbac is not available on the server.' - ) - ) - # First receive all needed information: # 1. HBAC rules (whether enabled or disabled) # 2. Required options are (user, target host, service) diff --git a/ipaserver/setup.py b/ipaserver/setup.py index 227327b..097508f 100755 --- a/ipaserver/setup.py +++ b/ipaserver/setup.py @@ -71,7 +71,6 @@ if __name__ == '__main__': }, extras_require={ # These packages are currently not available on PyPI. - "caacl": ["pyhbac"], "dcerpc": ["samba", "pysss", "pysss_nss_idmap"], "hbactest": ["pyhbac"], "install": ["SSSDConfig"], diff --git a/ipasetup.py.in b/ipasetup.py.in index 0940f5f..b0a5051 100644 --- a/ipasetup.py.in +++ b/ipasetup.py.in @@ -29,7 +29,8 @@ class build_py(setuptools_build_py): def finalize_options(self): setuptools_build_py.finalize_options(self) - if 'bdist_wheel' in self.distribution.commands: + omit = os.environ.get('IPA_OMIT_INSTALL', '0') + if omit == '1': distname = self.distribution.metadata.name self.skip_package = '{}.install'.format(distname) log.warn("bdist_wheel: Ignore package: %s",