diff --git a/bldpkg b/bldpkg index 7dafce3..72dd6d4 100755 --- a/bldpkg +++ b/bldpkg @@ -125,9 +125,7 @@ validatebldfile() { fi for reqvars in app version build homepage desc requires ; do - if [[ ! ${!reqvars} ]] ; then - err "Required variable '$reqvars' is not set in $buildfile!" - fi + [[ ! ${!reqvars} ]] && err "Required variable '$reqvars' is not set in $buildfile!" done # Validate $app @@ -422,9 +420,7 @@ promptuser() { esac fi - if [[ $pkgstatus = 0 ]]; then - exit 0 - fi + [[ $pkgstatus = 0 ]] && exit 0 } # This function will set the interrupt variable so prepbuildoutput can output the right build status @@ -646,14 +642,10 @@ EOF fi # Delete the build directory if preservebuilddir is set to 0 - if [[ $preservebuilddir = 0 ]] ; then - rm -rf "$tmp" - fi + [[ $preservebuilddir = 0 ]] && rm -rf "$tmp" # Delete the package staging directory if preservepackagedir is set to 0 - if [[ $preservepackagedir = 0 ]] ; then - rm -rf "$pkg" - fi + [[ $preservepackagedir = 0 ]] && rm -rf "$pkg" } buildfilecleanup() { @@ -661,9 +653,7 @@ buildfilecleanup() { rm "$parenttmp/BUILDING" # Autobuild discards $tempfile automatically, so only discard $tempfile if $autobuildtemp is unset - if [[ -z $autobuildtemp ]] ; then - rm "$tempfile" - fi + [[ -z $autobuildtemp ]] && rm "$tempfile" } @@ -1004,9 +994,7 @@ fi # Check integrity of files defined in sha512sums variable which is expected # in nearly every single package build file -if [[ -z $sha512sums ]] ; then - err "SHA512 checksums don't exist in '$buildfile'! Please run 'bldpkg -g' to add them" -fi +[[ -z $sha512sums ]] && err "Please run 'bldpkg -g' to add sha512sums into '$buildfile'!" eval sums=\"\$sha512sums\" @@ -1118,10 +1106,7 @@ if [[ $swapcheck = 1 ]]; then # is >= swapsize, we are all good. If it's less than swapsize, we exit with a status 1. swapcheck=$(grep "SwapFree" /proc/meminfo | awk '{print $2}') - if [[ $swapcheck -lt $swapsize ]]; then - err "Insufficient swap to build '$app' which is listed in '$packagesrequiringswap'. -Kindly add/increase swap size on this system and try again." - fi + [[ $swapcheck -lt $swapsize ]] && err "Insufficient swap size to build packages, advise increasing it." fi fi @@ -1189,9 +1174,7 @@ fi [[ -z $arch ]] && arch="$HOSTTYPE" for compilervariable in CC CXX CFLAGS ; do - if [[ -z $compilervariable ]] ; then - err "$compilervariable not set in bldpkg.conf!" - fi + [[ -z $compilervariable ]] && err "$compilervariable not set in bldpkg.conf!" done if [[ $arch = noarch ]]; then @@ -1209,9 +1192,7 @@ compilertestfile "$CXX" "$CXXFLAGS" cxx-test.cpp cxx-test # Validate everything related to ccache if ccache is set if [[ $ccache = 1 ]]; then - if [[ ! -x $ccachebinpath ]] ; then - err "Ccache binary was not found but ccache is enabled in bldpkg.conf!" - fi + [[ ! -x $ccachebinpath ]] && err "Ccache binary does not exist/is not an executable!" checkcompilersymlink $ccachesymdirpath $ccachebinpath @@ -1223,10 +1204,7 @@ fi # Validate everything related to sccache if ccache is set if [[ $sccache = 1 ]]; then - if [[ ! -x $sccachebinpath ]] ; then - err "Oops! sccache binary was not found but building with it was requested! -Either ensure sccache is in your '$PATH' or disable this option in bldpkg.conf." - fi + [[ ! -x $sccachebinpath ]] & err "$sccachebinpath was either not found or is not an executable!" # We expect the rustc wrapper to be defined in $HOME/.cargo/config.toml if ! grep -q 'rustc-wrapper\ \= "\/bin\/sccache"' $HOME/.cargo/config.toml ; then @@ -1247,9 +1225,7 @@ fi # Validate everything related to distcc if distcc is set if [[ $distcc = 1 ]] ; then # Check if distcc exists and is an executable - if [[ ! -x $distccbinpath ]]; then - err "Distcc binary was not found but distcc is enabled in bldpkg.conf" - fi + [[ ! -x $distccbinpath ]] && err "Distcc binary was either not found or is not an executable" checkcompilersymlink $distccsymdirpath $distccbinpath