mirror of
https://gitlab.archlinux.org/archlinux/devtools.git
synced 2025-09-15 10:56:19 +02:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3029c8e4bc | ||
![]() |
b8dd44083a | ||
![]() |
4b3a6c7803 | ||
![]() |
59e348fc3c | ||
![]() |
27441f201c | ||
![]() |
c4f72f781b | ||
![]() |
9974309cee | ||
![]() |
e3cf64ad2f | ||
![]() |
7524bec6d9 | ||
![]() |
70309118ab | ||
![]() |
164f5b758d | ||
![]() |
1ae58aed5b | ||
![]() |
0d16a91350 | ||
![]() |
e77242c539 | ||
![]() |
9c85d116f0 | ||
![]() |
914ebe3a74 | ||
![]() |
7267664ed8 | ||
![]() |
e0f7c21a68 |
@@ -40,15 +40,15 @@ shift $(($OPTIND - 1))
|
|||||||
(( $EUID != 0 )) && die 'This script must be run as root.'
|
(( $EUID != 0 )) && die 'This script must be run as root.'
|
||||||
(( $# < 1 )) && die 'You must specify a directory.'
|
(( $# < 1 )) && die 'You must specify a directory.'
|
||||||
|
|
||||||
working_dir="$(readlink -f $1)"
|
working_dir=$(readlink -f "$1")
|
||||||
shift 1
|
shift 1
|
||||||
|
|
||||||
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
[[ -z $working_dir ]] && die 'Please specify a working directory.'
|
||||||
|
|
||||||
if [[ -z $cache_dir ]]; then
|
if [[ -z $cache_dir ]]; then
|
||||||
cache_dirs=($(pacman -v $cache_conf 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
cache_dirs=($(pacman -v 2>&1 | grep '^Cache Dirs:' | sed 's/Cache Dirs:\s*//g'))
|
||||||
else
|
else
|
||||||
cache_dirs=(${cache_dir})
|
cache_dirs=("$cache_dir")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
|
host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/.*#\1$repo/os/$arch#')
|
||||||
@@ -56,31 +56,27 @@ host_mirror=$(pacman -Sddp extra/devtools 2>/dev/null | sed -r 's#(.*/)extra/os/
|
|||||||
|
|
||||||
# {{{ functions
|
# {{{ functions
|
||||||
build_mount_args() {
|
build_mount_args() {
|
||||||
local p
|
|
||||||
declare -g mount_args=()
|
declare -g mount_args=()
|
||||||
|
|
||||||
if [[ -n $host_mirror_path ]]; then
|
if [[ -n $host_mirror_path ]]; then
|
||||||
printf -v p '%q' "$host_mirror_path"
|
mount_args+=(--bind-ro="$host_mirror_path")
|
||||||
mount_args+=(--bind-ro="$p")
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf -v p '%q' "${cache_dirs[0]}"
|
mount_args+=(--bind="${cache_dirs[0]}")
|
||||||
mount_args+=(--bind="$p")
|
|
||||||
|
|
||||||
for cache_dir in ${cache_dirs[@]:1}; do
|
for cache_dir in ${cache_dirs[@]:1}; do
|
||||||
printf -v p '%q' "$cache_dir"
|
mount_args+=(--bind-ro="$cache_dir")
|
||||||
mount_args+=(--bind-ro="$p")
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_hostconf () {
|
copy_hostconf () {
|
||||||
cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d"
|
cp -a /etc/pacman.d/gnupg "$working_dir/etc/pacman.d"
|
||||||
echo "Server = $host_mirror" > $working_dir/etc/pacman.d/mirrorlist
|
echo "Server = $host_mirror" >"$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"
|
||||||
|
|
||||||
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i $working_dir/etc/pacman.conf
|
sed -r "s|^#?\\s*CacheDir.+|CacheDir = $(echo -n ${cache_dirs[@]})|g" -i "$working_dir/etc/pacman.conf"
|
||||||
}
|
}
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
@@ -98,7 +94,7 @@ copy_hostconf
|
|||||||
|
|
||||||
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
eval $(grep '^CARCH=' "$working_dir/etc/makepkg.conf")
|
||||||
|
|
||||||
machine_name="${working_dir//\//-}"
|
machine_name="${working_dir//[![:alnum:]_-]/-}"
|
||||||
machine_name="${machine_name#-}"
|
machine_name="${machine_name#-}"
|
||||||
|
|
||||||
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
|
exec ${CARCH:+setarch "$CARCH"} systemd-nspawn 2>/dev/null \
|
||||||
|
54
checkpkg.in
54
checkpkg.in
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
m4_include(lib/common.sh)
|
m4_include(lib/common.sh)
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
# Source makepkg.conf; fail if it is not found
|
||||||
@@ -18,26 +20,22 @@ 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
|
||||||
|
|
||||||
. PKGBUILD
|
. ./PKGBUILD
|
||||||
if [[ $arch == 'any' ]]; then
|
if [[ $arch == 'any' ]]; then
|
||||||
CARCH='any'
|
CARCH='any'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
STARTDIR=$(pwd)
|
STARTDIR=$(pwd)
|
||||||
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
|
||||||
cd "$TEMPDIR"
|
|
||||||
|
|
||||||
for _pkgname in "${pkgname[@]}"; do
|
for _pkgname in "${pkgname[@]}"; do
|
||||||
pkgfile=${_pkgname}-$(get_full_version $_pkgname)-${CARCH}${PKGEXT}
|
target_pkgver=$(get_full_version "$_pkgname")
|
||||||
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$target_pkgver" "$CARCH"); then
|
||||||
if [[ -f "$STARTDIR/$pkgfile" ]]; then
|
die 'tarball not found for package: %s' "${_pkgname}-$target_pkgver"
|
||||||
ln -s "$STARTDIR/$pkgfile" "$pkgfile"
|
|
||||||
elif [[ -f "$PKGDEST/$pkgfile" ]]; then
|
|
||||||
ln -s "$PKGDEST/$pkgfile" "$pkgfile"
|
|
||||||
else
|
|
||||||
die "File \"$pkgfile\" doesn't exist"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ln -s "$pkgfile" "$TEMPDIR"
|
||||||
|
|
||||||
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
@@ -50,31 +48,27 @@ for _pkgname in "${pkgname[@]}"; do
|
|||||||
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
die "The built package (%s) is the one in the repo right now!" "$_pkgname"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $oldpkg ]]; then
|
if [[ $pkgurl = file://* ]]; then
|
||||||
if [[ $pkgurl = file://* ]]; then
|
ln -s "${pkgurl#file://}" "$TEMPDIR/$oldpkg"
|
||||||
ln -s "${pkgurl#file://}" "${pkgurl##file://*/}"
|
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
||||||
elif [[ -f "$PKGDEST/$oldpkg" ]]; then
|
ln -s "$PKGDEST/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||||
ln -s "$PKGDEST/$oldpkg" "$oldpkg"
|
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
||||||
elif [[ -f "$STARTDIR/$oldpkg" ]]; then
|
ln -s "$STARTDIR/$oldpkg" "$TEMPDIR/$oldpkg"
|
||||||
ln -s "$STARTDIR/$oldpkg" "$oldpkg"
|
else
|
||||||
else
|
curl -fsLC - --retry 3 --retry-delay 3 -o "$TEMPDIR/$oldpkg" "$pkgurl"
|
||||||
curl -fsLC - --retry 3 --retry-delay 3 -o "$oldpkg" "$pkgurl"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bsdtar tf "$oldpkg" | sort > "filelist-$_pkgname-old"
|
bsdtar tf "$TEMPDIR/$oldpkg" | sort > "$TEMPDIR/filelist-$_pkgname-old"
|
||||||
bsdtar tf "$pkgfile" | sort > "filelist-$_pkgname"
|
bsdtar tf "$pkgfile" | sort > "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
sdiff -s "filelist-$_pkgname-old" "filelist-$_pkgname"
|
sdiff -s "$TEMPDIR/filelist-$_pkgname-old" "$TEMPDIR/filelist-$_pkgname"
|
||||||
|
|
||||||
if diff "filelist-$_pkgname-old" "filelist-$_pkgname" | grep '\.so' > /dev/null 2>&1; then
|
if diff "$TEMPDIR/filelist-$_pkgname"{-old,} | grep '\.so' &>/dev/null; then
|
||||||
mkdir -p pkg
|
mkdir -p "$TEMPDIR/pkg"
|
||||||
cd pkg
|
bsdtar -x -C "$TEMPDIR" -f "$pkgfile" #> /dev/null
|
||||||
bsdtar xf ../"$pkgfile" > /dev/null
|
comm -13 <(sort "$TEMPDIR/filelist-$_pkgname-old") <(sort "$TEMPDIR/filelist-$_pkgname") | grep .so$ | while read i; do
|
||||||
diff "../filelist-$_pkgname-old" "../filelist-$_pkgname" | awk '/>.*\.so/{$1 = ""; print $0}' | while read i; do
|
echo "${i}: " "$(objdump -p "$TEMPDIR/$i" | grep SONAME)"
|
||||||
echo "${i}: " "$(objdump -p "$i" | grep SONAME)"
|
|
||||||
done
|
done
|
||||||
cd ..
|
|
||||||
else
|
else
|
||||||
msg "No soname differences for $_pkgname."
|
msg "No soname differences for $_pkgname."
|
||||||
fi
|
fi
|
||||||
|
48
commitpkg.in
48
commitpkg.in
@@ -2,22 +2,6 @@
|
|||||||
|
|
||||||
m4_include(lib/common.sh)
|
m4_include(lib/common.sh)
|
||||||
|
|
||||||
getpkgfile() {
|
|
||||||
case $# in
|
|
||||||
0)
|
|
||||||
error 'No canonical package found!'
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
[!1])
|
|
||||||
error 'Failed to canonicalize package name -- multiple packages found:'
|
|
||||||
msg2 '%s' "$@"
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
# Source makepkg.conf; fail if it is not found
|
||||||
if [[ -r '/etc/makepkg.conf' ]]; then
|
if [[ -r '/etc/makepkg.conf' ]]; then
|
||||||
source '/etc/makepkg.conf'
|
source '/etc/makepkg.conf'
|
||||||
@@ -36,7 +20,7 @@ if [[ ! -f PKGBUILD ]]; then
|
|||||||
die 'No PKGBUILD file'
|
die 'No PKGBUILD file'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
. PKGBUILD
|
. ./PKGBUILD
|
||||||
pkgbase=${pkgbase:-$pkgname}
|
pkgbase=${pkgbase:-$pkgname}
|
||||||
|
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
@@ -55,24 +39,28 @@ case "$cmd" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# check if all local source files are under version control
|
# find files which should be under source control
|
||||||
|
needsversioning=()
|
||||||
for s in "${source[@]}"; do
|
for s in "${source[@]}"; do
|
||||||
if [[ $s != *://* ]] && ! svn status -v "$s@" | grep -q '^[ AMRX~]'; then
|
[[ $s != *://* ]] && needsversioning+=("$s")
|
||||||
die "%s is not under version control" "$s"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# check if changelog and install files are under version control
|
|
||||||
for i in 'changelog' 'install'; do
|
for i in 'changelog' 'install'; do
|
||||||
while read -r file; do
|
while read -r file; do
|
||||||
# evaluate any bash variables used
|
# evaluate any bash variables used
|
||||||
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
eval file=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "$file")\"
|
||||||
if ! svn status -v "${file}" | grep -q '^[ AMRX~]'; then
|
needsversioning+=("$file")
|
||||||
die "%s is not under version control" "$file"
|
|
||||||
fi
|
|
||||||
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
done < <(sed -n "s/^[[:space:]]*$i=//p" PKGBUILD)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# assert that they really are controlled by SVN
|
||||||
|
if (( ${#needsversioning[*]} )); then
|
||||||
|
# svn status's output is only two columns when the status is unknown
|
||||||
|
while read -r status filename; do
|
||||||
|
[[ $status = '?' ]] && unversioned+=("$filename")
|
||||||
|
done < <(svn status -v "${needsversioning[@]}")
|
||||||
|
(( ${#unversioned[*]} )) && die "%s is not under version control" "${unversioned[@]}"
|
||||||
|
fi
|
||||||
|
|
||||||
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
|
rsyncopts=(-e ssh -p --chmod=ug=rw,o=r -c -h -L --progress --partial -y)
|
||||||
archreleaseopts=()
|
archreleaseopts=()
|
||||||
while getopts ':l:a:s:f' flag; do
|
while getopts ':l:a:s:f' flag; do
|
||||||
@@ -95,9 +83,8 @@ 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=$(shopt -s nullglob;
|
if pkgfile=$(find_cached_package "$_pkgname" "$_arch" "$fullver"); then
|
||||||
getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
|
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf "$pkgfile" .PKGINFO); then
|
||||||
if grep -q "packager = Unknown Packager" <(bsdtar -xOqf $pkgfile .PKGINFO); then
|
|
||||||
die "PACKAGER was not set when building package"
|
die "PACKAGER was not set when building package"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -147,8 +134,7 @@ 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=$(shopt -s nullglob;
|
if ! pkgfile=$(find_cached_package "$_pkgname" "$fullver" "${_arch}"); then
|
||||||
getpkgfile "${PKGDEST+$PKGDEST/}$_pkgname-$fullver-${_arch}".pkg.tar.?z); then
|
|
||||||
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
|
warning "Skipping $_pkgname-$fullver-$_arch: failed to locate package file"
|
||||||
skip_arches+=($_arch)
|
skip_arches+=($_arch)
|
||||||
continue 2
|
continue 2
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
# Avoid any encoding problems
|
# Avoid any encoding problems
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
|
shopt -s extglob
|
||||||
|
|
||||||
# check if messages are to be printed using color
|
# check if messages are to be printed using color
|
||||||
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
unset ALL_OFF BOLD BLUE GREEN RED YELLOW
|
||||||
if [[ -t 2 ]]; then
|
if [[ -t 2 ]]; then
|
||||||
@@ -154,3 +156,70 @@ slock() {
|
|||||||
stat_done
|
stat_done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage: pkgver_equal( $pkgver1, $pkgver2 )
|
||||||
|
##
|
||||||
|
pkgver_equal() {
|
||||||
|
local left right
|
||||||
|
|
||||||
|
if [[ $1 = *-* && $2 = *-* ]]; then
|
||||||
|
# if both versions have a pkgrel, then they must be an exact match
|
||||||
|
[[ $1 = "$2" ]]
|
||||||
|
else
|
||||||
|
# otherwise, trim any pkgrel and compare the bare version.
|
||||||
|
[[ ${1%%-*} = "${2%%-*}" ]]
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage: find_cached_package( $pkgname, $pkgver, $arch )
|
||||||
|
#
|
||||||
|
# $pkgver can be supplied with or without a pkgrel appended.
|
||||||
|
# If not supplied, any pkgrel will be matched.
|
||||||
|
##
|
||||||
|
find_cached_package() {
|
||||||
|
local searchdirs=("$PWD" "$PKGDEST") results=()
|
||||||
|
local targetname=$1 targetver=$2 targetarch=$3
|
||||||
|
local dir pkg pkgbasename pkgparts name ver rel arch size results
|
||||||
|
|
||||||
|
for dir in "${searchdirs[@]}"; do
|
||||||
|
[[ -d $dir ]] || continue
|
||||||
|
|
||||||
|
for pkg in "$dir"/*.pkg.tar?(.?z); do
|
||||||
|
[[ -f $pkg ]] || continue
|
||||||
|
|
||||||
|
# split apart package filename into parts
|
||||||
|
pkgbasename=${pkg##*/}
|
||||||
|
pkgbasename=${pkgbasename%.pkg.tar?(.?z)}
|
||||||
|
|
||||||
|
arch=${pkgbasename##*-}
|
||||||
|
pkgbasename=${pkgbasename%-"$arch"}
|
||||||
|
|
||||||
|
rel=${pkgbasename##*-}
|
||||||
|
pkgbasename=${pkgbasename%-"$rel"}
|
||||||
|
|
||||||
|
ver=${pkgbasename##*-}
|
||||||
|
name=${pkgbasename%-"$ver"}
|
||||||
|
|
||||||
|
if [[ $targetname = "$name" && $targetarch = "$arch" ]] &&
|
||||||
|
pkgver_equal "$targetver" "$ver-$rel"; then
|
||||||
|
results+=("$pkg")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
case ${#results[*]} in
|
||||||
|
0)
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
printf '%s\n' "$results"
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
error 'Multiple packages found:'
|
||||||
|
printf '\t%s\n' "${results[@]}"
|
||||||
|
return 1
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
@@ -24,6 +24,9 @@ passeddir=
|
|||||||
declare -a install_pkgs
|
declare -a install_pkgs
|
||||||
declare -i ret=0
|
declare -i ret=0
|
||||||
|
|
||||||
|
bindmounts_ro=()
|
||||||
|
bindmounts_rw=()
|
||||||
|
|
||||||
copy=$USER
|
copy=$USER
|
||||||
[[ -n $SUDO_USER ]] && copy=$SUDO_USER
|
[[ -n $SUDO_USER ]] && copy=$SUDO_USER
|
||||||
[[ -z "$copy" || $copy = root ]] && copy=copy
|
[[ -z "$copy" || $copy = root ]] && copy=copy
|
||||||
@@ -48,6 +51,8 @@ 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 '-d <dir> Bind directory into build chroot as read-write'
|
||||||
|
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'
|
||||||
echo ' This is useful for rebuilds without dirtying the pristine'
|
echo ' This is useful for rebuilds without dirtying the pristine'
|
||||||
echo ' chroot'
|
echo ' chroot'
|
||||||
@@ -61,10 +66,12 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'hcur:I:l:nT' arg; do
|
while getopts 'hcur:I:l:nTD:d:' arg; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
h) usage ;;
|
h) usage ;;
|
||||||
c) clean_first=true ;;
|
c) clean_first=true ;;
|
||||||
|
D) bindmounts_ro+=(--bind-ro="$OPTARG") ;;
|
||||||
|
d) bindmounts_rw+=(--bind="$OPTARG") ;;
|
||||||
u) update_first=true ;;
|
u) update_first=true ;;
|
||||||
r) passeddir="$OPTARG" ;;
|
r) passeddir="$OPTARG" ;;
|
||||||
I) install_pkgs+=("$OPTARG") ;;
|
I) install_pkgs+=("$OPTARG") ;;
|
||||||
@@ -97,11 +104,13 @@ fi
|
|||||||
makepkg_args="$makepkg_args ${*:$OPTIND}"
|
makepkg_args="$makepkg_args ${*:$OPTIND}"
|
||||||
|
|
||||||
# See if -R was passed to makepkg
|
# See if -R was passed to makepkg
|
||||||
for arg in ${*:$OPTIND}; do
|
for arg in "${@:OPTIND}"; do
|
||||||
if [[ $arg = -R ]]; then
|
case ${arg%%=*} in
|
||||||
repack=true
|
-*R*|--repackage)
|
||||||
break
|
repack=true
|
||||||
fi
|
break 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n $SUDO_USER ]]; then
|
if [[ -n $SUDO_USER ]]; then
|
||||||
@@ -133,7 +142,7 @@ create_chroot() {
|
|||||||
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
slock 8 "$chrootdir/root.lock" "Locking clean chroot"
|
||||||
|
|
||||||
stat_busy "Creating clean working copy [$copy]"
|
stat_busy "Creating clean working copy [$copy]"
|
||||||
if [[ "$chroottype" == btrfs ]]; then
|
if [[ "$chroottype" == btrfs ]] && ! mountpoint -q "$copydir"; then
|
||||||
if [[ -d $copydir ]]; then
|
if [[ -d $copydir ]]; then
|
||||||
btrfs subvolume delete "$copydir" >/dev/null ||
|
btrfs subvolume delete "$copydir" >/dev/null ||
|
||||||
die "Unable to delete subvolume %s" "$copydir"
|
die "Unable to delete subvolume %s" "$copydir"
|
||||||
@@ -174,7 +183,9 @@ install_packages() {
|
|||||||
pkgname="${install_pkg##*/}"
|
pkgname="${install_pkg##*/}"
|
||||||
cp "$install_pkg" "$copydir/$pkgname"
|
cp "$install_pkg" "$copydir/$pkgname"
|
||||||
|
|
||||||
arch-nspawn "$copydir" pacman -U /$pkgname --noconfirm
|
arch-nspawn "$copydir" \
|
||||||
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
|
pacman -U /$pkgname --noconfirm
|
||||||
(( ret += !! $? ))
|
(( ret += !! $? ))
|
||||||
|
|
||||||
rm "$copydir/$pkgname"
|
rm "$copydir/$pkgname"
|
||||||
@@ -276,14 +287,16 @@ _chrootbuild() {
|
|||||||
ln -sft /srcdest /srcdest_host/*
|
ln -sft /srcdest /srcdest_host/*
|
||||||
ln -sft /startdir /startdir_host/*
|
ln -sft /startdir /startdir_host/*
|
||||||
|
|
||||||
# XXX: Keep svn sources writable
|
# XXX: Keep bzr and svn sources writable
|
||||||
# Since makepkg 4.1.1 they get checked out via cp -a, copying the symlink
|
# Since makepkg 4.1.1 they get checked out via cp -a, copying the symlink
|
||||||
for dir in /srcdest /startdir; do
|
for dir in /srcdest /startdir; do
|
||||||
cd $dir
|
for vcs in bzr svn; do
|
||||||
for svndir in */.svn; do
|
cd "$dir"
|
||||||
rm ${svndir%/.svn}
|
for vcsdir in */.$vcs; do
|
||||||
cp -a ${dir}_host/${svndir%/.svn} .
|
rm "${vcsdir%/.$vcs}"
|
||||||
chown -R nobody ${svndir%/.svn}
|
cp -a "${dir}_host/${vcsdir%/.$vcs}" .
|
||||||
|
chown -R nobody "${vcsdir%/.$vcs}"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -338,7 +351,9 @@ load_vars /etc/makepkg.conf
|
|||||||
|
|
||||||
create_chroot
|
create_chroot
|
||||||
|
|
||||||
$update_first && arch-nspawn "$copydir" pacman -Syu --noconfirm
|
$update_first && arch-nspawn "$copydir" \
|
||||||
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
|
pacman -Syu --noconfirm
|
||||||
|
|
||||||
[[ -n ${install_pkgs[*]} ]] && install_packages
|
[[ -n ${install_pkgs[*]} ]] && install_packages
|
||||||
|
|
||||||
@@ -349,6 +364,7 @@ download_sources
|
|||||||
if arch-nspawn "$copydir" \
|
if arch-nspawn "$copydir" \
|
||||||
--bind-ro="$PWD:/startdir_host" \
|
--bind-ro="$PWD:/startdir_host" \
|
||||||
--bind-ro="$SRCDEST:/srcdest_host" \
|
--bind-ro="$SRCDEST:/srcdest_host" \
|
||||||
|
"${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
|
||||||
/chrootbuild
|
/chrootbuild
|
||||||
then
|
then
|
||||||
move_products
|
move_products
|
||||||
|
@@ -67,7 +67,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
@@ -80,7 +80,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
#-- upx: Compress binary executable files using UPX
|
#-- upx: Compress binary executable files using UPX
|
||||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
|
@@ -67,7 +67,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
# These are default values for the options=() settings
|
# These are default values for the options=() settings
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
# Default: OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
# A negated option will do the opposite of the comments below.
|
# A negated option will do the opposite of the comments below.
|
||||||
#
|
#
|
||||||
#-- strip: Strip symbols from binaries/libraries
|
#-- strip: Strip symbols from binaries/libraries
|
||||||
@@ -80,7 +80,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
|
|||||||
#-- upx: Compress binary executable files using UPX
|
#-- upx: Compress binary executable files using UPX
|
||||||
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
#-- debug: Add debugging flags as specified in DEBUG_* variables
|
||||||
#
|
#
|
||||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
|
OPTIONS=(strip docs !libtool !staticlibs emptydirs zipman purge !upx !debug)
|
||||||
|
|
||||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
|
||||||
INTEGRITY_CHECK=(md5)
|
INTEGRITY_CHECK=(md5)
|
||||||
|
Reference in New Issue
Block a user