Changes to bldpkg:
* Removed redundant functions * Added further code to validate build variables
This commit is contained in:
parent
77245f220d
commit
679dc27727
1 changed files with 14 additions and 25 deletions
39
bldpkg
39
bldpkg
|
@ -70,27 +70,6 @@ setbuildfile() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Function to invoke bash shell's -x mode for troubleshooting
|
||||
tracemode() {
|
||||
set -xv
|
||||
}
|
||||
|
||||
# Function to enable building of packages with debug symbols using -g3 argument
|
||||
debugmode() {
|
||||
debug=1
|
||||
}
|
||||
|
||||
# Function to override extractprompt in bldpkg.conf and auto-extract into pkg source directory
|
||||
autoextractmode() {
|
||||
extractprompt=0
|
||||
autoextract=1
|
||||
}
|
||||
|
||||
# Override showsummary in bldpkg.conf
|
||||
displaysummary() {
|
||||
showsummary=1
|
||||
}
|
||||
|
||||
# Function to set number of make jobs, overrides those in bldpkg.conf
|
||||
setcputhreads() {
|
||||
cputhreads="$OPTARG"
|
||||
|
@ -189,14 +168,14 @@ exit 0
|
|||
# Function for providing handy arguments to users. Some will override bldpkg.conf.
|
||||
while getopts ':def:ghj:sx' option; do
|
||||
case "$option" in
|
||||
d) debugmode ;;
|
||||
e) autoextractmode ;;
|
||||
d) debug=1 ;; # Produce a debug build with -g3
|
||||
e) extractprompt=0; autoextract=1 ;; # Automatically extract the final pkg installer inside user's PWD
|
||||
f) setbuildfile "$OPTARG" ;;
|
||||
g) genchecksum ;;
|
||||
h) help ;;
|
||||
j) setcputhreads "$OPTARG" ;;
|
||||
s) displaysummary ;;
|
||||
x) tracemode ;;
|
||||
s) showsummary=1 ;; # Show build summary at the end of the build irrespective of the build status
|
||||
x) set -xv ;; # Invoke bash's -x option for command tracing
|
||||
*) help ;;
|
||||
esac
|
||||
done
|
||||
|
@ -218,6 +197,11 @@ for buildvariables in app version build homepage desc requires ; do
|
|||
echo "[ERROR] Required variable \"${buildvariables}\" is not set. Please check your build file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if egrep -q "$buildvariables='*'" "$buildfile" ; then
|
||||
echo "Please dont use single quotes to define the \"${buildvariables}\" variable"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Validate $app
|
||||
|
@ -246,6 +230,11 @@ if [[ -n $download ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if egrep -q "download='*'" "$buildfile" ; then
|
||||
echo "Please dont use single quotes to define the download variable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate $desc
|
||||
if [[ ${#desc} -gt 100 ]] ; then
|
||||
echo "[ERROR] Package description should not exceed 100 characters in the build file."
|
||||
|
|
Loading…
Reference in a new issue