summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_clean.subr
blob: 39b0ead545aa66dd7e9b8f5c35987f1fcbc6d02a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#
# set +o errexit -o noglob -o nounset is assumed.
#

pkg_clean() {
	if [ "${PKG_NO_CLEAN:-0}" -eq 0 ]; then
		if rtl_lmatch "${ARG_CLEAN_BUILDS}" "build" ","; then
			if ! rtl_fileop rm "${PKG_BUILD_DIR}"; then
				return 1;
			fi;
		fi;
		if rtl_lmatch "${ARG_CLEAN_BUILDS}" "dest" ","; then
			if ! rtl_fileop rm "${PKG_DESTDIR}"; then
				return 1;
			fi;
		fi;
		if rtl_lmatch "${ARG_CLEAN_BUILDS}" "src" ","; then
			if ! rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; then
				return 1;
			fi;
		fi;
	fi;
};

# vim:filetype=sh