diff options
author | 2019-07-29 15:43:14 +0200 | |
---|---|---|
committer | 2019-07-29 22:02:20 +0200 | |
commit | cd8fcd4fa6ec236a71d5dec7469db3e1072ef0a3 (patch) | |
tree | 24cbbe924dde8d3cdf2b89a02187c4c4430ac8f6 /gen_compile.sh | |
parent | gen_determineargs.sh: determine_KV(): Quote $KERNEL_OUTPUTDIR (diff) | |
download | genkernel-cd8fcd4fa6ec236a71d5dec7469db3e1072ef0a3.tar.gz genkernel-cd8fcd4fa6ec236a71d5dec7469db3e1072ef0a3.tar.bz2 genkernel-cd8fcd4fa6ec236a71d5dec7469db3e1072ef0a3.zip |
gen_compile.sh: Refactor populate_binpkg() function
- Use nameref instead of manually created references
- Fix quoting of BINPKGs
- Pass delimiter-separated BINPKG deps value to gkbuild()
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'gen_compile.sh')
-rwxr-xr-x | gen_compile.sh | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gen_compile.sh b/gen_compile.sh index dd2e7d7..0cf6114 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -437,8 +437,7 @@ populate_binpkg() { local REQUIRED_BINPKGS_PARENT_VARNAME="CHECK_L${CHECK_LEVEL_PARENT}_REQUIRED_BINPKGS" local REQUIRED_BINPKGS_CURRENT_VARNAME="CHECK_L${CHECK_LEVEL_CURRENT}_REQUIRED_BINPKGS" - local REQUIRED_BINPKGS_CURRENT_VARNAME_SEPARATE_WORD="${REQUIRED_BINPKGS_CURRENT_VARNAME}[@]" - local REQUIRED_BINPKGS_CURRENT_VARNAME_SINGLE_WORD="${REQUIRED_BINPKGS_CURRENT_VARNAME}[*]" + local -n REQUIRED_BINPKGS_CURRENT_VARNAME_ref="${REQUIRED_BINPKGS_CURRENT_VARNAME}" # Make sure we start with an empty array just in case ... eval declare -ga ${REQUIRED_BINPKGS_CURRENT_VARNAME}=\(\) @@ -523,7 +522,7 @@ populate_binpkg() { if [[ -f "${BINPKG}" ]] then local required_binpkg= - for required_binpkg in "${!REQUIRED_BINPKGS_CURRENT_VARNAME_SEPARATE_WORD}" + for required_binpkg in "${REQUIRED_BINPKGS_CURRENT_VARNAME_ref[@]}" do # Create shorter variable value so we do not clutter output local required_binpkg_filename=$(basename "${required_binpkg}") @@ -537,7 +536,7 @@ populate_binpkg() { print_info 3 "${CHECK_LEVEL_PREFIX}Existing ${P} binpkg is newer than '${required_binpkg_filename}'; Skipping ..." done - unset required_binpkg REQUIRED_BINPKGS_CURRENT_VARNAME_SEPARATE_WORD required_binpkg_filename + unset required_binpkg required_binpkg_filename fi if [[ -f "${BINPKG}" ]] @@ -562,13 +561,22 @@ populate_binpkg() { if [[ ! -f "${BINPKG}" ]] then print_info 3 "${CHECK_LEVEL_PREFIX}Binpkg '${BINPKG}' does NOT exist; Need to build ${P} ..." + + local required_binpkgs= + local required_binpkg= + for required_binpkg in "${REQUIRED_BINPKGS_CURRENT_VARNAME_ref[@]}" + do + required_binpkgs+="${required_binpkg};" + done + unset required_binpkg required_binpkg_filename + gkbuild \ ${PN} \ ${PV} \ $(get_gkpkg_srcdir "${PN}") \ $(get_gkpkg_srctar "${PN}") \ "${BINPKG}" \ - "${!REQUIRED_BINPKGS_CURRENT_VARNAME_SINGLE_WORD}" + "${required_binpkgs}" else print_info 3 "${CHECK_LEVEL_PREFIX}Can keep using existing ${P} binpkg from '${BINPKG}'!" [[ ${CHECK_LEVEL_CURRENT} -eq 0 ]] && print_info 2 "$(get_indent 2)${PN}: >> Using ${P} binpkg ..." @@ -581,7 +589,7 @@ populate_binpkg() { unset CHECK_L${CHECK_LEVEL_PARENT}_REQUIRED_BINPKGS else print_info 3 "${CHECK_LEVEL_PREFIX}Binpkg of ${P} is ready; Adding to list '${REQUIRED_BINPKGS_PARENT_VARNAME}' ..." - eval ${REQUIRED_BINPKGS_PARENT_VARNAME}+=\( "${BINPKG}" \) + eval ${REQUIRED_BINPKGS_PARENT_VARNAME}+=\( \"${BINPKG}\" \) fi # REQUIRED_BINPKGS_CURRENT_VARNAME |