Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2019-12-03 01:14:35 +0100
committerLevente Polyak <anthraxx@archlinux.org>2019-12-05 22:50:11 +0100
commitf20435643f55c37e3f8274a03e7fe5e052dc8dd9 (patch)
tree2e84688d1a28dadf89f6e5c35d7ab9d46d88b984
parent8d99df602d6e5fc377a37f67d0e5ce74c8facecd (diff)
makechrootpkg: sync databases for checkpkg off-site
Use pacman's --dbpath feature to sync fresh databases inside an isolated location and split up the database sync and package location calls to remove the need of weird grep calls. It isn't nice of makechrootpkg to modify the host database state just by building packages. No foreign program shall automatically modify the host database other than by the explicit will of a system maintainer, which is the major reason this changes get incorporated. However, there is certain indoctrinated believe that using -Sy is the prime evil. In fact it has been declared as a social rule to a technical problem of not getting into potential partial upgrade states. This is not a proper loophole less solution as there are multiple ways and use cases that lead to such a state, like aborting a -Syu on the prompt for whatever reason, what really matters is that it is not a technically bullet proof solution to solve the problem. Databases shall have the freedom to be as up to date as databases or their owner wishes, allowing querying on latest database state without fear. The only loophole-less contract that _really_ is from importance is always using -Su instead of plain -S to install packages. Installing packages is what actually brings one into a potential partial upgrade state and by using -Su an outstanding upgrade is forced when installing a new package. This properly solves all edge cases in a technical manner instead of declaring people who abort the prompt of -Syu to be the problem. In fact, using this simple contract allows whatever system maintenance workflow a host owner wants to follow, which may still be to always use -Syu and deal with system upgrades explicitly instead of the time when installing new packages, but the -Su contract is the real safe guard to guarantee no edge case can ever slip in. This magically also opens up the freedom to people who wish to use -Sy to simply query on up to date data as the currently indoctrinated "never do -Sy" stone plates not only are not rock solid in technical terms but also make certain use cases simply impossible and hence cripple the functionality without at the very least being fully loophole free. Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--makechrootpkg.in15
1 files changed, 13 insertions, 2 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index a0a95a7..dfea18c 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -387,17 +387,28 @@ if (( ret != 0 )); then
else
if (( run_checkpkg )); then
msg "Running checkpkg"
- remotepkgs=($(pacman -Syddp --logfile /dev/null "${pkgnames[@]}"|grep '://'))
+
+ # 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 --logfile /dev/null "${pkgnames[@]}"
+ pacman --noconfirm -Swdd --dbpath "$dbpath" --logfile /dev/null "${pkgnames[@]}"
break
done
+
msg2 "Checking packages"
sudo -u "$makepkg_user" checkpkg --rmdir --warn
fi