From 88b5653b06c99342b2aa57cf4864b29dc33c6923 Mon Sep 17 00:00:00 2001 From: Gleb Chesnokov Date: Sun, 18 Oct 2026 12:59:18 +0300 Subject: [PATCH] scripts: Group source maintenance helpers under source/ Keep source inventory, cleanup and shell lint helpers together. Update the Makefile, Debian packaging, scstadmin and the kernel, release and existing checkpatch callers in the same commit so each consumer uses a valid path. Keep run-shellcheck rooted at scripts/ after the move, preserving its coverage of all tracked Bash helpers. Source selection and the existing checkpatch exclusions are unchanged. --- Makefile | 8 ++++---- debian/copyright | 2 +- debian/rules | 4 ++-- scripts/checkpatch_scan | 2 +- scripts/generate-patched-kernel | 2 +- scripts/generate-release-archive | 2 +- scripts/run-regression-tests | 2 +- scripts/{ => source}/clean-source-tree | 0 scripts/{ => source}/list-double-blank-lines | 0 scripts/{ => source}/list-non-source-files | 0 scripts/{ => source}/list-source-files | 0 scripts/{ => source}/run-shellcheck | 5 +++-- scstadmin/Makefile | 2 +- 13 files changed, 15 insertions(+), 14 deletions(-) rename scripts/{ => source}/clean-source-tree (100%) rename scripts/{ => source}/list-double-blank-lines (100%) rename scripts/{ => source}/list-non-source-files (100%) rename scripts/{ => source}/list-source-files (100%) rename scripts/{ => source}/run-shellcheck (82%) diff --git a/Makefile b/Makefile index 9616f4110..196286f07 100644 --- a/Makefile +++ b/Makefile @@ -130,8 +130,8 @@ DOCKER_RPM_KERNEL_REPOSITORY ?= $(shell bash scripts/kernel-matrix rpm-field \ RPM_ARTIFACT_SOURCE_DIR ?= $(CURDIR) RPM_ARTIFACT_OUTPUT_DIR ?= $(CURDIR)/rpm-artifacts RPM_ARTIFACT_KERNEL_DEVEL_PACKAGE ?= kernel-devel -SCST_SOURCE_FILES = $(shell if [ -e scripts/list-source-files ]; then \ - scripts/list-source-files; \ +SCST_SOURCE_FILES = $(shell if [ -e scripts/source/list-source-files ]; then \ + scripts/source/list-source-files; \ else \ echo scripts-source-files-is-missing; \ fi) @@ -256,7 +256,7 @@ cov-build: done shellcheck: - scripts/run-shellcheck + scripts/source/run-shellcheck all clean extraclean install uninstall: if [ $@ = extraclean ]; then rm -f TAGS tags cscope.out; fi @@ -419,7 +419,7 @@ make-scst-dist = \ mkdir "$${name}-$(3)" && \ { \ { \ - scripts/list-source-files | grep -v '/\.gitignore' && \ + scripts/source/list-source-files | grep -v '/\.gitignore' && \ if [ -e debian/changelog ]; then echo debian/changelog; fi; \ if [ -e debian/compat ]; then echo debian/compat; fi; \ } | \ diff --git a/debian/copyright b/debian/copyright index 41c02f3ff..135d2919c 100644 --- a/debian/copyright +++ b/debian/copyright @@ -21,7 +21,7 @@ Files: Makefile scripts/generate-kernel-patch scripts/generate-patched-kernel scripts/generate-scst-patch - scripts/list-double-blank-lines + scripts/source/list-double-blank-lines scripts/monitor-memory-usage scripts/run-regression-tests scripts/specialize-patch diff --git a/debian/rules b/debian/rules index 41ec4f33e..e49450d80 100755 --- a/debian/rules +++ b/debian/rules @@ -60,7 +60,7 @@ VERSION:=$(shell head -n1 debian/changelog | sed 's/.*(\([0-9.]*\).*).*/\1/') clean: dh_testdir && \ dh_prep -Xqla_isp/TAGS -Xdebian/changelog && \ - scripts/clean-source-tree -x debian/changelog -x debian/compat -x debian/scst.preinst \ + scripts/source/clean-source-tree -x debian/changelog -x debian/compat -x debian/scst.preinst \ -x debian/scst.postinst build: @@ -108,7 +108,7 @@ install: done && \ cp debian/scst.dkms \ $(DESTDIR)/usr/src/scst-$(VERSION)/dkms.conf && \ - scripts/list-source-files | \ + scripts/source/list-source-files | \ grep -E '^Makefile$$|^(fcst|iscsi-scst|$(QLA_INI_DIR)|scst|$(SCST_LOCAL)|$(SCST_SRPT))/'|\ tar -T- -cf- | \ tar -C $(DESTDIR)/usr/src/scst-$(VERSION) -xf- && \ diff --git a/scripts/checkpatch_scan b/scripts/checkpatch_scan index b2ecaa463..b153040db 100755 --- a/scripts/checkpatch_scan +++ b/scripts/checkpatch_scan @@ -7,7 +7,7 @@ scriptsdir="${rootdir}/scripts" outputfile="checkpatch.out" mapfile -t src_files < <( - "${scriptsdir}/list-source-files" "${rootdir}" | \ + "${scriptsdir}/source/list-source-files" "${rootdir}" | \ grep -vE '^debian/|^fcst/linux-patches|patch$|pdf$|png$|^iscsi-scst/usr|^qla|^scripts/|^scstadmin/|^usr/|^www/' | \ while read -r filename; do echo "${rootdir}/$filename"; done) diff --git a/scripts/generate-patched-kernel b/scripts/generate-patched-kernel index 2f1b2fcff..a65157974 100755 --- a/scripts/generate-patched-kernel +++ b/scripts/generate-patched-kernel @@ -46,7 +46,7 @@ download_and_extract_kernel_tree "$1" || exit $? cd "${target}" || exit $? -"${script_dir}/list-source-files" "${scst_dir}" | +"${script_dir}/source/list-source-files" "${scst_dir}" | grep -- "-${kernel_version}.*.patch$" | grep -v /in-tree/ | while read -r p; do diff --git a/scripts/generate-release-archive b/scripts/generate-release-archive index 858abe199..c94f1be48 100755 --- a/scripts/generate-release-archive +++ b/scripts/generate-release-archive @@ -16,7 +16,7 @@ name="$1"; shift version="$1"; shift files=("$@") if [ "${#files[@]}" -eq 0 ]; then - file_list="$("$scriptdir/list-source-files")" || exit $? + file_list="$("$scriptdir/source/list-source-files")" || exit $? if [ -z "$file_list" ]; then echo "Error: no source files found." >&2 exit 1 diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 08c936a7e..bf28e7b6d 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -117,7 +117,7 @@ function test_scst_tree_patches { function duplicate_scst_source_tree { if [ -e "$1/AskingQuestions" ]; then ( set -o pipefail - "${scriptsdir}"/list-source-files "$1" | + "${scriptsdir}"/source/list-source-files "$1" | tar -C "$1" --files-from=- -c -f - | tar -x -f - ) diff --git a/scripts/clean-source-tree b/scripts/source/clean-source-tree similarity index 100% rename from scripts/clean-source-tree rename to scripts/source/clean-source-tree diff --git a/scripts/list-double-blank-lines b/scripts/source/list-double-blank-lines similarity index 100% rename from scripts/list-double-blank-lines rename to scripts/source/list-double-blank-lines diff --git a/scripts/list-non-source-files b/scripts/source/list-non-source-files similarity index 100% rename from scripts/list-non-source-files rename to scripts/source/list-non-source-files diff --git a/scripts/list-source-files b/scripts/source/list-source-files similarity index 100% rename from scripts/list-source-files rename to scripts/source/list-source-files diff --git a/scripts/run-shellcheck b/scripts/source/run-shellcheck similarity index 82% rename from scripts/run-shellcheck rename to scripts/source/run-shellcheck index 1b6b75f95..e5a281e9d 100755 --- a/scripts/run-shellcheck +++ b/scripts/source/run-shellcheck @@ -9,9 +9,10 @@ if ! command -v shellcheck >/dev/null 2>&1; then exit 1 fi -source_files="$("$script_dir/list-source-files" "$script_dir")" +scripts_root="$(dirname -- "$script_dir")" +source_files="$("$script_dir/list-source-files" "$scripts_root")" -cd "$script_dir" +cd "$scripts_root" bash_scripts=() while IFS= read -r file; do diff --git a/scstadmin/Makefile b/scstadmin/Makefile index 37cdd18e1..d37183da5 100644 --- a/scstadmin/Makefile +++ b/scstadmin/Makefile @@ -151,7 +151,7 @@ test: dist-gzip: name=$(shell basename $$PWD) && \ mkdir $${name}-$(VERSION) && \ - { ../scripts/list-source-files | tar -T- -cf- | \ + { ../scripts/source/list-source-files | tar -T- -cf- | \ tar -C $${name}-$(VERSION) -xf-; } && \ rm -f $${name}-$(VERSION).tar.bz2 && \ tar -cjf $${name}-$(VERSION).tar.bz2 $${name}-$(VERSION) && \