publish_utils.sh: even faster checksum matching

Another order of magnitude speadup.

Signed-off-by: Scott Little <scott.little@windriver.com>
Change-Id: Ic1cb9494e693388e4767e2009b390e4e1ffc9991
This commit is contained in:
Scott Little 2022-10-28 14:48:43 -04:00
parent 7f604733e5
commit 068dc0db84
2 changed files with 18 additions and 1 deletions

View File

@ -8,6 +8,17 @@
CHECKSUMS_FILENAME="StxChecksums"
create_checksum_files_meta () {
local published_checksum_files_list_file="$1"
local meta_file="${published_checksum_files_list_file}.meta"
if [ -f "$meta_file" ]; then
\rm -f "$meta_file"
fi
cat "$published_checksum_files_list_file" | xargs grep -H -v '^$' > $meta_file
}
publish_file() {
local filename="$1"
local dst_dir="$2"
@ -32,7 +43,12 @@ publish_file() {
local link_created
link_created=$(
cat "$published_checksum_files_list_file" | xargs -P $p \grep -l "$checksum " | {
( if [ -f ${published_checksum_files_list_file}.meta ];
then
grep ":$checksum " /tmp/published_package_checksum_files.meta | cut -d ':' -f 1
else
cat "$published_checksum_files_list_file" | xargs -P $p \grep -l "^$checksum "
fi ) | {
while read checksum_file ; do
local checksum_dir
checksum_dir="${checksum_file%/*}"

View File

@ -238,6 +238,7 @@ publish_aptly_public_repos() {
"${PUBLISH_SUBDIR}/outputs/aptly" \
>"$checksum_files_list_file" || exit 1
create_checksum_files_meta "$checksum_files_list_file"
# copy/link package files
local aptly_repo