Skip to content

Commit

Permalink
Append version to RID only with valid characters (#81497)
Browse files Browse the repository at this point in the history
This is the `init-distro-rid.sh` counterpart of 31e4f40.

In `amd64/archlinux` docker container, the non-portable RID auto-detection (without explicit `-p:TargetRid=arch-x64` arg or `__DistroRid=arch-x64` env var) looks like this:

Before: `__DistroRid: arch.TEMPLATE_VERSION_ID-x64`
After: `__DistroRid: arch-x64`
  • Loading branch information
am11 committed Mar 2, 2023
1 parent 3c89673 commit 52bdf6c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions eng/native/init-distro-rid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ initNonPortableDistroRid()
VERSION_ID="${VERSION_ID%.*}"
fi

if [ -z "${VERSION_ID+x}" ]; then
# Rolling release distros do not set VERSION_ID, so omit
# it here to be consistent with everything else.
nonPortableBuildID="${ID}-${buildArch}"
if [[ "${VERSION_ID}" =~ ^([[:digit:]]|\.)+$ ]]; then
nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}"
else
nonPortableBuildID="${ID}.${VERSION_ID}-${buildArch}"
# Rolling release distros either do not set VERSION_ID, set it as blank or
# set it to non-version looking string (such as TEMPLATE_VERSION_ID on ArchLinux);
# so omit it here to be consistent with everything else.
nonPortableBuildID="${ID}-${buildArch}"
fi
fi

Expand Down

0 comments on commit 52bdf6c

Please sign in to comment.