Fix bugs, refactor and remove relPkgFile variable
This commit is contained in:
parent
d2171738d6
commit
5d4590b055
51
pkgbuild.sh
51
pkgbuild.sh
|
@ -51,16 +51,35 @@ buildPackage() {
|
|||
fi
|
||||
}
|
||||
|
||||
printWarnings() {
|
||||
[ ${#warnings[@]} -eq 0 ] && return
|
||||
for warning in "${warnings[@]}"; do
|
||||
echo "::warning::$1 ——— $warning"
|
||||
done
|
||||
}
|
||||
|
||||
namcapAnalysis() {
|
||||
pacman -S --noconfirm namcap
|
||||
mapfile -t warnings < <(namcap PKGBUILD)
|
||||
printWarnings "PKGBUILD"
|
||||
pkgFile=$(sudo -u calbuilder makepkg --packagelist)
|
||||
pkgFile=$(basename "$pkgFile")
|
||||
if [ -f "$pkgFile" ]; then
|
||||
mapfile -t warnings < <(namcap "$pkgFile")
|
||||
printWarnings "$pkgFile"
|
||||
fi
|
||||
}
|
||||
|
||||
exportPackageFiles() {
|
||||
sudo -u calbuilder makepkg --printsrcinfo > .SRCINFO
|
||||
exportFile "srcInfo" ".SRCINFO"
|
||||
|
||||
pkgFile=$(sudo -u calbuilder makepkg --packagelist)
|
||||
pkgFile=$(basename "$pkgFile")
|
||||
if [ -f "$pkgFile" ]; then
|
||||
relPkgFile="$(realpath --relative-base="$baseDir" "$pkgFile")"
|
||||
exportFile "pkgFile" "$relPkgFile" "$pkgFile"
|
||||
exportFile "pkgFile" "$pkgFile"
|
||||
if [ -n "$gpgPrivateKey" ]; then
|
||||
exportFile "pkgFileSig" "$relPkgFile.sig" "$pkgFile.sig"
|
||||
exportFile "pkgFileSig" "$pkgFile.sig"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -68,31 +87,10 @@ exportPackageFiles() {
|
|||
exportFile() {
|
||||
echo "::set-output name=$1::$2"
|
||||
if [ "$inBaseDir" = false ]; then
|
||||
[ $# -eq 2 ] && pkgFile=$2 || pkgFile=$3
|
||||
mv "$pkgFile" /github/workspace
|
||||
fi
|
||||
}
|
||||
|
||||
namcapAnalysis() {
|
||||
pacman -S --noconfirm namcap
|
||||
|
||||
mapfile -t warnings < <(namcap PKGBUILD)
|
||||
printWarnings "PKGBUILD"
|
||||
pkgFile=$(sudo -u calbuilder makepkg --packagelist)
|
||||
if [ -f "$pkgFile" ]; then
|
||||
relPkgFile="$(realpath --relative-base="$baseDir" "$pkgFile")"
|
||||
mapfile -t warnings < <(namcap "$pkgFile")
|
||||
printWarnings "$relPkgFile"
|
||||
fi
|
||||
}
|
||||
|
||||
printWarnings() {
|
||||
[ ${#warnings[@]} -eq 0 ] && return
|
||||
for warning in "${warnings[@]}"; do
|
||||
echo "::warning::$1 ——— $warning"
|
||||
done
|
||||
}
|
||||
|
||||
getInputs() {
|
||||
gpgPrivateKey="$INPUT_GPGPRIVATEKEY"
|
||||
gpgPublicKey="$INPUT_GPGPUBLICKEY"
|
||||
|
@ -120,17 +118,14 @@ runScript() {
|
|||
|
||||
installAurDeps
|
||||
buildPackage
|
||||
exportPackageFiles
|
||||
namcapAnalysis
|
||||
exportPackageFiles
|
||||
|
||||
findArgs+=("-not" "-name" "$relPkgFile*" "-not" "-name" ".SRCINFO")
|
||||
newFiles=$(find -H "$PWD" "${findArgs[@]}")
|
||||
files=$(printf '%s\n%s\n' "$newFiles" "$oldFiles")
|
||||
mapfile -t toRemove < <(echo "$files" | sort | uniq -u)
|
||||
rm -rf "${toRemove[@]}"
|
||||
|
||||
cd ..
|
||||
ls -al
|
||||
}
|
||||
|
||||
runScript "$@"
|
||||
|
|
Loading…
Reference in New Issue