#51137 Issue 50781 - Make building cockpit plugin optional
Closed 3 years ago by spichugi. Opened 3 years ago by vashirov.
vashirov/389-ds-base ds50781  into  master

file modified
+5
@@ -778,6 +778,7 @@ 

  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 @@ 

  	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-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 @@ 

  389-console-clean:

  	cd $(srcdir)/src/cockpit/389-console; make -f node_modules.mk clean

  

+ endif

  

  if HAVE_DOXYGEN

  

file modified
+9
@@ -113,6 +113,15 @@ 

  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)]),

file modified
+13
@@ -27,6 +27,8 @@ 

  

  RUST_ON = 0

  

+ COCKPIT_ON = 0

This should be 1 by default

+ 

  # 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 @@ 

  	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 @@ 

  	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 @@ 

  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 @@ 

  	-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

file modified
+18 -2
@@ -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}-libselinux

  

  # For cockpit

+ %if %{use_cockpit}

  BuildRequires:    rsync

  BuildRequires:    npm

  BuildRequires:    nodejs

+ %endif

  

  # END BUILD REQUIRES

  
@@ -287,7 +292,6 @@ 

  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 @@ 

  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 @@ 

  

  %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="--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 @@ 

             --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 @@ 

  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 @@ 

  %{_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 <mreynolds@redhat.com> - 1.3.4.1-3

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: ???

rebased onto ac54e06

3 years ago

This should be 1 by default

This should be 1 by default

Sorry, it's fine. Ack!

Thanks! I had been meaning to maek something like this for a while since I don't test/use cockpit and we don't ship it on suse. Should make my test cycles faster, thank you!

Merging because I want this now darn it!

This should be 1 by default

Sorry, it's fine. Ack!

@mreynolds, you were right, It really should be 1 by default, I committed with 0 by accident. As we agreed in the meeting, I will fix it.

@firstyear, thanks for merging, but you were too fast :) The default in rpm.mk should be 1. Hope it's not too much of overhead to disable it in your workflow.

Not too much work at all. :)

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/4190

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago