Fix cache version ref and ver function output.

This commit is contained in:
awalsh128 2022-06-30 01:17:13 -07:00
parent 45b8861f3a
commit e6baec0bc6
2 changed files with 6 additions and 5 deletions

2
lib.sh
View file

@ -15,5 +15,5 @@ function get_package_name_ver {
if test -z "${ver}"; then
ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')"
fi
echo ""${name}"="${ver}""
echo "${name}" "${ver}"
}

View file

@ -20,7 +20,7 @@ packages="$(normalize_package_list "${input_packages}")"
mkdir -p ${cache_dir}
echo -n "Validating action arguments (version='${version}', packages='${packages}')...";
if grep -q " " <<< "${cache_version}"; then
if grep -q " " <<< "${version}"; then
echo "aborted."
echo "Version value '${version}' cannot contain spaces." >&2
exit 1
@ -42,7 +42,8 @@ for package in ${packages}; do
echo "Package '${package}' not found." >&2
exit 3
fi
versioned_packages=""${versioned_packages}" "$(get_package_name_ver "${package}")""
read package_name package_ver < <(get_package_name_ver "${package}") # -> package_name, package_ver
versioned_packages=""${versioned_packages}" "${package_name}"="${package_ver}""
done
echo "done."
@ -55,7 +56,7 @@ echo "Creating cache key..."
normalized_versioned_packages="$(normalize_package_list "${versioned_packages}")"
echo "- Normalized package list is '${normalized_versioned_packages}'."
value="$(echo "${normalized_versioned_packages} @ ${cache_version}")"
value="$(echo "${normalized_versioned_packages} @ ${version}")"
echo "- Value to hash is '${value}'."
key="$(echo "${value}" | md5sum | /bin/cut -f1 -d' ')"