summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-12-10 18:40:13 +0000
committerLucio Andrés Illanes Albornoz (arab, vxp) <lucio@lucioillanes.de>2017-12-10 18:40:13 +0000
commit19ab706dac37932341aa743c982dd4cca9df4636 (patch)
treeed0d97e117fbc2548e147afc07550d5c49627556 /subr
parent49dcd021ff436d28307fedfb1270ba662fa765eb (diff)
downloadmidipix_build-19ab706dac37932341aa743c982dd4cca9df4636.tar.bz2
midipix_build-19ab706dac37932341aa743c982dd4cca9df4636.tar.xz
etc/build.usage, subr/build_args.subr: adds -C build[,dest[,src]] (clean subdirs) and -p (create package tarballs).
subr/pkg_clean.subr: given -C, clean build, dest, and/or src. subr/pkg_install.subr: given -p, create gzip(1)-compressed package tarball at ${PKG_BASE_DIR}/${PKG_NAME}.tgz. vars/env.vars:${DEFAULT_BUILD_STEPS}: adds `clean' post-install.
Diffstat (limited to 'subr')
-rw-r--r--subr/build_args.subr13
-rw-r--r--subr/pkg_clean.subr17
-rw-r--r--subr/pkg_install.subr6
3 files changed, 33 insertions, 3 deletions
diff --git a/subr/build_args.subr b/subr/build_args.subr
index 8bf668a4..34875047 100644
--- a/subr/build_args.subr
+++ b/subr/build_args.subr
@@ -8,8 +8,10 @@ BUILD_ARGS_SPEC="
ARCH:arg:-a:
BUILD:arg:-b:
ARG_CLEAN:-c:
+ ARG_CLEAN_BUILDS:arg:-C:
ARG_DEBUG_MINIPIX:--debug-minipix:
ARG_OFFLINE:-N:
+ ARG_PACKAGE:-p:
ARG_PARALLEL:optarg:-P:auto
ARG_RELAXED:-R:
ARG_RESTART:arg:-r:
@@ -57,7 +59,14 @@ build_args() {
shift;
fi;
done;
- if [ -n "${ARG_TARBALL}" ]; then
+ if [ -n "${ARG_CLEAN_BUILDS}" ]; then
+ ARG_CLEAN_BUILDS="$(echo "${ARG_CLEAN_BUILDS}" | sed "s/,/ /g")";
+ fi;
+ if [ -n "${ARG_CLEAN_BUILDS}" ]\
+ || [ "${ARG_PACKAGE:-0}" -eq 1 ]\
+ && [ -n "${ARG_TARBALL}" ]; then
+ unset ARG_TARBALL;
+ elif [ -n "${ARG_TARBALL}" ]; then
if [ "${ARG_TARBALL#-t.}" != "${ARG_TARBALL}" ]; then
TARBALL_SUFFIX="${ARG_TARBALL#-t.}";
else
@@ -78,7 +87,7 @@ build_args() {
else
ARG_RESTART_AT=ALL;
fi;
- ARG_RESTART="$(echo ${ARG_RESTART} | sed "s/,/ /g")";
+ ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")";
fi;
while [ ${#} -gt 0 ]; do
case "${1}" in
diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr
new file mode 100644
index 00000000..d18adc13
--- /dev/null
+++ b/subr/pkg_clean.subr
@@ -0,0 +1,17 @@
+#
+# set -o errexit -o noglob are assumed.
+#
+
+pkg_clean() {
+ local _dir;
+ for _dir in ${ARG_CLEAN_BUILDS}; do
+ case "${_dir}" in
+ build) ex_rtl_fileop rm "${PKG_BUILD_DIR}"; ;;
+ src) ex_rtl_fileop rm "${PKG_SUBDIR}"; ;;
+ dest) ex_rtl_fileop rm "${PKG_DESTDIR}"; ;;
+ *) return 1; ;;
+ esac;
+ done;
+};
+
+# vim:filetype=sh
diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr
index 84eda480..81c67d21 100644
--- a/subr/pkg_install.subr
+++ b/subr/pkg_install.subr
@@ -4,8 +4,12 @@
pkg_install() {
ex_rtl_fileop mkdir "${PKG_PREFIX}";
- tar -C "${PKG_DESTDIR}" -cpf - . |\
+ tar -C "${PKG_DESTDIR}" -cpf - . |\
tar -C "${PKG_PREFIX}" --overwrite -xpf -;
+ if [ "${ARG_PACKAGE:-0}" -eq 1 ]; then
+ tar -C "${PKG_DESTDIR}" -cpf - . |\
+ gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz"
+ fi;
};
# vim:filetype=sh