Compare commits

..

5 Commits

Author SHA1 Message Date
Levente Polyak
0cdabbe051 offload-build: support different pkgdatadir locations on the remote
Use devtools-config to get the pkgdatadir on the remote and use that
location to search for the appropriate makepkg.conf file. This way the
remote environment can have a non repo matching devtools build for
example being installed to /usr/local
2022-05-17 19:49:43 +02:00
Levente Polyak
1feaad345d devtools-config: add tool to handle and print environment specifics
Let's introduce a new tool so we can handle environment and installation
specific information and print out things like pkgdatadir.
2022-05-17 19:49:37 +02:00
Levente Polyak
a6d8115908 diffpkg: support comparing two given package archives
This adds support similar to diffpkg from the infrastructure repo
that is based on the assumption that two archives can be passed
to the tooling in order to compare them.
2022-05-12 17:16:01 +02:00
Levente Polyak
f90b5a523e diffpkg: support multiple diff modes to compare with
This adds support for the following diff modes:

- content list (default)
- diffoscope
- .PKGINFO diff
- .BUILDINFO diff
2022-05-12 17:16:01 +02:00
Jelle van der Waa
3765ea90a6 diffpkg - diff repo vs. build package
Include a new tool as alternative to checkpkg, this runs diffoscope on a
newly build package and the current repository package. This can be
useful for finding new files / binaries.
2022-05-12 17:15:56 +02:00
10 changed files with 92 additions and 131 deletions

2
.gitignore vendored
View File

@@ -6,8 +6,8 @@ archrelease
bash_completion
checkpkg
commitpkg
devtools-config
diffpkg
export-pkgbuild-keys
finddeps
lddd
makechrootpkg

View File

@@ -1,4 +1,4 @@
V=20220609
V=20220207
BUILDTOOLVER ?= $(V)
PREFIX = /usr/local
@@ -12,8 +12,8 @@ IN_PROGS = \
checkpkg \
commitpkg \
crossrepomove\
devtools-config \
diffpkg \
export-pkgbuild-keys \
finddeps \
find-libdeps \
lddd \
@@ -75,10 +75,10 @@ BASHCOMPLETION_LINKS = \
MANS = \
doc/archbuild.1 \
doc/arch-nspawn.1 \
doc/export-pkgbuild-keys.1 \
doc/makechrootpkg.1 \
doc/lddd.1 \
doc/checkpkg.1 \
doc/devtools-config.1 \
doc/diffpkg.1 \
doc/offload-build.1 \
doc/sogrep.1 \
@@ -120,8 +120,8 @@ install:
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -Dm0644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
for l in ${BASHCOMPLETION_LINKS}; do ln -sf devtools $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$l; done
install -Dm0644 bash_completion $(DESTDIR)/usr/share/bash-completion/completions/devtools
for l in ${BASHCOMPLETION_LINKS}; do ln -sf devtools $(DESTDIR)/usr/share/bash-completion/completions/$$l; done
install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
ln -sf archco $(DESTDIR)$(PREFIX)/bin/communityco
for manfile in $(MANS); do \
@@ -135,8 +135,7 @@ uninstall:
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${BASHCOMPLETION_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/$$l; done
rm $(DESTDIR)$(PREFIX)/share/bash-completion/completions/devtools
rm $(DESTDIR)/usr/share/bash-completion/completions/devtools
rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
rm -f $(DESTDIR)$(PREFIX)/bin/communityco
rm -f $(DESTDIR)$(PREFIX)/bin/find-libprovides

View File

@@ -48,21 +48,6 @@ case "$cmd" in
;;
esac
if (( ${#validpgpkeys[@]} != 0 )); then
if [[ -d keys ]]; then
for key in "${validpgpkeys[@]}"; do
if [[ ! -f keys/pgp/$key.asc ]]; then
export-pkgbuild-keys || die 'Failed to export valid PGP keys for source files'
fi
done
else
export-pkgbuild-keys || die 'Failed to export valid PGP keys for source files'
fi
svn add --parents --force keys/pgp/*
fi
# find files which should be under source control
needsversioning=()
for s in "${source[@]}"; do
@@ -75,9 +60,6 @@ for i in 'changelog' 'install'; do
needsversioning+=("$file")
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
done
for key in "${validpgpkeys[@]}"; do
needsversioning+=("keys/pgp/$key.asc")
done
# assert that they really are controlled by SVN
if (( ${#needsversioning[*]} )); then

46
devtools-config.in Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
pkgdatadir='@pkgdatadir@'
# shellcheck disable=SC2059
die() { printf "error: $1\n" "${@:2}" >&2; exit 1; }
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/} [OPTION...]
Manage and print environment specific devtools information.
OPTIONS
--pkgdatadir Print pkgdatadir location
-h, --help Show this help text
_EOF_
}
print_pkgdatadir() {
printf "%s\n" "${pkgdatadir}"
}
if (( $# == 0 )); then
usage
exit 0
fi
# option checking
while (( $# )); do
case $1 in
-h|--help)
usage
exit 0
;;
--pkgdatadir)
print_pkgdatadir
exit 0
;;
*)
die "invalid argument: %s" "$1"
;;
esac
done

View File

@@ -0,0 +1,26 @@
devtools-config(1)
================
Name
----
devtools-config - Manage and print environment specific devtools information.
Synopsis
--------
devtools-config [OPTIONS]
Description
-----------
Manage and print environment specific devtools information.
Options
-------
*--pkgdatadir*::
Print environment specific pkgdatadir location.
*-h, --help*::
Show a help text.
include::footer.asciidoc[]

View File

@@ -1,25 +0,0 @@
export-pkgbuild-keys(1)
=======================
Name
----
export-pkgbuild-keys - Export valid source signing keys from a PKGBUILD
Synopsis
--------
export-pkgbuild-keys
Description
-----------
Export the PGP keys from a PKGBUILDs validpgpkeys array into the keys/pgp/
subdirectory. Useful for distributing packager validated source signing
keys alongside PKGBUILDs.
Options
-------
*-h, --help*::
Show a help text.
include::footer.asciidoc[]

View File

@@ -1,73 +0,0 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later
m4_include(lib/common.sh)
usage() {
cat <<- _EOF_
Usage: ${BASH_SOURCE[0]##*/}
Export the PGP keys from a PKGBUILDs validpgpkeys array into the keys/pgp/
subdirectory. Useful for distributing packager validated source signing
keys alongside PKGBUILDs.
OPTIONS
-h, --help Show this help text
_EOF_
}
# option checking
while (( $# )); do
case $1 in
-h|--help)
usage
exit 0
;;
*)
die "invalid argument: %s" "$1"
;;
esac
done
if [[ ! -f PKGBUILD ]]; then
die "This must be run a directory containing a PKGBUILD."
fi
mapfile -t validpgpkeys < <(
# shellcheck source=PKGBUILD.proto
. ./PKGBUILD
printf "%s\n" "${validpgpkeys[@]}"
)
msg "Exporting ${#validpgpkeys[@]} PGP keys..."
if (( ${#validpgpkeys[@]} == 0 )); then
exit 0
fi
trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
TEMPDIR=$(mktemp -d --tmpdir export-pkgbuild-keys.XXXXXXXXXX)
mkdir -p keys/pgp
error=0
for key in "${validpgpkeys[@]}"; do
gpg --output "$TEMPDIR/$key.asc" --armor --export --export-options export-minimal "$key" 2>/dev/null
# gpg does not give a non-zero return value if it fails to export...
if [[ -f $TEMPDIR/$key.asc ]]; then
msg2 "Exported $key"
mv "$TEMPDIR/$key.asc" "keys/pgp/$key.asc"
else
if [[ -f keys/pgp/$key.asc ]]; then
warning "Failed to update key: $key"
else
error "Key unavailable: $key"
error=1
fi
fi
done
if (( error )); then
die "Failed to export all \'validpgpkeys\' entries."
fi

View File

@@ -81,11 +81,11 @@ for file in "${files[@]}"; do
cp "$file" "$working_dir$file"
done
unshare --mount pacstrap -${umode}Mcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
pacstrap -${umode}Mcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \
"${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages'
printf '%s.UTF-8 UTF-8\n' C en_US de_DE > "$working_dir/etc/locale.gen"
echo 'LANG=C.UTF-8' > "$working_dir/etc/locale.conf"
printf '%s.UTF-8 UTF-8\n' en_US de_DE > "$working_dir/etc/locale.gen"
echo 'LANG=en_US.UTF-8' > "$working_dir/etc/locale.conf"
echo "$CHROOT_VERSION" > "$working_dir/.arch-chroot"
systemd-machine-id-setup --root="$working_dir"

View File

@@ -101,10 +101,11 @@ mapfile -t files < <(
printf "%s\n" "" "-> build complete" &&
printf "\t%s\n" "$temp"/*
} >&2 &&
pkgdatadir="$(devtools-config --pkgdatadir||echo /usr/share/devtools)" &&
makepkg_user_config="${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" &&
makepkg_config="/usr/share/devtools/makepkg-'"${arch}"'.conf" &&
if [[ -f /usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf ]]; then
makepkg_config="/usr/share/devtools/makepkg-'"${repo}"'-'"${arch}"'.conf"
makepkg_config="${pkgdatadir}/makepkg-'"${arch}"'.conf" &&
if [[ -f "${pkgdatadir}/makepkg-'"${repo}"'-'"${arch}"'.conf" ]]; then
makepkg_config="${pkgdatadir}/makepkg-'"${repo}"'-'"${arch}"'.conf"
fi &&
makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
printf "%s\n" "${temp}/PKGBUILD"

View File

@@ -1,4 +1,4 @@
#compdef archbuild archco arch-nspawn archrelease commitpkg diffpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild communityco=archco checkpkg sogrep offload-build makerepropkg
#compdef archbuild archco arch-nspawn archrelease commitpkg devtools-config diffpkg finddeps makechrootpkg mkarchroot rebuildpkgs extrapkg=commitpkg corepkg=commitpkg testingpkg=commitpkg stagingpkg=commitpkg communitypkg=commitpkg community-testingpkg=commitpkg community-stagingpkg=commitpkg multilibpkg=commitpkg multilib-testingpkg=commitpkg extra-x86_64-build=archbuild testing-x86_64-build=archbuild staging-x86_64-build=archbuild multilib-build=archbuild multilib-testing-build=archbuild multilib-staging-build=archbuild kde-unstable-x86_64-build=archbuild gnome-unstable-x86_64-build=archbuild communityco=archco checkpkg sogrep offload-build makerepropkg
#
# SPDX-License-Identifier: GPL-3.0-or-later
@@ -41,6 +41,11 @@ _commitpkg_args=(
'1:commit_msg'
)
_devtools_config_args=(
'(--pkgdatadir)'{--pkgdatadir}'[Print pkgdatadir location]'
'(-h --help)'{-h,--help}'[Display usage]'
)
_diffpkg_args=(
'(-l --list)'{-l,--list}'[Tar content list diff mode]'
'(-d --diffoscope)'{-d,--diffoscope}'[Diffoscope diff mode]'