Compare commits

..

1 Commits

Author SHA1 Message Date
Levente Polyak
ef6da62956 chore(license): avoid sourcing PKGBUILD in check subcommand
We don't actually need any data from the package, except the pkgbase
which is exclusively used during logging. Simply grep the pkgbase name
and use the path during early code path issues.

Component: pkgctl license check
2025-08-02 06:29:26 +02:00
5 changed files with 10 additions and 20 deletions

View File

@@ -79,9 +79,6 @@ Options
*-x* <when>::
Inspect chroot after build, possible modes are 'never' (default), 'always' or 'failure'
*-s* <args>::
Additional systemd-nspawn args (comma-separated) for the arch-nspawn build phase
See Also
--------

View File

@@ -155,7 +155,7 @@ if (( ${#needsversioning[*]} )); then
if [[ ! -f "${file}" ]]; then
continue
fi
if ! git ls-files --error-unmatch "$file" >/dev/null; then
if ! git ls-files --error-unmatch "$file"; then
die "%s is not under version control" "$file"
fi
done

View File

@@ -94,19 +94,19 @@ pkgctl_license_check() {
pushd "${path}" >/dev/null
if [[ ! -f PKGBUILD ]]; then
msg_error "${BOLD}${pkgbase}:${ALL_OFF} no PKGBUILD found"
msg_error "${BOLD}${path}:${ALL_OFF} no PKGBUILD found"
return 1
fi
# reset common PKGBUILD variables
unset pkgbase
# shellcheck source=contrib/makepkg/PKGBUILD.proto
if ! . ./PKGBUILD; then
msg_error "${BOLD}${pkgbase}:${ALL_OFF} failed to source PKGBUILD"
if [[ ! -f .SRCINFO ]]; then
msg_error "${BOLD}${path}:${ALL_OFF} no .SRCINFO found"
return 1
fi
if ! pkgbase=$(grep --max-count=1 --extended-regexp "pkgbase = (.+)" .SRCINFO | awk '{print $3}'); then
msg_error "${BOLD}${path}:${ALL_OFF} pkgbase not found in .SRCINFO"
return 1
fi
pkgbase=${pkgbase:-$pkgname}
if [[ ! -e LICENSE ]]; then
msg_error "${BOLD}${pkgbase}:${ALL_OFF} is missing the LICENSE file"

View File

@@ -191,9 +191,7 @@ path = [
".nvchecker.toml",
"*.install",
"*.sysusers",
"*sysusers.conf",
"*.tmpfiles",
"*tmpfiles.conf",
"*.logrotate",
"*.pam",
"*.service",

View File

@@ -39,7 +39,6 @@ inspect=never
bindmounts_ro=()
bindmounts_rw=()
bindmounts_tmpfs=()
nspawn_add_args=()
copy=$USER
[[ -n ${SUDO_USER:-} ]] && copy=$SUDO_USER
@@ -85,8 +84,6 @@ usage() {
echo '-T Build in a temporary directory'
echo '-U Run makepkg as a specified user'
echo '-x <when> Inspect chroot after build (never, always, failure)'
echo '-s <args> Additional systemd-nspawn args (comma-separated) for'
echo ' the arch-nspawn build phase'
exit 1
}
@@ -296,7 +293,7 @@ move_products() {
}
# }}}
while getopts 'hcur:I:l:nCTD:d:U:x:t:s:' arg; do
while getopts 'hcur:I:l:nCTD:d:U:x:t:' arg; do
case "$arg" in
c) clean_first=1 ;;
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
@@ -311,7 +308,6 @@ while getopts 'hcur:I:l:nCTD:d:U:x:t:s:' arg; do
T) temp_chroot=1; copy+="-$$" ;;
U) makepkg_user="$OPTARG" ;;
x) inspect="$OPTARG" ;;
s) IFS=, read -ra nspawn_add_args <<< "$OPTARG" ;;
h|*) usage ;;
esac
done
@@ -398,7 +394,6 @@ nspawn_build_args=(
"${bindmounts_ro[@]}"
"${bindmounts_rw[@]}"
"${bindmounts_tmpfs[@]}"
"${nspawn_add_args[@]}"
)
if arch-nspawn "$copydir" \