-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmakepkg-with-sleuthing
More file actions
54 lines (48 loc) · 1.96 KB
/
Copy pathmakepkg-with-sleuthing
File metadata and controls
54 lines (48 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
# makepkg-with-sleuthing - makepkg wrapper that checks the package with aur-sleuth
# before building.
# Skip the audit only for makepkg actions that run no maintainer-authored code.
# The trap: -o/--nobuild is not one of them. It extracts the sources and runs
# prepare() and pkgver() before exiting, so it must be audited -- it is the
# first invocation that executes the maintainer's code, and both yay
# (--nobuild -f) and paru (-ofA -C) call it that way. --verifysource and
# -g/--geninteg do exit before extraction.
skip=false
for arg in "$@"; do
case "$arg" in
--verifysource|--geninteg|--packagelist|--printsrcinfo|--help|-h|--version|-V|-g)
skip=yes
;;
--*)
# Any other long option is a build-related one; audit it.
;;
-?*)
# A cluster of short flags, which is how both helpers spell their
# phases, so g must be matched inside a cluster as well as bare.
rest="${arg#-}"
# -p (build script) and -D (directory) take an argument that
# consumes the rest of the cluster -- getopt reads -Dg as -D with
# the argument "g", a real build -- so only the characters before
# the first p or D are flags. makepkg's OPT_SHORT is
# AcCdD:efFghiLmop:rRsSV; D: and p: are the only two taking one.
case "$rest" in
*[pD]*) rest="${rest%%[pD]*}" ;;
esac
case "$rest" in
*g*) skip=yes ;;
esac
;;
esac
done
if [[ "$skip" = yes ]]; then
exec /usr/bin/makepkg "$@"
fi
# Run audit against the current working directory's PKGBUILD and sources.
"${AUR_SLEUTH_BIN:-aur-sleuth}" --pkgdir "${PWD}"
status=$?
# Non-zero means audit failed and is fatal under current settings inside aur-sleuth.
# If AUDIT_FAILURE_FATAL=false, aur-sleuth returns 0 here and we proceed.
if [ $status -ne 0 ]; then
exit $status
fi
exec /usr/bin/makepkg "$@"