summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
Diffstat (limited to 'subr')
-rw-r--r--subr/build_args.subr45
-rw-r--r--subr/build_init.subr2
-rw-r--r--subr/pkg_clean.subr17
-rw-r--r--subr/pkg_install.subr2
-rw-r--r--subr/pkg_install_rpm.subr43
5 files changed, 45 insertions, 64 deletions
diff --git a/subr/build_args.subr b/subr/build_args.subr
index 750aa535..5cdc63b9 100644
--- a/subr/build_args.subr
+++ b/subr/build_args.subr
@@ -3,29 +3,23 @@
#
BUILD_ARGS_SPEC="
+ ARCH:arg:-a:
ARG_IPV4_ONLY:-4:
ARG_IPV6_ONLY:-6:
- ARCH:arg:-a:
- BUILD:arg:-b:
+ ARG_AS_NEEDED:--as-needed:
ARG_CLEAN:-c:
ARG_CLEAN_BUILDS:arg:-C:
- ARG_AS_NEEDED:--as-needed:
ARG_DEBUG_MINIPIX:--debug-minipix:
- ARG_RPM:--rpm:
+ ARG_DIST:arg:-D:
ARG_OFFLINE:-N:
- ARG_PACKAGE:-p:
ARG_PARALLEL:optarg:-P:auto
ARG_RELAXED:-R:
ARG_RESTART:arg:-r:
- ARG_TARBALL:selfarg:-t:
- ARG_TARBALL:selfarg:-t.bz2;
- ARG_TARBALL:selfarg:-t.gz:
- ARG_TARBALL:selfarg:-t.xz:
ARG_VERBOSE:selfarg:-v:
ARG_VERBOSE:selfarg:-vv:
ARG_VERBOSE:selfarg:-vvv:
ARG_XTRACE:-x:
- ARG_ZIPDIST:arg:-z:";
+ BUILD:arg:-b:";
build_args() {
local _spec="${BUILD_ARGS_SPEC}" _spec_arg="" _found="";
@@ -62,28 +56,6 @@ build_args() {
shift;
fi;
done;
- 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
- TARBALL_SUFFIX=xz;
- fi;
- fi;
- case "${ARG_VERBOSE}" in
- -v) ARG_VERBOSE=1; ;;
- -vv) ARG_VERBOSE=2; ;;
- -vvv) ARG_VERBOSE=3; ;;
- esac;
- if [ "${ARG_XTRACE:-0}" -eq 1 ]; then
- ARG_VERBOSE=2;
- fi;
if [ -n "${ARG_RESTART}" ]; then
if [ "${ARG_RESTART%:*}" != "${ARG_RESTART}" ]; then
ARG_RESTART_AT="${ARG_RESTART#*:}"; ARG_RESTART="${ARG_RESTART%:*}";
@@ -92,6 +64,15 @@ build_args() {
fi;
ARG_RESTART="$(echo "${ARG_RESTART}" | sed "s/,/ /g")";
fi;
+ if [ "${ARG_XTRACE:-0}" -eq 1 ]; then
+ ARG_VERBOSE=2;
+ else
+ case "${ARG_VERBOSE}" in
+ -v) ARG_VERBOSE=1; ;;
+ -vv) ARG_VERBOSE=2; ;;
+ -vvv) ARG_VERBOSE=3; ;;
+ esac;
+ fi;
while [ ${#} -gt 0 ]; do
case "${1}" in
*=*) ex_rtl_set_var_unsafe "${1%%=*}" "${1#*=}"; ;;
diff --git a/subr/build_init.subr b/subr/build_init.subr
index 7e52a280..34fa6b68 100644
--- a/subr/build_init.subr
+++ b/subr/build_init.subr
@@ -56,7 +56,7 @@ build_init() {
ex_rtl_unset_vars $(ex_rtl_lfilter_not "${_env_vars}" "${_env_vars_except}");
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${PREFIX}/lib";
ex_rtl_fileop mkdir "${BUILD_DLCACHEDIR}" "${BUILD_WORKDIR}";
- if [ "${ARG_RPM:-0}" -eq 1 ]; then
+ if ex_rtl_lmatch "${ARG_DIST}" , rpm; then
ex_rtl_fileop mkdir "${PREFIX_RPM}";
fi;
if [ -e "${DEFAULT_BUILD_STATUS_IN_PROGRESS_FNAME}" ]; then
diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr
index 8128dfd4..dfc83b76 100644
--- a/subr/pkg_clean.subr
+++ b/subr/pkg_clean.subr
@@ -7,14 +7,15 @@ pkg_clean() {
if [ -n "${PKG_DEPS_BASE}" ]; then
return 0;
fi;
- for _dir in ${ARG_CLEAN_BUILDS}; do
- case "${_dir}" in
- build) ex_rtl_fileop rm "${PKG_BUILD_DIR}"; ;;
- src) ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; ;;
- dest) ex_rtl_fileop rm "${PKG_DESTDIR}"; ;;
- *) return 1; ;;
- esac;
- done;
+ if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , build; then
+ ex_rtl_fileop rm "${PKG_BUILD_DIR}";
+ fi;
+ if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , dest; then
+ ex_rtl_fileop rm "${PKG_DESTDIR}";
+ fi;
+ if ex_rtl_lmatch "${ARG_CLEAN_BUILDS}" , src; then
+ ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}";
+ fi;
};
# vim:filetype=sh
diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr
index 14cd8a0b..b4f68754 100644
--- a/subr/pkg_install.subr
+++ b/subr/pkg_install.subr
@@ -14,7 +14,7 @@ pkg_install() {
-perm /0111 -type f -exec chmod 0755 {} \;;
tar -C "${PKG_DESTDIR}" -cpf - . |\
tar -C "${PKG_PREFIX}" --overwrite -xpf -;
- if [ "${ARG_PACKAGE:-0}" -eq 1 ]; then
+ if ex_rtl_lmatch "${ARG_DIST}" , pkg; then
tar -C "${PKG_DESTDIR}" -cpf - . |\
gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz"
fi;
diff --git a/subr/pkg_install_rpm.subr b/subr/pkg_install_rpm.subr
index cd920eb6..691fe04c 100644
--- a/subr/pkg_install_rpm.subr
+++ b/subr/pkg_install_rpm.subr
@@ -4,25 +4,23 @@
pkg_install_rpm() {
local _pkg_url="" _pkg_version_full="" _pkg_version_rpm="";
- if [ "${ARG_RPM:-0}" -eq 0 ]\
- || [ "${PKG_RPM_DISABLE:-0}" -eq 1 ]\
- || ! [ -x "$(which rpmbuild 2>/dev/null)" ]; then
- return 0;
- fi;
- if [ -n "${PKG_URL}" ]; then
- _pkg_version_rpm="${PKG_VERSION%%-*}";
- _pkg_version_full="${PKG_VERSION}";
- _pkg_url="${PKG_URL}";
- elif [ -n "${PKG_URLS_GIT}" ]; then
- _pkg_version_rpm="$(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse HEAD)";
- _pkg_version_full="${_pkg_version_rpm} ($(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse --abbrev-ref HEAD))";
- _pkg_url="${PKG_URLS_GIT%% *}";
- _pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}";
- if [ "${_pkg_url#${DEFAULT_GITROOT_HEAD}}" != "${_pkg_url}" ]; then
- _pkg_url="Unknown";
+ if ex_rtl_lmatch "${ARG_DIST}" , rpm \
+ && [ "${PKG_RPM_DISABLE:-0}" -eq 0 ] \
+ && [ -x "$(which rpmbuild 2>/dev/null)" ]; then
+ if [ -n "${PKG_URL}" ]; then
+ _pkg_version_rpm="${PKG_VERSION%%-*}";
+ _pkg_version_full="${PKG_VERSION}";
+ _pkg_url="${PKG_URL}";
+ elif [ -n "${PKG_URLS_GIT}" ]; then
+ _pkg_version_rpm="$(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse HEAD)";
+ _pkg_version_full="${_pkg_version_rpm} ($(cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && git rev-parse --abbrev-ref HEAD))";
+ _pkg_url="${PKG_URLS_GIT%% *}";
+ _pkg_url="${_pkg_url##*=}"; _pkg_url="${_pkg_url%%@*}";
+ if [ "${_pkg_url#${DEFAULT_GITROOT_HEAD}}" != "${_pkg_url}" ]; then
+ _pkg_url="Unknown";
+ fi;
fi;
- fi;
- cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" <<EOF
+ cat > "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" <<EOF
Name: ${PKG_NAME}
Version: ${_pkg_version_rpm}
Release: 1
@@ -49,10 +47,11 @@ cp -pPr "${PKG_DESTDIR}/." "\${RPM_BUILD_ROOT}"
%changelog
EOF
- rpmbuild -bb --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec";
- find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;;
- ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}";
- ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/";
+ rpmbuild -bb --define="_topdir ${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" --nodeps "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec";
+ find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" -iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \;;
+ ex_rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}";
+ ex_rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/";
+ fi;
};
# vim:filetype=sh