From 396dc70bcc4e5271528b1de1a7dbb41789211f6d Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Tue, 16 Apr 2024 15:53:05 +0200 Subject: [PATCH] Revert "build-system: configurable number directory components to be strip" This reverts commit 58f6a2ed4e92953bb815d3ef5a741ee63110955a. --- CHANGELOG.md | 3 --- Pmodules/libpbuild.bash | 26 +++++++++----------------- Pmodules/modbuild.in | 10 +--------- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98665a0..014ae10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,9 +17,6 @@ * Option '--clean-install' added. If this option is set, the module is removed before building, if the module already exist. (issue #247) -* The number of directory components to be removed while - un-taring can now be configured in the YAML configuration - file. If not specified, 1 is used as default. (issue #251) ## Version 1.1.18 ### modulecmd diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index a5cd7f9..eaf9749 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -18,7 +18,6 @@ declare -r _DOCDIR='share/doc' declare -a SOURCE_URLS=() declare -a SOURCE_SHA256_SUMS=() declare -a SOURCE_NAMES=() -declare -a SOURCE_STRIP_DIRS=() declare -A SOURCE_UNPACK_DIRS=() declare -a CONFIGURE_ARGS=() declare -a PATCH_FILES=() @@ -399,6 +398,11 @@ pbuild::set_download_url() { std::info \ "Using ${FUNCNAME} is deprecated with YAML module configuration files." fi + pbuild.set_urls "$@" +} +readonly -f pbuild::set_download_url + +pbuild.set_urls(){ local -i _i=${#SOURCE_URLS[@]} SOURCE_URLS[_i]=$1 if (( $# > 1 )); then @@ -406,15 +410,6 @@ pbuild::set_download_url() { else SOURCE_NAMES[$_i]="${1##*/}" fi - SOURCE_STRIP_DIRS[_i]='1' -} -readonly -f pbuild::set_download_url - -pbuild.set_urls(){ - local -i _i=${#SOURCE_URLS[@]} - SOURCE_URLS[_i]="$1" - SOURCE_NAMES[$_i]="$2" - SOURCE_STRIP_DIRS[_i]="$3" } #.............................................................................. @@ -500,8 +495,7 @@ readonly -f pbuild::set_default_patch_strip pbuild::unpack(){ local -r file="$1" local -r dir="${2:-${SRC_DIR}}" - local -r strip="${3:-1}" - ${tar} --directory="${dir}" -xv --strip-components "${strip}" -f "${file}" + ${tar} --directory="${dir}" -xv --strip-components 1 -f "${file}" } #.............................................................................. @@ -607,11 +601,10 @@ pbuild::prep() { unpack() { local -r file="$1" - local -r dir="$2" - local -r strip="$3" + local -r dir="${2:-${SRC_DIR}}" { mkdir -p "${dir}" - pbuild::unpack "${file}" "${dir}" "${strip}" + pbuild::unpack "${file}" "${dir}" } || { ${rm} -f "${file}" std::die 4 \ @@ -664,8 +657,7 @@ pbuild::prep() { else dir="${SRC_DIR}" fi - local strip_dirs="${SOURCE_STRIP_DIRS[i]}" - unpack "${source_fname}" "${dir}" "${strip_dirs}" + unpack "${source_fname}" "${dir}" done patch_sources # create build directory diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index b348596..8d00443 100755 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -1143,7 +1143,6 @@ build_modules_yaml_v1(){ std::die 3 "error parsing YAML configuration" local url='' local fname='' - local strip_dirs='' while read key value; do key=${key:0:-1} case "${key}" in @@ -1153,10 +1152,6 @@ build_modules_yaml_v1(){ name ) fname=$(envsubst <<<"${value}") ;; - strip_dirs ) - strip_dirs="${value}" - # :FIXME: add check for unsigned int! - ;; * ) std::die 3 "Invalid key in list of URLs -- ${key}" ;; @@ -1165,10 +1160,7 @@ build_modules_yaml_v1(){ std::die 3 "URL missing!" fi done <<<"${url_yaml}" - [[ -z "${url}" ]] && std::die 3 "url missing in:\n${yaml}" - [[ -z "${fname}" ]] && fname="${url##*/}" - [[ -z "${strip_dirs}" ]] && strip_dirs=1 - pbuild.set_urls "${url}" "${fname}" "${strip_dirs}" + pbuild.set_urls "${url}" "${fname}" done }