From 5cdca5b1da7884c54260db473f892354bc79951b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sat, 9 Apr 2022 04:09:55 +0200 Subject: [PATCH] autoconf: use include directives instead of recursing down cmd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No installation diff, dist lost -zfs-2.1.99/cmd/fsck_zfs/fsck.zfs which was distributed erroneously, since it's generated Also clean gitrev on clean Also add -e 'any possible bashisms' to default checkbashisms flags, and fully parallelise it and shellcheck, and it works out-of-tree, too Also align the Release in the dist META file correctly Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- .gitignore | 90 +++++---- Makefile.am | 32 +-- cmd/Makefile.am | 54 +++-- cmd/arc_summary/.gitignore | 1 - cmd/arc_summary/Makefile.am | 12 +- cmd/arcstat/.gitignore | 1 - cmd/arcstat/Makefile.am | 9 +- cmd/dbufstat/.gitignore | 1 - cmd/dbufstat/Makefile.am | 9 +- cmd/fsck_zfs/.gitignore | 1 - cmd/fsck_zfs/Makefile.am | 12 +- cmd/fsck_zfs/fsck.zfs.in | 4 +- cmd/mount_zfs/.gitignore | 1 - cmd/mount_zfs/Makefile.am | 17 +- cmd/raidz_test/.gitignore | 1 - cmd/raidz_test/Makefile.am | 22 +- cmd/vdev_id/Makefile.am | 5 +- cmd/zdb/.gitignore | 1 - cmd/zdb/Makefile.am | 22 +- cmd/zed/Makefile.am | 82 ++++---- cmd/zed/zed.d/Makefile.am | 66 +++--- cmd/zfs/.gitignore | 1 - cmd/zfs/Makefile.am | 28 ++- cmd/zfs_ids_to_path/.gitignore | 1 - cmd/zfs_ids_to_path/Makefile.am | 12 +- cmd/zgenhostid/.gitignore | 1 - cmd/zgenhostid/Makefile.am | 11 +- cmd/zhack/.gitignore | 1 - cmd/zhack/Makefile.am | 18 +- cmd/zinject/.gitignore | 1 - cmd/zinject/Makefile.am | 20 +- cmd/zpool/.gitignore | 1 - cmd/zpool/Makefile.am | 191 +++++++++--------- cmd/zpool_influxdb/.gitignore | 1 - cmd/zpool_influxdb/Makefile.am | 16 +- cmd/zstream/.gitignore | 1 - cmd/zstream/Makefile.am | 31 ++- cmd/ztest/.gitignore | 1 - cmd/ztest/Makefile.am | 24 +-- cmd/zvol_id/.gitignore | 1 - cmd/zvol_id/Makefile.am | 10 +- cmd/zvol_wait/Makefile.am | 5 +- config/Shellcheck.am | 50 +++-- config/Substfiles.am | 30 +-- configure.ac | 22 -- contrib/bash_completion.d/Makefile.am | 4 +- contrib/bpftrace/Makefile.am | 2 +- .../dracut/02zfsexpandknowledge/Makefile.am | 3 + contrib/dracut/90zfs/Makefile.am | 3 + contrib/initramfs/Makefile.am | 2 +- contrib/initramfs/hooks/Makefile.am | 3 + contrib/initramfs/scripts/Makefile.am | 1 + .../initramfs/scripts/local-top/Makefile.am | 3 +- etc/default/Makefile.am | 3 + etc/init.d/Makefile.am | 3 + etc/systemd/system/Makefile.am | 2 + etc/zfs/Makefile.am | 3 + man/Makefile.am | 2 + scripts/Makefile.am | 20 +- scripts/zfs-helpers.sh | 47 ++--- scripts/zfs-tests.sh | 10 +- scripts/zimport.sh | 4 +- tests/Makefile.am | 3 +- tests/test-runner/bin/Makefile.am | 2 + tests/zfs-tests/.gitignore | 1 + tests/zfs-tests/include/Makefile.am | 2 + .../tests/functional/pyzfs/Makefile.am | 2 + udev/rules.d/Makefile.am | 2 + 68 files changed, 514 insertions(+), 534 deletions(-) delete mode 100644 cmd/arc_summary/.gitignore delete mode 100644 cmd/arcstat/.gitignore delete mode 100644 cmd/dbufstat/.gitignore delete mode 100644 cmd/fsck_zfs/.gitignore delete mode 100644 cmd/mount_zfs/.gitignore delete mode 100644 cmd/raidz_test/.gitignore delete mode 100644 cmd/zdb/.gitignore delete mode 100644 cmd/zfs/.gitignore delete mode 100644 cmd/zfs_ids_to_path/.gitignore delete mode 100644 cmd/zgenhostid/.gitignore delete mode 100644 cmd/zhack/.gitignore delete mode 100644 cmd/zinject/.gitignore delete mode 100644 cmd/zpool/.gitignore delete mode 100644 cmd/zpool_influxdb/.gitignore delete mode 100644 cmd/zstream/.gitignore delete mode 100644 cmd/ztest/.gitignore delete mode 100644 cmd/zvol_id/.gitignore create mode 100644 tests/zfs-tests/.gitignore diff --git a/.gitignore b/.gitignore index 056bbb8f0..8d91dd946 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # -# N.B. -# This is the toplevel .gitignore file. +# This is the top-level .gitignore file: +# ignore everything except a list of allowed files. +# # This is not the place for entries that are specific to # a subdirectory. Instead add those files to the # .gitignore file in that subdirectory. @@ -10,6 +11,56 @@ # command after changing this file, to see if there are # any tracked files which get ignored after the change. +* + +!.github +!cmd +!config +!contrib +!etc +!include +!lib +!man +!module +!rpm +!scripts +!tests +!udev + +!.github/** +!cmd/** +!config/** +!contrib/** +!etc/** +!include/** +!lib/** +!man/** +!module/** +!rpm/** +!scripts/** +!tests/** +!udev/** + +!.editorconfig +!.gitignore +!.gitmodules +!AUTHORS +!autogen.sh +!CODE_OF_CONDUCT.md +!configure.ac +!copy-builtin +!COPYRIGHT +!LICENSE +!Makefile.am +!META +!NEWS +!NOTICE +!README.md +!RELEASES.md +!TEST +!zfs.release.in + + # # Normal rules # @@ -31,40 +82,7 @@ modules.order Makefile Makefile.in - -# -# Top level generated files specific to this top level dir -# -/bin -/build -/configure -/config.log -/config.status -/libtool -/zfs_config.h -/zfs_config.h.in -/zfs.release -/stamp-h1 -/aclocal.m4 -/autom4te.cache - -# -# Top level generic files -# -!.gitignore -tags -TAGS -current -cscope.* -*.rpm -*.deb -*.tar.gz *.patch *.orig -*.log *.tmp -venv - -*.so -*.so.debug -*.so.full +*.log diff --git a/Makefile.am b/Makefile.am index 24236cfe4..131066b4d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,11 @@ +CLEANFILES = +EXTRA_DIST = +INSTALL_DATA_HOOKS = + include $(top_srcdir)/config/Shellcheck.am include $(top_srcdir)/config/Rules.am include $(top_srcdir)/config/CppCheck.am +include $(top_srcdir)/config/Substfiles.am ACLOCAL_AMFLAGS = -I config @@ -9,11 +14,11 @@ if BUILD_LINUX SUBDIRS += rpm endif -EXTRA_DIST = -CPPCHECKDIRS += cmd etc/systemd/system-generators +CPPCHECKDIRS += etc/systemd/system-generators if CONFIG_USER -SUBDIRS += scripts . man tests cmd etc contrib +SUBDIRS += scripts . man tests etc contrib include $(srcdir)/%D%/lib/Makefile.am +include $(srcdir)/%D%/cmd/Makefile.am if BUILD_LINUX SUBDIRS += udev endif @@ -51,18 +56,22 @@ EXTRA_DIST += module/zfs/THIRDPARTYLICENSE.cityhash.descrip @CODE_COVERAGE_RULES@ GITREV = include/zfs_gitrev.h - +CLEANFILES += $(GITREV) PHONY += gitrev gitrev: $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh $(GITREV) all: gitrev -# Double-colon rules are allowed; there are multiple independent definitions. -maintainer-clean-local:: +PHONY += install-data-hook $(INSTALL_DATA_HOOKS) +install-data-hook: $(INSTALL_DATA_HOOKS) + +PHONY += maintainer-clean-local +maintainer-clean-local: -$(RM) $(GITREV) -distclean-local:: +PHONY += distclean-local +distclean-local: -$(RM) -R autom4te*.cache build -find . \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \ -o -name .pc -o -name .hg -o -name .git \) -prune -o \ @@ -78,9 +87,8 @@ all-local: -SCRIPT_COMMON=$(top_builddir)/scripts/common.sh $(top_srcdir)/scripts/zfs-tests.sh -c dist-hook: - $(AM_V_GEN)$(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV) - $(SED) ${ac_inplace} -e 's/Release:[[:print:]]*/Release: $(RELEASE)/' \ - $(distdir)/META + $(top_srcdir)/scripts/make_gitrev.sh -D $(distdir) $(GITREV) + $(SED) $(ac_inplace) 's/\(Release:[[:space:]]*\).*/\1$(RELEASE)/' $(distdir)/META PHONY += codecheck codecheck: cstyle shellcheck checkbashisms flake8 mancheck testscheck vcscheck zstdcheck @@ -114,8 +122,8 @@ cstyle: filter_executable = -exec test -x '{}' \; -print -SHELLCHECKDIRS = cmd contrib etc scripts tests -SHELLCHECKSCRIPTS = autogen.sh +SHELLCHECKDIRS = contrib etc scripts tests +SHELLCHECKSCRIPTS += autogen.sh PHONY += mancheck mancheck: diff --git a/cmd/Makefile.am b/cmd/Makefile.am index fbdeaee62..2fa281cad 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,23 +1,39 @@ -PHONY = -include $(top_srcdir)/config/Shellcheck.am -include $(top_srcdir)/config/CppCheck.am +bin_SCRIPTS = +bin_PROGRAMS = +sbin_SCRIPTS = +sbin_PROGRAMS = +udev_PROGRAMS = +dist_bin_SCRIPTS = +zfsexec_PROGRAMS = +dist_udev_SCRIPTS = +mounthelper_PROGRAMS = -SUBDIRS = zfs zpool zdb zhack zinject zstream ztest -SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path -SUBDIRS += zpool_influxdb - -CPPCHECKDIRS += zfs zpool zdb zhack zinject zstream ztest -CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb - -# TODO: #12084: SHELLCHECKDIRS += vdev_id -SHELLCHECKDIRS = fsck_zfs zed zpool zvol_wait - -if USING_PYTHON -SUBDIRS += arcstat arc_summary dbufstat -endif +include $(srcdir)/%D%/fsck_zfs/Makefile.am +include $(srcdir)/%D%/raidz_test/Makefile.am +include $(srcdir)/%D%/vdev_id/Makefile.am +include $(srcdir)/%D%/zdb/Makefile.am +include $(srcdir)/%D%/zfs/Makefile.am +include $(srcdir)/%D%/zfs_ids_to_path/Makefile.am +include $(srcdir)/%D%/zhack/Makefile.am +include $(srcdir)/%D%/zinject/Makefile.am +include $(srcdir)/%D%/zpool/Makefile.am +include $(srcdir)/%D%/zpool_influxdb/Makefile.am +include $(srcdir)/%D%/zstream/Makefile.am +include $(srcdir)/%D%/ztest/Makefile.am if BUILD_LINUX -SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait -CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id -SHELLCHECKDIRS += zed +include $(srcdir)/%D%/mount_zfs/Makefile.am +include $(srcdir)/%D%/zed/Makefile.am +include $(srcdir)/%D%/zgenhostid/Makefile.am +include $(srcdir)/%D%/zvol_id/Makefile.am +include $(srcdir)/%D%/zvol_wait/Makefile.am endif + +if USING_PYTHON +include $(srcdir)/%D%/arc_summary/Makefile.am +include $(srcdir)/%D%/arcstat/Makefile.am +include $(srcdir)/%D%/dbufstat/Makefile.am +endif + +PHONY += cmd +cmd: $(bin_SCRIPTS) $(bin_PROGRAMS) $(sbin_SCRIPTS) $(sbin_PROGRAMS) $(udev_PROGRAMS) $(dist_bin_SCRIPTS) $(zfsexec_PROGRAMS) $(dist_udev_SCRIPTS) $(mounthelper_PROGRAMS) diff --git a/cmd/arc_summary/.gitignore b/cmd/arc_summary/.gitignore deleted file mode 100644 index 50ba15f03..000000000 --- a/cmd/arc_summary/.gitignore +++ /dev/null @@ -1 +0,0 @@ -arc_summary diff --git a/cmd/arc_summary/Makefile.am b/cmd/arc_summary/Makefile.am index f419f07e0..90dd981d9 100644 --- a/cmd/arc_summary/Makefile.am +++ b/cmd/arc_summary/Makefile.am @@ -1,8 +1,8 @@ -bin_SCRIPTS = arc_summary +bin_SCRIPTS += arc_summary +CLEANFILES += arc_summary -CLEANFILES = arc_summary -EXTRA_DIST = arc_summary3 -SCRIPT = arc_summary3 +EXTRA_DIST += %D%/arc_summary3 +ARC_SUMMARY = %D%/arc_summary3 -arc_summary: $(SCRIPT) - cp $< $@ +arc_summary: $(ARC_SUMMARY) + $(AM_V_at)cp $< $@ diff --git a/cmd/arcstat/.gitignore b/cmd/arcstat/.gitignore deleted file mode 100644 index 6d6cd1ab7..000000000 --- a/cmd/arcstat/.gitignore +++ /dev/null @@ -1 +0,0 @@ -arcstat diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am index d1ba989a0..d7fd81074 100644 --- a/cmd/arcstat/Makefile.am +++ b/cmd/arcstat/Makefile.am @@ -1,5 +1,4 @@ -include $(top_srcdir)/config/Substfiles.am - -bin_SCRIPTS = arcstat - -SUBSTFILES += $(bin_SCRIPTS) +bin_SCRIPTS += arcstat +CLEANFILES += arcstat +EXTRA_DIST += %D%/arcstat.in +$(call SUBST,arcstat,%D%/) diff --git a/cmd/dbufstat/.gitignore b/cmd/dbufstat/.gitignore deleted file mode 100644 index 2c2e913ce..000000000 --- a/cmd/dbufstat/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dbufstat diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am index e672a01a4..107f35573 100644 --- a/cmd/dbufstat/Makefile.am +++ b/cmd/dbufstat/Makefile.am @@ -1,5 +1,4 @@ -include $(top_srcdir)/config/Substfiles.am - -bin_SCRIPTS = dbufstat - -SUBSTFILES += $(bin_SCRIPTS) +bin_SCRIPTS += dbufstat +CLEANFILES += dbufstat +EXTRA_DIST += %D%/dbufstat.in +$(call SUBST,dbufstat,%D%/) diff --git a/cmd/fsck_zfs/.gitignore b/cmd/fsck_zfs/.gitignore deleted file mode 100644 index 0edf0309e..000000000 --- a/cmd/fsck_zfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/fsck.zfs diff --git a/cmd/fsck_zfs/Makefile.am b/cmd/fsck_zfs/Makefile.am index ec955c7c7..a252e3d0c 100644 --- a/cmd/fsck_zfs/Makefile.am +++ b/cmd/fsck_zfs/Makefile.am @@ -1,7 +1,5 @@ -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -dist_sbin_SCRIPTS = fsck.zfs - -SUBSTFILES += $(dist_sbin_SCRIPTS) - +sbin_SCRIPTS += fsck.zfs +SHELLCHECKSCRIPTS += fsck.zfs +CLEANFILES += fsck.zfs +EXTRA_DIST += %D%/fsck.zfs.in +$(call SUBST,fsck.zfs,%D%/) diff --git a/cmd/fsck_zfs/fsck.zfs.in b/cmd/fsck_zfs/fsck.zfs.in index 37096902c..f0d4d2ec3 100755 --- a/cmd/fsck_zfs/fsck.zfs.in +++ b/cmd/fsck_zfs/fsck.zfs.in @@ -7,13 +7,13 @@ # see fsck.zfs(8) # -if [ "$#" = "0" ]; then +if [ $# -eq 0 ]; then echo "Usage: $0 [options] dataset…" >&2 exit 16 fi ret=0 -for dataset in "$@"; do +for dataset; do case "$dataset" in -*) continue diff --git a/cmd/mount_zfs/.gitignore b/cmd/mount_zfs/.gitignore deleted file mode 100644 index cd9254bde..000000000 --- a/cmd/mount_zfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mount.zfs diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am index a1f902c1c..0ba61abe5 100644 --- a/cmd/mount_zfs/Makefile.am +++ b/cmd/mount_zfs/Makefile.am @@ -1,23 +1,20 @@ -include $(top_srcdir)/config/Rules.am - # # Ignore the prefix for the mount helper. It must be installed in /sbin/ # because this path is hardcoded in the mount(8) for security reasons. # However, if needed, the configure option --with-mounthelperdir= can be used # to override the default install location. # -sbindir=$(mounthelperdir) -sbin_PROGRAMS = mount.zfs +mounthelper_PROGRAMS += mount.zfs +CPPCHECKTARGETS += mount.zfs mount_zfs_SOURCES = \ - mount_zfs.c + %D%/mount_zfs.c mount_zfs_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la mount_zfs_LDADD += $(LTLIBINTL) -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += mount.zfs +CPPCHECKTARGETS += raidz_test diff --git a/cmd/raidz_test/.gitignore b/cmd/raidz_test/.gitignore deleted file mode 100644 index f8b83d9cc..000000000 --- a/cmd/raidz_test/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/raidz_test diff --git a/cmd/raidz_test/Makefile.am b/cmd/raidz_test/Makefile.am index 86ac3cc94..3b8b60568 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -1,20 +1,16 @@ -include $(top_srcdir)/config/Rules.am +raidz_test_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) +raidz_test_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -AM_CFLAGS += $(KERNEL_CFLAGS) -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) - -bin_PROGRAMS = raidz_test +bin_PROGRAMS += raidz_test +CPPCHECKTARGETS += raidz_test raidz_test_SOURCES = \ - raidz_test.h \ - raidz_test.c \ - raidz_bench.c + %D%/raidz_bench.c \ + %D%/raidz_test.c \ + %D%/raidz_test.h raidz_test_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la + libzpool.la \ + libzfs_core.la raidz_test_LDADD += -lm - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += raidz_test diff --git a/cmd/vdev_id/Makefile.am b/cmd/vdev_id/Makefile.am index 4071c6d5e..ca57a9107 100644 --- a/cmd/vdev_id/Makefile.am +++ b/cmd/vdev_id/Makefile.am @@ -1,3 +1,2 @@ -include $(top_srcdir)/config/Shellcheck.am - -dist_udev_SCRIPTS = vdev_id +dist_udev_SCRIPTS += %D%/vdev_id +# TODO: #12084: SHELLCHECKSCRIPTS += %D%/vdev_id diff --git a/cmd/zdb/.gitignore b/cmd/zdb/.gitignore deleted file mode 100644 index f64a3fc5a..000000000 --- a/cmd/zdb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zdb diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index 032132bc6..b80f38b3f 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -1,18 +1,14 @@ -include $(top_srcdir)/config/Rules.am +zdb_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS = zdb +sbin_PROGRAMS += zdb +CPPCHECKTARGETS += zdb zdb_SOURCES = \ - zdb.c \ - zdb_il.c \ - zdb.h + %D%/zdb.c \ + %D%/zdb.h \ + %D%/zdb_il.c zdb_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zdb + libzpool.la \ + libzfs_core.la \ + libnvpair.la diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index b509516f9..6eea1a135 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -1,54 +1,46 @@ -include $(top_srcdir)/config/Rules.am -include $(top_srcdir)/config/Shellcheck.am +include $(srcdir)/%D%/zed.d/Makefile.am -AM_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS) +zed_CFLAGS = $(AM_CFLAGS) +zed_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS) -SUBDIRS = zed.d -SHELLCHECKDIRS = $(SUBDIRS) +sbin_PROGRAMS += zed +CPPCHECKTARGETS += zed -sbin_PROGRAMS = zed - -ZED_SRC = \ - zed.c \ - zed.h \ - zed_conf.c \ - zed_conf.h \ - zed_disk_event.c \ - zed_disk_event.h \ - zed_event.c \ - zed_event.h \ - zed_exec.c \ - zed_exec.h \ - zed_file.c \ - zed_file.h \ - zed_log.c \ - zed_log.h \ - zed_strings.c \ - zed_strings.h - -FMA_SRC = \ - agents/zfs_agents.c \ - agents/zfs_agents.h \ - agents/zfs_diagnosis.c \ - agents/zfs_mod.c \ - agents/zfs_retire.c \ - agents/fmd_api.c \ - agents/fmd_api.h \ - agents/fmd_serd.c \ - agents/fmd_serd.h - -zed_SOURCES = $(ZED_SRC) $(FMA_SRC) +zed_SOURCES = \ + %D%/zed.c \ + %D%/zed.h \ + %D%/zed_conf.c \ + %D%/zed_conf.h \ + %D%/zed_disk_event.c \ + %D%/zed_disk_event.h \ + %D%/zed_event.c \ + %D%/zed_event.h \ + %D%/zed_exec.c \ + %D%/zed_exec.h \ + %D%/zed_file.c \ + %D%/zed_file.h \ + %D%/zed_log.c \ + %D%/zed_log.h \ + %D%/zed_strings.c \ + %D%/zed_strings.h \ + \ + %D%/agents/fmd_api.c \ + %D%/agents/fmd_api.h \ + %D%/agents/fmd_serd.c \ + %D%/agents/fmd_serd.h \ + %D%/agents/zfs_agents.c \ + %D%/agents/zfs_agents.h \ + %D%/agents/zfs_diagnosis.c \ + %D%/agents/zfs_mod.c \ + %D%/agents/zfs_retire.c zed_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la \ + libuutil.la zed_LDADD += -lrt $(LIBATOMIC_LIBS) $(LIBUDEV_LIBS) $(LIBUUID_LIBS) zed_LDFLAGS = -pthread -EXTRA_DIST = agents/README.md - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zed +EXTRA_DIST += $(addprefix %D%/,agents/README.md) diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 3efcfb362..122d2c0c5 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -1,36 +1,27 @@ -include $(top_srcdir)/config/Rules.am -include $(top_srcdir)/config/Substfiles.am -include $(top_srcdir)/config/Shellcheck.am - -EXTRA_DIST += README - zedconfdir = $(sysconfdir)/zfs/zed.d - dist_zedconf_DATA = \ - zed-functions.sh \ - zed.rc - -SHELLCHECKSCRIPTS = zed-functions.sh zed.rc -SHELLCHECK_SHELL = sh + %D%/zed-functions.sh \ + %D%/zed.rc zedexecdir = $(zfsexecdir)/zed.d dist_zedexec_SCRIPTS = \ - all-debug.sh \ - all-syslog.sh \ - data-notify.sh \ - generic-notify.sh \ - resilver_finish-notify.sh \ - scrub_finish-notify.sh \ - statechange-led.sh \ - statechange-notify.sh \ - vdev_clear-led.sh \ - vdev_attach-led.sh \ - pool_import-led.sh \ - resilver_finish-start-scrub.sh \ - trim_finish-notify.sh + %D%/all-debug.sh \ + %D%/all-syslog.sh \ + %D%/data-notify.sh \ + %D%/generic-notify.sh \ + %D%/pool_import-led.sh \ + %D%/resilver_finish-notify.sh \ + %D%/resilver_finish-start-scrub.sh \ + %D%/scrub_finish-notify.sh \ + %D%/statechange-led.sh \ + %D%/statechange-notify.sh \ + %D%/trim_finish-notify.sh \ + %D%/vdev_attach-led.sh \ + %D%/vdev_clear-led.sh -nodist_zedexec_SCRIPTS = history_event-zfs-list-cacher.sh +nodist_zedexec_SCRIPTS = \ + %D%/history_event-zfs-list-cacher.sh SUBSTFILES += $(nodist_zedexec_SCRIPTS) @@ -38,22 +29,27 @@ zedconfdefaults = \ all-syslog.sh \ data-notify.sh \ history_event-zfs-list-cacher.sh \ + pool_import-led.sh \ resilver_finish-notify.sh \ + resilver_finish-start-scrub.sh \ scrub_finish-notify.sh \ statechange-led.sh \ statechange-notify.sh \ - vdev_clear-led.sh \ vdev_attach-led.sh \ - pool_import-led.sh \ - resilver_finish-start-scrub.sh + vdev_clear-led.sh -install-data-hook: +EXTRA_DIST += $(addprefix %D%/,README) + +INSTALL_DATA_HOOKS += zed-install-data-hook +zed-install-data-hook: $(MKDIR_P) "$(DESTDIR)$(zedconfdir)" - for f in $(zedconfdefaults); do \ - test -f "$(DESTDIR)$(zedconfdir)/$${f}" -o \ - -L "$(DESTDIR)$(zedconfdir)/$${f}" || \ - ln -s "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \ + set -x; for f in $(zedconfdefaults); do \ + [ -f "$(DESTDIR)$(zedconfdir)/$${f}" ] ||\ + [ -L "$(DESTDIR)$(zedconfdir)/$${f}" ] || \ + $(LN_S) "$(zedexecdir)/$${f}" "$(DESTDIR)$(zedconfdir)"; \ done +SHELLCHECKSCRIPTS += $(dist_zedconf_DATA) $(dist_zedexec_SCRIPTS) $(nodist_zedexec_SCRIPTS) +$(call SHELLCHECK_OPTS,$(dist_zedconf_DATA) $(dist_zedexec_SCRIPTS) $(nodist_zedexec_SCRIPTS)): SHELLCHECK_SHELL = sh # False positive: 1>&"${ZED_FLOCK_FD}" looks suspiciously similar to a >&filename bash extension -CHECKBASHISMS_IGNORE = -e 'should be >word 2>&1' -e '&"$${ZED_FLOCK_FD}"' +$(call SHELLCHECK_OPTS,$(dist_zedconf_DATA) $(dist_zedexec_SCRIPTS) $(nodist_zedexec_SCRIPTS)): CHECKBASHISMS_IGNORE = -e 'should be >word 2>&1' -e '&"$${ZED_FLOCK_FD}"' diff --git a/cmd/zfs/.gitignore b/cmd/zfs/.gitignore deleted file mode 100644 index 0fd9cc63a..000000000 --- a/cmd/zfs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zfs diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index ca5e823aa..8a3c13a1f 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -1,26 +1,22 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zfs +sbin_PROGRAMS += zfs +CPPCHECKTARGETS += zfs zfs_SOURCES = \ - zfs_iter.c \ - zfs_iter.h \ - zfs_main.c \ - zfs_util.h \ - zfs_project.c \ - zfs_projectutil.h + %D%/zfs_iter.c \ + %D%/zfs_iter.h \ + %D%/zfs_main.c \ + %D%/zfs_project.c \ + %D%/zfs_projectutil.h \ + %D%/zfs_util.h zfs_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la \ + libuutil.la zfs_LDADD += $(LTLIBINTL) if BUILD_FREEBSD zfs_LDADD += -lgeom -ljail endif - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zfs diff --git a/cmd/zfs_ids_to_path/.gitignore b/cmd/zfs_ids_to_path/.gitignore deleted file mode 100644 index f95f853e4..000000000 --- a/cmd/zfs_ids_to_path/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zfs_ids_to_path diff --git a/cmd/zfs_ids_to_path/Makefile.am b/cmd/zfs_ids_to_path/Makefile.am index c57f1d977..09ddd8116 100644 --- a/cmd/zfs_ids_to_path/Makefile.am +++ b/cmd/zfs_ids_to_path/Makefile.am @@ -1,12 +1,8 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zfs_ids_to_path +sbin_PROGRAMS += zfs_ids_to_path +CPPCHECKTARGETS += zfs_ids_to_path zfs_ids_to_path_SOURCES = \ - zfs_ids_to_path.c + %D%/zfs_ids_to_path.c zfs_ids_to_path_LDADD = \ - $(abs_top_builddir)/libzfs.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zfs_ids_to_path + libzfs.la diff --git a/cmd/zgenhostid/.gitignore b/cmd/zgenhostid/.gitignore deleted file mode 100644 index 072246c73..000000000 --- a/cmd/zgenhostid/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zgenhostid diff --git a/cmd/zgenhostid/Makefile.am b/cmd/zgenhostid/Makefile.am index 96799a5a2..722950eb7 100644 --- a/cmd/zgenhostid/Makefile.am +++ b/cmd/zgenhostid/Makefile.am @@ -1,8 +1,5 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zgenhostid - -zgenhostid_SOURCES = zgenhostid.c - -include $(top_srcdir)/config/CppCheck.am +sbin_PROGRAMS += zgenhostid CPPCHECKTARGETS += zgenhostid + +zgenhostid_SOURCES = \ + %D%/zgenhostid.c diff --git a/cmd/zhack/.gitignore b/cmd/zhack/.gitignore deleted file mode 100644 index 763a18898..000000000 --- a/cmd/zhack/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zhack diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am index fa911e9e3..94fa76d14 100644 --- a/cmd/zhack/Makefile.am +++ b/cmd/zhack/Makefile.am @@ -1,16 +1,12 @@ -include $(top_srcdir)/config/Rules.am +zhack_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS = zhack +sbin_PROGRAMS += zhack +CPPCHECKTARGETS += zhack zhack_SOURCES = \ - zhack.c + %D%/zhack.c zhack_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zhack + libzpool.la \ + libzfs_core.la \ + libnvpair.la diff --git a/cmd/zinject/.gitignore b/cmd/zinject/.gitignore deleted file mode 100644 index bded84009..000000000 --- a/cmd/zinject/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zinject diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index 94a48f48b..c90f73fc0 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -1,16 +1,12 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zinject +sbin_PROGRAMS += zinject +CPPCHECKTARGETS += zinject zinject_SOURCES = \ - translate.c \ - zinject.c \ - zinject.h + %D%/translate.c \ + %D%/zinject.c \ + %D%/zinject.h zinject_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zinject + libzfs.la \ + libzfs_core.la \ + libnvpair.la diff --git a/cmd/zpool/.gitignore b/cmd/zpool/.gitignore deleted file mode 100644 index 8ea518af7..000000000 --- a/cmd/zpool/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zpool diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 12f2cd226..9ba72eadf 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -1,34 +1,35 @@ -include $(top_srcdir)/config/Rules.am -include $(top_srcdir)/config/Shellcheck.am +zpool_CFLAGS = $(AM_CFLAGS) +zpool_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) -AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) +zpool_CPPFLAGS = $(AM_CPPFLAGS) +zpool_CPPFLAGS += -I$(srcdir)/%D% -AM_CPPFLAGS += -I$(srcdir) - - -sbin_PROGRAMS = zpool +sbin_PROGRAMS += zpool +CPPCHECKTARGETS += zpool zpool_SOURCES = \ - zpool_iter.c \ - zpool_main.c \ - zpool_util.c \ - zpool_util.h \ - zpool_vdev.c + %D%/zpool_iter.c \ + %D%/zpool_main.c \ + %D%/zpool_util.c \ + %D%/zpool_util.h \ + %D%/zpool_vdev.c if BUILD_FREEBSD -zpool_SOURCES += os/freebsd/zpool_vdev_os.c +zpool_SOURCES += \ + %D%/os/freebsd/zpool_vdev_os.c endif if BUILD_LINUX -zpool_SOURCES += os/linux/zpool_vdev_os.c +zpool_SOURCES += \ + %D%/os/linux/zpool_vdev_os.c endif zpool_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la \ - $(abs_top_builddir)/libuutil.la \ - $(abs_top_builddir)/libzutil.la + libzfs.la \ + libzfs_core.la \ + libnvpair.la \ + libuutil.la \ + libzutil.la zpool_LDADD += $(LTLIBINTL) @@ -37,57 +38,53 @@ zpool_LDADD += -lgeom endif zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zpool +EXTRA_DIST += $(addprefix %D%/,zpool.d/README compatibility.d) -zpoolconfdir = $(sysconfdir)/zfs/zpool.d +SHELLCHECKSCRIPTS += $(dist_zpoolexec_SCRIPTS) zpoolexecdir = $(zfsexecdir)/zpool.d - -EXTRA_DIST = zpool.d/README compatibility.d - dist_zpoolexec_SCRIPTS = \ - zpool.d/dm-deps \ - zpool.d/enc \ - zpool.d/encdev \ - zpool.d/fault_led \ - zpool.d/iostat \ - zpool.d/iostat-1s \ - zpool.d/iostat-10s \ - zpool.d/label \ - zpool.d/locate_led \ - zpool.d/lsblk \ - zpool.d/media \ - zpool.d/model \ - zpool.d/serial \ - zpool.d/ses \ - zpool.d/size \ - zpool.d/slot \ - zpool.d/smart \ - zpool.d/smartx \ - zpool.d/temp \ - zpool.d/health \ - zpool.d/r_proc \ - zpool.d/w_proc \ - zpool.d/r_ucor \ - zpool.d/w_ucor \ - zpool.d/nonmed \ - zpool.d/defect \ - zpool.d/hours_on \ - zpool.d/realloc \ - zpool.d/rep_ucor \ - zpool.d/cmd_to \ - zpool.d/pend_sec \ - zpool.d/off_ucor \ - zpool.d/ata_err \ - zpool.d/nvme_err \ - zpool.d/pwr_cyc \ - zpool.d/upath \ - zpool.d/vendor \ - zpool.d/smart_test \ - zpool.d/test_type \ - zpool.d/test_status \ - zpool.d/test_progress \ - zpool.d/test_ended + %D%/zpool.d/ata_err \ + %D%/zpool.d/cmd_to \ + %D%/zpool.d/defect \ + %D%/zpool.d/dm-deps \ + %D%/zpool.d/enc \ + %D%/zpool.d/encdev \ + %D%/zpool.d/fault_led \ + %D%/zpool.d/health \ + %D%/zpool.d/hours_on \ + %D%/zpool.d/iostat \ + %D%/zpool.d/iostat-10s \ + %D%/zpool.d/iostat-1s \ + %D%/zpool.d/label \ + %D%/zpool.d/locate_led \ + %D%/zpool.d/lsblk \ + %D%/zpool.d/media \ + %D%/zpool.d/model \ + %D%/zpool.d/nonmed \ + %D%/zpool.d/nvme_err \ + %D%/zpool.d/off_ucor \ + %D%/zpool.d/pend_sec \ + %D%/zpool.d/pwr_cyc \ + %D%/zpool.d/r_proc \ + %D%/zpool.d/r_ucor \ + %D%/zpool.d/realloc \ + %D%/zpool.d/rep_ucor \ + %D%/zpool.d/serial \ + %D%/zpool.d/ses \ + %D%/zpool.d/size \ + %D%/zpool.d/slot \ + %D%/zpool.d/smart \ + %D%/zpool.d/smart_test \ + %D%/zpool.d/smartx \ + %D%/zpool.d/temp \ + %D%/zpool.d/test_ended \ + %D%/zpool.d/test_progress \ + %D%/zpool.d/test_status \ + %D%/zpool.d/test_type \ + %D%/zpool.d/upath \ + %D%/zpool.d/vendor \ + %D%/zpool.d/w_proc \ + %D%/zpool.d/w_ucor zpoolconfdefaults = \ dm-deps \ @@ -134,29 +131,28 @@ zpoolconfdefaults = \ test_ended zpoolcompatdir = $(pkgdatadir)/compatibility.d - dist_zpoolcompat_DATA = \ - compatibility.d/compat-2018 \ - compatibility.d/compat-2019 \ - compatibility.d/compat-2020 \ - compatibility.d/compat-2021 \ - compatibility.d/freebsd-11.0 \ - compatibility.d/freebsd-11.2 \ - compatibility.d/freebsd-11.3 \ - compatibility.d/freenas-9.10.2 \ - compatibility.d/grub2 \ - compatibility.d/openzfsonosx-1.7.0 \ - compatibility.d/openzfsonosx-1.8.1 \ - compatibility.d/openzfsonosx-1.9.3 \ - compatibility.d/openzfs-2.0-freebsd \ - compatibility.d/openzfs-2.0-linux \ - compatibility.d/openzfs-2.1-freebsd \ - compatibility.d/openzfs-2.1-linux \ - compatibility.d/zol-0.6.1 \ - compatibility.d/zol-0.6.4 \ - compatibility.d/zol-0.6.5 \ - compatibility.d/zol-0.7 \ - compatibility.d/zol-0.8 + %D%/compatibility.d/compat-2018 \ + %D%/compatibility.d/compat-2019 \ + %D%/compatibility.d/compat-2020 \ + %D%/compatibility.d/compat-2021 \ + %D%/compatibility.d/freebsd-11.0 \ + %D%/compatibility.d/freebsd-11.2 \ + %D%/compatibility.d/freebsd-11.3 \ + %D%/compatibility.d/freenas-9.10.2 \ + %D%/compatibility.d/grub2 \ + %D%/compatibility.d/openzfs-2.0-freebsd \ + %D%/compatibility.d/openzfs-2.0-linux \ + %D%/compatibility.d/openzfs-2.1-freebsd \ + %D%/compatibility.d/openzfs-2.1-linux \ + %D%/compatibility.d/openzfsonosx-1.7.0 \ + %D%/compatibility.d/openzfsonosx-1.8.1 \ + %D%/compatibility.d/openzfsonosx-1.9.3 \ + %D%/compatibility.d/zol-0.6.1 \ + %D%/compatibility.d/zol-0.6.4 \ + %D%/compatibility.d/zol-0.6.5 \ + %D%/compatibility.d/zol-0.7 \ + %D%/compatibility.d/zol-0.8 # canonical <- alias symbolic link pairs # eg: "2018" is a link to "compat-2018" @@ -179,13 +175,16 @@ zpoolcompatlinks = \ "zol-0.7 ubuntu-18.04" \ "zol-0.8 ubuntu-20.04" -install-data-hook: +zpoolconfdir = $(sysconfdir)/zfs/zpool.d +INSTALL_DATA_HOOKS += zpool-install-data-hook +zpool-install-data-hook: $(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)" - for f in $(zpoolconfdefaults); do \ - test -f "$(DESTDIR)$(zpoolconfdir)/$${f}" -o \ - -L "$(DESTDIR)$(zpoolconfdir)/$${f}" || \ - ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ + set -x; for f in $(zpoolconfdefaults); do \ + [ -f "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \ + [ -L "$(DESTDIR)$(zpoolconfdir)/$${f}" ] || \ + $(LN_S) "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ done - for l in $(zpoolcompatlinks); do \ - (cd "$(DESTDIR)$(zpoolcompatdir)"; ln -sf $${l} ); \ + set -x; printf '%s\n' $(zpoolcompatlinks) | \ + while read -r canon alias; do \ + $(LN_S) -f "$${canon}" "$(DESTDIR)$(zpoolcompatdir)/$${alias}"; \ done diff --git a/cmd/zpool_influxdb/.gitignore b/cmd/zpool_influxdb/.gitignore deleted file mode 100644 index bd765d188..000000000 --- a/cmd/zpool_influxdb/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/zpool_influxdb diff --git a/cmd/zpool_influxdb/Makefile.am b/cmd/zpool_influxdb/Makefile.am index 600108137..b237532ce 100644 --- a/cmd/zpool_influxdb/Makefile.am +++ b/cmd/zpool_influxdb/Makefile.am @@ -1,14 +1,10 @@ -include $(top_srcdir)/config/Rules.am - -zfsexec_PROGRAMS = zpool_influxdb +zfsexec_PROGRAMS += zpool_influxdb +CPPCHECKTARGETS += zpool_influxdb zpool_influxdb_SOURCES = \ - zpool_influxdb.c + %D%/zpool_influxdb.c zpool_influxdb_LDADD = \ - $(top_builddir)/libspl.la \ - $(top_builddir)/libnvpair.la \ - $(top_builddir)/libzfs.la - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zpool_influxdb + libspl.la \ + libnvpair.la \ + libzfs.la diff --git a/cmd/zstream/.gitignore b/cmd/zstream/.gitignore deleted file mode 100644 index fd1240d55..000000000 --- a/cmd/zstream/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zstream diff --git a/cmd/zstream/Makefile.am b/cmd/zstream/Makefile.am index 7749e94ba..9b2716ae0 100644 --- a/cmd/zstream/Makefile.am +++ b/cmd/zstream/Makefile.am @@ -1,21 +1,18 @@ -include $(top_srcdir)/config/Rules.am - -sbin_PROGRAMS = zstream - -zstream_SOURCES = \ - zstream.c \ - zstream.h \ - zstream_dump.c \ - zstream_redup.c \ - zstream_token.c - -zstream_LDADD = \ - $(abs_top_builddir)/libzfs.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la - -include $(top_srcdir)/config/CppCheck.am +sbin_PROGRAMS += zstream CPPCHECKTARGETS += zstream +zstream_SOURCES = \ + %D%/zstream.c \ + %D%/zstream.h \ + %D%/zstream_dump.c \ + %D%/zstream_redup.c \ + %D%/zstream_token.c + +zstream_LDADD = \ + libzfs.la \ + libzfs_core.la \ + libnvpair.la + +PHONY += install-exec-hook install-exec-hook: cd $(DESTDIR)$(sbindir) && $(LN_S) -f zstream zstreamdump diff --git a/cmd/ztest/.gitignore b/cmd/ztest/.gitignore deleted file mode 100644 index d3d498dae..000000000 --- a/cmd/ztest/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/ztest diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index 353e81eb7..e27643a44 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -1,24 +1,18 @@ -include $(top_srcdir)/config/Rules.am - -AM_CFLAGS += $(KERNEL_CFLAGS) - +ztest_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) # Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 -AM_CFLAGS += $(NO_FORMAT_TRUNCATION) +ztest_CFLAGS += $(NO_FORMAT_TRUNCATION) +ztest_CPPFLAGS = $(AM_CPPFLAGS) $(FORCEDEBUG_CPPFLAGS) -AM_CPPFLAGS += $(FORCEDEBUG_CPPFLAGS) - -sbin_PROGRAMS = ztest +sbin_PROGRAMS += ztest +CPPCHECKTARGETS += ztest ztest_SOURCES = \ - ztest.c + %D%/ztest.c ztest_LDADD = \ - $(abs_top_builddir)/libzpool.la \ - $(abs_top_builddir)/libzfs_core.la \ - $(abs_top_builddir)/libnvpair.la + libzpool.la \ + libzfs_core.la \ + libnvpair.la ztest_LDADD += -lm ztest_LDFLAGS = -pthread - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += ztest diff --git a/cmd/zvol_id/.gitignore b/cmd/zvol_id/.gitignore deleted file mode 100644 index 8b757a2d6..000000000 --- a/cmd/zvol_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zvol_id diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am index edac0adfc..7ba13205b 100644 --- a/cmd/zvol_id/Makefile.am +++ b/cmd/zvol_id/Makefile.am @@ -1,9 +1,5 @@ -include $(top_srcdir)/config/Rules.am - -udev_PROGRAMS = zvol_id +udev_PROGRAMS += zvol_id +CPPCHECKTARGETS += zvol_id zvol_id_SOURCES = \ - zvol_id_main.c - -include $(top_srcdir)/config/CppCheck.am -CPPCHECKTARGETS += zvol_id + %D%/zvol_id_main.c diff --git a/cmd/zvol_wait/Makefile.am b/cmd/zvol_wait/Makefile.am index 2e5bf3323..2d3736f75 100644 --- a/cmd/zvol_wait/Makefile.am +++ b/cmd/zvol_wait/Makefile.am @@ -1,3 +1,2 @@ -include $(top_srcdir)/config/Shellcheck.am - -dist_bin_SCRIPTS = zvol_wait +dist_bin_SCRIPTS += %D%/zvol_wait +SHELLCHECKSCRIPTS += %D%/zvol_wait diff --git a/config/Shellcheck.am b/config/Shellcheck.am index fb0bdedd3..873fb8eae 100644 --- a/config/Shellcheck.am +++ b/config/Shellcheck.am @@ -1,30 +1,46 @@ -.PHONY: shellcheck -shellcheck: $(SCRIPTS) $(SHELLCHECKSCRIPTS) - -# ShellCheck exclusions +# Global ShellCheck exclusions: # # ShellCheck can't follow non-constant source. Use a directive to specify location. [SC1090] # Not following: a was not specified as input (see shellcheck -x). [SC1091] # Prefer putting braces around variable references even when not strictly required. [SC2250] # In POSIX sh, 'local' is undefined. [SC2039] # older ShellCheck versions # In POSIX sh, 'local' is undefined. [SC3043] # newer ShellCheck versions -if HAVE_SHELLCHECK - [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; shellcheck --format=gcc --enable=all --exclude=SC1090,SC1091,SC2039,SC2250,SC3043 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") $(SHELLCHECK_OPTS) $(SCRIPTS) $(SHELLCHECKSCRIPTS) -else - @[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping shellcheck of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because shellcheck is not installed" -endif + +SHELLCHECKSCRIPTS = + +JUST_SHELLCHECK_OPTS = $(addprefix shellcheck-here-,$(subst /,^,$(1))) +JUST_CHECKBASHISMS_OPTS = $(addprefix checkbashisms-here-,$(subst /,^,$(1))) +SHELLCHECK_OPTS = $(call JUST_SHELLCHECK_OPTS,$(1)) $(call JUST_CHECKBASHISMS_OPTS,$(1)) + +.PHONY: shellcheck shellcheck-recursive + +shellcheck-recursive: @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir shellcheck; done +_STGT = $(subst ^,/,$(subst shellcheck-here-,,$@)) +shellcheck-here-%: +if HAVE_SHELLCHECK + shellcheck --format=gcc --enable=all --exclude=SC1090,SC1091,SC2039,SC2250,SC3043 $$([ -n "$(SHELLCHECK_SHELL)" ] && echo "--shell=$(SHELLCHECK_SHELL)") "$$([ -e "$(_STGT)" ] || echo "$(srcdir)/")$(_STGT)" +else + @echo "skipping shellcheck of" $(_STGT) "because shellcheck is not installed" +endif + +shellcheck: $(SHELLCHECKSCRIPTS) $(call JUST_SHELLCHECK_OPTS,$(SHELLCHECKSCRIPTS)) shellcheck-recursive + + +.PHONY: checkbashisms checkbashisms-recursive + +checkbashisms-recursive: + @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done # command -v *is* specified by POSIX and every shell in existence supports it -.PHONY: checkbashisms -checkbashisms: $(SCRIPTS) $(SHELLCHECKSCRIPTS) +_BTGT = $(subst ^,/,$(subst checkbashisms-here-,,$@)) +checkbashisms-here-%: if HAVE_CHECKBASHISMS - [ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; ! if [ -z "$(SHELLCHECK_SHELL)" ]; then \ - checkbashisms -npx $(SCRIPTS) $(SHELLCHECKSCRIPTS); else \ - for f in $(SCRIPTS) $(SHELLCHECKSCRIPTS); do echo $$f >&3; { echo '#!/bin/$(SHELLCHECK_SHELL)'; cat $$f; } | checkbashisms -npx; done; \ - fi 3>&2 2>&1 | grep -vFe "'command' with option other than -p" -e 'command -v' $(CHECKBASHISMS_IGNORE) >&2 + ! { [ -n "$(SHELLCHECK_SHELL)" ] && echo '#!/bin/$(SHELLCHECK_SHELL)'; cat "$$([ -e "$(_BTGT)" ] || echo "$(srcdir)/")$(_BTGT)"; } | \ + checkbashisms -npx 2>&1 | grep -vFe "'command' with option other than -p" -e 'command -v' -e 'any possible bashisms' $(CHECKBASHISMS_IGNORE) >&2 else - @[ -z "$(SCRIPTS)$(SHELLCHECKSCRIPTS)" ] && exit; echo "skipping checkbashisms of" $(SCRIPTS) $(SHELLCHECKSCRIPTS) "because checkbashisms is not installed" + @echo "skipping checkbashisms of" $(_BTGT) "because checkbashisms is not installed" endif - @set -e; for dir in $(SHELLCHECKDIRS); do $(MAKE) -C $$dir checkbashisms; done + +checkbashisms: $(SHELLCHECKSCRIPTS) $(call JUST_CHECKBASHISMS_OPTS,$(SHELLCHECKSCRIPTS)) checkbashisms-recursive diff --git a/config/Substfiles.am b/config/Substfiles.am index b051438fb..7f069877a 100644 --- a/config/Substfiles.am +++ b/config/Substfiles.am @@ -21,18 +21,22 @@ subst_sed_cmd = \ -e 's|@ASAN_ENABLED[@]|$(ASAN_ENABLED)|g' \ -e 's|@UBSAN_ENABLED[@]|$(UBSAN_ENABLED)|g' -SUBSTFILES = -CLEANFILES = $(SUBSTFILES) -EXTRA_DIST = $(SUBSTFILES:=.in) - -$(SUBSTFILES):%:%.in Makefile - $(AM_V_GEN)set -e; \ - $(MKDIR_P) $$(dirname $@); \ - $(RM) $@~; \ - $(SED) $(subst_sed_cmd) $< >$@~; \ - if grep -E '@[a-zA-Z0-9_]+@' $@~ >&2; then \ +define SUBST +$(1) : $(2)$(1).in Makefile; + $$(AM_V_GEN)set -e; \ + $$(MKDIR_P) $$(@D); \ + $$(RM) $$@~; \ + $$(SED) $$(subst_sed_cmd) $$< >$$@~; \ + if grep -E '@[a-zA-Z0-9_]+@' $$@~ >&2; then \ echo "Undefined substitution" >&2; \ exit 1; \ - else test $$? -eq 1; fi; \ - test -x $< && chmod +x $@~; \ - mv -f $@~ $@ + fi; \ + [ -x $$< ] && chmod +x $$@~; \ + mv -f $$@~ $$@ +endef + +SUBSTFILES = +CLEANFILES += $(SUBSTFILES) +EXTRA_DIST += $(SUBSTFILES:=.in) + +$(call SUBST,%,) diff --git a/configure.ac b/configure.ac index 981215995..106d1876e 100644 --- a/configure.ac +++ b/configure.ac @@ -66,28 +66,6 @@ ZFS_AC_DEBUG_INVARIANTS AC_CONFIG_FILES([ Makefile - cmd/Makefile - cmd/arc_summary/Makefile - cmd/arcstat/Makefile - cmd/dbufstat/Makefile - cmd/fsck_zfs/Makefile - cmd/mount_zfs/Makefile - cmd/raidz_test/Makefile - cmd/vdev_id/Makefile - cmd/zdb/Makefile - cmd/zed/Makefile - cmd/zed/zed.d/Makefile - cmd/zfs/Makefile - cmd/zfs_ids_to_path/Makefile - cmd/zgenhostid/Makefile - cmd/zhack/Makefile - cmd/zinject/Makefile - cmd/zpool/Makefile - cmd/zstream/Makefile - cmd/ztest/Makefile - cmd/zvol_id/Makefile - cmd/zvol_wait/Makefile - cmd/zpool_influxdb/Makefile contrib/Makefile contrib/bash_completion.d/Makefile contrib/bpftrace/Makefile diff --git a/contrib/bash_completion.d/Makefile.am b/contrib/bash_completion.d/Makefile.am index eee617802..0295843eb 100644 --- a/contrib/bash_completion.d/Makefile.am +++ b/contrib/bash_completion.d/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -8,5 +10,5 @@ noinst_DATA = zfs EXTRA_DIST += $(noinst_DATA) SUBSTFILES += $(noinst_DATA) -SHELLCHECKSCRIPTS = $(noinst_DATA) +SHELLCHECKSCRIPTS += $(noinst_DATA) SHELLCHECK_SHELL = bash diff --git a/contrib/bpftrace/Makefile.am b/contrib/bpftrace/Makefile.am index 05e4f1c50..7194ec689 100644 --- a/contrib/bpftrace/Makefile.am +++ b/contrib/bpftrace/Makefile.am @@ -4,4 +4,4 @@ EXTRA_DIST = \ taskqlatency.bt \ zfs-trace.sh -SHELLCHECKSCRIPTS = zfs-trace.sh +SHELLCHECKSCRIPTS += zfs-trace.sh diff --git a/contrib/dracut/02zfsexpandknowledge/Makefile.am b/contrib/dracut/02zfsexpandknowledge/Makefile.am index b1bbb6bd3..23fcc0a3c 100644 --- a/contrib/dracut/02zfsexpandknowledge/Makefile.am +++ b/contrib/dracut/02zfsexpandknowledge/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -6,3 +8,4 @@ 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 index 3f7050300..28bedfb39 100644 --- a/contrib/dracut/90zfs/Makefile.am +++ b/contrib/dracut/90zfs/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -22,3 +24,4 @@ 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/initramfs/Makefile.am b/contrib/initramfs/Makefile.am index 57e8f5c3a..5ee8e16a0 100644 --- a/contrib/initramfs/Makefile.am +++ b/contrib/initramfs/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/config/Shellcheck.am initrddir = /usr/share/initramfs-tools dist_initrd_SCRIPTS = \ - zfsunlock + zfsunlock SUBDIRS = conf.d conf-hooks.d hooks scripts SHELLCHECKDIRS = hooks scripts diff --git a/contrib/initramfs/hooks/Makefile.am b/contrib/initramfs/hooks/Makefile.am index 0cd1aafcd..e872c0a00 100644 --- a/contrib/initramfs/hooks/Makefile.am +++ b/contrib/initramfs/hooks/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -8,3 +10,4 @@ hooks_SCRIPTS = \ zfsunlock SUBSTFILES += $(hooks_SCRIPTS) +SHELLCHECKSCRIPTS += $(hooks_SCRIPTS) diff --git a/contrib/initramfs/scripts/Makefile.am b/contrib/initramfs/scripts/Makefile.am index 444a5f374..8b48f2056 100644 --- a/contrib/initramfs/scripts/Makefile.am +++ b/contrib/initramfs/scripts/Makefile.am @@ -9,3 +9,4 @@ 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 index f3dc23129..f64665f4b 100644 --- a/contrib/initramfs/scripts/local-top/Makefile.am +++ b/contrib/initramfs/scripts/local-top/Makefile.am @@ -3,5 +3,6 @@ include $(top_srcdir)/config/Shellcheck.am localtopdir = /usr/share/initramfs-tools/scripts/local-top dist_localtop_SCRIPTS = \ - zfs + zfs +SHELLCHECKSCRIPTS += $(dist_scripts_SCRIPTS) diff --git a/etc/default/Makefile.am b/etc/default/Makefile.am index 0f7c96698..98f22b8da 100644 --- a/etc/default/Makefile.am +++ b/etc/default/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -6,3 +8,4 @@ initconf_SCRIPTS = zfs SUBSTFILES += $(initconf_SCRIPTS) SHELLCHECK_SHELL = sh +SHELLCHECKSCRIPTS += $(initconf_SCRIPTS) diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am index 625d0b91f..0a997f445 100644 --- a/etc/init.d/Makefile.am +++ b/etc/init.d/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -8,3 +10,4 @@ init_SCRIPTS = zfs-import zfs-load-key zfs-mount zfs-share zfs-zed SUBSTFILES += $(init_SCRIPTS) SHELLCHECK_SHELL = sh +SHELLCHECKSCRIPTS += $(init_SCRIPTS) diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am index 5e65e1db4..b5fcddbf5 100644 --- a/etc/systemd/system/Makefile.am +++ b/etc/systemd/system/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am systemdpreset_DATA = \ diff --git a/etc/zfs/Makefile.am b/etc/zfs/Makefile.am index 8a67d548b..f62c687c6 100644 --- a/etc/zfs/Makefile.am +++ b/etc/zfs/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am include $(top_srcdir)/config/Shellcheck.am @@ -16,3 +18,4 @@ pkgsysconf_SCRIPTS = \ SUBSTFILES += $(pkgsysconf_SCRIPTS) SHELLCHECK_SHELL = sh +SHELLCHECKSCRIPTS += $(pkgsysconf_SCRIPTS) diff --git a/man/Makefile.am b/man/Makefile.am index 64650c2b9..e58683739 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am EXTRA_DIST += \ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 775759187..af7be462c 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -28,7 +28,7 @@ EXTRA_DIST = \ zol2zfs-patch.sed \ $(EXTRA_SCRIPTS) -SHELLCHECKSCRIPTS = $(EXTRA_SCRIPTS) +SHELLCHECKSCRIPTS += $(dist_pkgdata_SCRIPTS) $(EXTRA_SCRIPTS) define EXTRA_ENVIRONMENT @@ -37,13 +37,13 @@ export INTREE="yes" export GDB="libtool --mode=execute gdb" export LDMOD=/sbin/insmod -export CMD_DIR=@abs_top_builddir@/cmd +export CMD_DIR=@abs_top_builddir@ export UDEV_RULE_DIR=@abs_top_builddir@/udev/rules.d -export ZEDLET_ETC_DIR=$$CMD_DIR/zed/zed.d -export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/zed/zed.d -export ZPOOL_SCRIPT_DIR=$$CMD_DIR/zpool/zpool.d -export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/zpool/zpool.d -export ZPOOL_COMPAT_DIR=$$CMD_DIR/zpool/compatibility.d +export ZEDLET_ETC_DIR=$$CMD_DIR/cmd/zed/zed.d +export ZEDLET_LIBEXEC_DIR=$$CMD_DIR/cmd/zed/zed.d +export ZPOOL_SCRIPT_DIR=$$CMD_DIR/cmd/zpool/zpool.d +export ZPOOL_SCRIPTS_PATH=$$CMD_DIR/cmd/zpool/zpool.d +export ZPOOL_COMPAT_DIR=$$CMD_DIR/cmd/zpool/compatibility.d export CONTRIB_DIR=@abs_top_builddir@/contrib export LIB_DIR=@abs_top_builddir@/.libs export SYSCONF_DIR=@abs_top_builddir@/etc @@ -62,9 +62,9 @@ endef export EXTRA_ENVIRONMENT all-local: - -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/bin|' \ - -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@/bin|' \ - -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@/bin|' \ + -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/tests/zfs-tests/bin|' \ + -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@|' \ + -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@|' \ -e '\|^export ZTS_DIR=|s|$$|@abs_top_srcdir@/tests|' \ -e '\|^export SCRIPT_DIR=|s|$$|@abs_top_srcdir@/scripts|' \ $(abs_top_srcdir)/scripts/common.sh.in >common.sh diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index 93a047f22..5fa932dcc 100755 --- a/scripts/zfs-helpers.sh +++ b/scripts/zfs-helpers.sh @@ -18,7 +18,7 @@ # --sysconfdir=DIR install zfs configuration files [PREFIX/etc] # -BASE_DIR=$(dirname "$0") +BASE_DIR=${0%/*} SCRIPT_COMMON=common.sh if [ -f "${BASE_DIR}/${SCRIPT_COMMON}" ]; then . "${BASE_DIR}/${SCRIPT_COMMON}" @@ -46,7 +46,7 @@ msg() { usage() { cat << EOF USAGE: -$0 [dhirv] +$0 [-dhirv] DESCRIPTION: Install/remove the ZFS helper utilities. @@ -99,7 +99,7 @@ if [ "$INSTALL" = "no" ] && [ "$REMOVE" = "no" ]; then fail "Either -i or -r must be specified" fi -if [ "$(id -u)" != "0" ]; then +if [ "$(id -u)" != "0" ] && [ "$DRYRUN" = "no" ]; then fail "Must run as root" fi @@ -126,13 +126,13 @@ install() { echo "Symlink exists: $dst" elif [ -e "$dst" ]; then echo "File exists: $dst" - elif [ ! -e "$src" ]; then + elif ! [ -e "$src" ]; then echo "Source missing: $src" else msg "ln -s $src $dst" if [ "$DRYRUN" = "no" ]; then - DIR=$(dirname "$dst") + DIR=${dst%/*} mkdir -p "$DIR" >/dev/null 2>&1 ln -s "$src" "$dst" fi @@ -145,7 +145,7 @@ remove() { if [ -h "$dst" ]; then msg "rm $dst" rm "$dst" - DIR=$(dirname "$dst") + DIR=${dst%/*} rmdir "$DIR" >/dev/null 2>&1 elif [ -e "$dst" ]; then echo "Expected symlink: $dst" @@ -153,30 +153,23 @@ remove() { } if [ "${INSTALL}" = "yes" ]; then - install "$CMD_DIR/mount_zfs/mount.zfs" \ - "$INSTALL_MOUNT_HELPER_DIR/mount.zfs" - install "$CMD_DIR/fsck_zfs/fsck.zfs" \ - "$INSTALL_MOUNT_HELPER_DIR/fsck.zfs" - install "$CMD_DIR/zvol_id/zvol_id" \ - "$INSTALL_UDEV_DIR/zvol_id" - install "$CMD_DIR/vdev_id/vdev_id" \ - "$INSTALL_UDEV_DIR/vdev_id" - install "$UDEV_RULE_DIR/60-zvol.rules" \ - "$INSTALL_UDEV_RULE_DIR/60-zvol.rules" - install "$UDEV_RULE_DIR/69-vdev.rules" \ - "$INSTALL_UDEV_RULE_DIR/69-vdev.rules" - install "$UDEV_RULE_DIR/90-zfs.rules" \ - "$INSTALL_UDEV_RULE_DIR/90-zfs.rules" - install "$CMD_DIR/zpool/zpool.d" \ - "$INSTALL_SYSCONF_DIR/zfs/zpool.d" - install "$CONTRIB_DIR/pyzfs/libzfs_core" \ - "$INSTALL_PYTHON_DIR/libzfs_core" + for cmd in "mount.zfs" "fsck.zfs"; do + install "$CMD_DIR/$cmd" "$INSTALL_MOUNT_HELPER_DIR/$cmd" + done + for udev in "$CMD_DIR/zvol_id" "$UDEV_SCRIPT_DIR/vdev_id"; do + install "$udev" "$INSTALL_UDEV_DIR/${udev##*/}" + done + for rule in "60-zvol.rules" "69-vdev.rules" "90-zfs.rules"; do + install "$UDEV_RULE_DIR/$rule" "$INSTALL_UDEV_RULE_DIR/$rule" + done + install "$ZPOOL_SCRIPT_DIR" "$INSTALL_SYSCONF_DIR/zfs/zpool.d" + install "$CONTRIB_DIR/pyzfs/libzfs_core" "$INSTALL_PYTHON_DIR/libzfs_core" # Ideally we would install these in the configured ${libdir}, which is # by default "/usr/local/lib and unfortunately not included in the # dynamic linker search path. - install "$(find "$LIB_DIR" -type f -name 'libzfs_core.so*')" "/lib/libzfs_core.so" - install "$(find "$LIB_DIR" -type f -name 'libnvpair.so*')" "/lib/libnvpair.so" - ldconfig + install "$LIB_DIR"/libzfs_core.so.?.?.? "/lib/libzfs_core.so" + install "$LIB_DIR"/libnvpair.so.?.?.? "/lib/libnvpair.so" + [ "$DRYRUN" = "no" ] && ldconfig else remove "$INSTALL_MOUNT_HELPER_DIR/mount.zfs" remove "$INSTALL_MOUNT_HELPER_DIR/fsck.zfs" diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index df69325a1..cad65d048 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -248,7 +248,7 @@ constrain_path() { SYSTEM_DIRS="$SYSTEM_DIRS /usr/bin /usr/sbin /bin /sbin $LIBEXEC_DIR" if [ "$INTREE" = "yes" ]; then - # Constrained path set to ./zfs/bin/ + # Constrained path set to $(top_builddir)/tests/zfs-tests/bin STF_PATH="$BIN_DIR" STF_PATH_REMOVE="no" STF_MISSING_BIN="" @@ -258,14 +258,10 @@ constrain_path() { fi # Special case links for standard zfs utilities - DIRS="$(find "$CMD_DIR" -type d \( ! -name .deps -a \ - ! -name .libs \) -print | tr '\n' ' ')" - create_links "$DIRS" "$ZFS_FILES" + create_links "$CMD_DIR" "$ZFS_FILES" # Special case links for zfs test suite utilities - DIRS="$(find "$STF_SUITE" -type d \( ! -name .deps -a \ - ! -name .libs \) -print | tr '\n' ' ')" - create_links "$DIRS" "$ZFSTEST_FILES" + create_links "$CMD_DIR/tests/zfs-tests/cmd" "$ZFSTEST_FILES" else # Constrained path set to /var/tmp/constrained_path.* SYSTEMDIR=${SYSTEMDIR:-/var/tmp/constrained_path.XXXXXX} diff --git a/scripts/zimport.sh b/scripts/zimport.sh index 14d2813ce..595de494e 100755 --- a/scripts/zimport.sh +++ b/scripts/zimport.sh @@ -235,8 +235,8 @@ src_set_vars() { ZFS_CMD=$(command -v zfs) ZFS_SH="/usr/share/zfs/zfs.sh" else - ZPOOL_CMD="./cmd/zpool/zpool" - ZFS_CMD="./cmd/zfs/zfs" + ZPOOL_CMD="./zpool" + ZFS_CMD="./zfs" ZFS_SH="./scripts/zfs.sh" fi } diff --git a/tests/Makefile.am b/tests/Makefile.am index 1dfc2cc5f..731915498 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -4,5 +4,4 @@ SUBDIRS = runfiles test-runner zfs-tests EXTRA_DIST = README.md -SHELLCHECKSCRIPTS = $$(find . -name '*.sh') -.PHONY: $(SHELLCHECKSCRIPTS) +SHELLCHECKSCRIPTS += $(shell find $(srcdir) -name '*.sh') diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am index e11e55fff..74b98fa69 100644 --- a/tests/test-runner/bin/Makefile.am +++ b/tests/test-runner/bin/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am pkgdatadir = $(datadir)/@PACKAGE@/test-runner/bin diff --git a/tests/zfs-tests/.gitignore b/tests/zfs-tests/.gitignore new file mode 100644 index 000000000..ba077a403 --- /dev/null +++ b/tests/zfs-tests/.gitignore @@ -0,0 +1 @@ +bin diff --git a/tests/zfs-tests/include/Makefile.am b/tests/zfs-tests/include/Makefile.am index 16cdf2c81..b6f723267 100644 --- a/tests/zfs-tests/include/Makefile.am +++ b/tests/zfs-tests/include/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/include diff --git a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am index 26c5ac595..081789637 100644 --- a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am pkgpyzfsdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pyzfs diff --git a/udev/rules.d/Makefile.am b/udev/rules.d/Makefile.am index 72f47d6f2..c62b05e53 100644 --- a/udev/rules.d/Makefile.am +++ b/udev/rules.d/Makefile.am @@ -1,3 +1,5 @@ +CLEANFILES = +EXTRA_DIST = include $(top_srcdir)/config/Substfiles.am udevrule_DATA = \