summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
Diffstat (limited to 'subr')
-rw-r--r--subr/ex_pkg_env.subr5
-rw-r--r--subr/pkg_configure_patch.subr11
-rw-r--r--subr/pkg_fetch_download.subr35
3 files changed, 37 insertions, 14 deletions
diff --git a/subr/ex_pkg_env.subr b/subr/ex_pkg_env.subr
index ff2338e1..ebfb8f46 100644
--- a/subr/ex_pkg_env.subr
+++ b/subr/ex_pkg_env.subr
@@ -24,7 +24,10 @@ exp_pkg_env_defaults() {
: ${PKG_FNAME:="${PKG_URL##*/}"};
fi;
if [ -z "${PKG_SUBDIR:-}" ]; then
- if [ -n "${PKG_URLS_GIT:-}" ]; then
+ if [ -n "${PKG_URLS_GIT:-}" ]\
+ && [ -n "${PKG_FNAME:-}" ]; then
+ rtl_log_msg fatalexit "Error: \${PKG_SUBDIR} must be specified given both \${PKG_FNAME} and \${PKG_URLS_GIT}.";
+ elif [ -n "${PKG_URLS_GIT:-}" ]; then
PKG_SUBDIR="${PKG_URLS_GIT%%=*}";
else case "${PKG_FNAME:-}" in
*.t*) PKG_SUBDIR="${PKG_FNAME%%.t*}"; ;;
diff --git a/subr/pkg_configure_patch.subr b/subr/pkg_configure_patch.subr
index 6b4bcdd3..b789a80e 100644
--- a/subr/pkg_configure_patch.subr
+++ b/subr/pkg_configure_patch.subr
@@ -3,8 +3,15 @@
#
pkg_configure_patch() {
- local _patch_dir="${MIDIPIX_BUILD_PWD}/patches" _patch_fname="" \
+ local _patch_cwd="" _patch_dir="${MIDIPIX_BUILD_PWD}/patches" _patch_fname=""\
_patches_done="" _pkg_name_full="${PKG_NAME}${PKG_VERSION:+-${PKG_VERSION}}";
+
+ if [ -n "${PKG_FNAME}" ]\
+ && [ -n "${PKG_URLS_GIT}" ]; then
+ _patch_cwd="${PKG_BASE_DIR}";
+ else
+ _patch_cwd="${PKG_BASE_DIR}/${PKG_SUBDIR}";
+ fi;
set +o noglob;
for _patch_fname in \
"${_patch_dir}/${_pkg_name}/"*.patch \
@@ -13,7 +20,7 @@ pkg_configure_patch() {
${PKG_PATCHES_EXTRA:-}; do
if [ -r "${_patch_fname}" ]\
&& ! rtl_lmatch "${_patches_done}" "${_patch_fname}"; then
- if ! patch -b -d "${PKG_BASE_DIR}/${PKG_SUBDIR}" -p1 < "${_patch_fname}"; then
+ if ! patch -b -d "${_patch_cwd}" -p1 < "${_patch_fname}"; then
set -o noglob; return 1;
else
_patches_done="$(rtl_lconcat "${_patches_done}" "${_patch_fname}")";
diff --git a/subr/pkg_fetch_download.subr b/subr/pkg_fetch_download.subr
index 188c7f7b..2b94d720 100644
--- a/subr/pkg_fetch_download.subr
+++ b/subr/pkg_fetch_download.subr
@@ -2,6 +2,29 @@
# set +o errexit -o noglob -o nounset is assumed.
#
+pkg_fetch_download_clean_dlcache() {
+ local _dlcachedir="${1}" _pkg_name="${2}" _pkg_fname="${3}" _pkg_urls_git="${4}"\
+ _fname="" _pkg_urls_git_dname="";
+
+ if [ -n "${_pkg_urls_git}" ]; then
+ _pkg_urls_git_dname="${_pkg_urls_git%%=*}";
+ _pkg_urls_git_dname="${_pkg_urls_git_dname##*/}";
+ fi;
+ for _fname in $(cd "${_dlcachedir}/${_pkg_name}" && find \
+ -mindepth 1 \
+ -not -name "${_pkg_fname}" \
+ -not -name "${_pkg_fname}.fetched" \
+ ${_pkg_urls_git_dname:+ \
+ -not -path "./${_pkg_urls_git_dname}" \
+ -not -path "./${_pkg_urls_git_dname}/*" \
+ -not -path "./${_pkg_urls_git_dname}.git" \
+ -not -path "./${_pkg_urls_git_dname}.git/*"}); do
+ _fname="${_dlcachedir}/${_pkg_name}/${_fname#./}"
+ rtl_log_msg notice "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${_pkg_name}";
+ rtl_fileop rm "${_fname}";
+ done;
+};
+
pkg_fetch_download_dlcache_subdir() {
if [ -n "${PKG_INHERIT_FROM:-}" ]\
&& ! [ -e "${BUILD_DLCACHEDIR}/${PKG_NAME}" ]\
@@ -17,8 +40,6 @@ pkg_fetch_download_dlcache_subdir() {
};
pkg_fetch_download() {
- local _fname="";
-
if [ "${ARG_FETCH_FORCE:-}" != "offline" ]; then
if [ -n "${PKG_URL:-}" ]; then
if ! pkg_fetch_download_dlcache_subdir; then
@@ -27,15 +48,6 @@ pkg_fetch_download() {
"${PKG_URL}" "${PKG_SHA256SUM}" "${BUILD_DLCACHEDIR}/${PKG_NAME}"\
"${PKG_FNAME}" "${PKG_NAME}" "${PKG_MIRRORS:-}"; then
return 1;
- else
- for _fname in $(find \
- "${BUILD_DLCACHEDIR}/${PKG_NAME}" \
- -type f \
- -not -name "${PKG_FNAME}" \
- -not -name "${PKG_FNAME}.fetched"); do
- rtl_log_msg notice "Deleting redundant file \`%s' for package \`%s'." "${_fname}" "${PKG_NAME}";
- rtl_fileop rm "${_fname}";
- done;
fi;
fi;
if [ -n "${PKG_URLS_GIT:-}" ]; then
@@ -47,6 +59,7 @@ pkg_fetch_download() {
return 1;
fi;
fi;
+ pkg_fetch_download_clean_dlcache "${BUILD_DLCACHEDIR}" "${PKG_NAME}" "${PKG_FNAME}" "${PKG_URLS_GIT}";
fi;
};