summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_fetch_distclean.subr
diff options
context:
space:
mode:
Diffstat (limited to 'subr/pkg_fetch_distclean.subr')
-rw-r--r--subr/pkg_fetch_distclean.subr15
1 files changed, 15 insertions, 0 deletions
diff --git a/subr/pkg_fetch_distclean.subr b/subr/pkg_fetch_distclean.subr
new file mode 100644
index 00000000..19f0b741
--- /dev/null
+++ b/subr/pkg_fetch_distclean.subr
@@ -0,0 +1,15 @@
+#
+# set -o errexit -o noglob are assumed.
+#
+
+pkg_fetch_distclean() {
+ if [ "$(stat -c %i "${PKG_BASE_DIR}")" \
+ != "$(stat -c %i "${WORKDIR}")" ]; then
+ ex_build_fileop cd "${WORKDIR}";
+ ex_build_fileop rm "${PKG_BASE_DIR}";
+ ex_build_fileop mkdir "${PKG_BASE_DIR}";
+ ex_build_fileop cd "${PKG_BASE_DIR}";
+ fi;
+};
+
+# vim:filetype=sh