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 if test -z "${ver}"; then
ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')" ver="$(grep "Version:" <<< "$(apt show ${name})" | awk '{print $2}')"
fi fi
echo ""${name}"="${ver}"" echo "${name}" "${ver}"
} }

View file

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