diff options
Diffstat (limited to 'subr')
-rw-r--r-- | subr/build_args.subr | 13 | ||||
-rw-r--r-- | subr/pkg_clean.subr | 17 | ||||
-rw-r--r-- | subr/pkg_install.subr | 6 |
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 |