summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
authorLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-01 21:09:37 +0000
committerLucio Andrés Illanes Albornoz <lucio@lucioillanes.de>2020-03-01 21:09:37 +0000
commitbf9edfaed49c4387e181be454602e0cc65fe4382 (patch)
tree2bf582d4f1f0916946bc2285014b193482c52d86 /subr
parent725770754d9f53d5b41d876053a7a993b629472e (diff)
downloadmidipix_build-bf9edfaed49c4387e181be454602e0cc65fe4382.tar.bz2
midipix_build-bf9edfaed49c4387e181be454602e0cc65fe4382.tar.xz
General cleanup, pt. III.
dist/dist_digest.dist: removes obsolete dist file. etc/{build.usage,README.md}: updated. groups/000.host_tools.group:{autoconf,automake,gettext_tiny,install_strip,libtool,m4}_host: moved from groups/010.host_deps.group. groups/221.native_packages_dev.group:lua: moved from groups/231.native_packages_etc.group. groups/221.native_packages_dev.group:lua:${PKG_FORCE_AUTORECONF}: set. groups/231.native_packages_etc.group:{mlogin,tdnf}:${PKG_FORCE_AUTORECONF}: set. groups/241.native_packages_inet.group:nullmailer:${PKG_FORCE_AUTORECONF}: set. groups/251.native_packages_lib.group:lib{asr,gpg_error}:${PKG_FORCE_AUTORECONF}: set. midipix.env, etc/README.md, subr/pkg_configure_autotools.subr: adds FORCE_NO_AUTORECONF. subr/rtl_fileop.subr: adds ch{mod,own} fileops. vars/{check_updates,jamvm,lib{asr,gpg_error},lua,mlogin,tdnf}.vars: removes obsolete vars file.
Diffstat (limited to 'subr')
-rw-r--r--subr/ex_pkg_dispatch.subr6
-rw-r--r--subr/ex_pkg_env.subr2
-rw-r--r--subr/ex_pkg_exec.subr12
-rw-r--r--subr/pkg_clean.subr12
-rw-r--r--subr/pkg_configure.subr2
-rw-r--r--subr/pkg_configure_autotools.subr36
-rw-r--r--subr/pkg_configure_patch.subr7
-rw-r--r--subr/pkg_configure_patch_pre.subr11
-rw-r--r--subr/pkg_fetch_download.subr8
-rw-r--r--subr/pkg_fetch_extract.subr28
-rw-r--r--subr/pkg_install.subr50
-rw-r--r--subr/pkg_install_files.subr17
-rw-r--r--subr/pkg_install_libs.subr22
-rw-r--r--subr/pkg_install_rpm.subr4
-rw-r--r--subr/pkg_install_subdirs.subr9
-rw-r--r--subr/rtl_complex.subr6
-rw-r--r--subr/rtl_fetch.subr2
-rw-r--r--subr/rtl_fileop.subr16
18 files changed, 169 insertions, 81 deletions
diff --git a/subr/ex_pkg_dispatch.subr b/subr/ex_pkg_dispatch.subr
index ed860739..749fe7f7 100644
--- a/subr/ex_pkg_dispatch.subr
+++ b/subr/ex_pkg_dispatch.subr
@@ -99,14 +99,14 @@ exp_pkg_dispatch_package() {
if "${_dispatch_fn}" start_pkg "${_group_name}" "${_pkg_name}" "$((${EXP_PKG_DISPATCH_COUNT}+1))" "${EXP_PKG_DISPATCH_COUNT_MAX}"; then
: $((EXP_PKG_DISPATCH_NJOBS+=1)); : $((EXP_PKG_DISPATCH_COUNT+=1)); EX_PKG_DISPATCH_WAIT="$(rtl_lconcat "${EX_PKG_DISPATCH_WAIT}" "${_pkg_name}")";
(set +o errexit -o noglob; BUILD_IS_PARENT=0;
- if ex_pkg_env "${_build_steps_default}" "${_build_vars_default}" \
+ if ex_pkg_env "${_build_steps_default}" "${_build_vars_default}" \
"${_group_name}" "${_pkg_name}" "${_restart_at}" "${_workdir}"; then
ex_pkg_exec "${_dispatch_fn}" "${_group_name}" "${_pkg_name}" "${_restart_at}";
else
- return "${?}";
+ return 1;
fi;) 1>"${_workdir}/${_pkg_name}_stderrout.log" 2>&1 3>"${_pipe_path}" &
else
- return "${?}";
+ return 1;
fi;
};
diff --git a/subr/ex_pkg_env.subr b/subr/ex_pkg_env.subr
index dfcb0f69..7b1483b7 100644
--- a/subr/ex_pkg_env.subr
+++ b/subr/ex_pkg_env.subr
@@ -88,7 +88,7 @@ ex_pkg_env() {
rtl_fileop source_opt "vars/${_pkg_name}.vars" "${_group_name}/${_pkg_name}.${_group_name}";
if ! exp_pkg_env_set "${_build_vars_default}" "${_group_name}" "${_pkg_name}"\
|| ! exp_pkg_env_defaults "${_build_steps_default}" "${_pkg_name}" "${_workdir}"; then
- return "${?}";
+ return 1;
fi;
};
diff --git a/subr/ex_pkg_exec.subr b/subr/ex_pkg_exec.subr
index 6fb333bb..9e4629ba 100644
--- a/subr/ex_pkg_exec.subr
+++ b/subr/ex_pkg_exec.subr
@@ -22,11 +22,11 @@ exp_pkg_exec_pre() {
if [ "${PKG_NO_CLEAN_BASE_DIR:-0}" -eq 0 ]\
&& ! rtl_fileop rm "${PKG_BASE_DIR}" "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"\
|| ! rtl_fileop mkdir "${PKG_BASE_DIR}"; then
- return "${?}";
+ return 1;
fi;
if ! rtl_fileop mkdir "${PKG_BUILD_DIR}" "${PKG_DESTDIR}"\
|| ! ex_pkg_state_set "${_pkg_name}" "start"; then
- return "${?}";
+ return 1;
fi;
fi;
rtl_fileop cd "${PKG_BUILD_DIR}";
@@ -97,9 +97,11 @@ ex_pkg_exec() {
fi;
done;
fi;
- if [ "${_rc:-0}" -eq 0 ]\
- && [ -z "${_restart_at}" ]; then
- ex_pkg_state_set "${_pkg_name}" finish;
+ if [ "${_rc:-0}" -eq 0 ]; then
+ if [ -z "${_restart_at}" ]\
+ || [ "${_restart_at}" = "ALL" ]; then
+ ex_pkg_state_set "${_pkg_name}" finish;
+ fi;
fi;
fi;
return "${_rc}";
diff --git a/subr/pkg_clean.subr b/subr/pkg_clean.subr
index b122823e..a7df7920 100644
--- a/subr/pkg_clean.subr
+++ b/subr/pkg_clean.subr
@@ -5,13 +5,19 @@
pkg_clean() {
if [ "${PKG_NO_CLEAN:-0}" -eq 0 ]; then
if rtl_lmatch "${ARG_CLEAN_BUILDS}" "build" ","; then
- rtl_fileop rm "${PKG_BUILD_DIR}" || return "${?}";
+ if ! rtl_fileop rm "${PKG_BUILD_DIR}"; then
+ return 1;
+ fi;
fi;
if rtl_lmatch "${ARG_CLEAN_BUILDS}" "dest" ","; then
- rtl_fileop rm "${PKG_DESTDIR}" || return "${?}";
+ if ! rtl_fileop rm "${PKG_DESTDIR}"; then
+ return 1;
+ fi;
fi;
if rtl_lmatch "${ARG_CLEAN_BUILDS}" "src" ","; then
- rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}" || return "${?}";
+ if ! rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; then
+ return 1;
+ fi;
fi;
fi;
};
diff --git a/subr/pkg_configure.subr b/subr/pkg_configure.subr
index c6819886..974e708f 100644
--- a/subr/pkg_configure.subr
+++ b/subr/pkg_configure.subr
@@ -15,8 +15,8 @@ pkg_configure() {
LDFLAGS="${PKG_LDFLAGS_CONFIGURE}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}" \
"${PKG_CONFIGURE}" ${PKG_CONFIGURE_ARGS} ${PKG_CONFIGURE_ARGS_EXTRA} ${PKG_CONFIGURE_ARGS_EXTRA_DEBUG}; _rc="${?}"
rtl_export_vars -u PKG_CONFIG "${PKG_PKG_CONFIG}" PKG_CONFIG_PATH "${PKG_PKG_CONFIG_PATH}" PYTHON "${PKG_PYTHON}";
+ return "${_rc}";
fi;
- return "${?}";
};
# vim:filetype=sh
diff --git a/subr/pkg_configure_autotools.subr b/subr/pkg_configure_autotools.subr
index bc3b6c23..d28cc8e1 100644
--- a/subr/pkg_configure_autotools.subr
+++ b/subr/pkg_configure_autotools.subr
@@ -7,6 +7,10 @@ pkg_configure_autotools() {
if rtl_exists_any "${PKG_BASE_DIR}/${PKG_SUBDIR}" \
"config.guess" "configure.ac" "configure.in" "configure";
then rtl_export_vars PKG_CONFIG "${PKG_PKG_CONFIG}" PKG_CONFIG_PATH "${PKG_PKG_CONFIG_PATH}";
+ if [ "${PKG_FORCE_AUTORECONF:-0}" -eq 1 ]\
+ && ! (cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoreconf -fiv); then
+ return 1;
+ fi;
if [ -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure.ac" ]\
&& [ ! -e "${PKG_BASE_DIR}/${PKG_SUBDIR}/configure" ]; then
for _fname in bootstrap bootstrap.sh autogen.sh; do
@@ -15,16 +19,26 @@ pkg_configure_autotools() {
"${PKG_BASE_DIR}/${PKG_SUBDIR}/build-aux" \
"${PKG_BASE_DIR}/${PKG_SUBDIR}";
do if [ -e "${_subdir_tgt}" ]; then
- rtl_fileop install -m 0700 \
- "${MIDIPIX_BUILD_PWD}/etc/config.sub" \
- "${_subdir_tgt}/config.sub" || return "${?}" && break;
+ if ! rtl_fileop install -m 0700 \
+ "${MIDIPIX_BUILD_PWD}/etc/config.sub" \
+ "${_subdir_tgt}/config.sub"; then
+ return 1;
+ else
+ break;
+ fi;
fi;
done;
- (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && \
- /bin/sh "${_fname}") || return "${?}" && break;
+ if ! (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && \
+ /bin/sh "${_fname}"); then
+ return 1;
+ else
+ break;
+ fi;
fi;
done;
- (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoconf) || return "${?}";
+ if ! (rtl_fileop cd "${PKG_BASE_DIR}/${PKG_SUBDIR}" && autoconf); then
+ return 1;
+ fi;
fi;
for _fname in $(find "${PKG_BASE_DIR}/${PKG_SUBDIR}" -name config.sub); do
if ! rtl_fileop mv "${_fname}" "${_fname}.orig"\
@@ -39,10 +53,14 @@ pkg_configure_autotools() {
"${PKG_CONFIG_CACHE}" \
"${PKG_CONFIG_CACHE_LOCAL}" \
"${PKG_CONFIG_CACHE_EXTRA}";
- do echo "${_config_cache}" |\
- tr " " "\n" >> "${PKG_BUILD_DIR}/config.cache" || return "${?}";
+ do if ! echo "${_config_cache}" |\
+ tr " " "\n" >> "${PKG_BUILD_DIR}/config.cache"; then
+ return 1;
+ fi;
done;
- sed -i"" "s,%PREFIX%,${PKG_PREFIX},g" "${PKG_BUILD_DIR}/config.cache" || return "${?}";
+ if ! sed -i"" "s,%PREFIX%,${PKG_PREFIX},g" "${PKG_BUILD_DIR}/config.cache"; then
+ return 1;
+ fi;
fi;
fi;
rtl_export_vars -u PKG_CONFIG "${PKG_PKG_CONFIG}" PKG_CONFIG_PATH "${PKG_PKG_CONFIG_PATH}";
diff --git a/subr/pkg_configure_patch.subr b/subr/pkg_configure_patch.subr
index 80690b67..88f3f3d1 100644
--- a/subr/pkg_configure_patch.subr
+++ b/subr/pkg_configure_patch.subr
@@ -13,8 +13,11 @@ pkg_configure_patch() {
${PKG_PATCHES_EXTRA}; do
if [ -r "${_patch_fname}" ]\
&& ! rtl_lmatch "${_patches_done}" "${_patch_fname}"; then
- patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}" || return "${?}";
- _patches_done="$(rtl_lconcat "${_patches_done}" "${_patch_fname}")";
+ if ! patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}"; then
+ set -o noglob; return 1;
+ else
+ _patches_done="$(rtl_lconcat "${_patches_done}" "${_patch_fname}")";
+ fi;
fi;
done; set -o noglob;
};
diff --git a/subr/pkg_configure_patch_pre.subr b/subr/pkg_configure_patch_pre.subr
index 1c572efd..434b1cf7 100644
--- a/subr/pkg_configure_patch_pre.subr
+++ b/subr/pkg_configure_patch_pre.subr
@@ -7,8 +7,9 @@ pkgp_configure_patch_pre() {
for _patch_path in \
"${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local.patch" \
"${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}_pre.local@${BUILD_HNAME}.patch"; do
- if [ -r "${_patch_path}" ]; then
- patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_path}" || return "${?}";
+ if [ -r "${_patch_path}" ]\
+ && ! patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_path}"; then
+ return 1;
fi;
done;
};
@@ -17,8 +18,10 @@ pkgp_configure_patch_pre_chainport() {
local _chainport_patch_fname="${BUILD_WORKDIR}/chainport/patches/${PKG_NAME%%_*}/${PKG_NAME%%_*}-${PKG_VERSION}.midipix.patch"\
_chainport_patch_dname="${PKG_BASE_DIR}/${PKG_SUBDIR}/patches/${PKG_NAME%%_*}" _oldpwd="";
if [ -e "${_chainport_patch_fname}" ]; then
- rtl_fileop mkdir "${_chainport_patch_dname}" || return "${?}";
- rtl_fileop cp "${_chainport_patch_fname}" "${_chainport_patch_dname}" || return "${?}";
+ if ! rtl_fileop mkdir "${_chainport_patch_dname}"\
+ || ! rtl_fileop cp "${_chainport_patch_fname}" "${_chainport_patch_dname}"; then
+ return 1;
+ fi;
fi;
};
diff --git a/subr/pkg_fetch_download.subr b/subr/pkg_fetch_download.subr
index a23b8b9d..126675ad 100644
--- a/subr/pkg_fetch_download.subr
+++ b/subr/pkg_fetch_download.subr
@@ -4,10 +4,14 @@
pkg_fetch_download() {
if [ -n "${PKG_URL}" ]; then
- rtl_fetch_url_wget "${PKG_URL}" "${PKG_SHA256SUM}" "${PKG_FNAME}" || return "${?}";
+ if ! rtl_fetch_url_wget "${PKG_URL}" "${PKG_SHA256SUM}" "${PKG_FNAME}"; then
+ return 1;
+ fi;
fi;
if [ -n "${PKG_URLS_GIT}" ]; then
- rtl_fetch_urls_git "${PKG_BASE_DIR}" ${PKG_URLS_GIT} || return "${?}";
+ if ! rtl_fetch_urls_git "${PKG_BASE_DIR}" ${PKG_URLS_GIT}; then
+ return 1;
+ fi;
fi;
};
diff --git a/subr/pkg_fetch_extract.subr b/subr/pkg_fetch_extract.subr
index 8802a950..eedd84ab 100644
--- a/subr/pkg_fetch_extract.subr
+++ b/subr/pkg_fetch_extract.subr
@@ -13,16 +13,24 @@ pkgp_fetch_extract_type() {
pkg_fetch_extract() {
if [ -n "${PKG_URL}" ]; then
- _oldpwd="${PWD}"; rtl_fileop cd "${PKG_BASE_DIR}" || return "${?}";
- rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}" || return "${?}";
- case "$(pkgp_fetch_extract_type "${PKG_NAME}")" in
- bz2) bunzip2 -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
- gz) gunzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
- lz) lzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
- xz) xz -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
- *) tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/${PKG_FNAME}" || return "${?}"; ;;
- esac;
- rtl_fileop cd "${_oldpwd}" || return "${?}";
+ _oldpwd="${PWD}";
+ if ! rtl_fileop cd "${PKG_BASE_DIR}"\
+ || ! rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; then
+ rtl_fileop cd "${_oldpwd}"; return 1;
+ else
+ case "$(pkgp_fetch_extract_type "${PKG_NAME}")" in
+ bz2) bunzip2 -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
+ gz) gunzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
+ lz) lzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
+ xz) xz -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
+ *) tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/${PKG_FNAME}"; ;;
+ esac;
+ if [ "${?}" -ne 0 ]; then
+ rtl_fileop cd "${_oldpwd}"; return 1;
+ else
+ rtl_fileop cd "${_oldpwd}";
+ fi;
+ fi;
fi;
};
diff --git a/subr/pkg_install.subr b/subr/pkg_install.subr
index 87182d9c..4afd0750 100644
--- a/subr/pkg_install.subr
+++ b/subr/pkg_install.subr
@@ -3,24 +3,40 @@
#
pkg_install() {
- local _pkglist_name="";
- if ! rtl_fileop mkdir "${PKG_PREFIX}"\
- || ! find "${PKG_DESTDIR}" -type d -exec chmod 0755 {} \;\
- || ! find "${PKG_DESTDIR}" \( -not -perm /0111 \) -type f -exec chmod 0644 {} \;\
- || ! find "${PKG_DESTDIR}" -perm /0111 -type f -exec chmod 0755 {} \;\
- || ! tar -C "${PKG_DESTDIR}" -cpf - . | tar -C "${PKG_PREFIX}" --overwrite -xpf -; then
- return "${?}";
- else
- if rtl_lmatch "${ARG_DIST}" "pkg" ","; then
- tar -C "${PKG_DESTDIR}" -cpf - . |\
- gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz" || return "${?}";
- fi;
- if [ "${PKG_PKGLIST_DISABLE:-0}" -eq 0 ]; then
- if [ ! -e "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" ]; then
- touch "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" || return "${?}";
+ local _fname="" _ifs_old="${IFS}" _pkglist_name="" IFS;
+ if ! rtl_fileop mkdir "${PKG_PREFIX}"; then
+ return 1;
+ else IFS="
+"; for _fname in $(find "${PKG_DESTDIR}" -type d); do
+ if ! rtl_fileop chmod 0755 "${_fname}"; then
+ return 1;
+ fi;
+ done;
+ for _fname in $(find "${PKG_DESTDIR}" \( -not -perm /0111 \) -type f); do
+ if ! rtl_fileop chmod 0644 "${_fname}"; then
+ return 1;
+ fi;
+ done;
+ for _fname in $(find "${PKG_DESTDIR}" -perm /0111 -type f); do
+ if ! rtl_fileop chmod 0755 "${_fname}"; then
+ return 1;
+ fi;
+ done; IFS="${_ifs_old}";
+ if ! tar -C "${PKG_DESTDIR}" -cpf - . | tar -C "${PKG_PREFIX}" --overwrite -xpf -; then
+ return 1;
+ elif rtl_lmatch "${ARG_DIST}" "pkg" ","\
+ && ! tar -C "${PKG_DESTDIR}" -cpf - . | gzip -c -9 - > "${PKG_BASE_DIR}/${PKG_NAME}.tgz"; then
+ return 1;
+ elif [ "${PKG_PKGLIST_DISABLE:-0}" -eq 0 ]; then
+ if [ ! -e "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" ]\
+ && ! touch "${PREFIX}/pkglist.${PKG_BUILD_TYPE}"; then
+ return 1;
+ else
+ _pkglist_name="${PKG_BASE_DIR##*/}"; _pkglist_name="${_pkglist_name%%-*}";
+ if ! echo "${_pkglist_name}" >> "${PREFIX}/pkglist.${PKG_BUILD_TYPE}"; then
+ return 1;
+ fi;
fi;
- _pkglist_name="${PKG_BASE_DIR##*/}"; _pkglist_name="${_pkglist_name%%-*}";
- echo "${_pkglist_name}" >> "${PREFIX}/pkglist.${PKG_BUILD_TYPE}" || return "${?}";
fi;
fi;
};
diff --git a/subr/pkg_install_files.subr b/subr/pkg_install_files.subr
index 5a4d9708..362f4926 100644
--- a/subr/pkg_install_files.subr
+++ b/subr/pkg_install_files.subr
@@ -4,17 +4,20 @@
pkgp_install_files() {
if [ -n "${PKG_INSTALL_FILES}" ]; then
- rtl_install -v "${PKG_DESTDIR}" ${PKG_INSTALL_FILES} || return "${?}";
+ if ! rtl_install -v "${PKG_DESTDIR}" ${PKG_INSTALL_FILES}; then
+ return 1;
+ fi;
fi;
};
pkgp_install_files_pkgconfig() {
local _pc_path="";
for _pc_path in $(find "${PKG_DESTDIR}" -name \*.pc); do
- if grep -Eq '^libdir=[^$]+$' "${_pc_path}"; then
- sed -i"" -e '/^libdir=[^$]\+$/s/^libdir=\(.\+\)$/libdir=${exec_prefix}\1/' \
+ if grep -Eq '^libdir=[^$]+$' "${_pc_path}"\
+ && ! sed -i"" -e '/^libdir=[^$]\+$/s/^libdir=\(.\+\)$/libdir=${exec_prefix}\1/' \
-e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/' \
- "${_pc_path}" || return "${?}";
+ "${_pc_path}"; then
+ return 1;
fi;
done;
};
@@ -31,7 +34,9 @@ pkgp_install_files_strip() {
for _bin_path in $(find "${_tree_root}" -perm /a=x -type f); do
if objdump -sj .debug_info "${_bin_path}" >/dev/null 2>&1; then
rtl_log_msg info "Stripping ${_bin_path}...";
- "${PKG_TARGET}-strip" "${_bin_path}" || return "${?}";
+ if ! "${PKG_TARGET}-strip" "${_bin_path}"; then
+ return 1;
+ fi;
fi;
done;
fi;
@@ -41,7 +46,7 @@ pkg_install_files() {
if ! pkgp_install_files\
|| ! pkgp_install_files_pkgconfig\
|| ! pkgp_install_files_strip; then
- return "${?}";
+ return 1;
fi;
};
diff --git a/subr/pkg_install_libs.subr b/subr/pkg_install_libs.subr
index a00f15bb..76c7bfdb 100644
--- a/subr/pkg_install_libs.subr
+++ b/subr/pkg_install_libs.subr
@@ -5,7 +5,9 @@
pkgp_install_libs_purge_la() {
local _la_path="";
for _la_path in $(find "${PKG_DESTDIR}" -type f -name \*.la); do
- rtl_fileop rm "${_la_path}" || return "${?}";
+ if ! rtl_fileop rm "${_la_path}"; then
+ return 1;
+ fi;
done;
};
@@ -25,7 +27,7 @@ pkgp_install_libs_shared() {
local _lib_dst_path="" _lib_name="" _lib_src_path="" _so_dst_dir="" _so_src_path="";
if [ "${PKG_BUILD_TYPE}" != "host" ]; then
for _so_src_path in \
- $(find "${PKG_DESTDIR}" \
+ $(find "${PKG_DESTDIR}" \
\( -name "*.so" -or -name "*.so.*" \) -print);
do if [ "$(readlink -f "${_so_path}")" != "/dev/null" ]\
&& [ -z "$(rtl_head "[0-9.]" "${_so_src_path##*.so}")" ]; then
@@ -38,13 +40,17 @@ pkgp_install_libs_shared() {
_lib_dst_path="${_so_dst_dir}/${_lib_name}";
if [ ! -L "${_lib_src_path}" ]\
&& [ ! -e "${_lib_dst_path}" ]; then
- (rtl_fileop cd "$(rtl_dirname "${_so_src_path}")" &&\
- perk -e "$(rtl_basename "${_so_src_path}")" |\
- "${PKG_TARGET}-mdso" \
- -i "$(rtl_basename "${_lib_dst_path}")" \
- -n "$(rtl_basename "${_so_src_path}")" -) || return "${?}";
+ if ! (rtl_fileop cd "$(rtl_dirname "${_so_src_path}")" && \
+ perk -e "$(rtl_basename "${_so_src_path}")" |\
+ "${PKG_TARGET}-mdso" \
+ -i "$(rtl_basename "${_lib_dst_path}")" \
+ -n "$(rtl_basename "${_so_src_path}")" -); then
+ return 1;
+ fi;
+ fi;
+ if ! pkgp_install_libs_shared_link "${_lib_name}" "${_so_dst_dir}" "${_so_src_path}"; then
+ return 1;
fi;
- pkgp_install_libs_shared_link "${_lib_name}" "${_so_dst_dir}" "${_so_src_path}" || return "${?}";
fi;
done;
fi;
diff --git a/subr/pkg_install_rpm.subr b/subr/pkg_install_rpm.subr
index ae76ac70..6cc373ff 100644
--- a/subr/pkg_install_rpm.subr
+++ b/subr/pkg_install_rpm.subr
@@ -36,14 +36,14 @@ pkg_install_rpm() {
elif [ "${_rc}" -eq 141 ]; then
continue;
else
- return "${?}";
+ return "${_rc}";
fi;
done;
if ! find "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}/RPMS" \
-iname \*.rpm -exec cp -pP {} "${PREFIX_RPM}/" \; \
|| ! rtl_fileop rm "${PREFIX_RPM}/${PKG_NAME}-${_pkg_version_rpm}" \
|| ! rtl_fileop cp "${PKG_BASE_DIR}/${PKG_NAME}-${_pkg_version_rpm}.spec" "${PREFIX_RPM}/"; then
- return "${?}";
+ return 1;
fi;
fi;
fi;
diff --git a/subr/pkg_install_subdirs.subr b/subr/pkg_install_subdirs.subr
index 94557586..8e6e0429 100644
--- a/subr/pkg_install_subdirs.subr
+++ b/subr/pkg_install_subdirs.subr
@@ -7,11 +7,14 @@ pkg_install_subdirs() {
for _spec in \
"${PKG_INSTALL_FILES_DESTDIR}" \
"${PKG_INSTALL_FILES_DESTDIR_EXTRA}"; do
- rtl_install "${PKG_DESTDIR}" ${_spec} || return "${?}";
+ if ! rtl_install "${PKG_DESTDIR}" ${_spec}; then
+ return 1;
+ fi;
done;
if [ "${PKG_PREFIX%/}" = "${PREFIX_NATIVE%/}" ]; then
- rtl_install \
- "${PKG_DESTDIR}/${DEFAULT_TARGET}" ${PKG_INSTALL_FILES_DESTDIR} || return "${?}";
+ if ! rtl_install "${PKG_DESTDIR}/${DEFAULT_TARGET}" ${PKG_INSTALL_FILES_DESTDIR}; then
+ return 1;
+ fi;
fi;
};
diff --git a/subr/rtl_complex.subr b/subr/rtl_complex.subr
index 8370a4cf..e727e3cd 100644
--- a/subr/rtl_complex.subr
+++ b/subr/rtl_complex.subr
@@ -21,7 +21,7 @@ rtl_clean_env() {
for _env_var in ${_env_vars}; do
if [ "${_env_var#DEFAULT_}" != "${_env_var}" ]\
|| [ "${_env_var#PKG_}" != "${_env_var}" ]; then
- _env_vars_except="${_env_vars_except:+${_env_vars_except} }${_env_var}";
+ _env_vars_except="$(rtl_lconcat "${_env_vars_except}" "${_env_var}")";
fi;
done;
rtl_unset_vars $(rtl_lfilter "${_env_vars}" "${_env_vars_except}");
@@ -107,12 +107,12 @@ rtl_set_vars() {
_vval_src="$(rtl_get_var_unsafe "${_vname_src}")";
if [ -n "${_vval_src}" ]; then
rtl_set_var_unsafe "PKG_${_vname_dst}" "${_vval_src}";
- _vars_set_tmp="${_vars_set_tmp:+${_vars_set_tmp} }PKG_${_vname_dst}";
+ _vars_set_tmp="$(rtl_lconcat "${_vars_set_tmp}" "PKG_${_vname_dst}")";
fi;
done;
_vars_set_old="$(rtl_get_var_unsafe "${_vars_set_vname}")";
rtl_set_var_unsafe "${_vars_set_vname}" \
- "${_vars_set_old:+${_vars_set_old} }${_vars_set_tmp}";
+ "$(rtl_lconcat "${_vars_set_old}" "${_vars_set_tmp}")";
};
# vim:filetype=sh
diff --git a/subr/rtl_fetch.subr b/subr/rtl_fetch.subr
index d61d7858..3afd30dc 100644
--- a/subr/rtl_fetch.subr
+++ b/subr/rtl_fetch.subr
@@ -36,7 +36,7 @@ exp_rtl_fetch_url_git() {
if [ "${?}" -eq 0 ]; then
cd "$(pwd)";
else
- return "${?}";
+ return 1;
fi;
};
diff --git a/subr/rtl_fileop.subr b/subr/rtl_fileop.subr
index cc861787..c2b403fa 100644
--- a/subr/rtl_fileop.subr
+++ b/subr/rtl_fileop.subr
@@ -10,7 +10,7 @@ exp_rtl_fileop_check() {
};
rtl_fileop() {
- local _op="${1}" _dst="" _install_args="" _rc=0 _src=""; shift;
+ local _op="${1}" _dst="" _mode="" _install_args="" _owner="" _rc=0 _src=""; shift;
case "${_op}" in
cd) if [ \( -z "${1}" \) -o ! \( -L "${1}" -o -e "${1}" \) ]; then
rtl_log_msg failexit "Invalid or non-existent directory \`${1}'.";
@@ -18,6 +18,20 @@ rtl_fileop() {
rtl_log_msg vvvv "Changing working directory to \`${1}'.";
cd -- "${1}"; _rc="${?}";
fi; ;;
+ chmod) if [ "${#}" -lt 2 ]; then
+ rtl_log_msg failexit "Missing parameters (in: chmod ${*}.)";
+ elif _mode="${1}" && shift\
+ && exp_rtl_fileop_check "${PREFIX}" "${*}"; then
+ rtl_log_msg vvvv "Changing file mode bits of \`${*}' to \`${_mode}'.";
+ chmod -- "${_mode}" "${@}"; _rc="${?}";
+ fi; ;;
+ chown) if [ "${#}" -lt 2 ]; then
+ rtl_log_msg failexit "Missing parameters (in: chown ${*}.)";
+ elif _owner="${1}" && shift\
+ && exp_rtl_fileop_check "${PREFIX}" "${*}"; then
+ rtl_log_msg vvvv "Changing file owner of \`${*}' to \`${_owner}'.";
+ chown -- "${_owner}" "${@}"; _rc="${?}";
+ fi; ;;
cp_follow)
if [ "${#}" -lt 2 ]; then
rtl_log_msg failexit "Missing parameters (in: cp_follow ${*}.)";