mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 01:46:19 +02:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a17c9c6a70 | ||
![]() |
065c00ad8f | ||
![]() |
ea162ef041 | ||
![]() |
648ab0ad5e | ||
![]() |
63ad548818 | ||
![]() |
39a99e1664 | ||
![]() |
95d06e0f60 | ||
![]() |
ec16d6e4bd | ||
![]() |
fa5afbc30b |
4
Makefile
4
Makefile
@@ -1,4 +1,4 @@
|
||||
V=20211129
|
||||
V=20220207
|
||||
BUILDTOOLVER ?= $(V)
|
||||
|
||||
PREFIX = /usr/local
|
||||
@@ -146,7 +146,7 @@ tag:
|
||||
@git tag --sign --message "Version $(TODAY)" $(TODAY)
|
||||
|
||||
dist:
|
||||
git archive --format=tar --prefix=devtools-$(V)/ $(V) | gzip -9 > devtools-$(V).tar.gz
|
||||
git archive --format=tar --prefix=devtools-$(V)/ $(V) | gzip > devtools-$(V).tar.gz
|
||||
gpg --detach-sign --use-agent devtools-$(V).tar.gz
|
||||
|
||||
upload:
|
||||
|
96
checkpkg.in
96
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,41 +18,66 @@ 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
|
||||
|
||||
OPT_SHORT='rwh'
|
||||
OPT_LONG=('rmdir' 'warn' 'help')
|
||||
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||
exit 1
|
||||
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
|
||||
# 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
|
||||
|
||||
# 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
|
||||
die 'This must be run in the directory of a built package.'
|
||||
fi
|
||||
|
52
commitpkg.in
52
commitpkg.in
@@ -93,16 +93,14 @@ for _arch in "${arch[@]}"; do
|
||||
fullver=$(get_full_version "$_pkgname")
|
||||
|
||||
if pkgfile=$(find_cached_package "$_pkgname" "$fullver" "$_arch"); then
|
||||
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
|
||||
check_package_validity "$pkgfile"
|
||||
fi
|
||||
done
|
||||
|
||||
fullver=$(get_full_version "$pkgbase")
|
||||
if pkgfile=$(find_cached_package "$pkgbase-debug" "$fullver" "$_arch"); then
|
||||
check_package_validity "$pkgfile"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z $server ]]; then
|
||||
@@ -147,27 +145,37 @@ for _arch in "${arch[@]}"; do
|
||||
|
||||
for _pkgname in "${pkgname[@]}"; do
|
||||
fullver=$(get_full_version "$_pkgname")
|
||||
|
||||
if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
|
||||
warning "Skipping %s: failed to locate package file" "$_pkgname-$fullver-$_arch"
|
||||
skip_arches+=("$_arch")
|
||||
continue 2
|
||||
fi
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
for _arch in "${arch[@]}"; do
|
||||
|
@@ -29,6 +29,9 @@ Options
|
||||
*-w, --warn*::
|
||||
Print a warning instead of a regular message in case of soname differences.
|
||||
|
||||
*-M, --makepkg-config*::
|
||||
Set an alternate makepkg configuration file.
|
||||
|
||||
*-h, --help*::
|
||||
Show a help text
|
||||
|
||||
|
@@ -189,3 +189,73 @@ find_cached_package() {
|
||||
return 1
|
||||
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
|
||||
|
||||
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
|
||||
true
|
||||
fi
|
||||
|
@@ -49,8 +49,8 @@ LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
|
||||
#-- Make Flags: change this for DistCC/SMP systems
|
||||
#MAKEFLAGS="-j2"
|
||||
#-- Debugging flags
|
||||
DEBUG_CFLAGS="-g -fvar-tracking-assignments"
|
||||
DEBUG_CXXFLAGS="-g -fvar-tracking-assignments"
|
||||
DEBUG_CFLAGS="-g"
|
||||
DEBUG_CXXFLAGS="$DEBUG_CFLAGS"
|
||||
#DEBUG_RUSTFLAGS="-C debuginfo=2"
|
||||
|
||||
#########################################################################
|
||||
|
@@ -77,6 +77,7 @@ _rebuildpkgs_args=(
|
||||
_checkpkg_args=(
|
||||
'(-r --rmdir)'{-r,--rmdir}'[Remove the temporary directory]'
|
||||
'(-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]'
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user