mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
package: reintroduce/rewrite flat view (re: 20f8557c)
I called the flat view featuritis, but it turns out the dtksh build system depends on it. But it was broken, so let's make a proper version instead. This new approach does not symlink directories before make, but hardlinks files after make. To make performance tolerable, it requires a modern POSIX 'find' utility with '{} +'. bin/package, src/cmd/INIT/package.sh: - We're going to depend on 'test X -ef Y' to check if X is the same file as Y, so add that to the $min_posix checks even though it is not technically POSIX. But it's so close to universally available it doesn't really make a difference. - After 'make', create a flat view by hardlinking arch/$HOSTTYPE files, minus build system internals, onto their corresponding paths in $PACKAGEROOT. Fall back to symlinking if hardlinking fails (this would happen when crossing device boundaries). - Clean up flat view when doing clean/clobber. This is done by using 'find' to loop through the files in arch/ again and removing any root paths that are the same file as their corresponding arch/ path (this is where test X -ef Y comes in). Then delete arch/$HOSTTYPE, then delete empty directories left. - Check for the 'flat' qualifier when doing clean/clobber. If given, do not delete arch/$HOSTTYPE but only clean up the flat view and remove empty directories. src/cmd/INIT/Mamfile: - Do not create the lib/package directory. (re: beb3c64a) .gitignore: - Update.
This commit is contained in:
parent
3fc6cf0e2f
commit
336e82f942
4 changed files with 115 additions and 41 deletions
25
.gitignore
vendored
25
.gitignore
vendored
|
@ -5,44 +5,25 @@ lcl
|
||||||
|
|
||||||
# Flat make libs, binaries, etc
|
# Flat make libs, binaries, etc
|
||||||
/bin/.paths
|
/bin/.paths
|
||||||
/bin/ar
|
|
||||||
/bin/cc
|
|
||||||
/bin/crossexec
|
/bin/crossexec
|
||||||
/bin/ditto
|
/bin/execrate
|
||||||
/bin/filter
|
/bin/filter
|
||||||
/bin/hurl
|
|
||||||
/bin/iffe
|
/bin/iffe
|
||||||
/bin/ksh
|
/bin/ksh
|
||||||
/bin/mamake
|
/bin/mamake
|
||||||
/bin/mktest
|
|
||||||
/bin/ok/
|
|
||||||
/bin/proto
|
/bin/proto
|
||||||
|
/bin/mktest
|
||||||
/bin/pty
|
/bin/pty
|
||||||
/bin/ratz
|
|
||||||
/bin/regress
|
/bin/regress
|
||||||
/bin/release
|
|
||||||
/bin/rt
|
/bin/rt
|
||||||
/bin/shcomp
|
/bin/shcomp
|
||||||
/bin/suid_exec
|
/bin/suid_exec
|
||||||
/fun/
|
/fun/
|
||||||
/include/
|
/include/
|
||||||
/lib/file/
|
/lib/file/
|
||||||
/lib/lib/
|
/lib/*.a
|
||||||
/lib/libast.a
|
|
||||||
/lib/libcmd.a
|
|
||||||
/lib/libdll.a
|
|
||||||
/lib/libshell.a
|
|
||||||
/lib/libsum.a
|
|
||||||
/lib/make/
|
|
||||||
/lib/package/gen/
|
|
||||||
/lib/probe/
|
|
||||||
/man/
|
/man/
|
||||||
|
|
||||||
# This one keeps changing its license header, causing git to show an
|
|
||||||
# uncommitted file. It's always re-copied anyway, and not for direct
|
|
||||||
# invocation, so exclude. The source file is: src/cmd/INIT/execrate.sh
|
|
||||||
bin/execrate
|
|
||||||
|
|
||||||
# Miscellaneous artefacts
|
# Miscellaneous artefacts
|
||||||
*.bak
|
*.bak
|
||||||
*.sav
|
*.sav
|
||||||
|
|
61
bin/package
61
bin/package
|
@ -25,7 +25,8 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
# Escape from a non-POSIX shell
|
# Escape from a non-POSIX shell
|
||||||
min_posix='path=Bad && case $PATH in (Bad) exit 1;; esac && '\
|
# ('test X -ef Y' is technically non-POSIX, but practically universal)
|
||||||
|
min_posix='test / -ef / && path=Bad && case $PATH in (Bad) exit 1;; esac && '\
|
||||||
'PWD=Bad && cd -P -- / && case $PWD in (/) ;; (*) exit 1;; esac && '\
|
'PWD=Bad && cd -P -- / && case $PWD in (/) ;; (*) exit 1;; esac && '\
|
||||||
'! { ! case x in ( x ) : ${0##*/} || : $( : ) ;; esac; } && '\
|
'! { ! case x in ( x ) : ${0##*/} || : $( : ) ;; esac; } && '\
|
||||||
'trap "exit 0" 0 && exit 1'
|
'trap "exit 0" 0 && exit 1'
|
||||||
|
@ -140,6 +141,12 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
|
||||||
{
|
{
|
||||||
[+debug|environment?Show environment and actions but do not
|
[+debug|environment?Show environment and actions but do not
|
||||||
execute.]
|
execute.]
|
||||||
|
[+flat?With the \bmake\b action, create a flat view by linking all
|
||||||
|
files from \b$INSTALLROOT\b, minus build system internals, onto
|
||||||
|
their corresponding path under \b$PACKAGEROOT\b.
|
||||||
|
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.]
|
||||||
[+force?Force the action to override saved state.]
|
[+force?Force the action to override saved state.]
|
||||||
[+never?Run make -N and show other actions.]
|
[+never?Run make -N and show other actions.]
|
||||||
[+only?Only operate on the specified packages.]
|
[+only?Only operate on the specified packages.]
|
||||||
|
@ -150,7 +157,9 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
|
||||||
}
|
}
|
||||||
[+?The actions are:]
|
[+?The actions are:]
|
||||||
{
|
{
|
||||||
[+clean | clobber?Delete the \barch/\b\aHOSTTYPE\a hierarchy; this
|
[+clean | clobber?Clean up the flat view, if any.
|
||||||
|
Then, unless \bflat\b was given,
|
||||||
|
delete the \barch/\b\aHOSTTYPE\a hierarchy; this
|
||||||
deletes all generated files and directories for \aHOSTTYPE\a.
|
deletes all generated files and directories for \aHOSTTYPE\a.
|
||||||
The hierarchy can be rebuilt by \b'$command$' make\b.]
|
The hierarchy can be rebuilt by \b'$command$' make\b.]
|
||||||
[+export\b [ \avariable\a ...]]?List \aname\a=\avalue\a for
|
[+export\b [ \avariable\a ...]]?List \aname\a=\avalue\a for
|
||||||
|
@ -295,6 +304,7 @@ esac
|
||||||
action=
|
action=
|
||||||
bit=
|
bit=
|
||||||
exec=
|
exec=
|
||||||
|
flat=0
|
||||||
force=0
|
force=0
|
||||||
global=
|
global=
|
||||||
hi=
|
hi=
|
||||||
|
@ -331,6 +341,8 @@ do case $# in
|
||||||
debug|environment)
|
debug|environment)
|
||||||
exec=echo make=echo show=echo
|
exec=echo make=echo show=echo
|
||||||
;;
|
;;
|
||||||
|
flat) flat=1
|
||||||
|
;;
|
||||||
force) force=1
|
force) force=1
|
||||||
;;
|
;;
|
||||||
never) exec=echo noexec=-N
|
never) exec=echo noexec=-N
|
||||||
|
@ -392,6 +404,11 @@ DESCRIPTION
|
||||||
The qualifiers are:
|
The qualifiers are:
|
||||||
debug|environment
|
debug|environment
|
||||||
Show environment and actions but do not execute.
|
Show environment and actions but do not execute.
|
||||||
|
flat With the make action, create a flat view by linking all files from
|
||||||
|
$INSTALLROOT, minus build system internals, 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.
|
||||||
force Force the action to override saved state.
|
force Force the action to override saved state.
|
||||||
never Run make -N and show other actions.
|
never Run make -N and show other actions.
|
||||||
only Only operate on the specified packages.
|
only Only operate on the specified packages.
|
||||||
|
@ -403,8 +420,9 @@ DESCRIPTION
|
||||||
|
|
||||||
The actions are:
|
The actions are:
|
||||||
clean | clobber
|
clean | clobber
|
||||||
Delete the arch/HOSTTYPE hierarchy; this deletes all generated files
|
Clean up the flat view, if any. Then, unless flat was given, delete
|
||||||
and directories for HOSTTYPE. The hierarchy can be rebuilt by package
|
the arch/HOSTTYPE hierarchy; this deletes all generated files and
|
||||||
|
directories for HOSTTYPE. The hierarchy can be rebuilt by package
|
||||||
make.
|
make.
|
||||||
export [ variable ...]
|
export [ variable ...]
|
||||||
List name=value for variable, one per line. If the only attribute is
|
List name=value for variable, one per line. If the only attribute is
|
||||||
|
@ -2743,9 +2761,23 @@ error_status=0
|
||||||
case $action in
|
case $action in
|
||||||
|
|
||||||
clean|clobber)
|
clean|clobber)
|
||||||
cd $PACKAGEROOT
|
cd "$PACKAGEROOT" || exit
|
||||||
|
note "cleaning up flat view"
|
||||||
|
$exec find "arch/$HOSTTYPE" -name src -prune -o -type f -exec "$SHELL" -c '
|
||||||
|
for h
|
||||||
|
do p=${h#"arch/$HOSTTYPE/"}
|
||||||
|
if test "$p" -ef "$h"
|
||||||
|
then rm -f "$p"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
' "$0" {} +
|
||||||
|
case $flat in
|
||||||
|
0) note "deleting arch/$HOSTTYPE"
|
||||||
$exec rm -rf arch/$HOSTTYPE
|
$exec rm -rf arch/$HOSTTYPE
|
||||||
exit
|
;;
|
||||||
|
esac
|
||||||
|
note "removing empty directories"
|
||||||
|
$exec find . -depth -type d -exec rmdir {} + 2>/dev/null
|
||||||
;;
|
;;
|
||||||
|
|
||||||
export) case $INSTALLROOT in
|
export) case $INSTALLROOT in
|
||||||
|
@ -3293,6 +3325,23 @@ cat $j $k
|
||||||
'') target="install" ;;
|
'') target="install" ;;
|
||||||
esac
|
esac
|
||||||
eval capture mamake \$makeflags \$noexec \$target $assign
|
eval capture mamake \$makeflags \$noexec \$target $assign
|
||||||
|
|
||||||
|
case $flat in
|
||||||
|
1) note "creating flat view"
|
||||||
|
cd "$PACKAGEROOT" || exit
|
||||||
|
# exclude build system internals
|
||||||
|
$exec find "arch/$HOSTTYPE" -name package -prune -o -name probe -prune -o -name FEATURE -prune \
|
||||||
|
-o -name ok -prune -o -name src -prune -o -name '*.dSYM' -prune -o -path "*/lib/lib" -prune \
|
||||||
|
-o -type f ! -name '*.old' -exec "$SHELL" -c '
|
||||||
|
for h
|
||||||
|
do p=${h#"arch/$HOSTTYPE/"}
|
||||||
|
d=${p%/*}
|
||||||
|
test -d "$d" || mkdir -p "$d" || exit
|
||||||
|
ln -f "$h" "$p" 2>/dev/null || ln -sf "$h" "$p" || exit
|
||||||
|
done
|
||||||
|
' "$0" {} +
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
results)set '' $target
|
results)set '' $target
|
||||||
|
|
|
@ -590,11 +590,6 @@ make install
|
||||||
prev filter
|
prev filter
|
||||||
exec - test '' = 'filter' || ${STDCMP} 2>/dev/null -s filter ${INSTALLROOT}/bin/filter || { ${STDMV} ${INSTALLROOT}/bin/filter ${INSTALLROOT}/bin/filter.old 2>/dev/null || true; ${STDCP} filter ${INSTALLROOT}/bin/filter ;}
|
exec - test '' = 'filter' || ${STDCMP} 2>/dev/null -s filter ${INSTALLROOT}/bin/filter || { ${STDMV} ${INSTALLROOT}/bin/filter ${INSTALLROOT}/bin/filter.old 2>/dev/null || true; ${STDCP} filter ${INSTALLROOT}/bin/filter ;}
|
||||||
done ${INSTALLROOT}/bin/filter generated
|
done ${INSTALLROOT}/bin/filter generated
|
||||||
make ${PACKAGEROOT}/lib/package
|
|
||||||
exec - if test ! -d ${PACKAGEROOT}/lib/package
|
|
||||||
exec - then mkdir -p ${PACKAGEROOT}/lib/package
|
|
||||||
exec - fi
|
|
||||||
done ${PACKAGEROOT}/lib/package generated
|
|
||||||
make ${INSTALLROOT}/bin/mamake
|
make ${INSTALLROOT}/bin/mamake
|
||||||
prev mamake
|
prev mamake
|
||||||
exec - test '' = 'mamake' || ${STDCMP} 2>/dev/null -s mamake ${INSTALLROOT}/bin/mamake || { ${STDMV} ${INSTALLROOT}/bin/mamake ${INSTALLROOT}/bin/mamake.old 2>/dev/null || true; ${STDCP} mamake ${INSTALLROOT}/bin/mamake ;}
|
exec - test '' = 'mamake' || ${STDCMP} 2>/dev/null -s mamake ${INSTALLROOT}/bin/mamake || { ${STDMV} ${INSTALLROOT}/bin/mamake ${INSTALLROOT}/bin/mamake.old 2>/dev/null || true; ${STDCP} mamake ${INSTALLROOT}/bin/mamake ;}
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
# Escape from a non-POSIX shell
|
# Escape from a non-POSIX shell
|
||||||
min_posix='path=Bad && case $PATH in (Bad) exit 1;; esac && '\
|
# ('test X -ef Y' is technically non-POSIX, but practically universal)
|
||||||
|
min_posix='test / -ef / && path=Bad && case $PATH in (Bad) exit 1;; esac && '\
|
||||||
'PWD=Bad && cd -P -- / && case $PWD in (/) ;; (*) exit 1;; esac && '\
|
'PWD=Bad && cd -P -- / && case $PWD in (/) ;; (*) exit 1;; esac && '\
|
||||||
'! { ! case x in ( x ) : ${0##*/} || : $( : ) ;; esac; } && '\
|
'! { ! case x in ( x ) : ${0##*/} || : $( : ) ;; esac; } && '\
|
||||||
'trap "exit 0" 0 && exit 1'
|
'trap "exit 0" 0 && exit 1'
|
||||||
|
@ -140,6 +141,12 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
|
||||||
{
|
{
|
||||||
[+debug|environment?Show environment and actions but do not
|
[+debug|environment?Show environment and actions but do not
|
||||||
execute.]
|
execute.]
|
||||||
|
[+flat?With the \bmake\b action, create a flat view by linking all
|
||||||
|
files from \b$INSTALLROOT\b, minus build system internals, onto
|
||||||
|
their corresponding path under \b$PACKAGEROOT\b.
|
||||||
|
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.]
|
||||||
[+force?Force the action to override saved state.]
|
[+force?Force the action to override saved state.]
|
||||||
[+never?Run make -N and show other actions.]
|
[+never?Run make -N and show other actions.]
|
||||||
[+only?Only operate on the specified packages.]
|
[+only?Only operate on the specified packages.]
|
||||||
|
@ -150,7 +157,9 @@ case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
|
||||||
}
|
}
|
||||||
[+?The actions are:]
|
[+?The actions are:]
|
||||||
{
|
{
|
||||||
[+clean | clobber?Delete the \barch/\b\aHOSTTYPE\a hierarchy; this
|
[+clean | clobber?Clean up the flat view, if any.
|
||||||
|
Then, unless \bflat\b was given,
|
||||||
|
delete the \barch/\b\aHOSTTYPE\a hierarchy; this
|
||||||
deletes all generated files and directories for \aHOSTTYPE\a.
|
deletes all generated files and directories for \aHOSTTYPE\a.
|
||||||
The hierarchy can be rebuilt by \b'$command$' make\b.]
|
The hierarchy can be rebuilt by \b'$command$' make\b.]
|
||||||
[+export\b [ \avariable\a ...]]?List \aname\a=\avalue\a for
|
[+export\b [ \avariable\a ...]]?List \aname\a=\avalue\a for
|
||||||
|
@ -295,6 +304,7 @@ esac
|
||||||
action=
|
action=
|
||||||
bit=
|
bit=
|
||||||
exec=
|
exec=
|
||||||
|
flat=0
|
||||||
force=0
|
force=0
|
||||||
global=
|
global=
|
||||||
hi=
|
hi=
|
||||||
|
@ -331,6 +341,8 @@ do case $# in
|
||||||
debug|environment)
|
debug|environment)
|
||||||
exec=echo make=echo show=echo
|
exec=echo make=echo show=echo
|
||||||
;;
|
;;
|
||||||
|
flat) flat=1
|
||||||
|
;;
|
||||||
force) force=1
|
force) force=1
|
||||||
;;
|
;;
|
||||||
never) exec=echo noexec=-N
|
never) exec=echo noexec=-N
|
||||||
|
@ -392,6 +404,11 @@ DESCRIPTION
|
||||||
The qualifiers are:
|
The qualifiers are:
|
||||||
debug|environment
|
debug|environment
|
||||||
Show environment and actions but do not execute.
|
Show environment and actions but do not execute.
|
||||||
|
flat With the make action, create a flat view by linking all files from
|
||||||
|
$INSTALLROOT, minus build system internals, 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.
|
||||||
force Force the action to override saved state.
|
force Force the action to override saved state.
|
||||||
never Run make -N and show other actions.
|
never Run make -N and show other actions.
|
||||||
only Only operate on the specified packages.
|
only Only operate on the specified packages.
|
||||||
|
@ -403,8 +420,9 @@ DESCRIPTION
|
||||||
|
|
||||||
The actions are:
|
The actions are:
|
||||||
clean | clobber
|
clean | clobber
|
||||||
Delete the arch/HOSTTYPE hierarchy; this deletes all generated files
|
Clean up the flat view, if any. Then, unless flat was given, delete
|
||||||
and directories for HOSTTYPE. The hierarchy can be rebuilt by package
|
the arch/HOSTTYPE hierarchy; this deletes all generated files and
|
||||||
|
directories for HOSTTYPE. The hierarchy can be rebuilt by package
|
||||||
make.
|
make.
|
||||||
export [ variable ...]
|
export [ variable ...]
|
||||||
List name=value for variable, one per line. If the only attribute is
|
List name=value for variable, one per line. If the only attribute is
|
||||||
|
@ -2743,9 +2761,23 @@ error_status=0
|
||||||
case $action in
|
case $action in
|
||||||
|
|
||||||
clean|clobber)
|
clean|clobber)
|
||||||
cd $PACKAGEROOT
|
cd "$PACKAGEROOT" || exit
|
||||||
|
note "cleaning up flat view"
|
||||||
|
$exec find "arch/$HOSTTYPE" -name src -prune -o -type f -exec "$SHELL" -c '
|
||||||
|
for h
|
||||||
|
do p=${h#"arch/$HOSTTYPE/"}
|
||||||
|
if test "$p" -ef "$h"
|
||||||
|
then rm -f "$p"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
' "$0" {} +
|
||||||
|
case $flat in
|
||||||
|
0) note "deleting arch/$HOSTTYPE"
|
||||||
$exec rm -rf arch/$HOSTTYPE
|
$exec rm -rf arch/$HOSTTYPE
|
||||||
exit
|
;;
|
||||||
|
esac
|
||||||
|
note "removing empty directories"
|
||||||
|
$exec find . -depth -type d -exec rmdir {} + 2>/dev/null
|
||||||
;;
|
;;
|
||||||
|
|
||||||
export) case $INSTALLROOT in
|
export) case $INSTALLROOT in
|
||||||
|
@ -3293,6 +3325,23 @@ cat $j $k
|
||||||
'') target="install" ;;
|
'') target="install" ;;
|
||||||
esac
|
esac
|
||||||
eval capture mamake \$makeflags \$noexec \$target $assign
|
eval capture mamake \$makeflags \$noexec \$target $assign
|
||||||
|
|
||||||
|
case $flat in
|
||||||
|
1) note "creating flat view"
|
||||||
|
cd "$PACKAGEROOT" || exit
|
||||||
|
# exclude build system internals
|
||||||
|
$exec find "arch/$HOSTTYPE" -name package -prune -o -name probe -prune -o -name FEATURE -prune \
|
||||||
|
-o -name ok -prune -o -name src -prune -o -name '*.dSYM' -prune -o -path "*/lib/lib" -prune \
|
||||||
|
-o -type f ! -name '*.old' -exec "$SHELL" -c '
|
||||||
|
for h
|
||||||
|
do p=${h#"arch/$HOSTTYPE/"}
|
||||||
|
d=${p%/*}
|
||||||
|
test -d "$d" || mkdir -p "$d" || exit
|
||||||
|
ln -f "$h" "$p" 2>/dev/null || ln -sf "$h" "$p" || exit
|
||||||
|
done
|
||||||
|
' "$0" {} +
|
||||||
|
;;
|
||||||
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
results)set '' $target
|
results)set '' $target
|
||||||
|
|
Loading…
Reference in a new issue