Merge pull request #1128 from aurutils/depends-pm
[aurutils.git] / tests / issue / 0085
blob48d36d0affb37a0866531e0db34e1c99c8e97780
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 CacheDir = $tmp
11 HoldPkg = pacman-git glibc
12 Architecture = auto
13 CheckSpace
14 [core]
15 Include = /etc/pacman.d/mirrorlist
16 [extra]
17 Include = /etc/pacman.d/mirrorlist
18 [$tmp_uid]
19 SigLevel = Optional TrustAll
20 Server = file://$tmp
21 EOF
23 # create local repository
24 repo-add "$tmp/$tmp_uid".db.tar
26 # create temporary pacman database
27 mkdir -p "$tmp"/pacman/{local,sync}
29 # cache/checksum test
30 cat > "$tmp"/PKGBUILD <<EOF
31 pkgname=test-random
32 pkgver=1
33 pkgrel=1
34 pkgdesc="description"
35 arch=('any')
36 url="http://example.com"
37 license=('GPL')
39 package() {
40 install -dm1777 "\$pkgdir"/tmp
41 install -dm0700 "\$pkgdir"$tmp
42 dd if=/dev/urandom of="\$pkgdir"$tmp/random bs=1M count=4
44 EOF
46 cat "$tmp"/PKGBUILD
47 # TODO: add test with pkgver bumps (no CacheDir)
48 i=0
50 while [ $((i < 10)) -eq 1 ]; do
51 env -C "$tmp" -u AUR_REPO -u AUR_DBROOT -u AUR_DBEXT -u MAKEPKG AUR_ENV=/dev/null aur build \
52 --no-sync -fd "$tmp_uid" --pacman-conf "$tmp"/pacman.conf
54 fakeroot pacsync --config "$tmp"/pacman.conf --dbpath "$tmp"/pacman
55 # XXX: results in "could not change the root directory", however
56 # this does not seem to affect the result of the test
57 fakeroot pacman -S --noconfirm --dbpath "$tmp"/pacman \
58 --config "$tmp"/pacman.conf "$tmp_uid"/test-random
60 i=$((i +1))
61 done
63 # vim: set et sw=4 sts=4 ft=sh:\n