summaryrefslogtreecommitdiff
path: root/src/chroot-tools/hooks-check.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-11 10:56:46 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-11 15:55:15 -0400
commit6eddc77d5e6abb25f33751308419fa0c62518188 (patch)
tree4f1d004e46d5be3f54efb04d6fd6c5cc6b50c0da /src/chroot-tools/hooks-check.sh
parent2a971c6ad1e55f95f5486b265307160e57b47e5f (diff)
Update to the new version of devtools (huge commit).
User-facing changes: - libremessages: `lock_open_write` became `lock` - libremessages: `lock_open_read` became `slock` - librechroot: learned the `-r` and `-w` flags to do bind mounts. Internal changes: The changes to librechroot were pretty straight-forward; the biggest change is that `archroot` got split into `mkarchroot` and `arch-nspawn`. libremakepkg got a major overhaul Honestly, the changes to libremakepklg probably could have been a lot smaller, but... I wanted to do it right/be clean. makechrootpkg in devtools got cleaned up a lot, actually a lot of the same changes I was making. But, the small differences between the way we did things made it less than simple to adjust. The biggest changes in terms of conflict for me are how devtools now uses bind-mounts to put files in the chroot, and that the /chrootbuild file is more complicated. I handled a lot of the complexity by moving things out of the main program, and adding hooks for non-core functionality, including chcleanup, distcc compatability hacks, and PKGBUILD/pkg checking. Unfortunately, the files containing the hooks are currently hard-coded. Perhaps they will be truly pluggable in the future. That might be neat. Or over-complicated. We'll see where it goes.
Diffstat (limited to 'src/chroot-tools/hooks-check.sh')
-rw-r--r--src/chroot-tools/hooks-check.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/chroot-tools/hooks-check.sh b/src/chroot-tools/hooks-check.sh
new file mode 100644
index 0000000..dee7c04
--- /dev/null
+++ b/src/chroot-tools/hooks-check.sh
@@ -0,0 +1,38 @@
+#!/bin/bash -euE
+
+hook_check_pkgbuild+=("check_pkgbuild_dependencies")
+check_pkgbuild_dependencies() {
+ local s=0
+ sudo -EH -u "$LIBREUSER" pkgbuild-check-nonfree -f || s=$?
+ case $s in
+ 0) :;;
+ 15) error "This PKGBUILD links to known unfree packages"; return 1;;
+ *) warning "pkgbuild-check-nonfree failed to run";;
+ esac
+}
+
+hook_check_pkgbuild+=("check_pkgbuild_license")
+check_pkgbuild_license() {
+ local s=0
+ sudo -EH -u "$LIBREUSER" pkgbuild-check-licenses -f || s=$?
+ for i in 1 2 4; do
+ if [[ $i -eq $(($s & $i)) ]]; then
+ case $i in
+ 1) warning "pkgbuild-check-licenses encountered an error";;
+ 2) warning "This PKGBUILD has an uncommon license";;
+ 4) error "This PKGBUILD has a known nonfree license"; ret=1;;
+ esac
+ fi
+ done
+}
+
+#hook_check_pkgbuild+=("check_pkgbuild_namcap")
+check_pkgbuild_namcap() {
+ sudo -EH -u "$LIBREUSER" namcap PKGBUILD
+}
+
+#hook_check_pkg+=("check_pkg")
+check_pkg() {
+ # TODO
+ :
+}