Skip to content

Commit

Permalink
autoconf: use include directives instead of recursing down cmd
Browse files Browse the repository at this point in the history
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 <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316
  • Loading branch information
nabijaczleweli authored and behlendorf committed May 10, 2022
1 parent 3ff81c4 commit 5cdca5b
Show file tree
Hide file tree
Showing 68 changed files with 508 additions and 528 deletions.
90 changes: 54 additions & 36 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
#
Expand All @@ -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
32 changes: 20 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
50 changes: 33 additions & 17 deletions cmd/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
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

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 BUILD_LINUX
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
SUBDIRS += arcstat arc_summary dbufstat
include $(srcdir)/%D%/arc_summary/Makefile.am
include $(srcdir)/%D%/arcstat/Makefile.am
include $(srcdir)/%D%/dbufstat/Makefile.am
endif

if BUILD_LINUX
SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait
CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id
SHELLCHECKDIRS += zed
endif
PHONY += cmd
cmd: $(bin_SCRIPTS) $(bin_PROGRAMS) $(sbin_SCRIPTS) $(sbin_PROGRAMS) $(udev_PROGRAMS) $(dist_bin_SCRIPTS) $(zfsexec_PROGRAMS) $(dist_udev_SCRIPTS) $(mounthelper_PROGRAMS)
1 change: 0 additions & 1 deletion cmd/arc_summary/.gitignore

This file was deleted.

12 changes: 6 additions & 6 deletions cmd/arc_summary/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 $< $@
1 change: 0 additions & 1 deletion cmd/arcstat/.gitignore

This file was deleted.

9 changes: 4 additions & 5 deletions cmd/arcstat/Makefile.am
Original file line number Diff line number Diff line change
@@ -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%/)
1 change: 0 additions & 1 deletion cmd/dbufstat/.gitignore

This file was deleted.

9 changes: 4 additions & 5 deletions cmd/dbufstat/Makefile.am
Original file line number Diff line number Diff line change
@@ -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%/)
1 change: 0 additions & 1 deletion cmd/fsck_zfs/.gitignore

This file was deleted.

12 changes: 5 additions & 7 deletions cmd/fsck_zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -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%/)
4 changes: 2 additions & 2 deletions cmd/fsck_zfs/fsck.zfs.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cmd/mount_zfs/.gitignore

This file was deleted.

17 changes: 7 additions & 10 deletions cmd/mount_zfs/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion cmd/raidz_test/.gitignore

This file was deleted.

22 changes: 9 additions & 13 deletions cmd/raidz_test/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
5 changes: 2 additions & 3 deletions cmd/vdev_id/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion cmd/zdb/.gitignore

This file was deleted.

Loading

0 comments on commit 5cdca5b

Please sign in to comment.