Changes to bldpkg:

-> Replaced basename and dirname with bash's built-in pattern matching
-> Added code to prompt for resuming an existing build in the presence of .$app.extraction.complete
-> Fixed some comments relating to $resumepkgbuild
Changes to bldpkg.conf:
-> Updated pkg names in tmpfsexceptionlist and packagesrequiringswap array
-> Added validatecompilers, compilerverbosity and autoresumepkgbuild variables
This commit is contained in:
PktSurf 2023-03-13 23:44:49 +05:30
parent 89420776a8
commit 2e10ab6dad
2 changed files with 44 additions and 12 deletions

39
bldpkg
View file

@ -181,7 +181,7 @@ srcdir="$PWD"
# Presume that the build file name will match the name of the parent directory
# unless otherwise overridden using -f <buildfile>
buildfile="$(basename $srcdir).SMBuild"
buildfile="${srcdir##*/}.SMBuild"
# Find all required files. If either of them don't exist, abort.
rqfiles=( installpkg upgradepkg sha512sum patch find findmnt patch tput bc tar )
@ -398,7 +398,7 @@ applypatch() {
fi
# Get relative path of the patch file
relativepath=$(basename $patchfile)
relativepath=${patchfile##*/}
info "Applying patch '$relativepath'.."
# We use if/else to determine if the patch applied successfully
if ! patch -p1 < "$patchfile" ; then
@ -896,7 +896,13 @@ fixbuilddirpermissions() {
chown -R root.root .
find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
\! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+ || true
touch ".$app.extraction.complete"
# Only put $app.extraction.complete file if $extractioncomplete is unset.
# This ensures that the file is only set once.
if [[ -z $extractioncomplete ]] ; then
touch ".$app.extraction.complete"
extractioncomplete=1
fi
}
# Function to calculate elapsed build time. runtime takes the $SECONDS variable as an argument. $SECONDS is an
@ -1520,25 +1526,40 @@ interruptoutput() {
trap "prepbuildoutput" EXIT
trap "interruptoutput" INT
# Prompt the user to resume the current build if $app.extraction.complete is found inside $tmp
# and if $resumepkgbuild from getopts is unset.
buildresumepath="$(find $tmp -type f -name .$app.extraction.complete)"
if [[ -f $buildresumepath ]] && [[ -z $resumepkgbuild ]] && [[ $autoresumepkgbuild = 1 ]] ; then
echo "[NOTIFY] Found $buildresumepath."
echo "[NOTIFY] Hit 'Y' to resume building from current src,"
echo "[NOTIFY] Hit 'N' to start building from scratch by removing old src."
read -r -p "[NOTIFY] Would you like to resume building? " yn
case "$yn" in
N|n|No|no) info "Nope? Alright." ;
unset resumepkgbuild ;;
*) info "Wise choice :-) "
resumepkgbuild=1 ;;
esac
fi
# If $resumepkgbuild variable is not set in getopts, only then execute prepbuilddir variable
if [[ -z $resumepkgbuild ]] ; then
prepbuilddir
fi
# If $resumepkgbuild is set, execute mkandenterbuilddir function to enter the build directory
# This is being done because mkandenterbuilddir is part of prepbuilddir function in the build
# file and ignoring prepbuilddir will not cause mkandenterbuilddir to be invoked separately unless the build
# system is told to.
# If $resumepkgbuild is set either in getopts or from the user prompt above, execute mkandenterbuilddir
# function to enter the build directory. This is being done because mkandenterbuilddir is part of prepbuilddir
# function in the build file and ignoring prepbuilddir will not cause mkandenterbuilddir to be invoked
# separately unless the build system is told to.
if [[ -n $resumepkgbuild ]] ; then
mkandenterbuilddir
buildresumepath="$(find $tmp -type f -name .$app.extraction.complete)"
# fixbuilddirpermissions places a file ".$app.extraction.complete". Get the directory name that houses that file
# and cd into it
if [[ ! -f $buildresumepath ]] ; then
err "Can't resume build of '"$app"'! Are you certain the source was extracted completely?"
else
cd $(dirname $buildresumepath)
cd ${buildresumepath%/*}
fi
fi
build

View file

@ -162,15 +162,15 @@ checkdependencies=0
# This array lists the packages whose sources will not be extracted and
# compiled inside tmpfs, if tmpfs is <= 2GB. If your tmpfs is >= 2GB, empty
# out this entire list.
tmpfsexceptionlist=( mozjs nodejs firefox wxwidgets palemoon qemu dovecot gdb gimp gnumeric \
tmpfsexceptionlist=( mozjs nodejs firefox wxwidgets palemoon qemu dovecot gdb gnumeric \
gtk+2 gtk+3 guile llvm mariadb mesa mesa-demos mupdf perl postfix python2 \
python3 rtorrent spice python-lxml kernel libreoffice mono \
qtwebengine kernel-source rust webkitgtk )
qtwebengine kernel-source rust webkitgtk boost go llvm-runtimes )
# This array lists the packages which require additional swap for
# compilation to prevent the system from becoming completely unresponsive
# for want of more memory.
packagesrequiringswap=( mozjs nodejs firefox palemoon qemu gdb gimp gnumeric gtk+2 \
packagesrequiringswap=( mozjs nodejs firefox palemoon qemu gdb gnumeric gtk+2 \
gtk+3 guile llvm mariadb mesa mupdf libtorrent rtorrent \
qtwebengine )
@ -190,3 +190,14 @@ htmloutput=1
# Invoke the audit daemon for logging write accesses to system directories
# outside the build and staging directory
useauditd=0
# Validate distcc, ccache and sccache depending on which compiler is enabled
# globally above
validatecompilers=0
# Be verbose about compiler output. Make and Cmake currently supported.
compilerverbosity=0
# Whether to prompt a user to resume a build if
# $tmp/src/.$app.extraction.complete is found or to build the package from scratch
autoresumepkgbuild=0