From ac54e069ceb2d928805d877659aa0b4e7b10da88 Mon Sep 17 00:00:00 2001 From: Viktor Ashirov Date: Jun 04 2020 23:58:49 +0000 Subject: Issue 50781 - Make building cockpit plugin optional Bug Description: Currently building 389-ds involves building cockpit-389-ds too, which is not always desired. Fix Description: Introduce a new configure parameter --enable-cockpit, which is on by default. Fixes: https://pagure.io/389-ds-base/issue/50781 Doc impact: no Reviewed by: ??? --- diff --git a/Makefile.am b/Makefile.am index b6b42d9..826efb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -778,6 +778,7 @@ if SYSTEMD libexec_SCRIPTS += wrappers/ds_systemd_ask_password_acl endif +if ENABLE_COCKPIT install-data-hook: if [ "$(srcdir)" != "." ]; then cp -r $(srcdir)/src/cockpit src ; fi mkdir -p src/cockpit/389-console/cockpit_dist/ @@ -785,6 +786,7 @@ install-data-hook: rsync -rupE src/cockpit/389-console/cockpit_dist/ $(DESTDIR)$(cockpitdir) mkdir -p $(DESTDIR)$(metainfodir) rsync -up src/cockpit/389-console/org.port389.cockpit_console.metainfo.xml $(DESTDIR)$(metainfodir)/org.port389.cockpit_console.metainfo.xml +endif sbin_SCRIPTS = if ENABLE_PERL @@ -2545,6 +2547,8 @@ lib389: src/lib389/setup.py lib389-install: lib389 cd $(srcdir)/src/lib389; $(PYTHON) setup.py install --skip-build --force +if ENABLE_COCKPIT + NODE_MODULES_TEST = src/cockpit/389-console/node_modules/webpack WEBPACK_TEST = src/cockpit/389-console/cockpit_dist/index.html @@ -2568,6 +2572,7 @@ $(WEBPACK_TEST): $(NODE_MODULES_TEST) 389-console-clean: cd $(srcdir)/src/cockpit/389-console; make -f node_modules.mk clean +endif if HAVE_DOXYGEN diff --git a/configure.ac b/configure.ac index 2fa1b2c..4843a82 100644 --- a/configure.ac +++ b/configure.ac @@ -113,6 +113,15 @@ fi AC_SUBST([enable_rust]) AM_CONDITIONAL([RUST_ENABLE],[test "$enable_rust" = yes -o "$enable_rust_offline" = yes]) +# Optional cockpit support (enabled by default) +AC_MSG_CHECKING(for --enable-cockpit) +AC_ARG_ENABLE(cockpit, AS_HELP_STRING([--enable-cockpit], [Enable cockpit plugin (default: yes)]), + [], [ enable_cockpit=yes ]) +AC_MSG_RESULT($enable_cockpit) +AC_SUBST([enable_cockpit]) +AC_SUBST(ENABLE_COCKPIT) +AM_CONDITIONAL([ENABLE_COCKPIT],[test "$enable_cockpit" = yes]) + AC_MSG_CHECKING(for --enable-debug) AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Enable debug features (default: no)]), diff --git a/rpm.mk b/rpm.mk index 02f5bba..480a1d7 100644 --- a/rpm.mk +++ b/rpm.mk @@ -27,6 +27,8 @@ UBSAN_ON = 0 RUST_ON = 0 +COCKPIT_ON = 0 + # PERL_ON is deprecated and turns on the LEGACY_ON, this for not breaking people's workflows. PERL_ON = 1 LEGACY_ON = 0 @@ -49,13 +51,18 @@ download-cargo-dependencies: tar -czf vendor.tar.gz vendor install-node-modules: +ifeq ($(COCKPIT_ON), 1) cd src/cockpit/389-console; make -f node_modules.mk install +endif build-cockpit: install-node-modules +ifeq ($(COCKPIT_ON), 1) cd src/cockpit/389-console; \ NODE_ENV=production make -f node_modules.mk build-cockpit-plugin +endif dist-bz2: install-node-modules download-cargo-dependencies +ifeq ($(COCKPIT_ON), 1) cd src/cockpit/389-console; \ rm -rf cockpit_dist; \ NODE_ENV=production make -f node_modules.mk build-cockpit-plugin; \ @@ -63,10 +70,13 @@ dist-bz2: install-node-modules download-cargo-dependencies touch cockpit_dist/* mkdir -p $(NODE_MODULES_TEST) touch -r src/cockpit/389-console/package.json $(NODE_MODULES_TEST) +endif tar cjf $(GIT_TAG).tar.bz2 --transform "s,^,$(GIT_TAG)/," $$(git ls-files) src/cockpit/389-console/cockpit_dist/ src/cockpit/389-console/node_modules +ifeq ($(COCKPIT_ON), 1) cd src/cockpit/389-console; \ rm -rf node_modules; \ mv node_modules.release node_modules +endif local-archive: build-cockpit -mkdir -p dist/$(NAME_VERSION) @@ -75,7 +85,9 @@ local-archive: build-cockpit tarballs: local-archive -mkdir -p dist/sources cd dist; tar cfj sources/$(TARBALL) $(NAME_VERSION) +ifeq ($(COCKPIT_ON), 1) cd src/cockpit/389-console; rm -rf dist +endif rm -rf dist/$(NAME_VERSION) cd dist/sources ; \ if [ $(BUNDLE_JEMALLOC) -eq 1 ]; then \ @@ -97,6 +109,7 @@ rpmroot: -e s/__TSAN_ON__/$(TSAN_ON)/ \ -e s/__UBSAN_ON__/$(UBSAN_ON)/ \ -e s/__LEGACY_ON__/$(LEGACY_ON)/ \ + -e s/__COCKPIT_ON__/$(COCKPIT_ON)/ \ -e s/__CLANG_ON__/$(CLANG_ON)/ \ -e s/__BUNDLE_JEMALLOC__/$(BUNDLE_JEMALLOC)/ \ rpm/$(PACKAGE).spec.in > $(RPMBUILD)/SPECS/$(PACKAGE).spec diff --git a/rpm/389-ds-base.spec.in b/rpm/389-ds-base.spec.in index dab29c6..509a1ac 100644 --- a/rpm/389-ds-base.spec.in +++ b/rpm/389-ds-base.spec.in @@ -40,6 +40,9 @@ # Use Clang instead of GCC %global use_clang __CLANG_ON__ +# Build cockpit plugin +%global use_cockpit __COCKPIT_ON__ + # fedora 15 and later uses tmpfiles.d # otherwise, comment this out %{!?with_tmpfiles_d: %global with_tmpfiles_d %{_sysconfdir}/tmpfiles.d} @@ -130,9 +133,11 @@ BuildRequires: python%{python3_pkgversion}-policycoreutils BuildRequires: python%{python3_pkgversion}-libselinux # For cockpit +%if %{use_cockpit} BuildRequires: rsync BuildRequires: npm BuildRequires: nodejs +%endif # END BUILD REQUIRES @@ -287,7 +292,6 @@ SNMP Agent for the 389 Directory Server base package. Summary: A library for accessing, testing, and configuring the 389 Directory Server BuildArch: noarch Group: Development/Libraries -Requires: krb5-workstation Requires: openssl # This is for /usr/bin/c_rehash tool, only needed for openssl < 1.1.0 Requires: openssl-perl @@ -310,6 +314,7 @@ Recommends: bash-completion This module contains tools and libraries for accessing, testing, and configuring the 389 Directory Server. +%if %{use_cockpit} %package -n cockpit-389-ds Summary: Cockpit UI Plugin for configuring and administering the 389 Directory Server BuildArch: noarch @@ -320,6 +325,7 @@ Requires: python%{python3_pkgversion}-lib389 %description -n cockpit-389-ds A cockpit UI Plugin for configuring and administering the 389 Directory Server +%endif %prep %setup -q -n %{name}-%{version}%{?prerel} @@ -366,6 +372,10 @@ LEGACY_FLAGS="--enable-legacy --enable-perl" LEGACY_FLAGS="--disable-legacy --disable-perl" %endif +%if !%{use_cockpit} +COCKPIT_FLAGS="--disable-cockpit" +%endif + %if %{bundle_jemalloc} # Override page size, bz #1545539 # 4K @@ -403,7 +413,7 @@ autoreconf -fiv --with-systemdsystemconfdir=%{_sysconfdir}/systemd/system \ --with-systemdgroupname=%{groupname} \ --libexecdir=%{_libexecdir}/%{pkgname} \ - $ASAN_FLAGS $MSAN_FLAGS $TSAN_FLAGS $UBSAN_FLAGS $RUST_FLAGS $CLANG_FLAGS $LEGACY_FLAGS\ + $ASAN_FLAGS $MSAN_FLAGS $TSAN_FLAGS $UBSAN_FLAGS $RUST_FLAGS $CLANG_FLAGS $LEGACY_FLAGS $COCKPIT_FLAGS \ --enable-cmocka %if 0%{?rhel} > 7 || 0%{?fedora} @@ -429,11 +439,15 @@ make %{?_smp_mflags} rm -rf $RPM_BUILD_ROOT mkdir -p %{buildroot}%{_datadir}/gdb/auto-load%{_sbindir} +%if %{use_cockpit} mkdir -p %{buildroot}%{_datadir}/cockpit +%endif make DESTDIR="$RPM_BUILD_ROOT" install +%if %{use_cockpit} find %{buildroot}%{_datadir}/cockpit/389-console -type d | sed -e "s@%{buildroot}@@" | sed -e 's/^/\%dir /' > cockpit.list find %{buildroot}%{_datadir}/cockpit/389-console -type f | sed -e "s@%{buildroot}@@" >> cockpit.list +%endif # Copy in our docs from doxygen. cp -r %{_builddir}/%{name}-%{version}%{?prerel}/man/man3 $RPM_BUILD_ROOT/%{_mandir}/man3 @@ -829,9 +843,11 @@ exit 0 %{_mandir}/man8/dsidm.8.gz %{_libexecdir}/%{pkgname}/dscontainer +%if %{use_cockpit} %files -n cockpit-389-ds -f cockpit.list %{_datarootdir}/metainfo/389-console/org.port389.cockpit_console.metainfo.xml %doc README.md +%endif %changelog * Mon Dec 21 2015 Mark Reynolds - 1.3.4.1-3