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
}
---
abuild.in | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/abuild.in b/abuild.in
index eceb9f2..bee3ec2 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..."
--
2.19.2
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---