TT#65907 Speedup 'ngcpcfg build' (2-3 seconds faster when we build all files)

We are performing complex manipulations with list of files to be build
to understand which tt2 file we should use: .tt2/customtt.tt2/tt2.sp1/...
In the same time 90% of our files has only .tt2, so let's check the count here
and use the $file if only one record is available to proceed.

Change-Id: Ib754390563a93a1fbdeb4a4147b066fcb53ed5cc
changes/08/33608/6
Alexander Lutay 7 years ago
parent ef9ebde2f3
commit 9afac63acc

@ -273,6 +273,13 @@ generate_template_list() {
normalized_filename="${normalized_filename%.customtt.tt2}"
normalized_filename="${normalized_filename%.tt2}"
# skipping all further checks IF we have only one entry in 'filelist_prepared' (90% cases)
if [[ "$(grep -Ec "^${normalized_filename}" "${filelist_prepared}")" == "1" ]]; then
log_debug "Using the only one available file '${line}' matching on '${normalized_filename}'"
echo "${line}" >> "${filelist_final}"
continue
fi
# foo.custom.tt2.hostname
if [ -n "${HOST_FILE:-}" ] ; then
if grep -q -- "^${normalized_filename}.customtt.tt2${HOST_FILE}$" "${filelist_prepared}" ; then

Loading…
Cancel
Save