summaryrefslogtreecommitdiffstats
path: root/abuild.in
diff options
context:
space:
mode:
authorChloe Kudryavtsev <toast@toastin.space>2018-12-08 13:22:44 -0500
committerNatanael Copa <ncopa@alpinelinux.org>2019-04-03 15:59:54 +0000
commit6a6310f030ebcec98710ff838b95a4c2d9c5cf9a (patch)
tree65725db899c04edd1a3814bb54b2bac6664ae1f9 /abuild.in
parent30d296ddb38d3f6f7755003e34495f78d710a567 (diff)
downloadabuild-6a6310f030ebcec98710ff838b95a4c2d9c5cf9a.tar.bz2
abuild-6a6310f030ebcec98710ff838b95a4c2d9c5cf9a.tar.xz
Add default_cleanup_srcdir
In some cases, a simple rm -rf is not sufficent to clean srcdir. One such case is the new go module system, that marks everything as read-only - thus only letting root rm -rf it without a chmod. There is a command intended to clean them - `go clean -modcache`. However, for that to work, GOPATH must be defined and existent. Running chmod for all srcdir cleanups makes no sense, nor does enforcing root, or putting global overrides just for go. This patch allows overriding what happens on `cleanup srcdir`, by overriding cleanup_srcdir, and allows the use of default_cleanup_srcdir. In our go example, it might be used as such: cleanup_srcdir() { go clean -modcache default_cleanup_srcdir }
Diffstat (limited to 'abuild.in')
-rw-r--r--abuild.in10
1 files changed, 9 insertions, 1 deletions
diff --git a/abuild.in b/abuild.in
index 74340b0..4cf9f35 100644
--- a/abuild.in
+++ b/abuild.in
@@ -76,6 +76,14 @@ want_check() {
return 0
}
+default_cleanup_srcdir() {
+ rm -rf "$srcdir"
+}
+
+cleanup_srcdir() {
+ default_cleanup_srcdir
+}
+
cleanup() {
local i=
[ -z "$subpkgdir" ] && set_xterm_title ""
@@ -90,7 +98,7 @@ cleanup() {
abuild-rmtemp "$BUILD_ROOT"
fi;;
pkgdir) msg "Cleaning up pkgdir"; rm -rf "$pkgbasedir";;
- srcdir) msg "Cleaning up srcdir"; rm -rf "$srcdir";;
+ srcdir) msg "Cleaning up srcdir"; cleanup_srcdir;;
deps)
if [ -z "$install_after" ] && [ -n "$uninstall_after" ]; then
msg "Uninstalling dependencies..."