Blame subr.pkg/pkg_clean.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 19ab70
#
8d7a8a
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 19ab70
#
Lucio Andrés Illanes Albornoz (arab, vxp) 19ab70
Lucio Andrés Illanes Albornoz (arab, vxp) 19ab70
pkg_clean() {
e9fa07
	local _pc_group_name="${1}" _pc_pkg_name="${2}" _pc_restart_at="${3}";
e9fa07
Lucio Andrés Illanes Albornoz 2b85d0
	if [ "${PKG_NO_CLEAN:-0}" -eq 0 ]; then
e9fa07
		if rtl_lmatch \$ARG_CLEAN_BUILDS "build" ","\
8953f4
		&& [ "${PKG_NO_CLEAN_BUILD_DIR:-0}" -eq 0 ]; then
Lucio Andrés Illanes Albornoz bf9edf
			if ! rtl_fileop rm "${PKG_BUILD_DIR}"; then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz 2b85d0
		fi;
e9fa07
		if rtl_lmatch \$ARG_CLEAN_BUILDS "dest" ","; then
Lucio Andrés Illanes Albornoz bf9edf
			if ! rtl_fileop rm "${PKG_DESTDIR}"; then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz 8a4e16
			elif [ -e "${PKG_DESTDIR_HOST}" ]\
Lucio Andrés Illanes Albornoz 8a4e16
			&&   ! rtl_fileop rm "${PKG_DESTDIR_HOST}"; then
Lucio Andrés Illanes Albornoz 8a4e16
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz 2b85d0
		fi;
e9fa07
		if rtl_lmatch \$ARG_CLEAN_BUILDS "src" ","; then
Lucio Andrés Illanes Albornoz bf9edf
			if ! rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; then
Lucio Andrés Illanes Albornoz bf9edf
				return 1;
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz 2b85d0
		fi;
Lucio Andrés Illanes Albornoz 0eaee4
	fi;
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 19ab70
};
Lucio Andrés Illanes Albornoz (arab, vxp) 19ab70
64844b
# vim:filetype=sh textwidth=0