Add tix-port(8) --distclean option and fine tune cleaning support.
This commit is contained in:
parent
8cffe07eea
commit
36f6cbc387
2 changed files with 46 additions and 7 deletions
33
tix/tix-port
33
tix/tix-port
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 2022, 2023 Jonas 'Sortie' Termansen.
|
||||
# Copyright (c) 2022, 2023, 2024 Jonas 'Sortie' Termansen.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software for any
|
||||
# purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -22,6 +22,7 @@ unset build
|
|||
cache_package=false
|
||||
unset collection
|
||||
unset destination
|
||||
distclean=false
|
||||
unset end
|
||||
unset exec_prefix
|
||||
unset generation
|
||||
|
@ -67,6 +68,7 @@ for argument do
|
|||
--collection) previous_option=collection ;;
|
||||
--destination=*) destination=$parameter ;;
|
||||
--destination) previous_option=destination ;;
|
||||
--distclean) distclean=true ;;
|
||||
--end=*) end=$parameter ;;
|
||||
--end) previous_option=end ;;
|
||||
--exec-prefix=*) exec_prefix=$parameter ;;
|
||||
|
@ -157,6 +159,26 @@ if [ -n "$SOURCE_PORT" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if $distclean; then
|
||||
if [ "$DEVELOPMENT" = true ]; then
|
||||
case "`cat "$port.version"`" in
|
||||
*.development)
|
||||
echo "Port is in development: $port"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ -e "$port" ]; then
|
||||
echo "Removing '$port'"
|
||||
fi
|
||||
rm -rf "$port"
|
||||
rm -rf "$port.upstream"
|
||||
rm -f "$port.version"
|
||||
rm -f "$port.version.new"
|
||||
rm -f "$port.mirror"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
step_number() {
|
||||
nl << EOF | grep -E -- " $1$" | grep -Eo '[0-9]+'
|
||||
start
|
||||
|
@ -490,7 +512,12 @@ fi
|
|||
update_version=false
|
||||
if [ $(step_number "${start-start}") -lt $(step_number tix-build-end) ] &&
|
||||
[ $(step_number "${end-end}") -gt $(step_number tix-build-start) ]; then
|
||||
announce "Building $NAME"
|
||||
if [ "$start" = clean -a "$end" = clean ]; then
|
||||
if [ ! -d "$port" ]; then exit; fi
|
||||
announce "Cleaning $NAME"
|
||||
else
|
||||
announce "Building $NAME"
|
||||
fi
|
||||
unset tix_build_start
|
||||
unset tix_build_end
|
||||
if [ -n "$start" ]; then
|
||||
|
@ -542,7 +569,7 @@ if should_run_step diff; then
|
|||
update_version=true
|
||||
fi
|
||||
|
||||
if $update_version && [ "${destination-.}" != "." ]; then
|
||||
if $update_version && [ "${destination:-.}" != "." ]; then
|
||||
cp "$port.version" "$destination/$NAME.version"
|
||||
fi
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
.Op Fl \-cache-package
|
||||
.Op Fl \-collection Ns = Ns Ar collection
|
||||
.Op Fl \-destination Ns = Ns Ar directory
|
||||
.Op Fl \-distclean
|
||||
.Op Fl \-end Ns = Ns Ar step
|
||||
.Op Fl \-exec-prefix Ns = Ns Ar prefix
|
||||
.Op Fl \-generation Ns = Ns Ar level
|
||||
|
@ -39,8 +40,8 @@ Many of the options are forwarded to the low-level
|
|||
which performs the build once the source code has been prepared.
|
||||
.Nm
|
||||
is usually invoked through
|
||||
.Xr development 7
|
||||
for the official ports.
|
||||
.Xr tix-metabuild 8 ,
|
||||
which builds multiple ports in the right order.
|
||||
.Pp
|
||||
The mandatory
|
||||
.Ar port
|
||||
|
@ -84,6 +85,16 @@ plus
|
|||
.It Fl \-destination Ns = Ns Ar directory
|
||||
The binary package is placed inside this
|
||||
.Ar directory .
|
||||
.It Fl \-distclean
|
||||
Clean the port for distribution.
|
||||
Remove the extraction and all the metadata files.
|
||||
If
|
||||
.Sy DEVELOPMENT
|
||||
is
|
||||
.Sy true
|
||||
in the
|
||||
.Xr port 5 ,
|
||||
then emit a warning, and do nothing to avoid deleting any in-progress work.
|
||||
.It Fl \-end Ns = Ns Ar step
|
||||
Stop the build after this
|
||||
.Ar step :
|
||||
|
@ -135,7 +146,7 @@ where architecture dependent files are installed.
|
|||
.It Fl \-generation Ns = Ns Ar generation
|
||||
Create a binary package in the format of this tix generation
|
||||
.Ar level .
|
||||
(Default: 2)
|
||||
(Default: 3)
|
||||
.It Fl \-host Ns = Ns Ar triplet
|
||||
The platform
|
||||
.Ar triplet
|
||||
|
@ -269,7 +280,8 @@ by stopping after the binary package has been stripped.
|
|||
.Xr porting 7 ,
|
||||
.Xr tix-build 8 ,
|
||||
.Xr tix-collection 8 ,
|
||||
.Xr tix-install 8
|
||||
.Xr tix-install 8 ,
|
||||
.Xr tix-metabuild 8
|
||||
.Sh HISTORY
|
||||
.Nm
|
||||
originally appeared in Sortix 1.1 as a networked higher level interface around
|
||||
|
|
Loading…
Add table
Reference in a new issue