build: propagate --pacman-conf to local upgrade
[aurutils.git] / tests / issue / 0741
blobecc2fa100ac2b8d83fb68354cef82dc811587686
1 #!/bin/bash
2 set -e
4 tmp=$(mktemp -d)
5 #trap 'rm -rf -- "$tmp"' EXIT
6 tmp_uid=custom-$RANDOM
8 cat >"$tmp"/pacman.conf <<EOF
9 [options]
10 HoldPkg = pacman-git glibc
11 Architecture = auto
12 CheckSpace
13 [core]
14 Include = /etc/pacman.d/mirrorlist
15 [extra]
16 Include = /etc/pacman.d/mirrorlist
17 [community]
18 Include = /etc/pacman.d/mirrorlist
19 [$tmp_uid]
20 SigLevel = Optional TrustAll
21 Server = file://$tmp
22 EOF
24 # create local repository
25 repo-add "$tmp/$tmp_uid".db.tar
27 config=(--pacman-conf "$tmp"/pacman.conf)
28 pkg=aurutils
29 rev=c07b5215df935cfe02f5c47411d2d717d9bb6aab
30 ver=17
32 # checkout and build previous revision
33 cd "$tmp"
34 env - HOME=$HOME USER=$USER PATH=$PATH aur fetch "$pkg"
36 cd "$pkg"
37 git reset --hard "$rev"
38 env_unset=(-u AUR_REPO -u AUR_DBROOT -u AUR_DBEXT -u MAKEPKG -u XDG_CACHE_HOME)
40 env "${env_unset[@]}" AUR_ENV=/dev/null aur build --no-sync \
41 -rnd "$tmp_uid" --margs --skippgpcheck --pacman-conf "$tmp"/pacman.conf
43 fakeroot -- pacman --config "$tmp"/pacman.conf --dbpath "$tmp" -Sy
44 found_package=$(pacsift --config "$tmp"/pacman.conf --dbpath "$tmp" --repo="$tmp_uid" --satisfies="$pkg=$ver")
45 [[ -n $found_package ]]
47 # update to latest revision
48 cd -
49 env "${env_unset[@]}" -u AUR_SYNC_NINJA AUR_ENV=/dev/null AURDEST="$tmp" \
50 aur sync --no-build --upgrades --ignore-file=/dev/null -d "$tmp_uid" --no-view --pacman-conf "$tmp"/pacman.conf
52 # build new version
53 cd "$pkg"
54 env "${env_unset[@]}" AUR_ENV=/dev/null aur build --no-sync \
55 -rnd "$tmp_uid" --margs --skippgpcheck --pacman-conf "$tmp"/pacman.conf
57 fakeroot -- pacman --config "$tmp"/pacman.conf --dbpath "$tmp" -Sy
58 found_package=$(pacsift --config "$tmp"/pacman.conf --dbpath "$tmp" --repo="$tmp_uid" --satisfies="$pkg>$ver")
59 [[ -n $found_package ]]
61 # vim: set et sw=4 sts=4 ft=sh:\n