Ports: Actually clean port build directory

The functionality for `./package.sh clean` was a bit weird: based on
whether you were working in dev mode, it would try to delete either
`$workdir` or `$nongit_workdir` and `*.out` from your `pwd`.

The new functionality is pretty clear: `./package.sh clean` deletes the
entire build directory for the port regardless of what mode you're in,
`./package.sh clean_dist` removes all `$files`, and
`./package.sh clean_all` does both.
This commit is contained in:
Jelle Raaijmakers 2022-09-13 12:40:04 +02:00 committed by Tim Flynn
parent 27fa038ffa
commit 5bfc61bc69
Notes: sideshowbarker 2024-07-17 07:48:42 +09:00

View file

@ -441,11 +441,7 @@ func_defined post_install || post_install() {
echo echo
} }
func_defined clean || clean() { func_defined clean || clean() {
if [ -z "${IN_SERENITY_PORT_DEV:-}" ]; then rm -rf "${PORT_BUILD_DIR}"
rm -rf "$workdir" *.out
else
rm -rf "$nongit_workdir" *.out
fi
} }
func_defined clean_dist || clean_dist() { func_defined clean_dist || clean_dist() {
OLDIFS=$IFS OLDIFS=$IFS
@ -457,18 +453,8 @@ func_defined clean_dist || clean_dist() {
done done
} }
func_defined clean_all || clean_all() { func_defined clean_all || clean_all() {
if [ -z "${IN_SERENITY_PORT_DEV:-}" ]; then clean
rm -rf "$workdir" *.out clean_dist
else
rm -rf "$nongit_workdir" *.out
fi
OLDIFS=$IFS
IFS=$'\n'
for f in $files; do
IFS=$OLDIFS
read url filename hash <<< $(echo "$f")
rm -f "${PORT_META_DIR}/${filename}"
done
} }
addtodb() { addtodb() {
if [ -n "$(package_install_state $port $version)" ]; then if [ -n "$(package_install_state $port $version)" ]; then
@ -574,15 +560,15 @@ do_install() {
addtodb "${1:-}" addtodb "${1:-}"
} }
do_clean() { do_clean() {
echo "Cleaning workdir and .out files in $port..." echo "Cleaning build directory for $port..."
clean clean
} }
do_clean_dist() { do_clean_dist() {
echo "Cleaning dist in $port..." echo "Cleaning dist files for $port..."
clean_dist clean_dist
} }
do_clean_all() { do_clean_all() {
echo "Cleaning all in $port..." echo "Cleaning all for $port..."
clean_all clean_all
} }
do_uninstall() { do_uninstall() {