Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/checkpkg.in
diff options
context:
space:
mode:
authorFelix Yan <felixonmars@archlinux.org>2021-07-27 19:22:19 +0800
committerLevente Polyak <anthraxx@archlinux.org>2022-01-22 01:12:32 +0100
commitfa5afbc30b68912eb7f16d434a27faf787c3da9c (patch)
tree47b2146d91d1d2ec378b37b300a1b1abe7e516b0 /checkpkg.in
parent412d032c265e2f5193e41cdad2e739b1501b9ca5 (diff)
checkpkg: set makepkg vars from build root to support none host archs
When building for an architecture different from the host, the correct old package was downloaded as "$copydir"'s pacman was configured with the target CARCH, but checkpkg doesn't know this and tries to search the cache for host CARCH instead, producing the following error: `==> ERROR: tarball not found for package: xxx` This change fixes this by passing the appropriate makepkg config explicitly, so that checkpkg behaves consistently. Co-Authored-by: Levente Polyak <anthraxx@archlinux.org> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'checkpkg.in')
-rw-r--r--checkpkg.in96
1 files changed, 52 insertions, 44 deletions
diff --git a/checkpkg.in b/checkpkg.in
index f40989d..aa862c5 100644
--- a/checkpkg.in
+++ b/checkpkg.in
@@ -6,23 +6,6 @@ shopt -s extglob
m4_include(lib/common.sh)
-# Source makepkg.conf; fail if it is not found
-if [[ -r '/etc/makepkg.conf' ]]; then
- # shellcheck source=makepkg-x86_64.conf
- source '/etc/makepkg.conf'
-else
- die '/etc/makepkg.conf not found!'
-fi
-
-# Source user-specific makepkg.conf overrides
-if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
- # shellcheck source=/dev/null
- source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
-elif [[ -r "$HOME/.makepkg.conf" ]]; then
- # shellcheck source=/dev/null
- source "$HOME/.makepkg.conf"
-fi
-
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS]
@@ -35,40 +18,65 @@ usage() {
list for both packages and a library list for both packages.
OPTIONS
- -r, --rmdir Remove the temporary directory
- -w, --warn Print a warning in case of differences
- -h, --help Show this help text
+ -r, --rmdir Remove the temporary directory
+ -w, --warn Print a warning in case of differences
+ -M, --makepkg-config Set an alternate makepkg configuration file
+ -h, --help Show this help text
_EOF_
}
RMDIR=0
WARN=0
+MAKEPKG_CONF=/etc/makepkg.conf
+
+# option checking
+while (( $# )); do
+ case $1 in
+ -h|--help)
+ usage
+ exit 0
+ ;;
+ -r|--rmdir)
+ RMDIR=1
+ shift
+ ;;
+ -w|--warn)
+ WARN=1
+ shift
+ ;;
+ -M|--makepkg-config)
+ MAKEPKG_CONF="$2"
+ shift 2
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*,--*)
+ die "invalid argument: %s" "$1"
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
-OPT_SHORT='rwh'
-OPT_LONG=('rmdir' 'warn' 'help')
-if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
- exit 1
+# Source makepkg.conf; fail if it is not found
+if [[ -r "${MAKEPKG_CONF}" ]]; then
+ # shellcheck source=makepkg-x86_64.conf
+ source "${MAKEPKG_CONF}"
+else
+ die "${MAKEPKG_CONF} not found!"
+fi
+
+# Source user-specific makepkg.conf overrides
+if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
+ source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
+elif [[ -r "$HOME/.makepkg.conf" ]]; then
+ # shellcheck source=/dev/null
+ source "$HOME/.makepkg.conf"
fi
-set -- "${OPTRET[@]}"
-
-while :; do
- case $1 in
- -r|--rmdir)
- RMDIR=1
- ;;
- -w|--warn)
- WARN=1
- ;;
- -h|--help)
- usage
- exit 0
- ;;
- --)
- shift; break
- ;;
- esac
- shift
-done
if [[ ! -f PKGBUILD ]]; then
die 'This must be run in the directory of a built package.'