From 26ffea11803bc151a56b79229200d637bb120602 Mon Sep 17 00:00:00 2001 From: William Brown Date: Wed, 11 Oct 2017 22:20:35 +1000 Subject: [PATCH] Ticket 49363 - Merge lib389 Bug Description: The issue is that we have a split: we have tests in 389-ds-base/dirsrvtests that are often version dependent. They relate to features of the server, or issues in specific versions of the server that may not exist in older versions. Today we kind of stradle the line of "it's a bit of both". We have tests in 389-ds-base that depend on versions of lib389 - but lib389 moves quickly and has little ability to distinguish 389-ds-base versions. Fix Description: Merge lib389 source code and update related build components. https://pagure.io/389-ds-base/issue/49363 Author: wibrown Review by: ??? --- Makefile.am | 17 ++++++--- rpm/389-ds-base.spec.in | 94 +++++++++++++++++++++++++------------------------ src/lib389/setup.py | 8 +++-- 3 files changed, 66 insertions(+), 53 deletions(-) diff --git a/Makefile.am b/Makefile.am index c491fd9..b71a8f3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,7 @@ QUOTE := $(NULLSTRING)"# a double quote" # First, we setup the definitions from configure.ac # +PYTHON := python3 BUILDNUM := $(shell perl $(srcdir)/buildnum.pl) NQBUILDNUM := $(subst \,,$(subst $(QUOTE),,$(BUILDNUM))) DEBUG_DEFINES = @debug_defs@ @@ -581,7 +582,9 @@ dist_noinst_DATA = \ $(srcdir)/setup.py.in \ $(srcdir)/wrappers/*.in \ $(srcdir)/wrappers/systemd.template.sysconfig \ - $(srcdir)/dirsrvtests + $(srcdir)/dirsrvtests \ + $(srcdir)/src/lib389/setup.py \ + $(srcdir)/src/lib389 if ENABLE_PERL dist_noinst_DATA += \ @@ -2211,11 +2214,17 @@ git-archive: # Python test tests # How will we update this to python 3? -tests: setup.py.in - python setup.py build +lib389: src/lib389/setup.py + cd $(srcdir)/src/lib389; $(PYTHON) setup.py build + +lib389-install: lib389 + cd $(srcdir)/src/lib389; $(PYTHON) setup.py install --skip-build + +tests: setup.py.in lib389 + $(PYTHON) setup.py build tests-install: tests - python setup.py install + $(PYTHON) setup.py install # RPM-related tasks diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in index 30a1d7d..b4c863a 100644 --- a/rpm/389-ds-base.spec.in +++ b/rpm/389-ds-base.spec.in @@ -85,6 +85,10 @@ BuildRequires: doxygen # For tests! BuildRequires: libcmocka-devel BuildRequires: libevent-devel +# For lib389 and related components. +BuildRequires: python%{python3_pkgversion} +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools %if %{use_tcmalloc} BuildRequires: gperftools-devel @@ -206,46 +210,35 @@ Obsoletes: %{name} <= 1.3.5.4 SNMP Agent for the 389 Directory Server base package. - - -%package -n python2-%{srcname}-tests -Summary: The lib389 Continuous Integration Tests -Group: Development/Libraries +%package -n python%{python3_pkgversion}-lib389 +Summary: A library for accessing, testing, and configuring the 389 Directory Server BuildArch: noarch -Requires: python2-lib389 -%if 0%{?rhel} -Requires: python -BuildRequires: python -BuildRequires: python-devel -BuildRequires: python-setuptools -%else -Requires: python2 -BuildRequires: python2 -BuildRequires: python2-devel -BuildRequires: python2-setuptools -%endif - -%description -n python2-%{srcname}-tests -The lib389 CI tests that can be run against the Directory Server. - - +Group: Development/Libraries +Requires: krb5-workstation +Requires: krb5-server +Requires: openssl +Requires: iproute +Requires: python%{python3_pkgversion} +Requires: python%{python3_pkgversion}-pytest +Requires: python%{python3_pkgversion}-pyldap +Requires: python%{python3_pkgversion}-six +Requires: python%{python3_pkgversion}-pyasn1 +Requires: python%{python3_pkgversion}-pyasn1-modules +Requires: python%{python3_pkgversion}-dateutil +%{?python_provide:%python_provide python%{python3_pkgversion}-lib389} +%description -n python%{python3_pkgversion}-lib389 +This module contains tools and libraries for accessing, testing, + and configuring the 389 Directory Server. -# Can't build on EL7! Python3 tooling is too broken :( -# We have to use >= 8, because <= 7 doesn't work .... -%if 0%{?rhel} >= 8 || 0%{?fedora} %package -n python%{python3_pkgversion}-%{srcname}-tests Summary: The lib389 Continuous Integration Tests Group: Development/Libraries BuildArch: noarch Requires: python%{python3_pkgversion} Requires: python%{python3_pkgversion}-lib389 -BuildRequires: python%{python3_pkgversion} -BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-setuptools %description -n python%{python3_pkgversion}-%{srcname}-tests The lib389 CI tests that can be run against the Directory Server. -%endif %prep %setup -q -n %{name}-%{version}%{?prerel} @@ -277,20 +270,22 @@ autoreconf -fiv $NSSARGS $TCMALLOC_FLAGS $ASAN_FLAGS \ --enable-cmocka +make setup.py + +# lib389 +pushd ./src/lib389 +%py3_build +popd + +# tests +%py3_build + + # Generate symbolic info for debuggers export XCFLAGS=$RPM_OPT_FLAGS make %{?_smp_mflags} -make setup.py - -%if 0%{?rhel} >= 8 || 0%{?fedora} -%py2_build -%py3_build -%else -%{__python} setup.py build -%endif - %install rm -rf $RPM_BUILD_ROOT @@ -300,12 +295,13 @@ make DESTDIR="$RPM_BUILD_ROOT" install # Copy in our docs from doxygen. cp -r %{_builddir}/%{name}-%{version}%{?prerel}/man/man3 $RPM_BUILD_ROOT/%{_mandir}/man3 -%if 0%{?rhel} >= 8 || 0%{?fedora} -%py2_install +# lib389 +pushd src/lib389 +%py3_install +popd + +# tests %py3_install -%else -%{__python} setup.py install -O1 --skip-build --root %{buildroot} -%endif mkdir -p $RPM_BUILD_ROOT/var/log/%{pkgname} mkdir -p $RPM_BUILD_ROOT/var/lib/%{pkgname} @@ -535,16 +531,22 @@ fi %{_mandir}/man1/ldap-agent.1.gz %{_unitdir}/%{pkgname}-snmp.service -%files -n python2-%{srcname}-tests +%if 0%{?rhel} >= 8 || 0%{?fedora} +%files -n python%{python3_pkgversion}-lib389 %defattr(-,root,root,-) %doc LICENSE LICENSE.GPLv3+ -%{python2_sitelib}/* +%{_sbindir}/dsconf +%{_sbindir}/dscreate +%{_sbindir}/dsctl +%{_sbindir}/dsidm +%{python3_sitelib}/lib389* +%endif %if 0%{?rhel} >= 8 || 0%{?fedora} %files -n python%{python3_pkgversion}-%{srcname}-tests %defattr(-,root,root,-) %doc LICENSE LICENSE.GPLv3+ -%{python3_sitelib}/* +%{python3_sitelib}/dirsrvtests* %endif %changelog diff --git a/src/lib389/setup.py b/src/lib389/setup.py index b3c41c6..2053c98 100644 --- a/src/lib389/setup.py +++ b/src/lib389/setup.py @@ -18,8 +18,10 @@ from os import path here = path.abspath(path.dirname(__file__)) # fedora/rhel versioning or PEP440?; ATM semantic versioning -with open(path.join(here, 'VERSION'), 'r') as version_file: - version = version_file.read().strip() +# with open(path.join(here, 'VERSION'), 'r') as version_file: +# version = version_file.read().strip() + +version = "1.4.0.1" with open(path.join(here, 'README.md'), 'r') as f: long_description = f.read() @@ -60,5 +62,5 @@ setup( ]), ], - install_requires=['python-ldap'], + install_requires=['pyldap'], ) -- 1.8.3.1