Changes to bldpkg:

* "subshelled" the entire script and discarded code to unset variables
* Moved up code that displays application name and version at the start
  of the build a few lines up
* Fixed typos
This commit is contained in:
SMLinux 2022-02-15 15:18:30 +05:30
parent 16246f3ef9
commit a418675a82

20
bldpkg
View file

@ -22,10 +22,13 @@
# "catting" important build info into a unique build file and then
# the build monitor sources from that file
# Begin subshell
(
# Exit on any error
set -e
# All variable names are to be in upper-case, function names in lower-xase.
# All variable names are to be in upper-case, function names in lower-case.
# Time when the build commenced. Note: elapsed time is logged by the runtime function way below. This output goes
# into package build summary.
@ -67,9 +70,6 @@ genchecksum() {
exit 0
}
# Unset standard variables before sourcing from the build file
unset app version build homepage download requires desc arch CFLAGS CXXFLAGS
# If the first argument is "genchecksum", invoke the genchecksum function.
# Else if the first argument is filename, then get the build extension of that file and source it, else throw an error
# Else if no argument is given, get the basename of the directory and look for a matching package build file name.
@ -102,13 +102,16 @@ for buildvariables in app version build homepage desc requires ; do
fi
done
# Display the package and its version we are building
echo "[INFO] Building package $app version $version ..."
sleep 0.5
# Check if build() function exists in the build file
if [[ ! "$(grep '^build()' "$srcdirpath".SMBuild)" ]] ; then
echo "build() function does not exist in your build file. Aborting!"
exit 1
fi
# Only verify source checksums if skipchecksum is not set in the build file
if [ -z "$skipchecksum" ] ; then
if [ -z "$sha512sums" ] ; then
@ -172,10 +175,6 @@ inarray() {
return 1
}
# Display the package and its version we are building
echo "[INFO] Building package $app version $version ..."
sleep 0.5
# Check if $parenttmp is set and is a directory
if [ -z "$parenttmp" ] ; then
echo "parenttmp variable not set in /etc/bldpkg.conf. Aborting!"
@ -1213,3 +1212,6 @@ trap "prepbuildsummary" EXIT
trap "interruptsummary" INT
build
)
# End subshell and script