From 50d2c9e4fd2a891cad9530da39b39a173307e1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 10 Apr 2022 00:16:59 +0200 Subject: [PATCH] autoconf: use include directives instead of recursing down contrib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also make the pyzfs build actually out-of-tree and quiet by default Reviewed-by: Brian Behlendorf Co-authored-by: Rapptz Signed-off-by: Ahelenia ZiemiaƄska Closes #13316 --- Makefile.am | 5 ++- config/Substfiles.am | 2 + configure.ac | 16 ------- contrib/Makefile.am | 17 ++++---- contrib/bash_completion.d/Makefile.am | 16 ++----- contrib/bpftrace/Makefile.am | 8 ++-- contrib/dracut/{90zfs => }/.gitignore | 0 .../dracut/02zfsexpandknowledge/.gitignore | 1 - .../dracut/02zfsexpandknowledge/Makefile.am | 11 ----- contrib/dracut/90zfs/Makefile.am | 27 ------------ contrib/dracut/Makefile.am | 29 +++++++++++-- contrib/initramfs/Makefile.am | 42 +++++++++++++++---- contrib/initramfs/conf-hooks.d/Makefile.am | 4 -- contrib/initramfs/conf.d/Makefile.am | 4 -- contrib/initramfs/hooks/Makefile.am | 13 ------ contrib/initramfs/scripts/Makefile.am | 12 ------ .../initramfs/scripts/local-top/Makefile.am | 8 ---- contrib/pam_zfs_key/Makefile.am | 25 ++++++----- contrib/pyzfs/Makefile.am | 29 ++++++------- contrib/pyzfs/setup.py.in | 8 ++-- contrib/zcp/Makefile.am | 2 +- 21 files changed, 112 insertions(+), 167 deletions(-) rename contrib/dracut/{90zfs => }/.gitignore (100%) delete mode 100644 contrib/dracut/02zfsexpandknowledge/.gitignore delete mode 100644 contrib/dracut/02zfsexpandknowledge/Makefile.am delete mode 100644 contrib/dracut/90zfs/Makefile.am delete mode 100644 contrib/initramfs/conf-hooks.d/Makefile.am delete mode 100644 contrib/initramfs/conf.d/Makefile.am delete mode 100644 contrib/initramfs/hooks/Makefile.am delete mode 100644 contrib/initramfs/scripts/Makefile.am delete mode 100644 contrib/initramfs/scripts/local-top/Makefile.am diff --git a/Makefile.am b/Makefile.am index e90a2eb51..ca2093781 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,8 +18,9 @@ endif CPPCHECKDIRS += etc/systemd/system-generators if CONFIG_USER -SUBDIRS += . tests etc contrib +SUBDIRS += . tests etc include $(srcdir)/%D%/cmd/Makefile.am +include $(srcdir)/%D%/contrib/Makefile.am include $(srcdir)/%D%/lib/Makefile.am include $(srcdir)/%D%/man/Makefile.am include $(srcdir)/%D%/scripts/Makefile.am @@ -97,7 +98,7 @@ dist-hook: PHONY += codecheck $(CHECKS) codecheck: $(CHECKS) -SHELLCHECKDIRS = contrib etc tests +SHELLCHECKDIRS = etc tests SHELLCHECKSCRIPTS += autogen.sh PHONY += checkstyle diff --git a/config/Substfiles.am b/config/Substfiles.am index 7f069877a..ce02ac9c7 100644 --- a/config/Substfiles.am +++ b/config/Substfiles.am @@ -1,4 +1,5 @@ subst_sed_cmd = \ + -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \ -e 's|@bindir[@]|$(bindir)|g' \ -e 's|@sbindir[@]|$(sbindir)|g' \ -e 's|@datadir[@]|$(datadir)|g' \ @@ -12,6 +13,7 @@ subst_sed_cmd = \ -e 's|@udevdir[@]|$(udevdir)|g' \ -e 's|@udevruledir[@]|$(udevruledir)|g' \ -e 's|@zfsexecdir[@]|$(zfsexecdir)|g' \ + -e 's|@VERSION[@]|$(VERSION)|g' \ -e 's|@PYTHON[@]|$(PYTHON)|g' \ -e 's|@PYTHON_SHEBANG[@]|$(PYTHON_SHEBANG)|g' \ -e 's|@DEFAULT_INIT_NFS_SERVER[@]|$(DEFAULT_INIT_NFS_SERVER)|g' \ diff --git a/configure.ac b/configure.ac index d4aa71e27..f536ff2fc 100644 --- a/configure.ac +++ b/configure.ac @@ -66,22 +66,6 @@ ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile - contrib/Makefile - contrib/bash_completion.d/Makefile - contrib/bpftrace/Makefile - contrib/dracut/02zfsexpandknowledge/Makefile - contrib/dracut/90zfs/Makefile - contrib/dracut/Makefile - contrib/initramfs/Makefile - contrib/initramfs/conf.d/Makefile - contrib/initramfs/conf-hooks.d/Makefile - contrib/initramfs/hooks/Makefile - contrib/initramfs/scripts/Makefile - contrib/initramfs/scripts/local-top/Makefile - contrib/pam_zfs_key/Makefile - contrib/pyzfs/Makefile - contrib/pyzfs/setup.py - contrib/zcp/Makefile etc/Makefile etc/default/Makefile etc/init.d/Makefile diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 5ec13ece5..fa51bd941 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -1,12 +1,13 @@ -include $(top_srcdir)/config/Shellcheck.am +include $(srcdir)/%D%/bash_completion.d/Makefile.am +include $(srcdir)/%D%/pyzfs/Makefile.am +include $(srcdir)/%D%/zcp/Makefile.am -SUBDIRS = bash_completion.d pyzfs zcp if BUILD_LINUX -SUBDIRS += bpftrace dracut initramfs +include $(srcdir)/%D%/bpftrace/Makefile.am +include $(srcdir)/%D%/dracut/Makefile.am +include $(srcdir)/%D%/initramfs/Makefile.am endif -if PAM_ZFS_ENABLED -SUBDIRS += pam_zfs_key -endif -DIST_SUBDIRS = bash_completion.d bpftrace dracut initramfs pam_zfs_key pyzfs zcp -SHELLCHECKDIRS = bash_completion.d bpftrace dracut initramfs +if PAM_ZFS_ENABLED +include $(srcdir)/%D%/pam_zfs_key/Makefile.am +endif diff --git a/contrib/bash_completion.d/Makefile.am b/contrib/bash_completion.d/Makefile.am index 0295843eb..4f451fb1d 100644 --- a/contrib/bash_completion.d/Makefile.am +++ b/contrib/bash_completion.d/Makefile.am @@ -1,14 +1,6 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -bashcompletiondir = $(sysconfdir)/bash_completion.d - -noinst_DATA = zfs - -EXTRA_DIST += $(noinst_DATA) -SUBSTFILES += $(noinst_DATA) +noinst_DATA = %D%/zfs +EXTRA_DIST += $(noinst_DATA) +SUBSTFILES += $(noinst_DATA) SHELLCHECKSCRIPTS += $(noinst_DATA) -SHELLCHECK_SHELL = bash +$(call SHELLCHECK_OPTS,$(noinst_DATA)): SHELLCHECK_SHELL = bash diff --git a/contrib/bpftrace/Makefile.am b/contrib/bpftrace/Makefile.am index 7194ec689..5382f1e1d 100644 --- a/contrib/bpftrace/Makefile.am +++ b/contrib/bpftrace/Makefile.am @@ -1,7 +1,5 @@ -include $(top_srcdir)/config/Shellcheck.am - -EXTRA_DIST = \ +EXTRA_DIST += $(addprefix %D%/, \ taskqlatency.bt \ - zfs-trace.sh + zfs-trace.sh) -SHELLCHECKSCRIPTS += zfs-trace.sh +SHELLCHECKSCRIPTS += %D%/zfs-trace.sh diff --git a/contrib/dracut/90zfs/.gitignore b/contrib/dracut/.gitignore similarity index 100% rename from contrib/dracut/90zfs/.gitignore rename to contrib/dracut/.gitignore diff --git a/contrib/dracut/02zfsexpandknowledge/.gitignore b/contrib/dracut/02zfsexpandknowledge/.gitignore deleted file mode 100644 index 7fb6b964f..000000000 --- a/contrib/dracut/02zfsexpandknowledge/.gitignore +++ /dev/null @@ -1 +0,0 @@ -module-setup.sh diff --git a/contrib/dracut/02zfsexpandknowledge/Makefile.am b/contrib/dracut/02zfsexpandknowledge/Makefile.am deleted file mode 100644 index 23fcc0a3c..000000000 --- a/contrib/dracut/02zfsexpandknowledge/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -pkgdracutdir = $(dracutdir)/modules.d/02zfsexpandknowledge -pkgdracut_SCRIPTS = \ - module-setup.sh - -SUBSTFILES += $(pkgdracut_SCRIPTS) -SHELLCHECKSCRIPTS += $(pkgdracut_SCRIPTS) diff --git a/contrib/dracut/90zfs/Makefile.am b/contrib/dracut/90zfs/Makefile.am deleted file mode 100644 index 28bedfb39..000000000 --- a/contrib/dracut/90zfs/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -pkgdracutdir = $(dracutdir)/modules.d/90zfs -pkgdracut_SCRIPTS = \ - export-zfs.sh \ - module-setup.sh \ - mount-zfs.sh \ - parse-zfs.sh \ - zfs-generator.sh \ - zfs-load-key.sh \ - zfs-needshutdown.sh \ - zfs-lib.sh \ - import-opts-generator.sh - -pkgdracut_DATA = \ - zfs-env-bootfs.service \ - zfs-snapshot-bootfs.service \ - zfs-rollback-bootfs.service - -SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA) - -# Provided by /bin/sleep, and, again, every implementation of that supports this -CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.' -SHELLCHECKSCRIPTS += $(pkgdracut_SCRIPTS) diff --git a/contrib/dracut/Makefile.am b/contrib/dracut/Makefile.am index 09805277f..f0c103b0a 100644 --- a/contrib/dracut/Makefile.am +++ b/contrib/dracut/Makefile.am @@ -1,6 +1,27 @@ -include $(top_srcdir)/config/Shellcheck.am +pkgdracut_02dir = $(dracutdir)/modules.d/02zfsexpandknowledge +pkgdracut_02_SCRIPTS = \ + %D%/02zfsexpandknowledge/module-setup.sh -SUBDIRS = 02zfsexpandknowledge 90zfs -SHELLCHECKDIRS = $(SUBDIRS) +pkgdracut_90dir = $(dracutdir)/modules.d/90zfs +pkgdracut_90_SCRIPTS = \ + %D%/90zfs/export-zfs.sh \ + %D%/90zfs/import-opts-generator.sh \ + %D%/90zfs/module-setup.sh \ + %D%/90zfs/mount-zfs.sh \ + %D%/90zfs/parse-zfs.sh \ + %D%/90zfs/zfs-generator.sh \ + %D%/90zfs/zfs-lib.sh \ + %D%/90zfs/zfs-load-key.sh \ + %D%/90zfs/zfs-needshutdown.sh -EXTRA_DIST = README.md +pkgdracut_90_DATA = \ + %D%/90zfs/zfs-env-bootfs.service \ + %D%/90zfs/zfs-rollback-bootfs.service \ + %D%/90zfs/zfs-snapshot-bootfs.service + +SUBSTFILES += $(pkgdracut_02_SCRIPTS) $(pkgdracut_90_SCRIPTS) $(pkgdracut_90_DATA) +SHELLCHECKSCRIPTS += $(pkgdracut_02_SCRIPTS) $(pkgdracut_90_SCRIPTS) +# Provided by /bin/sleep, and, again, every implementation of that supports this +$(call SHELLCHECK_OPTS,$(pkgdracut_90_SCRIPTS)): CHECKBASHISMS_IGNORE = -e 'sleep only takes one integer' -e 'sleep 0.' + +EXTRA_DIST += $(addprefix %D%/,README.md) diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am index 5ee8e16a0..6917b517f 100644 --- a/contrib/initramfs/Makefile.am +++ b/contrib/initramfs/Makefile.am @@ -1,11 +1,39 @@ -include $(top_srcdir)/config/Shellcheck.am +i_tdir = /usr/share/initramfs-tools +dist_i_t_SCRIPTS = \ + %D%/zfsunlock -initrddir = /usr/share/initramfs-tools -dist_initrd_SCRIPTS = \ - zfsunlock +i_t_confhooks_ddir = $(i_tdir)/conf-hooks.d +dist_i_t_confhooks_d_DATA = \ + %D%/conf-hooks.d/zfs -SUBDIRS = conf.d conf-hooks.d hooks scripts -SHELLCHECKDIRS = hooks scripts -EXTRA_DIST = README.md +i_t_conf_ddir = $(i_tdir)/conf.d +dist_i_t_conf_d_DATA = \ + %D%/conf.d/zfs + + +i_t_hooksdir = $(i_tdir)/hooks +i_t_hooks_SCRIPTS = \ + %D%/hooks/zfs \ + %D%/hooks/zfsunlock + +SUBSTFILES += $(i_t_hooks_SCRIPTS) + + +i_t_scriptsdir = $(i_tdir)/scripts +dist_i_t_scripts_SCRIPTS = \ + %D%/scripts/zfs + + +i_t_scripts_localtopdir = $(i_t_scriptsdir)/local-top +dist_i_t_scripts_localtop_SCRIPTS = \ + %D%/scripts/local-top/zfs + + +i_t_check_scripts = $(dist_i_t_SCRIPTS) $(i_t_hooks_SCRIPTS) $(dist_i_t_scripts_SCRIPTS) $(dist_i_t_scripts_localtop_SCRIPTS) +SHELLCHECKSCRIPTS += $(i_t_check_scripts) +$(call SHELLCHECK_OPTS,$(i_t_check_scripts)): SHELLCHECK_SHELL = sh + + +EXTRA_DIST += $(addprefix %D%/,README.md) diff --git a/contrib/initramfs/conf-hooks.d/Makefile.am b/contrib/initramfs/conf-hooks.d/Makefile.am deleted file mode 100644 index f84ba5cc7..000000000 --- a/contrib/initramfs/conf-hooks.d/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -confhooksddir = /usr/share/initramfs-tools/conf-hooks.d - -dist_confhooksd_DATA = \ - zfs diff --git a/contrib/initramfs/conf.d/Makefile.am b/contrib/initramfs/conf.d/Makefile.am deleted file mode 100644 index 5ef27e0aa..000000000 --- a/contrib/initramfs/conf.d/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -confddir = /usr/share/initramfs-tools/conf.d - -dist_confd_DATA = \ - zfs diff --git a/contrib/initramfs/hooks/Makefile.am b/contrib/initramfs/hooks/Makefile.am deleted file mode 100644 index e872c0a00..000000000 --- a/contrib/initramfs/hooks/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -CLEANFILES = -EXTRA_DIST = -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -hooksdir = /usr/share/initramfs-tools/hooks - -hooks_SCRIPTS = \ - zfs \ - zfsunlock - -SUBSTFILES += $(hooks_SCRIPTS) -SHELLCHECKSCRIPTS += $(hooks_SCRIPTS) diff --git a/contrib/initramfs/scripts/Makefile.am b/contrib/initramfs/scripts/Makefile.am deleted file mode 100644 index 8b48f2056..000000000 --- a/contrib/initramfs/scripts/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -include $(top_srcdir)/config/Shellcheck.am - -scriptsdir = /usr/share/initramfs-tools/scripts - -dist_scripts_SCRIPTS = \ - zfs - -SUBDIRS = local-top - -SHELLCHECKDIRS = $(SUBDIRS) -SHELLCHECK_SHELL = sh -SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) diff --git a/contrib/initramfs/scripts/local-top/Makefile.am b/contrib/initramfs/scripts/local-top/Makefile.am deleted file mode 100644 index f64665f4b..000000000 --- a/contrib/initramfs/scripts/local-top/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -include $(top_srcdir)/config/Shellcheck.am - -localtopdir = /usr/share/initramfs-tools/scripts/local-top - -dist_localtop_SCRIPTS = \ - zfs - -SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) diff --git a/contrib/pam_zfs_key/Makefile.am b/contrib/pam_zfs_key/Makefile.am index bcb60b71c..aaa608b7d 100644 --- a/contrib/pam_zfs_key/Makefile.am +++ b/contrib/pam_zfs_key/Makefile.am @@ -1,19 +1,18 @@ -include $(top_srcdir)/config/Rules.am +%C%_pam_zfs_key_la_CFLAGS = $(AM_CFLAGS) +%C%_pam_zfs_key_la_CFLAGS += $(LIBCRYPTO_CFLAGS) -AM_CFLAGS += $(LIBCRYPTO_CFLAGS) +pammodule_LTLIBRARIES = %D%/pam_zfs_key.la -pammodule_LTLIBRARIES = pam_zfs_key.la +%C%_pam_zfs_key_la_SOURCES = %D%/pam_zfs_key.c -pam_zfs_key_la_SOURCES = pam_zfs_key.c +%C%_pam_zfs_key_la_LIBADD = \ + libnvpair.la \ + libuutil.la \ + libzfs.la \ + libzfs_core.la -pam_zfs_key_la_LIBADD = \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la +%C%_pam_zfs_key_la_LIBADD += -lpam $(LIBCRYPTO_LIBS) -pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared +%C%_pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared -pam_zfs_key_la_LIBADD += -lpam $(LIBCRYPTO_LIBS) - -dist_pamconfigs_DATA = zfs_key +dist_pamconfigs_DATA = %D%/zfs_key diff --git a/contrib/pyzfs/Makefile.am b/contrib/pyzfs/Makefile.am index fa1bb32ce..1bcbfd042 100644 --- a/contrib/pyzfs/Makefile.am +++ b/contrib/pyzfs/Makefile.am @@ -1,10 +1,11 @@ -EXTRA_DIST = libzfs_core setup.py.in README LICENSE docs +EXTRA_DIST += $(addprefix %D%/,libzfs_core README LICENSE docs) +SUBSTFILES += %D%/setup.py if PYZFS_ENABLED -all: - -all-local: - $(PYTHON) setup.py build +ALL_LOCAL += pyzfs-all-local +pyzfs_V_1 = -v +pyzfs-all-local: %D%/setup.py + cd %D% && $(PYTHON) setup.py -q $(pyzfs_V_$(V)) egg_info -e . build # # On Debian (Ubuntu, and other downstream distros) the install location of @@ -24,17 +25,13 @@ all-local: # files are later created by manually loading the Python modules. # install-exec-local: - $(PYTHON) $(builddir)/setup.py install \ - --prefix $(prefix) \ - --root $(DESTDIR)/ \ - --install-lib $(pythonsitedir) \ - --single-version-externally-managed \ - --verbose - -clean: clean-local - rm -rf build/ pyzfs.egg-info/ + cd %D% && $(PYTHON) setup.py egg_info -e . install \ + --prefix $(prefix) \ + --root $(DESTDIR)/ \ + --install-lib $(pythonsitedir) \ + --single-version-externally-managed \ + --verbose clean-local: - -check-local: all + -$(RM) -r %D%/build/ %D%/pyzfs.egg-info/ endif diff --git a/contrib/pyzfs/setup.py.in b/contrib/pyzfs/setup.py.in index 934b3189e..43a1accfa 100644 --- a/contrib/pyzfs/setup.py.in +++ b/contrib/pyzfs/setup.py.in @@ -13,9 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from __future__ import absolute_import, division, print_function - from setuptools import setup, find_packages +import os.path + +srcdir = "@abs_top_srcdir@/contrib/pyzfs" setup( name="pyzfs", @@ -44,7 +45,8 @@ setup( "libzfs_core", ], - packages=find_packages(), + packages=find_packages(where=srcdir), + package_dir={"": os.path.relpath(srcdir)}, include_package_data=True, install_requires=[ "cffi", diff --git a/contrib/zcp/Makefile.am b/contrib/zcp/Makefile.am index e6a777ad7..759a9d529 100644 --- a/contrib/zcp/Makefile.am +++ b/contrib/zcp/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = autosnap.lua +EXTRA_DIST += $(addprefix %D%/,autosnap.lua)