Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/genkernel:master commit in: worker_modules/, /
Date: Mon, 29 Jul 2019 20:10:38
Message-Id: 1564430540.cd8fcd4fa6ec236a71d5dec7469db3e1072ef0a3.whissi@gentoo
1 commit: cd8fcd4fa6ec236a71d5dec7469db3e1072ef0a3
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 29 13:43:14 2019 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 29 20:02:20 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=cd8fcd4f
7
8 gen_compile.sh: Refactor populate_binpkg() function
9
10 - Use nameref instead of manually created references
11
12 - Fix quoting of BINPKGs
13
14 - Pass delimiter-separated BINPKG deps value to gkbuild()
15
16 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
17
18 gen_compile.sh | 20 ++++++++++++++------
19 worker_modules/gkbuild.sh | 3 +--
20 2 files changed, 15 insertions(+), 8 deletions(-)
21
22 diff --git a/gen_compile.sh b/gen_compile.sh
23 index dd2e7d7..0cf6114 100755
24 --- a/gen_compile.sh
25 +++ b/gen_compile.sh
26 @@ -437,8 +437,7 @@ populate_binpkg() {
27
28 local REQUIRED_BINPKGS_PARENT_VARNAME="CHECK_L${CHECK_LEVEL_PARENT}_REQUIRED_BINPKGS"
29 local REQUIRED_BINPKGS_CURRENT_VARNAME="CHECK_L${CHECK_LEVEL_CURRENT}_REQUIRED_BINPKGS"
30 - local REQUIRED_BINPKGS_CURRENT_VARNAME_SEPARATE_WORD="${REQUIRED_BINPKGS_CURRENT_VARNAME}[@]"
31 - local REQUIRED_BINPKGS_CURRENT_VARNAME_SINGLE_WORD="${REQUIRED_BINPKGS_CURRENT_VARNAME}[*]"
32 + local -n REQUIRED_BINPKGS_CURRENT_VARNAME_ref="${REQUIRED_BINPKGS_CURRENT_VARNAME}"
33
34 # Make sure we start with an empty array just in case ...
35 eval declare -ga ${REQUIRED_BINPKGS_CURRENT_VARNAME}=\(\)
36 @@ -523,7 +522,7 @@ populate_binpkg() {
37 if [[ -f "${BINPKG}" ]]
38 then
39 local required_binpkg=
40 - for required_binpkg in "${!REQUIRED_BINPKGS_CURRENT_VARNAME_SEPARATE_WORD}"
41 + for required_binpkg in "${REQUIRED_BINPKGS_CURRENT_VARNAME_ref[@]}"
42 do
43 # Create shorter variable value so we do not clutter output
44 local required_binpkg_filename=$(basename "${required_binpkg}")
45 @@ -537,7 +536,7 @@ populate_binpkg() {
46
47 print_info 3 "${CHECK_LEVEL_PREFIX}Existing ${P} binpkg is newer than '${required_binpkg_filename}'; Skipping ..."
48 done
49 - unset required_binpkg REQUIRED_BINPKGS_CURRENT_VARNAME_SEPARATE_WORD required_binpkg_filename
50 + unset required_binpkg required_binpkg_filename
51 fi
52
53 if [[ -f "${BINPKG}" ]]
54 @@ -562,13 +561,22 @@ populate_binpkg() {
55 if [[ ! -f "${BINPKG}" ]]
56 then
57 print_info 3 "${CHECK_LEVEL_PREFIX}Binpkg '${BINPKG}' does NOT exist; Need to build ${P} ..."
58 +
59 + local required_binpkgs=
60 + local required_binpkg=
61 + for required_binpkg in "${REQUIRED_BINPKGS_CURRENT_VARNAME_ref[@]}"
62 + do
63 + required_binpkgs+="${required_binpkg};"
64 + done
65 + unset required_binpkg required_binpkg_filename
66 +
67 gkbuild \
68 ${PN} \
69 ${PV} \
70 $(get_gkpkg_srcdir "${PN}") \
71 $(get_gkpkg_srctar "${PN}") \
72 "${BINPKG}" \
73 - "${!REQUIRED_BINPKGS_CURRENT_VARNAME_SINGLE_WORD}"
74 + "${required_binpkgs}"
75 else
76 print_info 3 "${CHECK_LEVEL_PREFIX}Can keep using existing ${P} binpkg from '${BINPKG}'!"
77 [[ ${CHECK_LEVEL_CURRENT} -eq 0 ]] && print_info 2 "$(get_indent 2)${PN}: >> Using ${P} binpkg ..."
78 @@ -581,7 +589,7 @@ populate_binpkg() {
79 unset CHECK_L${CHECK_LEVEL_PARENT}_REQUIRED_BINPKGS
80 else
81 print_info 3 "${CHECK_LEVEL_PREFIX}Binpkg of ${P} is ready; Adding to list '${REQUIRED_BINPKGS_PARENT_VARNAME}' ..."
82 - eval ${REQUIRED_BINPKGS_PARENT_VARNAME}+=\( "${BINPKG}" \)
83 + eval ${REQUIRED_BINPKGS_PARENT_VARNAME}+=\( \"${BINPKG}\" \)
84 fi
85
86 # REQUIRED_BINPKGS_CURRENT_VARNAME
87
88 diff --git a/worker_modules/gkbuild.sh b/worker_modules/gkbuild.sh
89 index 41d2791..e6b90b2 100644
90 --- a/worker_modules/gkbuild.sh
91 +++ b/worker_modules/gkbuild.sh
92 @@ -284,8 +284,7 @@ _initialize() {
93
94 if [[ -n "${GKPKG_DEPS}" ]]
95 then
96 - # GKPKG_DEPS is ${ARRAY[*]} value (single word), not ${ARRAY[@]} (separate word)!
97 - GKPKG_DEPS=( ${GKPKG_DEPS} )
98 + IFS=';' read -r -a GKPKG_DEPS <<< "${GKPKG_DEPS}"
99 local GKPKG_DEP=
100 for GKPKG_DEP in "${GKPKG_DEPS[@]}"
101 do