mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-24 15:16:40 -06:00
Build: replace ipaplatform magic with symlinks generated by configure
The original approach with __path__ implemented
by 8f98fa1bd5
broke Pylint:
We decided to resort back to symlinks as it is easiest solution
which does not break pylint in weird ways.
This commit introduces configure --with-ipaplatform option.
https://fedorahosted.org/freeipa/ticket/6418
Reviewed-By: Lukas Slebodnik <lslebodn@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
parent
c954d0e1ba
commit
c70a2873f8
5
.gitignore
vendored
5
.gitignore
vendored
@ -74,3 +74,8 @@ freeipa2-dev-doc
|
||||
!/ipapython/Makefile
|
||||
|
||||
/ipaplatform/__init__.py
|
||||
/ipaplatform/constants.py
|
||||
/ipaplatform/paths.py
|
||||
/ipaplatform/services.py
|
||||
/ipaplatform/tasks.py
|
||||
/ipaplatform/setup.py
|
||||
|
9
Makefile
9
Makefile
@ -13,8 +13,6 @@ PRJ_PREFIX=freeipa
|
||||
RPMBUILD ?= $(PWD)/rpmbuild
|
||||
TARGET ?= master
|
||||
|
||||
SUPPORTED_PLATFORM ?= fedora
|
||||
|
||||
IPA_NUM_VERSION ?= $(shell printf %d%02d%02d $(IPA_VERSION_MAJOR) $(IPA_VERSION_MINOR) $(IPA_VERSION_RELEASE))
|
||||
|
||||
# After updating the version in VERSION you should run the version-update
|
||||
@ -167,13 +165,6 @@ ipapython/version.py: ipapython/version.py.in FORCE
|
||||
ipasetup.py: ipasetup.py.in FORCE
|
||||
sed -e s/__VERSION__/$(IPA_VERSION)/ $< > $@
|
||||
|
||||
ipaplatform/__init__.py: ipaplatform/__init__.py.in FORCE
|
||||
if [ "$(SUPPORTED_PLATFORM)" != "" ]; then \
|
||||
sed -e s/__PLATFORM__/$(SUPPORTED_PLATFORM)/ \
|
||||
$< > $@; \
|
||||
rm -f ipaplatform/constants.py ipaplatform/paths.py ipaplatform/services.py ipaplatform/tasks.py ; \
|
||||
fi
|
||||
|
||||
.PHONY: egg_info
|
||||
egg_info: ipapython/version.py ipaplatform/__init__.py ipasetup.py
|
||||
for directory in $(PYPKGDIRS); do \
|
||||
|
35
configure.ac
35
configure.ac
@ -308,6 +308,35 @@ if test "x$MSGATTRIB" = "xno"; then
|
||||
AC_MSG_ERROR([msgattrib not found, install gettext])
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl IPA platform
|
||||
dnl ---------------------------------------------------------------------------
|
||||
AC_ARG_WITH([ipaplatform],
|
||||
[AC_HELP_STRING([--with-ipaplatform],
|
||||
[IPA platform module to use])],
|
||||
[IPAPLATFORM=${withval}],
|
||||
[IPAPLATFORM=""])
|
||||
AC_MSG_CHECKING([supported IPA platform])
|
||||
|
||||
if test "x${IPAPLATFORM}" == "x"; then
|
||||
if test -r "/etc/os-release"; then
|
||||
IPAPLATFORM=$(. /etc/os-release; echo "$ID")
|
||||
else
|
||||
AC_MSG_ERROR([unable to read /etc/os-release])
|
||||
fi
|
||||
if test "x${IPAPLATFORM}" == "x"; then
|
||||
AC_MSG_ERROR([unable to find ID variable in /etc/os-release])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test ! -d "ipaplatform/${IPAPLATFORM}"; then
|
||||
AC_MSG_ERROR([IPA platform ${IPAPLATFORM} is not supported])
|
||||
fi
|
||||
|
||||
AC_SUBST([IPAPLATFORM])
|
||||
AC_MSG_RESULT([${IPAPLATFORM}])
|
||||
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl Finish
|
||||
dnl ---------------------------------------------------------------------------
|
||||
@ -360,6 +389,12 @@ AC_SUBST(CPPFLAGS)
|
||||
AC_SUBST(LDFLAGS)
|
||||
|
||||
# Files
|
||||
AC_CONFIG_LINKS([ipaplatform/__init__.py:ipaplatform/$IPAPLATFORM/__init__.py
|
||||
ipaplatform/constants.py:ipaplatform/$IPAPLATFORM/constants.py
|
||||
ipaplatform/paths.py:ipaplatform/$IPAPLATFORM/paths.py
|
||||
ipaplatform/services.py:ipaplatform/$IPAPLATFORM/services.py
|
||||
ipaplatform/tasks.py:ipaplatform/$IPAPLATFORM/tasks.py
|
||||
])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
asn1/Makefile
|
||||
|
@ -24,11 +24,6 @@
|
||||
%global plugin_dir %{_libdir}/dirsrv/plugins
|
||||
%global etc_systemd_dir %{_sysconfdir}/systemd/system
|
||||
%global gettext_domain ipa
|
||||
%if 0%{?rhel}
|
||||
%global platform_module rhel
|
||||
%else
|
||||
%global platform_module fedora
|
||||
%endif
|
||||
|
||||
%define _hardened_build 1
|
||||
|
||||
@ -655,19 +650,8 @@ export JAVA_STACK_SIZE="8m"
|
||||
|
||||
export CFLAGS="%{optflags} $CFLAGS"
|
||||
export LDFLAGS="%{__global_ldflags} $LDFLAGS"
|
||||
export SUPPORTED_PLATFORM=%{platform_module}
|
||||
|
||||
# Force re-generate of platform support
|
||||
export IPA_VENDOR_VERSION_SUFFIX=-%{release}
|
||||
rm -f ipapython/version.py
|
||||
rm -f ipaplatform/services.py
|
||||
rm -f ipaplatform/tasks.py
|
||||
rm -f ipaplatform/paths.py
|
||||
rm -f ipaplatform/constants.py
|
||||
make LIBDIR=%{_libdir} version-update
|
||||
./autogen.sh --prefix=%{_usr} --sysconfdir=%{_sysconfdir} --localstatedir=%{_localstatedir} --libdir=%{_libdir} --mandir=%{_mandir}
|
||||
%if ! %{ONLY_CLIENT}
|
||||
%endif # ONLY_CLIENT
|
||||
|
||||
%if ! %{ONLY_CLIENT}
|
||||
make IPA_VERSION_IS_GIT_SNAPSHOT=no LIBDIR=%{_libdir} %{?_smp_mflags} all
|
||||
@ -686,14 +670,7 @@ make %{?_smp_mflags} client-check VERBOSE=yes LIBDIR=%{_libdir}
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
export SUPPORTED_PLATFORM=%{platform_module}
|
||||
# Force re-generate of platform support
|
||||
export IPA_VENDOR_VERSION_SUFFIX=-%{release}
|
||||
rm -f ipapython/version.py
|
||||
rm -f ipaplatform/services.py
|
||||
rm -f ipaplatform/tasks.py
|
||||
rm -f ipaplatform/paths.py
|
||||
rm -f ipaplatform/constants.py
|
||||
make version-update LIBDIR=%{_libdir}
|
||||
%if ! %{ONLY_CLIENT}
|
||||
make install DESTDIR=%{buildroot} LIBDIR=%{_libdir}
|
||||
|
@ -1,20 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2015 FreeIPA Contributors see COPYING for license
|
||||
#
|
||||
"""Module containing platform-specific functionality.
|
||||
|
||||
ipaplatform.constants
|
||||
ipaplatform.paths
|
||||
ipaplatform.services
|
||||
ipaplatform.tasks
|
||||
"""
|
||||
import os
|
||||
|
||||
|
||||
NAME = "__PLATFORM__"
|
||||
|
||||
# Create an alias for platform specific modulues, e.g.
|
||||
# 'import ipaplatform.paths' loads 'ipaplatform/NAME/paths.py'.
|
||||
|
||||
__path__.append(
|
||||
os.path.join(os.path.dirname(os.path.abspath(__file__)), NAME))
|
@ -483,10 +483,7 @@ class SystemdService(PlatformService):
|
||||
|
||||
# Objects below are expected to be exported by platform module
|
||||
|
||||
def base_service_class_factory(name):
|
||||
raise NotImplementedError
|
||||
|
||||
service = base_service_class_factory
|
||||
service = None
|
||||
knownservices = None
|
||||
|
||||
# System may support more time&date services. FreeIPA supports ntpd only, other
|
||||
|
@ -20,3 +20,4 @@
|
||||
'''
|
||||
This module contains Fedora specific platform files.
|
||||
'''
|
||||
NAME = 'fedora'
|
||||
|
@ -20,3 +20,4 @@
|
||||
'''
|
||||
This module contains RHEL-specific platform files.
|
||||
'''
|
||||
NAME = 'rhel'
|
||||
|
@ -58,7 +58,7 @@ from dns.exception import DNSException
|
||||
import pysss_nss_idmap
|
||||
import pysss
|
||||
import six
|
||||
from ipaplatform.paths import paths # pylint: disable=import-error
|
||||
from ipaplatform.paths import paths
|
||||
|
||||
from ldap.filter import escape_filter_chars
|
||||
from time import sleep
|
||||
|
@ -6,11 +6,9 @@ from __future__ import print_function
|
||||
|
||||
import copy
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
from astroid import MANAGER, register_module_extender
|
||||
from astroid import MANAGER
|
||||
from astroid import scoped_nodes
|
||||
from astroid.builder import AstroidBuilder
|
||||
|
||||
|
||||
def register(linter):
|
||||
@ -257,19 +255,3 @@ def fix_ipa_classes(cls):
|
||||
fake_class(cls, ipa_class_members[class_name_with_module])
|
||||
|
||||
MANAGER.register_transform(scoped_nodes.Class, fix_ipa_classes)
|
||||
|
||||
|
||||
def ipaplatform_transform():
|
||||
"""Module aliases for IpaPlatformImporter
|
||||
"""
|
||||
return AstroidBuilder(MANAGER).string_build(textwrap.dedent(
|
||||
"""
|
||||
from ipaplatform.base import constants
|
||||
from ipaplatform.base import paths
|
||||
from ipaplatform.base import services
|
||||
from ipaplatform.base import tasks
|
||||
"""
|
||||
))
|
||||
|
||||
|
||||
register_module_extender(MANAGER, 'ipaplatform', ipaplatform_transform)
|
||||
|
Loading…
Reference in New Issue
Block a user