pkg.sh build: Support -a / --include-vcs-files

pkg.sh by default doesn't pack up version control metadata. Passing
-a or --include-vcs-files includes them in the source packages.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-12-01 11:31:51 +01:00
commit e42e3b783b

View file

@ -90,7 +90,7 @@ scm_files()
{ {
( (
cd $TOPDIR cd $TOPDIR
/bin/bash $JWB_SCRIPT_DIR/scm.sh ls-files -f $@ /bin/bash $JWB_SCRIPT_DIR/scm.sh ls-files -f "$@"
) )
} }
@ -401,6 +401,23 @@ cmd_version()
build_pkg() build_pkg()
{ {
local scm_files_opts=""
eval set -- `getopt -o a -l include-vcs-files -- "$@"`
while [ "$1" != -- ]; do
case $1 in
-a|--include-vcs-files)
scm_files_opts="$scm_files_opts -a"
;;
*)
echo -e "Unexpected argument >$1<\n" >&2
exit 1
;;
esac
shift
done
shift
set -e set -e
local version=`read_map $TOPDIR/VERSION | sed 's/-dev//'` local version=`read_map $TOPDIR/VERSION | sed 's/-dev//'`
@ -425,7 +442,7 @@ build_pkg()
create_empty_dir $src_tree "Source files compilation directory" create_empty_dir $src_tree "Source files compilation directory"
# --- copy source files over # --- copy source files over
scm_files | scm_files $scm_files_opts |
grep -v VERSION | grep -v VERSION |
cpio -o -H newc | cpio -o -H newc |
( cd $src_tree; cpio -m --make-directories -i) ( cd $src_tree; cpio -m --make-directories -i)
@ -673,7 +690,7 @@ EOT
cmd_build() cmd_build()
{ {
build_pkg build_pkg "$@"
} }
cmd_upload() cmd_upload()
@ -1191,11 +1208,11 @@ version)
build) build)
check_cwd check_cwd
rm -rf ./$DIST_SRC_DIR ./$DIST_PCKG_DIR rm -rf ./$DIST_SRC_DIR ./$DIST_PCKG_DIR
cmd_build cmd_build "$@"
;; ;;
release-reinstall) release-reinstall)
check_update_version -c "Start version" check_update_version -c "Start version"
cmd_build cmd_build "$@"
cmd_upload cmd_upload
;; ;;
release) release)
@ -1206,7 +1223,7 @@ release)
check_cwd check_cwd
rm -rf ./$DIST_SRC_DIR ./$DIST_PCKG_DIR rm -rf ./$DIST_SRC_DIR ./$DIST_PCKG_DIR
check_update_version || true check_update_version || true
cmd_build cmd_build "$@"
check_pkg_reinstall check_pkg_reinstall
cmd_upload cmd_upload
} }
@ -1234,4 +1251,3 @@ milk-install-log)
esac esac
goodbye goodbye