Skip to content

Commit 07be613

Browse files
committed
ci-automation: Filter extra sysexts by architecture
It's a recent addition - nvidia sysexts are amd64-only for now, so the EXTRA_SYSEXTS variable got some new fields to indicate that. Make use of them for filtering which extra sysexts changes to report.
1 parent 4d5fdc5 commit 07be613

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

ci-automation/image_changes.sh

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ function run_image_changes_job() {
151151
local -a oemids base_sysexts extra_sysexts
152152
get_oem_id_list . "${arch}" oemids
153153
get_base_sysext_list . base_sysexts
154-
get_extra_sysext_list . extra_sysexts
154+
get_extra_sysext_list . "${arch}" extra_sysexts
155155
generate_image_changes_report \
156156
"${version_description}" "${report_file_name}" "${fbs_repo}" \
157157
"${package_diff_env[@]}" --- "${package_diff_params[@]}" -- \
@@ -285,13 +285,48 @@ function get_base_sysext_list() {
285285

286286
function get_extra_sysext_list() {
287287
local scripts_repo=${1}; shift
288+
local arch=${1}; shift
288289
local -n list_var_ref=${1}; shift
289290

290-
# defined in the file we source below
291+
# The EXTRA_SYSEXTS variable is defined at the top of the file,
292+
# below it is some extra stuff we don't want. So source only the
293+
# portion with the EXTRA_SYSEXTS variable.
294+
local -i line_idx
295+
line_idx=$(grep --line-regexp --fixed-strings --line-number --max-count=1 --regexp=')' build_library/extra_sysexts.sh | cut --fields=1 --delimiter=':')
296+
291297
local -a EXTRA_SYSEXTS
292-
source "${scripts_repo}/build_library/extra_sysexts.sh"
298+
source <(head --lines=${line_idx} build_library/extra_sysexts.sh)
299+
300+
# Get sysext names only if they are valid for the passed
301+
# architecture.
302+
local entry name pkgs_csv uses_csv arches_csv ok_arch ok
303+
local -a arches pkgs names=()
304+
for entry in "${EXTRA_SYSEXTS[@]}"; do
305+
# The "uses" field has spaces, so turn them into commas, so we
306+
# can turn pipes into spaces and make a use of read for entire
307+
# entry.
308+
entry=${entry// /,}
309+
entry=${entry//|/ }
310+
read -r name pkgs_csv uses_csv arches_csv <<<"${entry}"
311+
312+
ok=x
313+
if [[ -n ${arches_csv} ]]; then
314+
ok=
315+
read -r -a arches <<<"${arches_csv//,/ }"
316+
for ok_arch in "${arches[@]}"; do
317+
if [[ ${ok_arch} = "${arch}" ]]; then
318+
ok=x
319+
break
320+
fi
321+
done
322+
fi
323+
if [[ -z ${ok} ]]; then
324+
continue
325+
fi
326+
names+=( "${name}" )
327+
done
293328

294-
list_var_ref=( "${EXTRA_SYSEXTS[@]%%|*}" )
329+
list_var_ref=( "${names[@]}" )
295330
}
296331

297332
# Generates reports with passed parameters. The report is redirected

0 commit comments

Comments
 (0)