mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-13 01:46:19 +02:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
74d7a70915 | ||
![]() |
5eacb475cd | ||
![]() |
bcda211dd8 | ||
![]() |
d4546c59ce | ||
![]() |
d6866e0544 | ||
![]() |
8edad22616 | ||
![]() |
f20435643f | ||
![]() |
8d99df602d | ||
![]() |
4c803b9db8 | ||
![]() |
104c5bc90e | ||
![]() |
cee28a1b13 | ||
![]() |
e0f82d3947 | ||
![]() |
74313db9ee | ||
![]() |
2c611d20bd | ||
![]() |
ca4d348c86 | ||
![]() |
2fb1cc2dd2 | ||
![]() |
bcba566405 | ||
![]() |
f8f2f02028 | ||
![]() |
68f0bff172 | ||
![]() |
f85a58a0a6 | ||
![]() |
20eec484fa | ||
![]() |
6fffbfbc8a | ||
![]() |
0017263379 | ||
![]() |
751093eff2 | ||
![]() |
f43a86ee8a | ||
![]() |
0067176529 | ||
![]() |
75d23eec94 | ||
![]() |
6679c28625 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,6 +9,7 @@ commitpkg
|
||||
finddeps
|
||||
lddd
|
||||
makechrootpkg
|
||||
makerepropkg
|
||||
mkarchroot
|
||||
rebuildpkgs
|
||||
zsh_completion
|
||||
|
18
Makefile
18
Makefile
@@ -1,22 +1,23 @@
|
||||
V=20191016
|
||||
V=20191227
|
||||
|
||||
PREFIX = /usr/local
|
||||
MANDIR = $(PREFIX)/share/man
|
||||
|
||||
IN_PROGS = \
|
||||
checkpkg \
|
||||
commitpkg \
|
||||
archco \
|
||||
arch-nspawn \
|
||||
archrelease \
|
||||
archbuild \
|
||||
lddd \
|
||||
finddeps \
|
||||
rebuildpkgs \
|
||||
find-libdeps \
|
||||
checkpkg \
|
||||
commitpkg \
|
||||
crossrepomove\
|
||||
arch-nspawn \
|
||||
finddeps \
|
||||
find-libdeps \
|
||||
lddd \
|
||||
makerepropkg \
|
||||
mkarchroot \
|
||||
makechrootpkg \
|
||||
rebuildpkgs \
|
||||
sogrep
|
||||
|
||||
BINPROGS = \
|
||||
@@ -71,6 +72,7 @@ MANS = \
|
||||
doc/checkpkg.1 \
|
||||
doc/offload-build.1 \
|
||||
doc/sogrep.1 \
|
||||
doc/makerepropkg.1 \
|
||||
doc/mkarchroot.1 \
|
||||
doc/find-libdeps.1 \
|
||||
doc/find-libprovides.1
|
||||
|
@@ -20,6 +20,7 @@ umask 0022
|
||||
working_dir=''
|
||||
|
||||
files=()
|
||||
mount_args=()
|
||||
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options] working-dir [systemd-nspawn arguments]"
|
||||
@@ -65,40 +66,35 @@ fi
|
||||
# shellcheck disable=2016
|
||||
host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#'))
|
||||
|
||||
for host_mirror in "${host_mirrors[@]}"; do
|
||||
if [[ $host_mirror == *file://* ]]; then
|
||||
host_mirror=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
||||
in_array "$host_mirror" "${cache_dirs[@]}" || cache_dirs+=("$host_mirror")
|
||||
fi
|
||||
done
|
||||
|
||||
while read -r line; do
|
||||
mapfile -t lines < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" \
|
||||
--repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1$repo/os/$arch#')
|
||||
if [[ ${lines[0]} != ${host_mirrors[0]} ]]; then
|
||||
for line in "${lines[@]}"; do
|
||||
if [[ $line = file://* ]]; then
|
||||
line=${line#file://}
|
||||
in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
|
||||
|
||||
# {{{ functions
|
||||
build_mount_args() {
|
||||
declare -g mount_args=()
|
||||
|
||||
for host_mirror in "${host_mirrors[@]}"; do
|
||||
if [[ $host_mirror == *file://* ]]; then
|
||||
host_mirror_path=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
|
||||
mount_args+=("--bind-ro=${host_mirror_path//:/\\:}")
|
||||
--repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1#')
|
||||
for line in "${lines[@]}"; do
|
||||
if [[ $line = file://* ]]; then
|
||||
line=${line#file://}
|
||||
in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line")
|
||||
fi
|
||||
done
|
||||
done < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list)
|
||||
|
||||
mount_args+=("--bind=${cache_dirs[0]//:/\\:}")
|
||||
mount_args+=("--bind=${cache_dirs[0]//:/\\:}")
|
||||
|
||||
for cache_dir in "${cache_dirs[@]:1}"; do
|
||||
mount_args+=("--bind-ro=${cache_dir//:/\\:}")
|
||||
done
|
||||
}
|
||||
for cache_dir in "${cache_dirs[@]:1}"; do
|
||||
mount_args+=("--bind-ro=${cache_dir//:/\\:}")
|
||||
done
|
||||
|
||||
# {{{ functions
|
||||
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
|
||||
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"
|
||||
|
||||
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
|
||||
@@ -123,7 +119,6 @@ elif [[ $(cat "$working_dir/.arch-chroot") != "$CHROOT_VERSION" ]]; then
|
||||
die "chroot '%s' is not at version %s. Please rebuild." "$working_dir" "$CHROOT_VERSION"
|
||||
fi
|
||||
|
||||
build_mount_args
|
||||
copy_hostconf
|
||||
|
||||
eval "$(grep -a '^CARCH=' "$working_dir/etc/makepkg.conf")"
|
||||
|
@@ -68,7 +68,7 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
|
||||
lock_close 9
|
||||
|
||||
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
|
||||
mkdir -m755 -p "${chroots}/${repo}-${arch}"
|
||||
(umask 0022; mkdir -p "${chroots}/${repo}-${arch}")
|
||||
setarch "${arch}" mkarchroot \
|
||||
-C "${pacman_config}" \
|
||||
-M "${makepkg_config}" \
|
||||
|
@@ -109,10 +109,10 @@ if [[ -z $server ]]; then
|
||||
fi
|
||||
|
||||
if [[ -n $(svn status -q) ]]; then
|
||||
msgtemplate="upgpkg: $pkgbase $(get_full_version)"$'\n\n'
|
||||
msgtemplate="upgpkg: $pkgbase $(get_full_version)"
|
||||
if [[ -n $1 ]]; then
|
||||
stat_busy 'Committing changes to trunk'
|
||||
svn commit -q -m "${msgtemplate}${1}" || die
|
||||
svn commit -q -m "${msgtemplate}: ${1}" || die
|
||||
stat_done
|
||||
else
|
||||
msgfile="$(mktemp)"
|
||||
|
38
doc/makerepropkg.1.asciidoc
Normal file
38
doc/makerepropkg.1.asciidoc
Normal file
@@ -0,0 +1,38 @@
|
||||
makerepropkg(1)
|
||||
================
|
||||
|
||||
Name
|
||||
----
|
||||
makerepropkg - Rebuild a package to see if it is reproducible
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
makerepropkg [OPTIONS] <package_file>
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
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
|
||||
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
|
||||
linkman:BUILDINFO[5] manifest. On success, the resulting package will be
|
||||
compared to the input package, and makerepropkg will report whether the
|
||||
artifacts are identical.
|
||||
|
||||
This implements a verifier for pacman/libalpm packages in accordance with the
|
||||
link:https://reproducible-builds.org/[Reproducible Builds] project.
|
||||
|
||||
Options
|
||||
-------
|
||||
|
||||
*-c*::
|
||||
Set the pacman cache directory.
|
||||
|
||||
*-M* <file>::
|
||||
Location of a makepkg config file.
|
||||
|
||||
*-h*::
|
||||
Show this usage message
|
||||
|
||||
include::footer.asciidoc[]
|
@@ -20,6 +20,9 @@ en_US.UTF-8 and de_DE.UTF-8 locale and a generated machine-id.
|
||||
Options
|
||||
-------
|
||||
|
||||
*-U*::
|
||||
Use 'pacman -U' to install packages.
|
||||
|
||||
*-C* <file>::
|
||||
Location of a pacman config file.
|
||||
|
||||
|
@@ -17,7 +17,7 @@ export LANG=C
|
||||
shopt -s extglob
|
||||
|
||||
# check if messages are to be printed using color
|
||||
if [[ -t 2 ]]; then
|
||||
if [[ -t 2 && "$TERM" != dumb ]]; then
|
||||
colorize
|
||||
else
|
||||
# shellcheck disable=2034
|
||||
@@ -142,7 +142,7 @@ find_cached_package() {
|
||||
for dir in "${searchdirs[@]}"; do
|
||||
[[ -d $dir ]] || continue
|
||||
|
||||
for pkg in "$dir"/*.pkg.tar?(.?z); do
|
||||
for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do
|
||||
[[ -f $pkg ]] || continue
|
||||
|
||||
# avoid adding duplicates of the same inode
|
||||
@@ -152,7 +152,7 @@ find_cached_package() {
|
||||
|
||||
# split apart package filename into parts
|
||||
pkgbasename=${pkg##*/}
|
||||
pkgbasename=${pkgbasename%.pkg.tar?(.?z)}
|
||||
pkgbasename=${pkgbasename%.pkg.tar*}
|
||||
|
||||
arch=${pkgbasename##*-}
|
||||
pkgbasename=${pkgbasename%-"$arch"}
|
||||
|
@@ -13,6 +13,8 @@
|
||||
m4_include(lib/common.sh)
|
||||
m4_include(lib/archroot.sh)
|
||||
|
||||
source /usr/share/makepkg/util/config.sh
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
default_makepkg_args=(--syncdeps --noconfirm --log --holdver --skipinteg)
|
||||
@@ -80,26 +82,6 @@ usage() {
|
||||
}
|
||||
|
||||
# {{{ functions
|
||||
# Usage: load_vars $makepkg_conf
|
||||
# Globals:
|
||||
# - SRCDEST
|
||||
# - SRCPKGDEST
|
||||
# - PKGDEST
|
||||
# - LOGDEST
|
||||
# - MAKEFLAGS
|
||||
# - PACKAGER
|
||||
load_vars() {
|
||||
local makepkg_conf="$1" var
|
||||
|
||||
[[ -f $makepkg_conf ]] || return 1
|
||||
|
||||
for var in {SRC,SRCPKG,PKG,LOG}DEST MAKEFLAGS PACKAGER; do
|
||||
[[ -z ${!var:-} ]] && eval "$(source "$makepkg_conf"; printf "%s='%s'" "$var" "${!var}")"
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Usage: sync_chroot $chrootdir $copydir [$copy]
|
||||
sync_chroot() {
|
||||
local chrootdir=$1
|
||||
@@ -338,16 +320,12 @@ for arg in "${@:$OPTIND}"; do
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n $SUDO_USER ]]; then
|
||||
eval "USER_HOME=~$SUDO_USER"
|
||||
else
|
||||
USER_HOME=$HOME
|
||||
fi
|
||||
|
||||
umask 0022
|
||||
|
||||
load_vars "${XDG_CONFIG_HOME:-$USER_HOME/.config}/pacman/makepkg.conf" || load_vars "$USER_HOME/.makepkg.conf"
|
||||
load_vars /etc/makepkg.conf
|
||||
ORIG_HOME=$HOME
|
||||
IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}")
|
||||
load_makepkg_config
|
||||
HOME=$ORIG_HOME
|
||||
|
||||
# Use PKGBUILD directory if these don't exist
|
||||
[[ -d $PKGDEST ]] || PKGDEST=$PWD
|
||||
@@ -409,13 +387,30 @@ if (( ret != 0 )); then
|
||||
else
|
||||
if (( run_checkpkg )); then
|
||||
msg "Running checkpkg"
|
||||
msg2 "Downloading current versions"
|
||||
if pacman --noconfirm -Swdd --logfile /dev/null "${pkgnames[@]}"; then
|
||||
msg2 "Checking packages"
|
||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn
|
||||
else
|
||||
warning "Skipped checkpkg due to missing packages"
|
||||
|
||||
# sync off-site databases for up-to-date queries
|
||||
trap 'rm -rf $dbpath; cleanup' EXIT INT TERM QUIT
|
||||
dbpath=$(mktemp -d --tmpdir makechrootpkg-database.XXXXXXXXXX)
|
||||
mkdir -p "$dbpath"
|
||||
pacman -Sy --dbpath "$dbpath" --logfile /dev/null
|
||||
|
||||
# query current package locations
|
||||
remotepkgs=($(pacman -Sddp --dbpath "$dbpath" --logfile /dev/null "${pkgnames[@]}"))
|
||||
if (( $? )); then
|
||||
warning "Skipped checkpkg due to missing repo packages"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# download package files if any non-local location exists
|
||||
for remotepkg in "${remotepkgs[@]}"; do
|
||||
[[ $remotepkg == file://* ]] && continue
|
||||
msg2 "Downloading current versions"
|
||||
pacman --noconfirm -Swdd --dbpath "$dbpath" --logfile /dev/null "${pkgnames[@]}"
|
||||
break
|
||||
done
|
||||
|
||||
msg2 "Checking packages"
|
||||
sudo -u "$makepkg_user" checkpkg --rmdir --warn
|
||||
fi
|
||||
true
|
||||
fi
|
||||
|
@@ -132,18 +132,18 @@ DBGSRCDIR="/usr/src/debug"
|
||||
COMPRESSGZ=(gzip -c -f -n)
|
||||
COMPRESSBZ2=(bzip2 -c -f)
|
||||
COMPRESSXZ=(xz -c -z -)
|
||||
COMPRESSZST=(zstd -c -T0 --ultra -20 -)
|
||||
COMPRESSLRZ=(lrzip -q)
|
||||
COMPRESSLZO=(lzop -q)
|
||||
COMPRESSZ=(compress -c -f)
|
||||
COMPRESSLZ4=(lz4 -q)
|
||||
COMPRESSLZ=(lzip -c -f)
|
||||
|
||||
#########################################################################
|
||||
# EXTENSION DEFAULTS
|
||||
#########################################################################
|
||||
#
|
||||
# WARNING: Do NOT modify these variables unless you know what you are
|
||||
# doing.
|
||||
#
|
||||
PKGEXT='.pkg.tar.xz'
|
||||
PKGEXT='.pkg.tar.zst'
|
||||
SRCEXT='.src.tar.gz'
|
||||
|
||||
# vim: set ft=sh ts=2 sw=2 et:
|
||||
|
190
makerepropkg.in
Executable file
190
makerepropkg.in
Executable file
@@ -0,0 +1,190 @@
|
||||
#!/bin/bash
|
||||
# makerepropkg - rebuild a package to see if it is reproducible
|
||||
#
|
||||
# Copyright (c) 2019 by Eli Schwartz <eschwartz@archlinux.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
m4_include(lib/common.sh)
|
||||
m4_include(lib/archroot.sh)
|
||||
|
||||
source /usr/share/makepkg/util/config.sh
|
||||
source /usr/share/makepkg/util/message.sh
|
||||
|
||||
declare -A buildinfo
|
||||
declare -a buildenv buildopts installed installpkgs
|
||||
|
||||
archiveurl='https://archive.archlinux.org/packages'
|
||||
buildroot=/var/lib/archbuild/reproducible
|
||||
chroot=testenv
|
||||
|
||||
parse_buildinfo() {
|
||||
local line var val
|
||||
|
||||
while read -r line; do
|
||||
var="${line%% = *}"
|
||||
val="${line#* = }"
|
||||
case ${var} in
|
||||
buildenv)
|
||||
buildenv+=("${val}")
|
||||
;;
|
||||
options)
|
||||
buildopts+=("${val}")
|
||||
;;
|
||||
installed)
|
||||
installed+=("${val}")
|
||||
;;
|
||||
*)
|
||||
buildinfo["${var}"]="${val}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
get_pkgfile() {
|
||||
local cdir=${cache_dirs[0]}
|
||||
local pkgfilebase=${1}
|
||||
local pkgname=${pkgfilebase%-*-*-*}
|
||||
local pkgfile ext
|
||||
|
||||
for ext in .xz .zst ''; do
|
||||
pkgfile=${pkgfilebase}.pkg.tar${ext}
|
||||
|
||||
for c in "${cache_dirs[@]}"; do
|
||||
if [[ -f ${c}/${pkgfile} ]]; then
|
||||
cdir=${c}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for f in "${pkgfile}" "${pkgfile}.sig"; do
|
||||
if [[ ! -f "${cdir}/${f}" ]]; then
|
||||
msg2 "retrieving '%s'..." "${f}" >&2
|
||||
curl -Llf -# -o "${cdir}/${f}" "${archiveurl}/${pkgname:0:1}/${pkgname}/${f}" || continue 2
|
||||
fi
|
||||
done
|
||||
printf '%s\n' "file://${cdir}/${pkgfile}"
|
||||
return 0
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
usage() {
|
||||
cat << __EOF__
|
||||
usage: ${BASH_SOURCE[0]##*/} [options] <package_file>
|
||||
|
||||
Run this script in a PKGBUILD dir to build a package inside a
|
||||
clean chroot while attempting to reproduce it. The package file
|
||||
will be used to derive metadata needed for reproducing the
|
||||
package, including the .PKGINFO as well as the buildinfo.
|
||||
|
||||
For more details see https://reproducible-builds.org/
|
||||
|
||||
OPTIONS
|
||||
-c <dir> Set pacman cache
|
||||
-M <file> Location of a makepkg config file
|
||||
-h Show this usage message
|
||||
__EOF__
|
||||
}
|
||||
|
||||
while getopts 'M:c:h' arg; do
|
||||
case "$arg" in
|
||||
M) archroot_args+=(-M "$OPTARG") ;;
|
||||
c) cache_dirs+=("$OPTARG") ;;
|
||||
h) usage; exit 0 ;;
|
||||
*|?) usage; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
check_root
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
pkgfile="$1"
|
||||
if ! bsdtar -tqf "${pkgfile}" .BUILDINFO >/dev/null 2>&1; then
|
||||
error "file is not a valid pacman package: '%s'" "${pkgfile}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
error "no package file specified. Try '${BASH_SOURCE[0]##*/} -h' for more information. "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (( ${#cache_dirs[@]} == 0 )); then
|
||||
mapfile -t cache_dirs < <(pacman-conf CacheDir)
|
||||
fi
|
||||
|
||||
ORIG_HOME=${HOME}
|
||||
IFS=: read -r _ _ _ _ _ HOME _ < <(getent passwd "${SUDO_USER:-$USER}")
|
||||
load_makepkg_config
|
||||
HOME=${ORIG_HOME}
|
||||
[[ -d ${SRCDEST} ]] || SRCDEST=${PWD}
|
||||
|
||||
parse_buildinfo < <(bsdtar -xOqf "${pkgfile}" .BUILDINFO)
|
||||
export SOURCE_DATE_EPOCH="${buildinfo[builddate]}"
|
||||
PACKAGER="${buildinfo[packager]}"
|
||||
BUILDDIR="${buildinfo[builddir]}"
|
||||
|
||||
# nuke and restore reproducible testenv
|
||||
for copy in "${buildroot}"/*/; do
|
||||
[[ -d ${copy} ]] || continue
|
||||
subvolume_delete_recursive "${copy}"
|
||||
done
|
||||
rm -rf --one-file-system "${buildroot}"
|
||||
(umask 0022; mkdir -p "${buildroot}")
|
||||
|
||||
for fname in "${installed[@]}"; do
|
||||
if ! allpkgfiles+=("$(get_pkgfile "${fname}")"); then
|
||||
error "failed to retrieve ${fname}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -U "${archroot_args[@]}" "${buildroot}"/root - || exit 1
|
||||
|
||||
|
||||
# use makechrootpkg to prep the build directory
|
||||
makechrootpkg -r "${buildroot}" -l "${chroot}" -- --packagelist || exit 1
|
||||
|
||||
# set detected makepkg.conf options
|
||||
{
|
||||
for var in PACKAGER BUILDDIR; do
|
||||
printf '%s=%s\n' "${var}" "${!var@Q}"
|
||||
done
|
||||
printf 'OPTIONS=(%s)\n' "${buildopts[*]@Q}"
|
||||
printf 'BUILDENV=(%s)\n' "${buildenv[*]@Q}"
|
||||
} >> "${buildroot}/${chroot}"/etc/makepkg.conf >> "${buildroot}/${chroot}"/etc/makepkg.conf
|
||||
install -d -o "${SUDO_UID:-$UID}" -g "$(id -g "${SUDO_UID:-$UID}")" "${buildroot}/${chroot}/${BUILDDIR}"
|
||||
|
||||
# kick off the build
|
||||
arch-nspawn "${buildroot}/${chroot}" \
|
||||
--bind="${PWD}:/startdir" \
|
||||
--bind="${SRCDEST}:/srcdest" \
|
||||
/chrootbuild -C --noconfirm --log --holdver --skipinteg
|
||||
|
||||
if (( $? == 0 )); then
|
||||
msg2 "built succeeded! built packages can be found in ${buildroot}/${chroot}/pkgdest"
|
||||
msg "comparing artifacts..."
|
||||
if cmp -s "${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}"; then
|
||||
msg2 "Package successfully reproduced!"
|
||||
exit 0
|
||||
else
|
||||
warning "Package is not reproducible. :("
|
||||
sha256sum "${pkgfile}" "${buildroot}/${chroot}/pkgdest/${pkgfile##*/}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# the package either failed to build, or was unreproducible
|
||||
exit 1
|
@@ -18,6 +18,7 @@ m4_include(lib/archroot.sh)
|
||||
umask 0022
|
||||
|
||||
working_dir=''
|
||||
umode=''
|
||||
|
||||
files=()
|
||||
nspawn_args=()
|
||||
@@ -25,6 +26,7 @@ nspawn_args=()
|
||||
usage() {
|
||||
echo "Usage: ${0##*/} [options] working-dir package-list..."
|
||||
echo ' options:'
|
||||
echo ' -U Use pacman -U to install packages'
|
||||
echo ' -C <file> Location of a pacman config file'
|
||||
echo ' -M <file> Location of a makepkg config file'
|
||||
echo ' -c <dir> Set pacman cache'
|
||||
@@ -34,8 +36,9 @@ usage() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
while getopts 'hC:M:c:f:s' arg; do
|
||||
while getopts 'hUC:M:c:f:s' arg; do
|
||||
case "$arg" in
|
||||
U) umode=U ;;
|
||||
C) pac_conf="$OPTARG" ;;
|
||||
M) makepkg_conf="$OPTARG" ;;
|
||||
c) cache_dirs+=("$OPTARG") ;;
|
||||
@@ -44,8 +47,10 @@ while getopts 'hC:M:c:f:s' arg; do
|
||||
h|?) usage ;;
|
||||
*) error "invalid argument '%s'" "$arg"; usage ;;
|
||||
esac
|
||||
nspawn_args+=("-$arg")
|
||||
[[ -v OPTARG ]] && nspawn_args+=("$OPTARG")
|
||||
if [[ $arg != U ]]; then
|
||||
nspawn_args+=("-$arg")
|
||||
[[ -v OPTARG ]] && nspawn_args+=("$OPTARG")
|
||||
fi
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
@@ -85,7 +90,7 @@ for file in "${files[@]}"; do
|
||||
cp "$file" "$working_dir$file"
|
||||
done
|
||||
|
||||
pacstrap -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' en_US de_DE > "$working_dir/etc/locale.gen"
|
||||
|
@@ -18,6 +18,8 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
source /usr/share/makepkg/util/config.sh
|
||||
|
||||
|
||||
# global defaults suitable for use by Arch staff
|
||||
repo=extra
|
||||
@@ -78,7 +80,7 @@ fi
|
||||
|
||||
archbuild_cmd=("${repo}${arch:+-$arch}-build" "$@")
|
||||
|
||||
trap 'rm -rf $SRCPKGDEST' EXIT
|
||||
trap 'rm -rf $SRCPKGDEST' EXIT INT TERM QUIT
|
||||
|
||||
# Use a source-only tarball as an intermediate to transfer files. This
|
||||
# guarantees the checksums are okay, and guarantees that all needed files are
|
||||
@@ -86,6 +88,10 @@ trap 'rm -rf $SRCPKGDEST' EXIT
|
||||
export SRCPKGDEST=$(mktemp -d)
|
||||
makepkg --source || die "unable to make source package"
|
||||
|
||||
# Temporary cosmetic workaround makepkg if SRCDEST is set somewhere else
|
||||
# but an empty src dir is created in PWD. Remove once fixed in makepkg.
|
||||
rmdir --ignore-fail-on-non-empty src 2>/dev/null || true
|
||||
|
||||
mapfile -t files < <(
|
||||
# This is sort of bash golfing but it allows running a mildly complex
|
||||
# command over ssh with a single connection.
|
||||
@@ -105,4 +111,11 @@ mapfile -t files < <(
|
||||
makepkg --packagelist
|
||||
')
|
||||
|
||||
(( ${#files[@]} )) && printf '%s\n' '' '-> copying files...' && scp "${files[@]/#/$server:}" .
|
||||
|
||||
if (( ${#files[@]} )); then
|
||||
printf '%s\n' '' '-> copying files...'
|
||||
load_makepkg_config
|
||||
scp "${files[@]/#/$server:}" "${PKGDEST:-${PWD}}/"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -90,4 +89,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -99,4 +98,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -93,4 +92,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -107,4 +106,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -98,4 +97,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -99,4 +98,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -96,4 +95,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -16,10 +16,9 @@
|
||||
#GPGDir = /etc/pacman.d/gnupg/
|
||||
#HookDir = /etc/pacman.d/hooks/
|
||||
HoldPkg = pacman glibc
|
||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
|
||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
|
||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
|
||||
#CleanMethod = KeepInstalled
|
||||
#UseDelta = 0.7
|
||||
Architecture = auto
|
||||
|
||||
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
|
||||
@@ -90,4 +89,3 @@ Include = /etc/pacman.d/mirrorlist
|
||||
#[custom]
|
||||
#SigLevel = Optional TrustAll
|
||||
#Server = file:///home/custompkgs
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#compdef archbuild archco arch-nspawn archrelease commitpkg 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
|
||||
#compdef archbuild archco arch-nspawn archrelease commitpkg 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
|
||||
# License: Unspecified
|
||||
|
||||
m4_include(lib/valid-tags.sh)
|
||||
@@ -58,6 +58,7 @@ _makechrootpkg_args=(
|
||||
)
|
||||
|
||||
_mkarchroot_args=(
|
||||
'-U[Install a package into the working copy]:target:_files -g "*.pkg.tar.*(.)"'
|
||||
'-C[Location of a pacman config file]:pacman_config:_files -g "*.conf(.)"'
|
||||
'-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
||||
'-c[Set pacman cache]:pacman_cache:_files -/'
|
||||
@@ -92,6 +93,13 @@ _offload_build_args=(
|
||||
'(-h --help)'{-h,--help}'[Display usage]'
|
||||
)
|
||||
|
||||
_makerepropkg_args=(
|
||||
'-c[Set pacman cache]:pacman_cache:_files -/'
|
||||
'-M[Location of a makepkg config file]:makepkg_config:_files -g "*.conf(.)"'
|
||||
'-h[Display usage]'
|
||||
'1:working_dir:_files -g "*.pkg.tar.*(.)"'
|
||||
)
|
||||
|
||||
_devtools_completions_all_packages() {
|
||||
typeset -U packages
|
||||
packages=($(_call_program packages pacman -Sql))
|
||||
|
Reference in New Issue
Block a user