From a1c613c48dde7a881cfb479958a8a3898d4ccefc Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Sun, 2 Jan 2022 17:22:08 +0000 Subject: [PATCH] package: more flat view fixes (re: 336e82f9, aeda3502) bin/package, src/cmd/INIT/package.sh: - Automatically update an existing flat view even if 'flat' wasn't given for a make action. This stops a flat view becoming inaccurate if you forget to use 'bin/package flat make' consistently. If the $PACKAGEROOT/lib/package/gen directory exists, an existing flat view is assumed. - Correct symlink fallbacks. We need an absolute path for the symlink target or it's going to be broken. .gitignore: - Update. --- .gitignore | 41 ++++++++++++++++++++++++++++++++++++++--- bin/package | 30 +++++++++++++++++++----------- src/cmd/INIT/package.sh | 30 +++++++++++++++++++----------- 3 files changed, 76 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index f68096577..39a9f47c1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,10 @@ tgz lcl # Flat make libs, binaries, etc +*.a +*.o +*.req +FEATURE/ /bin/.paths /bin/crossexec /bin/execrate @@ -11,8 +15,9 @@ lcl /bin/iffe /bin/ksh /bin/mamake -/bin/proto /bin/mktest +/bin/ok/ +/bin/proto /bin/pty /bin/regress /bin/rt @@ -20,11 +25,41 @@ lcl /bin/suid_exec /fun/ /include/ -/lib/file/ -/lib/*.a +/lib/ /man/ +/src/cmd/INIT/crossexec +/src/cmd/INIT/execrate +/src/cmd/INIT/filter +/src/cmd/INIT/iffe +/src/cmd/INIT/ignore +/src/cmd/INIT/mamake +/src/cmd/INIT/mamprobe +/src/cmd/INIT/mktest +/src/cmd/INIT/mprobe +/src/cmd/INIT/package +/src/cmd/INIT/probe +/src/cmd/INIT/probe.ini +/src/cmd/INIT/probe.sh +/src/cmd/INIT/regress +/src/cmd/INIT/rt +/src/cmd/INIT/silent +/src/cmd/builtin/pty +/src/cmd/ksh93/ksh +/src/cmd/ksh93/shcomp +/src/cmd/ksh93/suid_exec +/src/lib/libast/*.h +/src/lib/libast/astmath.exe +/src/lib/libast/conf +/src/lib/libast/conftab.c +/src/lib/libast/lcgen +/src/lib/libast/lctab.c +/src/lib/libast/t.c +/src/lib/libcmd/cmdext.h +/src/lib/libcmd/cmdlist.h +/src/lib/libdll/dlldefs.h # Miscellaneous artefacts +*.dSYM/ *.bak *.sav *.old diff --git a/bin/package b/bin/package index 1559ef771..1a8c3b56e 100755 --- a/bin/package +++ b/bin/package @@ -109,12 +109,12 @@ command=${0##*/} case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in 0123) USAGE=$' [-? -@(#)$Id: '$command$' (ksh 93u+m) 2021-12-31 $ +@(#)$Id: '$command$' (ksh 93u+m) 2022-01-02 $ ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] [-copyright?(c) 1994-2012 AT&T Intellectual Property] -[-copyright?(c) 2020-2021 Contributors to https://github.com/ksh93/ksh] +[-copyright?(c) 2020-2022 Contributors to https://github.com/ksh93/ksh] [-license?http://www.eclipse.org/org/documents/epl-v10.html] [+NAME?'$command$' - build, test and install ksh 93u+m] [+DESCRIPTION?The \b'$command$'\b command is the main control script @@ -144,6 +144,8 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in [+flat?With the \bmake\b action, create a flat view by linking all files from \b$INSTALLROOT\b, minus \b*.old\b files, onto their corresponding path under \b$PACKAGEROOT\b. + Subsequent \bmake\b actions will update an existing flat view + whether or not \bflat\b is specified. Only one architecture can have a flat view. If \bflat\b is specified with the \bclean\b action, then only clean up this flat view and do not delete \b$INSTALLROOT\b.] @@ -406,9 +408,10 @@ DESCRIPTION Show environment and actions but do not execute. flat With the make action, create a flat view by linking all files from $INSTALLROOT, minus *.old files, onto their corresponding path under - $PACKAGEROOT. Only one architecture can have a flat view. If flat is - specified with the clean action, then only clean up this flat view - and do not delete $INSTALLROOT. + $PACKAGEROOT. Subsequent make actions will update an existing flat + view whether or not flat is specified. Only one architecture can have + a flat view. If flat is specified with the clean action, then only + clean up this flat view and do not delete $INSTALLROOT. force Force the action to override saved state. never Run make -N and show other actions. only Only operate on the specified packages. @@ -529,11 +532,11 @@ SEE ALSO mamake(1), pax(1), pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3) IMPLEMENTATION - version package (ksh 93u+m) 2021-12-31 + version package (ksh 93u+m) 2022-01-02 author Glenn Fowler author Contributors to https://github.com/ksh93/ksh copyright (c) 1994-2012 AT&T Intellectual Property - copyright (c) 2020-2021 Contributors to https://github.com/ksh93/ksh + copyright (c) 2020-2022 Contributors to https://github.com/ksh93/ksh license http://www.eclipse.org/org/documents/epl-v10.html' case $1 in html) echo "" ;; @@ -2778,7 +2781,7 @@ clean|clobber) then set -- "$@" "$p" # add to new PPs fi done - exec rm -f "$@" # rm all at once: fast + exec rm -f -- "$@" # rm all at once: fast ' "$0" {} + case $flat in 0) note "deleting arch/$HOSTTYPE" @@ -3351,13 +3354,18 @@ cat $j $k then set -- "$@" "$d" # add to new PPs fi done - exec rm -rf "$@" # rm all at once: fast + exec rm -rf -- "$@" # rm all at once: fast ' "$0" {} + ;; esac + if test -d "$PACKAGEROOT/lib/package/gen" + then a='updating' + flat=1 + else a='creating' + fi case $flat in - 1) note "updating flat view" + 1) note "$a flat view" cd "$PACKAGEROOT" || exit $exec find "arch/$HOSTTYPE" -type f ! -name '*.old' -exec "$SHELL" -c ' for h @@ -3365,7 +3373,7 @@ cat $j $k test "$h" -ef "$p" && continue # already created d=${p%/*} test -d "$d" || mkdir -p "$d" || exit - ln -f "$h" "$p" 2>/dev/null || ln -sf "$h" "$p" || exit + ln -f "$h" "$p" 2>/dev/null || ln -sf "$INSTALLROOT/$p" "$p" || exit done ' "$0" {} + ;; diff --git a/src/cmd/INIT/package.sh b/src/cmd/INIT/package.sh index 1559ef771..1a8c3b56e 100644 --- a/src/cmd/INIT/package.sh +++ b/src/cmd/INIT/package.sh @@ -109,12 +109,12 @@ command=${0##*/} case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in 0123) USAGE=$' [-? -@(#)$Id: '$command$' (ksh 93u+m) 2021-12-31 $ +@(#)$Id: '$command$' (ksh 93u+m) 2022-01-02 $ ] [-author?Glenn Fowler ] [-author?Contributors to https://github.com/ksh93/ksh] [-copyright?(c) 1994-2012 AT&T Intellectual Property] -[-copyright?(c) 2020-2021 Contributors to https://github.com/ksh93/ksh] +[-copyright?(c) 2020-2022 Contributors to https://github.com/ksh93/ksh] [-license?http://www.eclipse.org/org/documents/epl-v10.html] [+NAME?'$command$' - build, test and install ksh 93u+m] [+DESCRIPTION?The \b'$command$'\b command is the main control script @@ -144,6 +144,8 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in [+flat?With the \bmake\b action, create a flat view by linking all files from \b$INSTALLROOT\b, minus \b*.old\b files, onto their corresponding path under \b$PACKAGEROOT\b. + Subsequent \bmake\b actions will update an existing flat view + whether or not \bflat\b is specified. Only one architecture can have a flat view. If \bflat\b is specified with the \bclean\b action, then only clean up this flat view and do not delete \b$INSTALLROOT\b.] @@ -406,9 +408,10 @@ DESCRIPTION Show environment and actions but do not execute. flat With the make action, create a flat view by linking all files from $INSTALLROOT, minus *.old files, onto their corresponding path under - $PACKAGEROOT. Only one architecture can have a flat view. If flat is - specified with the clean action, then only clean up this flat view - and do not delete $INSTALLROOT. + $PACKAGEROOT. Subsequent make actions will update an existing flat + view whether or not flat is specified. Only one architecture can have + a flat view. If flat is specified with the clean action, then only + clean up this flat view and do not delete $INSTALLROOT. force Force the action to override saved state. never Run make -N and show other actions. only Only operate on the specified packages. @@ -529,11 +532,11 @@ SEE ALSO mamake(1), pax(1), pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3) IMPLEMENTATION - version package (ksh 93u+m) 2021-12-31 + version package (ksh 93u+m) 2022-01-02 author Glenn Fowler author Contributors to https://github.com/ksh93/ksh copyright (c) 1994-2012 AT&T Intellectual Property - copyright (c) 2020-2021 Contributors to https://github.com/ksh93/ksh + copyright (c) 2020-2022 Contributors to https://github.com/ksh93/ksh license http://www.eclipse.org/org/documents/epl-v10.html' case $1 in html) echo "" ;; @@ -2778,7 +2781,7 @@ clean|clobber) then set -- "$@" "$p" # add to new PPs fi done - exec rm -f "$@" # rm all at once: fast + exec rm -f -- "$@" # rm all at once: fast ' "$0" {} + case $flat in 0) note "deleting arch/$HOSTTYPE" @@ -3351,13 +3354,18 @@ cat $j $k then set -- "$@" "$d" # add to new PPs fi done - exec rm -rf "$@" # rm all at once: fast + exec rm -rf -- "$@" # rm all at once: fast ' "$0" {} + ;; esac + if test -d "$PACKAGEROOT/lib/package/gen" + then a='updating' + flat=1 + else a='creating' + fi case $flat in - 1) note "updating flat view" + 1) note "$a flat view" cd "$PACKAGEROOT" || exit $exec find "arch/$HOSTTYPE" -type f ! -name '*.old' -exec "$SHELL" -c ' for h @@ -3365,7 +3373,7 @@ cat $j $k test "$h" -ef "$p" && continue # already created d=${p%/*} test -d "$d" || mkdir -p "$d" || exit - ln -f "$h" "$p" 2>/dev/null || ln -sf "$h" "$p" || exit + ln -f "$h" "$p" 2>/dev/null || ln -sf "$INSTALLROOT/$p" "$p" || exit done ' "$0" {} + ;;