aboutsummaryrefslogtreecommitdiff
path: root/libexec/build-make-distclean
blob: ba39c6e79f1bf1c8810f826ec27f04fbc7cae685 (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
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env build

build_make_distclean()
{(
	echo "distcleaning: ${1}"
	load_rules "${1}"

	if [ -f "${BUILDER_ATFDIR}/${CATEGORY}/${NAME}-${VERSION}-${RELEASE}.${ARCHIVE_FORMAT}" ]; then
		rm "${BUILDER_ATFDIR}/${CATEGORY}/${NAME}-${VERSION}-${RELEASE}.${ARCHIVE_FORMAT}" &
	fi
	if [ -f "${SYSROOT}/var/db/binpkgs/${CATEGORY}/${NAME}" ]; then
		cd "${SYSROOT}"
		# FIXME: we are failing to handle file collisions produce in
		# this file.
		cat "var/db/binpkgs/${CATEGORY}/${NAME}" | xargs -0 rm  -f &
	fi
	if [ -d "${W}" ]; then
		rm -rf "${W}" &
	fi

	wait

	# Clobber our package marker.
	if [ -f "${SYSROOT}/var/db/binpkgs/${CATEGORY}/${NAME}" ]; then
		rm "${SYSROOT}/var/db/binpkgs/${CATEGORY}/${NAME}"
	fi
)}

if test "${BUILDER_CALL_STACK}" = '__main__'; then
	simple_usage 'distclean' '[all|[<category>/]<package|all>]' "$@"
	build_make_distclean "${@}"
fi


# vim: filetype=sh