Commit 6a6310f0 authored by Chloe Kudryavtsev's avatar Chloe Kudryavtsev Committed by Natanael Copa

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
}
parent 30d296dd
......@@ -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..."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment