summaryrefslogtreecommitdiff
path: root/makechrootpkg.in
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2017-02-15 14:40:06 -0500
committerLuke Shumaker <lukeshu@parabola.nu>2017-04-20 00:23:50 -0400
commit0a4b64cef91b26180aaa6fd83d3376b206641a3f (patch)
tree48ea213dc7d3a0e11fee49f50b89d6c21b22cfe6 /makechrootpkg.in
parentb1f96872be9778fb96c6ec76e567345f26d54658 (diff)
downloaddevtools32-0a4b64cef91b26180aaa6fd83d3376b206641a3f.tar.xz
makechrootpkg, arch-nspawn: Force-enable local '/repo/' repository.
The change in arch-nspawn is subtle: This was the source of "infamous" "it fails every other time" bug that took me over a year to solve. <https://labs.parabola.nu/issues/435> By having a repository of local packages (rather than simply running `pacman -U`), we are inviting pacman to cache them in `/var/cache/pacman/pkg`. Besides being needless disk writes, this actually causes a real issue. If the package gets rebuilt, pacman will balk, as the file no longer matches the cached signature. So, how do we prevent pacman from caching these local packages? Simple: include the directory they are already in in the pacman.conf:CacheDir list. This will prevent pacman from copying the files to one of the other cache directories.
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r--makechrootpkg.in12
1 files changed, 12 insertions, 0 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index 633d617..420f1ce 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -223,6 +223,18 @@ builduser ALL = NOPASSWD: /usr/bin/pacman
EOF
chmod 440 "$copydir/etc/sudoers.d/builduser-pacman"
+ if ! grep -q '^\[repo\]' "$copydir/etc/pacman.conf"; then
+ local line=$(grep -n '^\[' "$copydir/etc/pacman.conf" |grep -Fv ':[options]'|sed 's/:.*//;1q')
+ local ins='[repo]
+SigLevel = Optional TrustAll
+Server = file:///repo
+'
+ sed -i "${line}i${ins//$'\n'/\\n}" "$copydir/etc/pacman.conf"
+ fi
+ # Avoid having to use `pacman -Sy` to update [repo], as
+ # networking might be disabled inside of the chroot.
+ cp "$copydir/repo/repo.db" "$copydir/var/lib/pacman/sync/repo.db"
+
# This is a little gross, but this way the script is recreated every time in the
# working copy
{