diff --git a/twoliter/embedded/rpm2img b/twoliter/embedded/rpm2img index 855791c0..6fcf6690 100755 --- a/twoliter/embedded/rpm2img +++ b/twoliter/embedded/rpm2img @@ -170,6 +170,7 @@ INVENTORY_QUERY="\{\"Name\":\"%{NAME}\"\ ,\"Publisher\":\"Bottlerocket\"\ ,\"Version\":\"%{Version}\"\ ,\"Release\":\"%{Release}\"\ +,\"Epoch\":\"%{Epoch}\"\ ,\"InstalledTime\":\"${INSTALL_TIME}\"\ ,\"ApplicationType\":\"%{GROUP}\"\ ,\"Architecture\":\"%{ARCH}\"\ @@ -237,14 +238,13 @@ if [[ -n "${CORE_KIT_VERSION}" && -n "${CORE_KIT_VENDOR}" ]]; then # the version with the core kit's version, and replace the name with the unprefixed name. INVENTORY_DATA="$(jq \ --argfile replace core-kit-replacements.json \ - --arg CORE_KIT_VERSION "${CORE_KIT_VERSION}" \ - --arg CORE_KIT_GIT_SHA "${CORE_KIT_GIT_SHA}" \ - '(.Content[] | select(.Name | $replace[.] != null) | .Version) = $CORE_KIT_VERSION | - (.Content[] | select(.Name | $replace[.] != null) | .Release) = $CORE_KIT_GIT_SHA | - .Content[].Name |= (if $replace[.] then $replace[.] else . end)' \ + '.Content[].Name |= (if $replace[.] then $replace[.] else . end)' \ <<<"${INVENTORY_DATA}")" fi +# Queries on an RPM with no Epoch set result in "(none)". This is effectively "0" for package comparisons. +INVENTORY_DATA="${INVENTORY_DATA//\(none\)/0}" + # Verify we successfully inventoried some RPMs. INVENTORY_COUNT="$(jq '.Content | length' <<<"${INVENTORY_DATA}")" RPM_COUNT="$(find "${PACKAGE_DIR}" -maxdepth 1 -type f -name '*.rpm' | wc -l)"