mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 18:06:19 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
648ab0ad5e | ||
![]() |
63ad548818 | ||
![]() |
39a99e1664 | ||
![]() |
95d06e0f60 | ||
![]() |
ec16d6e4bd | ||
![]() |
fa5afbc30b |
2
Makefile
2
Makefile
@@ -1,4 +1,4 @@
|
|||||||
V=20211129
|
V=20220126
|
||||||
BUILDTOOLVER ?= $(V)
|
BUILDTOOLVER ?= $(V)
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
96
checkpkg.in
96
checkpkg.in
@@ -6,23 +6,6 @@ shopt -s extglob
|
|||||||
|
|
||||||
m4_include(lib/common.sh)
|
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() {
|
usage() {
|
||||||
cat <<- _EOF_
|
cat <<- _EOF_
|
||||||
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS]
|
Usage: ${BASH_SOURCE[0]##*/} [OPTIONS]
|
||||||
@@ -35,41 +18,66 @@ usage() {
|
|||||||
list for both packages and a library list for both packages.
|
list for both packages and a library list for both packages.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-r, --rmdir Remove the temporary directory
|
-r, --rmdir Remove the temporary directory
|
||||||
-w, --warn Print a warning in case of differences
|
-w, --warn Print a warning in case of differences
|
||||||
-h, --help Show this help text
|
-M, --makepkg-config Set an alternate makepkg configuration file
|
||||||
|
-h, --help Show this help text
|
||||||
_EOF_
|
_EOF_
|
||||||
}
|
}
|
||||||
|
|
||||||
RMDIR=0
|
RMDIR=0
|
||||||
WARN=0
|
WARN=0
|
||||||
|
MAKEPKG_CONF=/etc/makepkg.conf
|
||||||
|
|
||||||
OPT_SHORT='rwh'
|
# option checking
|
||||||
OPT_LONG=('rmdir' 'warn' 'help')
|
while (( $# )); do
|
||||||
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
case $1 in
|
||||||
exit 1
|
-h|--help)
|
||||||
fi
|
usage
|
||||||
set -- "${OPTRET[@]}"
|
exit 0
|
||||||
|
;;
|
||||||
while :; do
|
-r|--rmdir)
|
||||||
case $1 in
|
RMDIR=1
|
||||||
-r|--rmdir)
|
shift
|
||||||
RMDIR=1
|
;;
|
||||||
;;
|
-w|--warn)
|
||||||
-w|--warn)
|
WARN=1
|
||||||
WARN=1
|
shift
|
||||||
;;
|
;;
|
||||||
-h|--help)
|
-M|--makepkg-config)
|
||||||
usage
|
MAKEPKG_CONF="$2"
|
||||||
exit 0
|
shift 2
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
shift; break
|
shift
|
||||||
;;
|
break
|
||||||
esac
|
;;
|
||||||
shift
|
-*,--*)
|
||||||
|
die "invalid argument: %s" "$1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
if [[ ! -f PKGBUILD ]]; then
|
if [[ ! -f PKGBUILD ]]; then
|
||||||
die 'This must be run in the directory of a built package.'
|
die 'This must be run in the directory of a built package.'
|
||||||
fi
|
fi
|
||||||
|
52
commitpkg.in
52
commitpkg.in
@@ -93,16 +93,14 @@ for _arch in "${arch[@]}"; do
|
|||||||
fullver=$(get_full_version "$_pkgname")
|
fullver=$(get_full_version "$_pkgname")
|
||||||
|
|
||||||
if pkgfile=$(find_cached_package "$_pkgname" "$fullver" "$_arch"); then
|
if pkgfile=$(find_cached_package "$_pkgname" "$fullver" "$_arch"); then
|
||||||
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
|
check_package_validity "$pkgfile"
|
||||||
die "PACKAGER was not set when building package"
|
|
||||||
fi
|
|
||||||
hashsum=sha256sum
|
|
||||||
pkgbuild_hash=$(awk -v"hashsum=$hashsum" -F' = ' '$1 == "pkgbuild_"hashsum {print $2}' <(bsdtar -xOqf "$pkgfile" .BUILDINFO))
|
|
||||||
if [[ "$pkgbuild_hash" != "$($hashsum PKGBUILD|cut -d' ' -f1)" ]]; then
|
|
||||||
die "PKGBUILD $hashsum mismatch: expected $pkgbuild_hash"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
fullver=$(get_full_version "$pkgbase")
|
||||||
|
if pkgfile=$(find_cached_package "$pkgbase-debug" "$fullver" "$_arch"); then
|
||||||
|
check_package_validity "$pkgfile"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z $server ]]; then
|
if [[ -z $server ]]; then
|
||||||
@@ -147,27 +145,37 @@ for _arch in "${arch[@]}"; do
|
|||||||
|
|
||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
fullver=$(get_full_version "$_pkgname")
|
fullver=$(get_full_version "$_pkgname")
|
||||||
|
|
||||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
|
||||||
warning "Skipping %s: failed to locate package file" "$_pkgname-$fullver-$_arch"
|
warning "Skipping %s: failed to locate package file" "$_pkgname-$fullver-$_arch"
|
||||||
skip_arches+=("$_arch")
|
skip_arches+=("$_arch")
|
||||||
continue 2
|
continue 2
|
||||||
fi
|
fi
|
||||||
uploads+=("$pkgfile")
|
uploads+=("$pkgfile")
|
||||||
|
|
||||||
sigfile="${pkgfile}.sig"
|
|
||||||
if [[ ! -f $sigfile ]]; then
|
|
||||||
msg "Signing package %s..." "${pkgfile}"
|
|
||||||
if [[ -n $GPGKEY ]]; then
|
|
||||||
SIGNWITHKEY=(-u "${GPGKEY}")
|
|
||||||
fi
|
|
||||||
gpg --detach-sign --use-agent --no-armor "${SIGNWITHKEY[@]}" "${pkgfile}" || die
|
|
||||||
fi
|
|
||||||
if ! gpg --verify "$sigfile" "$pkgfile" >/dev/null 2>&1; then
|
|
||||||
die "Signature %s is incorrect!" "$sigfile"
|
|
||||||
fi
|
|
||||||
uploads+=("$sigfile")
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
fullver=$(get_full_version "$pkgbase")
|
||||||
|
if ! pkgfile=$(find_cached_package "$pkgbase-debug" "$fullver" "$_arch"); then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! is_debug_package "$pkgfile"; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
uploads+=("$pkgfile")
|
||||||
|
done
|
||||||
|
|
||||||
|
for pkgfile in "${uploads[@]}"; do
|
||||||
|
sigfile="${pkgfile}.sig"
|
||||||
|
if [[ ! -f $sigfile ]]; then
|
||||||
|
msg "Signing package %s..." "${pkgfile}"
|
||||||
|
if [[ -n $GPGKEY ]]; then
|
||||||
|
SIGNWITHKEY=(-u "${GPGKEY}")
|
||||||
|
fi
|
||||||
|
gpg --detach-sign --use-agent --no-armor "${SIGNWITHKEY[@]}" "${pkgfile}" || die
|
||||||
|
fi
|
||||||
|
if ! gpg --verify "$sigfile" "$pkgfile" >/dev/null 2>&1; then
|
||||||
|
die "Signature %s is incorrect!" "$sigfile"
|
||||||
|
fi
|
||||||
|
uploads+=("$sigfile")
|
||||||
done
|
done
|
||||||
|
|
||||||
for _arch in "${arch[@]}"; do
|
for _arch in "${arch[@]}"; do
|
||||||
|
@@ -29,6 +29,9 @@ Options
|
|||||||
*-w, --warn*::
|
*-w, --warn*::
|
||||||
Print a warning instead of a regular message in case of soname differences.
|
Print a warning instead of a regular message in case of soname differences.
|
||||||
|
|
||||||
|
*-M, --makepkg-config*::
|
||||||
|
Set an alternate makepkg configuration file.
|
||||||
|
|
||||||
*-h, --help*::
|
*-h, --help*::
|
||||||
Show a help text
|
Show a help text
|
||||||
|
|
||||||
|
@@ -189,3 +189,73 @@ find_cached_package() {
|
|||||||
return 1
|
return 1
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
check_package_validity(){
|
||||||
|
local pkgfile=$1
|
||||||
|
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
|
||||||
|
die "PACKAGER was not set when building package"
|
||||||
|
fi
|
||||||
|
hashsum=sha256sum
|
||||||
|
pkgbuild_hash=$(awk -v"hashsum=$hashsum" -F' = ' '$1 == "pkgbuild_"hashsum {print $2}' <(bsdtar -xOqf "$pkgfile" .BUILDINFO))
|
||||||
|
if [[ "$pkgbuild_hash" != "$($hashsum PKGBUILD|cut -d' ' -f1)" ]]; then
|
||||||
|
die "PKGBUILD $hashsum mismatch: expected $pkgbuild_hash"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# usage: grep_pkginfo pkgfile pattern
|
||||||
|
grep_pkginfo() {
|
||||||
|
local _ret=()
|
||||||
|
mapfile -t _ret < <(bsdtar -xOqf "$1" ".PKGINFO" | grep "^${2} = ")
|
||||||
|
printf '%s\n' "${_ret[@]#${2} = }"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get the package name
|
||||||
|
getpkgname() {
|
||||||
|
local _name
|
||||||
|
|
||||||
|
_name="$(grep_pkginfo "$1" "pkgname")"
|
||||||
|
if [[ -z $_name ]]; then
|
||||||
|
error "Package '%s' has no pkgname in the PKGINFO. Fail!" "$1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$_name"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Get the package base or name as fallback
|
||||||
|
getpkgbase() {
|
||||||
|
local _base
|
||||||
|
|
||||||
|
_base="$(grep_pkginfo "$1" "pkgbase")"
|
||||||
|
if [[ -z $_base ]]; then
|
||||||
|
getpkgname "$1"
|
||||||
|
else
|
||||||
|
echo "$_base"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
getpkgdesc() {
|
||||||
|
local _desc
|
||||||
|
|
||||||
|
_desc="$(grep_pkginfo "$1" "pkgdesc")"
|
||||||
|
if [[ -z $_desc ]]; then
|
||||||
|
error "Package '%s' has no pkgdesc in the PKGINFO. Fail!" "$1"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$_desc"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
is_debug_package() {
|
||||||
|
local pkgfile=${1} pkgbase pkgname pkgdesc
|
||||||
|
pkgbase="$(getpkgbase "${pkgfile}")"
|
||||||
|
pkgname="$(getpkgname "${pkgfile}")"
|
||||||
|
pkgdesc="$(getpkgdesc "${pkgfile}")"
|
||||||
|
[[ ${pkgdesc} == "Detached debugging symbols for "* && ${pkgbase}-debug = "${pkgname}" ]]
|
||||||
|
}
|
||||||
|
@@ -408,7 +408,7 @@ else
|
|||||||
done
|
done
|
||||||
|
|
||||||
msg2 "Checking packages"
|
msg2 "Checking packages"
|
||||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn "${remotepkgs[@]/#file:\/\//}"
|
sudo -u "$makepkg_user" checkpkg --rmdir --warn --makepkg-config "$copydir/etc/makepkg.conf" "${remotepkgs[@]/#file:\/\//}"
|
||||||
fi
|
fi
|
||||||
true
|
true
|
||||||
fi
|
fi
|
||||||
|
@@ -77,6 +77,7 @@ _rebuildpkgs_args=(
|
|||||||
_checkpkg_args=(
|
_checkpkg_args=(
|
||||||
'(-r --rmdir)'{-r,--rmdir}'[Remove the temporary directory]'
|
'(-r --rmdir)'{-r,--rmdir}'[Remove the temporary directory]'
|
||||||
'(-w --warn)'{-w,--warn}'[Print a warning in case of differences]'
|
'(-w --warn)'{-w,--warn}'[Print a warning in case of differences]'
|
||||||
|
'(-M --makepkg-config)'{-M,--makepkg-config}'[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
||||||
'(-h --help)'{-h,--help}'[Display usage]'
|
'(-h --help)'{-h,--help}'[Display usage]'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user