Compare commits
8 Commits
master
...
custom-201
Author | SHA1 | Date |
---|---|---|
Marius Kittler | 1d9c2b3350 | |
Kevin Mihelich | 1d2ead09c9 | |
Kevin Mihelich | 1cc8b102de | |
Kevin Mihelich | 918cdb2085 | |
Kevin Mihelich | 785fb7e087 | |
Kevin Mihelich | e93e702859 | |
Kevin Mihelich | 7aa39b7fb2 | |
Kevin Mihelich | ec11878a60 |
|
@ -11,7 +11,6 @@ lddd
|
||||||
makechrootpkg
|
makechrootpkg
|
||||||
makerepropkg
|
makerepropkg
|
||||||
mkarchroot
|
mkarchroot
|
||||||
offload-build
|
|
||||||
rebuildpkgs
|
rebuildpkgs
|
||||||
zsh_completion
|
zsh_completion
|
||||||
find-libdeps
|
find-libdeps
|
||||||
|
@ -19,4 +18,3 @@ crossrepomove
|
||||||
arch-nspawn
|
arch-nspawn
|
||||||
sogrep
|
sogrep
|
||||||
doc/*.1
|
doc/*.1
|
||||||
doc/*.7
|
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -1,4 +1,4 @@
|
||||||
V=20210202
|
V=20191227
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
MANDIR = $(PREFIX)/share/man
|
MANDIR = $(PREFIX)/share/man
|
||||||
|
@ -17,12 +17,12 @@ IN_PROGS = \
|
||||||
makerepropkg \
|
makerepropkg \
|
||||||
mkarchroot \
|
mkarchroot \
|
||||||
makechrootpkg \
|
makechrootpkg \
|
||||||
offload-build \
|
|
||||||
rebuildpkgs \
|
rebuildpkgs \
|
||||||
sogrep
|
sogrep
|
||||||
|
|
||||||
BINPROGS = \
|
BINPROGS = \
|
||||||
$(IN_PROGS)
|
$(IN_PROGS) \
|
||||||
|
offload-build \
|
||||||
|
|
||||||
CONFIGFILES = \
|
CONFIGFILES = \
|
||||||
makepkg-x86_64.conf \
|
makepkg-x86_64.conf \
|
||||||
|
@ -75,8 +75,7 @@ MANS = \
|
||||||
doc/makerepropkg.1 \
|
doc/makerepropkg.1 \
|
||||||
doc/mkarchroot.1 \
|
doc/mkarchroot.1 \
|
||||||
doc/find-libdeps.1 \
|
doc/find-libdeps.1 \
|
||||||
doc/find-libprovides.1 \
|
doc/find-libprovides.1
|
||||||
doc/devtools.7
|
|
||||||
|
|
||||||
|
|
||||||
all: $(BINPROGS) bash_completion zsh_completion man
|
all: $(BINPROGS) bash_completion zsh_completion man
|
||||||
|
|
|
@ -69,9 +69,7 @@ host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 's#(.*/)e
|
||||||
for host_mirror in "${host_mirrors[@]}"; do
|
for host_mirror in "${host_mirrors[@]}"; do
|
||||||
if [[ $host_mirror == *file://* ]]; then
|
if [[ $host_mirror == *file://* ]]; then
|
||||||
host_mirror=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
host_mirror=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
||||||
for m in "$host_mirror"/pool/*/; do
|
in_array "$host_mirror" "${cache_dirs[@]}" || cache_dirs+=("$host_mirror")
|
||||||
in_array "$m" "${cache_dirs[@]}" || cache_dirs+=("$m")
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -97,7 +95,7 @@ copy_hostconf () {
|
||||||
unshare --fork --pid gpg --homedir "$working_dir"/etc/pacman.d/gnupg/ --no-permission-warning --quiet --batch --import --import-options import-local-sigs "$(pacman-conf GpgDir)"/pubring.gpg >/dev/null 2>&1
|
unshare --fork --pid gpg --homedir "$working_dir"/etc/pacman.d/gnupg/ --no-permission-warning --quiet --batch --import --import-options import-local-sigs "$(pacman-conf GpgDir)"/pubring.gpg >/dev/null 2>&1
|
||||||
pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg/ --import-trustdb "$(pacman-conf GpgDir)" >/dev/null 2>&1
|
pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg/ --import-trustdb "$(pacman-conf GpgDir)" >/dev/null 2>&1
|
||||||
|
|
||||||
printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
|
#printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
|
||||||
|
|
||||||
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
|
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
|
||||||
[[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf"
|
[[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf"
|
||||||
|
@ -127,9 +125,12 @@ eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")"
|
||||||
|
|
||||||
[[ -z $nosetarch ]] || unset CARCH
|
[[ -z $nosetarch ]] || unset CARCH
|
||||||
|
|
||||||
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn -q \
|
exec systemd-nspawn -q \
|
||||||
-D "$working_dir" \
|
-D "$working_dir" \
|
||||||
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
|
-E "PATH=/usr/local/sbin:/usr/local/bin:/usr/bin" \
|
||||||
--register=no --keep-unit --as-pid2 \
|
--register=no \
|
||||||
|
--as-pid2 \
|
||||||
|
--rlimit=NOFILE=10000 \
|
||||||
|
--resolv-conf=copy-host \
|
||||||
"${mount_args[@]}" \
|
"${mount_args[@]}" \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
|
@ -69,7 +69,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||||
|
|
||||||
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
|
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
|
||||||
(umask 0022; mkdir -p "${chroots}/${repo}-${arch}")
|
(umask 0022; mkdir -p "${chroots}/${repo}-${arch}")
|
||||||
setarch "${arch}" mkarchroot \
|
mkarchroot \
|
||||||
-C "${pacman_config}" \
|
-C "${pacman_config}" \
|
||||||
-M "${makepkg_config}" \
|
-M "${makepkg_config}" \
|
||||||
"${chroots}/${repo}-${arch}/root" \
|
"${chroots}/${repo}-${arch}/root" \
|
||||||
|
|
|
@ -95,10 +95,8 @@ for _pkgname in "${pkgname[@]}"; do
|
||||||
|
|
||||||
if (( $# )); then
|
if (( $# )); then
|
||||||
case $1 in
|
case $1 in
|
||||||
*://*)
|
|
||||||
pkgurl=$1 ;;
|
|
||||||
/*|*/*)
|
/*|*/*)
|
||||||
pkgurl=$(readlink -m "$1") ;;
|
pkgurl=file://$(readlink -m "$1") ;;
|
||||||
*.pkg.tar*)
|
*.pkg.tar*)
|
||||||
pkgurl=$1 ;;
|
pkgurl=$1 ;;
|
||||||
'')
|
'')
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
devtools(7)
|
|
||||||
===========
|
|
||||||
|
|
||||||
Name
|
|
||||||
----
|
|
||||||
devtools - Developer tools for the Arch Linux distribution
|
|
||||||
|
|
||||||
Description
|
|
||||||
-----------
|
|
||||||
|
|
||||||
Devtools contains tools for package maintenance in Arch Linux. The toolset
|
|
||||||
varies from tools for building packages in a clean chroot ('mkarchroot',...),
|
|
||||||
packaging related tools for sonames ('sogrep', 'lddd') and tools for
|
|
||||||
repository management such as ('archco', 'extra2community')
|
|
||||||
|
|
||||||
Programs
|
|
||||||
--------
|
|
||||||
The list below gives a short overview; see the respective documentation
|
|
||||||
for details.
|
|
||||||
|
|
||||||
linkman:checkpkg[1]
|
|
||||||
Compare the current build pakcage with the repository version
|
|
||||||
|
|
||||||
linkman:find-libdeps[1]
|
|
||||||
Find soname dependencies for a package
|
|
||||||
|
|
||||||
linkman:find-libprovides[1]
|
|
||||||
Find soname's which are provided by a package
|
|
||||||
|
|
||||||
linkman:lddd[1]
|
|
||||||
Find broken library links on your system
|
|
||||||
|
|
||||||
linkman:makerepropkg[1]
|
|
||||||
Rebuild a package to see if it is reproducible
|
|
||||||
|
|
||||||
linkman:mkarchroot[1]
|
|
||||||
Creates an arch chroot in a specified location with a specified set of
|
|
||||||
packages
|
|
||||||
|
|
||||||
linkman:offload-build[1]
|
|
||||||
Build a PKGBUILD on a remote server using makechrootpkg
|
|
||||||
|
|
||||||
linkman:sogrep[1]
|
|
||||||
Find packages using a linked to a given shared library
|
|
||||||
|
|
||||||
include::footer.asciidoc[]
|
|
|
@ -7,12 +7,12 @@ makerepropkg - Rebuild a package to see if it is reproducible
|
||||||
|
|
||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
makerepropkg [OPTIONS] [<package_file|pkgname>...]
|
makerepropkg [OPTIONS] <package_file>
|
||||||
|
|
||||||
Description
|
Description
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Given the path to a built pacman package(s), attempt to rebuild it using the
|
Given the path to a built pacman package, attempt to rebuild it using the
|
||||||
PKGBUILD in the current directory. The package will be built in an environment
|
PKGBUILD in the current directory. The package will be built in an environment
|
||||||
as closely matching the environment of the initial package as possible, by
|
as closely matching the environment of the initial package as possible, by
|
||||||
building up a chroot to match the information exposed in the package's
|
building up a chroot to match the information exposed in the package's
|
||||||
|
@ -20,28 +20,12 @@ linkman:BUILDINFO[5] manifest. On success, the resulting package will be
|
||||||
compared to the input package, and makerepropkg will report whether the
|
compared to the input package, and makerepropkg will report whether the
|
||||||
artifacts are identical.
|
artifacts are identical.
|
||||||
|
|
||||||
When given multiple packages, additional package files are assumed to be split
|
|
||||||
packages and will be treated as additional artifacts to compare during the
|
|
||||||
verification step.
|
|
||||||
|
|
||||||
A valid target(s) for pacman -S can be specified instead, and makerepropkg will
|
|
||||||
download it to the cache if needed. This is mostly useful to specify which
|
|
||||||
repository to retrieve from. If no positional arguments are specified, the
|
|
||||||
targets will be sourced from the PKGBUILD.
|
|
||||||
|
|
||||||
In either case, the package name will be converted to a filename from the
|
|
||||||
cache, and makerepropkg will proceed as though this filename was initially
|
|
||||||
specified.
|
|
||||||
|
|
||||||
This implements a verifier for pacman/libalpm packages in accordance with the
|
This implements a verifier for pacman/libalpm packages in accordance with the
|
||||||
link:https://reproducible-builds.org/[Reproducible Builds] project.
|
link:https://reproducible-builds.org/[Reproducible Builds] project.
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
|
|
||||||
*-d*::
|
|
||||||
If packages are not reproducible, compare them using diffoscope.
|
|
||||||
|
|
||||||
*-c*::
|
*-c*::
|
||||||
Set the pacman cache directory.
|
Set the pacman cache directory.
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ Options
|
||||||
architecture officially supported by Arch Linux.
|
architecture officially supported by Arch Linux.
|
||||||
|
|
||||||
*-s, --server* <hostname>::
|
*-s, --server* <hostname>::
|
||||||
Offload to a specific build server. The default is build.archlinux.org
|
Offload to a specific build server. The default is dragon.archlinux.org
|
||||||
which is used as part of the build toolchain for the official Arch Linux
|
which is used as part of the build toolchain for the official Arch Linux
|
||||||
repos.
|
repos.
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ source /usr/share/makepkg/util/config.sh
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
|
default_makepkg_args=(--syncdeps --noconfirm --holdver --skipinteg)
|
||||||
makepkg_args=("${default_makepkg_args[@]}")
|
makepkg_args=("${default_makepkg_args[@]}")
|
||||||
verifysource_args=()
|
verifysource_args=()
|
||||||
chrootdir=
|
chrootdir=
|
||||||
|
@ -64,6 +64,7 @@ usage() {
|
||||||
echo 'Flags:'
|
echo 'Flags:'
|
||||||
echo '-h This help'
|
echo '-h This help'
|
||||||
echo '-c Clean the chroot before building'
|
echo '-c Clean the chroot before building'
|
||||||
|
echo '-C <dir> Set pacman cache to pass to arch-nspawn'
|
||||||
echo '-d <dir> Bind directory into build chroot as read-write'
|
echo '-d <dir> Bind directory into build chroot as read-write'
|
||||||
echo '-D <dir> Bind directory into build chroot as read-only'
|
echo '-D <dir> Bind directory into build chroot as read-only'
|
||||||
echo '-u Update the working copy of the chroot before building'
|
echo '-u Update the working copy of the chroot before building'
|
||||||
|
@ -171,9 +172,7 @@ prepare_chroot() {
|
||||||
|
|
||||||
$install -d "$copydir"/{build,startdir,{pkg,srcpkg,src,log}dest}
|
$install -d "$copydir"/{build,startdir,{pkg,srcpkg,src,log}dest}
|
||||||
|
|
||||||
sed -e '/^MAKEFLAGS=/d' -e '/^PACKAGER=/d' -i "$copydir/etc/makepkg.conf"
|
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest
|
||||||
for x in BUILDDIR=/build PKGDEST=/pkgdest SRCPKGDEST=/srcpkgdest SRCDEST=/srcdest LOGDEST=/logdest \
|
|
||||||
"MAKEFLAGS='${MAKEFLAGS:-}'" "PACKAGER='${PACKAGER:-}'"
|
|
||||||
do
|
do
|
||||||
grep -q "^$x" "$copydir/etc/makepkg.conf" && continue
|
grep -q "^$x" "$copydir/etc/makepkg.conf" && continue
|
||||||
echo "$x" >>"$copydir/etc/makepkg.conf"
|
echo "$x" >>"$copydir/etc/makepkg.conf"
|
||||||
|
@ -213,7 +212,9 @@ _chrootbuild() {
|
||||||
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||||
# ${1} is OK, but $foo or $1 isn't.
|
# ${1} is OK, but $foo or $1 isn't.
|
||||||
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||||
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
mkdir /build/.distcc
|
||||||
|
chown builduser /build/.distcc
|
||||||
|
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser DISTCC_IO_TIMEOUT=1200 DISTCC_DIR='/build/.distcc' bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
case $ret in
|
case $ret in
|
||||||
0|14)
|
0|14)
|
||||||
|
@ -238,19 +239,10 @@ download_sources() {
|
||||||
# Ensure sources are downloaded
|
# Ensure sources are downloaded
|
||||||
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME \
|
sudo -u "$makepkg_user" --preserve-env=GNUPGHOME \
|
||||||
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
env SRCDEST="$SRCDEST" BUILDDIR="$WORKDIR" \
|
||||||
makepkg --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
makepkg -A --config="$copydir/etc/makepkg.conf" --verifysource -o "${verifysource_args[@]}" ||
|
||||||
die "Could not download sources."
|
die "Could not download sources."
|
||||||
}
|
}
|
||||||
|
|
||||||
move_logfiles() {
|
|
||||||
local l
|
|
||||||
for l in "$copydir"/logdest/*; do
|
|
||||||
[[ $l == */logpipe.* ]] && continue
|
|
||||||
chown "$src_owner" "$l"
|
|
||||||
mv "$l" "$LOGDEST"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
move_products() {
|
move_products() {
|
||||||
local pkgfile
|
local pkgfile
|
||||||
for pkgfile in "$copydir"/pkgdest/*; do
|
for pkgfile in "$copydir"/pkgdest/*; do
|
||||||
|
@ -263,7 +255,12 @@ move_products() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
move_logfiles
|
local l
|
||||||
|
for l in "$copydir"/logdest/*; do
|
||||||
|
[[ $l == */logpipe.* ]] && continue
|
||||||
|
chown "$src_owner" "$l"
|
||||||
|
mv "$l" "$LOGDEST"
|
||||||
|
done
|
||||||
|
|
||||||
for s in "$copydir"/srcpkgdest/*; do
|
for s in "$copydir"/srcpkgdest/*; do
|
||||||
chown "$src_owner" "$s"
|
chown "$src_owner" "$s"
|
||||||
|
@ -277,12 +274,13 @@ move_products() {
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nCTD:d:U:' arg; do
|
while getopts 'hcuC:r:I:l:nCTD:d:U:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
c) clean_first=1 ;;
|
c) clean_first=1 ;;
|
||||||
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
D) bindmounts_ro+=("--bind-ro=$OPTARG") ;;
|
||||||
d) bindmounts_rw+=("--bind=$OPTARG") ;;
|
d) bindmounts_rw+=("--bind=$OPTARG") ;;
|
||||||
u) update_first=1 ;;
|
u) update_first=1 ;;
|
||||||
|
C) cache_dir="-c $OPTARG" ;;
|
||||||
r) passeddir="$OPTARG" ;;
|
r) passeddir="$OPTARG" ;;
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
l) copy="$OPTARG" ;;
|
l) copy="$OPTARG" ;;
|
||||||
|
@ -364,17 +362,20 @@ download_sources
|
||||||
|
|
||||||
prepare_chroot
|
prepare_chroot
|
||||||
|
|
||||||
if arch-nspawn "$copydir" \
|
if arch-nspawn $cache_dir "$copydir" \
|
||||||
--bind="${PWD//:/\\:}:/startdir" \
|
--bind="${PWD//:/\\:}:/startdir" \
|
||||||
--bind="${SRCDEST//:/\\:}:/srcdest" \
|
--bind="${SRCDEST//:/\\:}:/srcdest" \
|
||||||
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
/chrootbuild "${makepkg_args[@]}"
|
/chrootbuild "${makepkg_args[@]}"
|
||||||
then
|
then
|
||||||
mapfile -t pkgnames < <(sudo -u "$makepkg_user" bash -c 'source PKGBUILD; printf "%s\n" "${pkgname[@]}"')
|
pkgnames=()
|
||||||
|
for pkgfile in "$copydir"/pkgdest/*; do
|
||||||
|
pkgfile=${pkgfile##*/};
|
||||||
|
pkgnames+=("${pkgfile%-*-*-*}");
|
||||||
|
done
|
||||||
move_products
|
move_products
|
||||||
else
|
else
|
||||||
(( ret += 1 ))
|
(( ret += 1 ))
|
||||||
move_logfiles
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(( temp_chroot )) && delete_chroot "$copydir" "$copy"
|
(( temp_chroot )) && delete_chroot "$copydir" "$copy"
|
||||||
|
@ -389,29 +390,29 @@ else
|
||||||
if (( run_checkpkg )); then
|
if (( run_checkpkg )); then
|
||||||
msg "Running checkpkg"
|
msg "Running checkpkg"
|
||||||
|
|
||||||
mapfile -t remotepkgs < <(pacman --config "$copydir"/etc/pacman.conf \
|
# sync off-site databases for up-to-date queries
|
||||||
--dbpath "$copydir"/var/lib/pacman \
|
trap 'rm -rf $dbpath; cleanup' EXIT INT TERM QUIT
|
||||||
-Sddp "${pkgnames[@]}")
|
dbpath=$(mktemp -d --tmpdir makechrootpkg-database.XXXXXXXXXX)
|
||||||
|
mkdir -p "$dbpath"
|
||||||
|
pacman -Sy --dbpath "$dbpath" --logfile /dev/null
|
||||||
|
|
||||||
if ! wait $!; then
|
# query current package locations
|
||||||
|
remotepkgs=($(pacman -Sddp --dbpath "$dbpath" --logfile /dev/null "${pkgnames[@]}"))
|
||||||
|
if (( $? )); then
|
||||||
warning "Skipped checkpkg due to missing repo packages"
|
warning "Skipped checkpkg due to missing repo packages"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# download package files if any non-local location exists
|
# download package files if any non-local location exists
|
||||||
for remotepkg in "${remotepkgs[@]}"; do
|
for remotepkg in "${remotepkgs[@]}"; do
|
||||||
if [[ $remotepkg != file://* ]]; then
|
[[ $remotepkg == file://* ]] && continue
|
||||||
msg2 "Downloading current versions"
|
msg2 "Downloading current versions"
|
||||||
arch-nspawn "$copydir" pacman --noconfirm -Swdd "${pkgnames[@]}"
|
pacman --noconfirm -Swdd --dbpath "$dbpath" --logfile /dev/null "${pkgnames[@]}"
|
||||||
mapfile -t remotepkgs < <(pacman --config "$copydir"/etc/pacman.conf \
|
break
|
||||||
--dbpath "$copydir"/var/lib/pacman \
|
|
||||||
-Sddp "${pkgnames[@]}")
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
msg2 "Checking packages"
|
msg2 "Checking packages"
|
||||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn "${remotepkgs[@]/#file:\/\//}"
|
sudo -u "$makepkg_user" checkpkg --rmdir --warn
|
||||||
fi
|
fi
|
||||||
true
|
true
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -15,7 +15,7 @@ DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
|
||||||
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
|
||||||
'rsync::/usr/bin/rsync --no-motd -zz %u %o'
|
'rsync::/usr/bin/rsync --no-motd -z %u %o'
|
||||||
'scp::/usr/bin/scp -C %u %o')
|
'scp::/usr/bin/scp -C %u %o')
|
||||||
|
|
||||||
# Other common tools:
|
# Other common tools:
|
||||||
|
|
108
makerepropkg.in
108
makerepropkg.in
|
@ -29,7 +29,6 @@ declare -a buildenv buildopts installed installpkgs
|
||||||
archiveurl='https://archive.archlinux.org/packages'
|
archiveurl='https://archive.archlinux.org/packages'
|
||||||
buildroot=/var/lib/archbuild/reproducible
|
buildroot=/var/lib/archbuild/reproducible
|
||||||
chroot=testenv
|
chroot=testenv
|
||||||
diffoscope=0
|
|
||||||
|
|
||||||
parse_buildinfo() {
|
parse_buildinfo() {
|
||||||
local line var val
|
local line var val
|
||||||
|
@ -57,16 +56,10 @@ parse_buildinfo() {
|
||||||
get_pkgfile() {
|
get_pkgfile() {
|
||||||
local cdir=${cache_dirs[0]}
|
local cdir=${cache_dirs[0]}
|
||||||
local pkgfilebase=${1}
|
local pkgfilebase=${1}
|
||||||
local mode=${2}
|
|
||||||
local pkgname=${pkgfilebase%-*-*-*}
|
local pkgname=${pkgfilebase%-*-*-*}
|
||||||
local pkgfile ext
|
local pkgfile ext
|
||||||
|
|
||||||
# try without downloading
|
for ext in .xz .zst ''; do
|
||||||
if [[ ${mode} != localonly ]] && get_pkgfile "${pkgfilebase}" localonly; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
for ext in .zst .xz ''; do
|
|
||||||
pkgfile=${pkgfilebase}.pkg.tar${ext}
|
pkgfile=${pkgfilebase}.pkg.tar${ext}
|
||||||
|
|
||||||
for c in "${cache_dirs[@]}"; do
|
for c in "${cache_dirs[@]}"; do
|
||||||
|
@ -78,9 +71,6 @@ get_pkgfile() {
|
||||||
|
|
||||||
for f in "${pkgfile}" "${pkgfile}.sig"; do
|
for f in "${pkgfile}" "${pkgfile}.sig"; do
|
||||||
if [[ ! -f "${cdir}/${f}" ]]; then
|
if [[ ! -f "${cdir}/${f}" ]]; then
|
||||||
if [[ ${mode} = localonly ]]; then
|
|
||||||
continue 2
|
|
||||||
fi
|
|
||||||
msg2 "retrieving '%s'..." "${f}" >&2
|
msg2 "retrieving '%s'..." "${f}" >&2
|
||||||
curl -Llf -# -o "${cdir}/${f}" "${archiveurl}/${pkgname:0:1}/${pkgname}/${f}" || continue 2
|
curl -Llf -# -o "${cdir}/${f}" "${archiveurl}/${pkgname:0:1}/${pkgname}/${f}" || continue 2
|
||||||
fi
|
fi
|
||||||
|
@ -104,66 +94,35 @@ package, including the .PKGINFO as well as the buildinfo.
|
||||||
For more details see https://reproducible-builds.org/
|
For more details see https://reproducible-builds.org/
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-d Run diffoscope if the package is unreproducible
|
|
||||||
-c <dir> Set pacman cache
|
-c <dir> Set pacman cache
|
||||||
-M <file> Location of a makepkg config file
|
-M <file> Location of a makepkg config file
|
||||||
-h Show this usage message
|
-h Show this usage message
|
||||||
__EOF__
|
__EOF__
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'dM:c:h' arg; do
|
while getopts 'M:c:h' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
d) diffoscope=1 ;;
|
M) archroot_args+=(-M "$OPTARG") ;;
|
||||||
M) archroot_args+=(-M "$OPTARG") ;;
|
c) cache_dirs+=("$OPTARG") ;;
|
||||||
c) cache_dirs+=("$OPTARG") ;;
|
h) usage; exit 0 ;;
|
||||||
h) usage; exit 0 ;;
|
*|?) usage; exit 1 ;;
|
||||||
*|?) usage; exit 1 ;;
|
esac
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
check_root
|
check_root
|
||||||
|
|
||||||
[[ -f PKGBUILD ]] || { error "No PKGBUILD in current directory."; exit 1; }
|
if [[ -n $1 ]]; then
|
||||||
|
pkgfile="$1"
|
||||||
# without arguments, get list of packages from PKGBUILD
|
if ! bsdtar -tqf "${pkgfile}" .BUILDINFO >/dev/null 2>&1; then
|
||||||
if [[ -z $1 ]]; then
|
error "file is not a valid pacman package: '%s'" "${pkgfile}"
|
||||||
mapfile -t pkgnames < <(source PKGBUILD; pacman -Sddp --print-format '%r/%n' "${pkgname[@]}")
|
|
||||||
wait $! || {
|
|
||||||
error "No package file specified and failed to retrieve package names from './PKGBUILD'."
|
|
||||||
plain "Try '${BASH_SOURCE[0]##*/} -h' for more information." >&2
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
msg "Reproducing all pkgnames listed in ./PKGBUILD"
|
else
|
||||||
set -- "${pkgnames[@]}"
|
error "no package file specified. Try '${BASH_SOURCE[0]##*/} -h' for more information. "
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check each package to see if it's a file, and if not, try to download it
|
|
||||||
# using pacman -Sw, and get the filename from there
|
|
||||||
splitpkgs=()
|
|
||||||
for p in "$@"; do
|
|
||||||
if [[ -f ${p} ]]; then
|
|
||||||
splitpkgs+=("${p}")
|
|
||||||
else
|
|
||||||
pkgfile_remote=$(pacman -Sddp "${p}" 2>/dev/null) || { error "package name '%s' not in repos" "${p}"; exit 1; }
|
|
||||||
pkgfile=${pkgfile_remote#file://}
|
|
||||||
if [[ ! -f ${pkgfile} ]]; then
|
|
||||||
msg "Downloading package '%s' into pacman's cache" "${pkgfile}"
|
|
||||||
sudo pacman -Swdd --noconfirm --logfile /dev/null "${p}" || exit 1
|
|
||||||
pkgfile_remote=$(pacman -Sddp "${p}" 2>/dev/null)
|
|
||||||
pkgfile="${pkgfile_remote#file://}"
|
|
||||||
fi
|
|
||||||
splitpkgs+=("${pkgfile}")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in "${splitpkgs[@]}"; do
|
|
||||||
if ! bsdtar -tqf "${f}" .BUILDINFO >/dev/null 2>&1; then
|
|
||||||
error "file is not a valid pacman package: '%s'" "${f}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if (( ${#cache_dirs[@]} == 0 )); then
|
if (( ${#cache_dirs[@]} == 0 )); then
|
||||||
mapfile -t cache_dirs < <(pacman-conf CacheDir)
|
mapfile -t cache_dirs < <(pacman-conf CacheDir)
|
||||||
fi
|
fi
|
||||||
|
@ -174,11 +133,11 @@ load_makepkg_config
|
||||||
HOME=${ORIG_HOME}
|
HOME=${ORIG_HOME}
|
||||||
[[ -d ${SRCDEST} ]] || SRCDEST=${PWD}
|
[[ -d ${SRCDEST} ]] || SRCDEST=${PWD}
|
||||||
|
|
||||||
parse_buildinfo < <(bsdtar -xOqf "${splitpkgs[0]}" .BUILDINFO)
|
parse_buildinfo < <(bsdtar -xOqf "${pkgfile}" .BUILDINFO)
|
||||||
export SOURCE_DATE_EPOCH="${buildinfo[builddate]}"
|
export SOURCE_DATE_EPOCH="${buildinfo[builddate]}"
|
||||||
PACKAGER="${buildinfo[packager]}"
|
PACKAGER="${buildinfo[packager]}"
|
||||||
BUILDDIR="${buildinfo[builddir]}"
|
BUILDDIR="${buildinfo[builddir]}"
|
||||||
PKGEXT=${splitpkgs[0]#${splitpkgs[0]%.pkg.tar*}}
|
PKGEXT=${pkgfile#${pkgfile%.pkg.tar*}}
|
||||||
|
|
||||||
# nuke and restore reproducible testenv
|
# nuke and restore reproducible testenv
|
||||||
for copy in "${buildroot}"/*/; do
|
for copy in "${buildroot}"/*/; do
|
||||||
|
@ -194,7 +153,8 @@ for fname in "${installed[@]}"; do
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -M @pkgdatadir@/makepkg-x86_64.conf -U "${archroot_args[@]}" "${buildroot}"/root - || exit 1
|
printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -U "${archroot_args[@]}" "${buildroot}"/root - || exit 1
|
||||||
|
|
||||||
|
|
||||||
# use makechrootpkg to prep the build directory
|
# use makechrootpkg to prep the build directory
|
||||||
makechrootpkg -r "${buildroot}" -l "${chroot}" -- --packagelist || exit 1
|
makechrootpkg -r "${buildroot}" -l "${chroot}" -- --packagelist || exit 1
|
||||||
|
@ -214,26 +174,18 @@ arch-nspawn "${buildroot}/${chroot}" \
|
||||||
--bind="${PWD}:/startdir" \
|
--bind="${PWD}:/startdir" \
|
||||||
--bind="${SRCDEST}:/srcdest" \
|
--bind="${SRCDEST}:/srcdest" \
|
||||||
/chrootbuild -C --noconfirm --log --holdver --skipinteg
|
/chrootbuild -C --noconfirm --log --holdver --skipinteg
|
||||||
ret=$?
|
|
||||||
|
|
||||||
if (( ${ret} == 0 )); then
|
if (( $? == 0 )); then
|
||||||
msg2 "built succeeded! built packages can be found in ${buildroot}/${chroot}/pkgdest"
|
msg2 "built succeeded! built packages can be found in ${buildroot}/${chroot}/pkgdest"
|
||||||
msg "comparing artifacts..."
|
msg "comparing artifacts..."
|
||||||
|
if cmp -s "${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}"; then
|
||||||
for pkgfile in "${splitpkgs[@]}"; do
|
msg2 "Package successfully reproduced!"
|
||||||
comparefiles=("${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}")
|
exit 0
|
||||||
if cmp -s "${comparefiles[@]}"; then
|
else
|
||||||
msg2 "Package '%s' successfully reproduced!" "${pkgfile}"
|
warning "Package is not reproducible. :("
|
||||||
else
|
sha256sum "${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}"
|
||||||
ret=1
|
fi
|
||||||
warning "Package '%s' is not reproducible. :(" "${pkgfile}"
|
|
||||||
sha256sum "${comparefiles[@]}"
|
|
||||||
if (( diffoscope )); then
|
|
||||||
diffoscope "${comparefiles[@]}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# return failure from chrootbuild, or the reproducibility status
|
# the package either failed to build, or was unreproducible
|
||||||
exit ${ret}
|
exit 1
|
||||||
|
|
|
@ -24,7 +24,7 @@ source /usr/share/makepkg/util/config.sh
|
||||||
# global defaults suitable for use by Arch staff
|
# global defaults suitable for use by Arch staff
|
||||||
repo=extra
|
repo=extra
|
||||||
arch=x86_64
|
arch=x86_64
|
||||||
server=build.archlinux.org
|
server=dragon.archlinux.org
|
||||||
|
|
||||||
die() { printf "error: $1\n" "${@:2}"; exit 1; }
|
die() { printf "error: $1\n" "${@:2}"; exit 1; }
|
||||||
|
|
||||||
|
@ -74,23 +74,18 @@ while (( $# )); do
|
||||||
done
|
done
|
||||||
|
|
||||||
# multilib must be handled specially
|
# multilib must be handled specially
|
||||||
archbuild_arch="${arch}"
|
|
||||||
if [[ $repo = multilib* ]]; then
|
if [[ $repo = multilib* ]]; then
|
||||||
archbuild_arch=
|
arch=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
archbuild_cmd=("${repo}${archbuild_arch:+-$archbuild_arch}-build" "$@")
|
archbuild_cmd=("${repo}${arch:+-$arch}-build" "$@")
|
||||||
|
|
||||||
trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT
|
trap 'rm -rf $SRCPKGDEST' EXIT INT TERM QUIT
|
||||||
|
|
||||||
# Load makepkg.conf variables to be available
|
|
||||||
load_makepkg_config
|
|
||||||
|
|
||||||
# Use a source-only tarball as an intermediate to transfer files. This
|
# Use a source-only tarball as an intermediate to transfer files. This
|
||||||
# guarantees the checksums are okay, and guarantees that all needed files are
|
# guarantees the checksums are okay, and guarantees that all needed files are
|
||||||
# transferred, including local sources, install scripts, and changelogs.
|
# transferred, including local sources, install scripts, and changelogs.
|
||||||
export TEMPDIR=$(mktemp -d --tmpdir offload-build.XXXXXXXXXX)
|
export SRCPKGDEST=$(mktemp -d)
|
||||||
export SRCPKGDEST=${TEMPDIR}
|
|
||||||
makepkg --source || die "unable to make source package"
|
makepkg --source || die "unable to make source package"
|
||||||
|
|
||||||
# Temporary cosmetic workaround makepkg if SRCDEST is set somewhere else
|
# Temporary cosmetic workaround makepkg if SRCDEST is set somewhere else
|
||||||
|
@ -101,7 +96,7 @@ mapfile -t files < <(
|
||||||
# This is sort of bash golfing but it allows running a mildly complex
|
# This is sort of bash golfing but it allows running a mildly complex
|
||||||
# command over ssh with a single connection.
|
# command over ssh with a single connection.
|
||||||
# shellcheck disable=SC2145
|
# shellcheck disable=SC2145
|
||||||
cat "$SRCPKGDEST"/*"$SRCEXT" |
|
cat "$SRCPKGDEST"/*.src.tar.gz |
|
||||||
ssh $server '
|
ssh $server '
|
||||||
temp="${XDG_CACHE_HOME:-$HOME/.cache}/offload-build" &&
|
temp="${XDG_CACHE_HOME:-$HOME/.cache}/offload-build" &&
|
||||||
mkdir -p "$temp" &&
|
mkdir -p "$temp" &&
|
||||||
|
@ -113,21 +108,14 @@ mapfile -t files < <(
|
||||||
printf "%s\n" "" "-> build complete" &&
|
printf "%s\n" "" "-> build complete" &&
|
||||||
printf "\t%s\n" "$temp"/*
|
printf "\t%s\n" "$temp"/*
|
||||||
} >&2 &&
|
} >&2 &&
|
||||||
makepkg_user_config="${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" &&
|
makepkg --packagelist
|
||||||
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"
|
|
||||||
fi &&
|
|
||||||
makepkg --config <(cat "${makepkg_user_config}" "${makepkg_config}" 2>/dev/null) --packagelist &&
|
|
||||||
printf "%s\n" "${temp}/PKGBUILD"
|
|
||||||
')
|
')
|
||||||
|
|
||||||
|
|
||||||
if (( ${#files[@]} )); then
|
if (( ${#files[@]} )); then
|
||||||
printf '%s\n' '' '-> copying files...'
|
printf '%s\n' '' '-> copying files...'
|
||||||
scp "${files[@]/#/$server:}" "${TEMPDIR}/"
|
load_makepkg_config
|
||||||
mv "${TEMPDIR}"/*.pkg.tar* "${PKGDEST:-${PWD}}/"
|
scp "${files[@]/#/$server:}" "${PKGDEST:-${PWD}}/"
|
||||||
mv "${TEMPDIR}/PKGBUILD" "${PWD}/"
|
|
||||||
else
|
else
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
|
@ -94,11 +94,10 @@ _offload_build_args=(
|
||||||
)
|
)
|
||||||
|
|
||||||
_makerepropkg_args=(
|
_makerepropkg_args=(
|
||||||
'-d[Run diffoscope if the package is unreproducible]'
|
|
||||||
'-c[Set pacman cache]:pacman_cache:_files -/'
|
'-c[Set pacman cache]:pacman_cache:_files -/'
|
||||||
'-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
'-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
||||||
'-h[Display usage]'
|
'-h[Display usage]'
|
||||||
'*:working_dir:_files -g "*.pkg.tar.*(.)"'
|
'1:working_dir:_files -g "*.pkg.tar.*(.)"'
|
||||||
)
|
)
|
||||||
|
|
||||||
_devtools_completions_all_packages() {
|
_devtools_completions_all_packages() {
|
||||||
|
|
Loading…
Reference in New Issue