Skip to content

Commit 9082d32

Browse files
fix: os version format in tdnf install (#1215)
Signed-off-by: ashnamehrotra <ashnamehrotra@gmail.com>
1 parent e18304c commit 9082d32

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pkg/pkgmgr/rpm.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,11 @@ func (rm *rpmManager) unpackAndMergeUpdates(ctx context.Context, updates unversi
650650
651651
done <<< "$(echo "$json_str" | tr -d '{}\n' | tr ',' '\n')"
652652
653+
# Convert OS_VERSION from X.Y.Z to X.Y format
654+
OS_VERSION_XY=$(echo "$OS_VERSION" | cut -d'.' -f1-2)
655+
653656
tdnf makecache
654-
tdnf install -y --releasever=$OS_VERSION --installroot=/tmp/rootfs $packages_formatted
657+
tdnf install -y --releasever=$OS_VERSION_XY --installroot=/tmp/rootfs $packages_formatted
655658
656659
ls /tmp/rootfs/var/lib/rpm
657660
`,
@@ -676,7 +679,10 @@ func (rm *rpmManager) unpackAndMergeUpdates(ctx context.Context, updates unversi
676679
677680
for package in $packages; do
678681
package="${package%%.*}" # trim anything after the first "."
679-
output=$(tdnf install -y --releasever=$OS_VERSION --installroot=/tmp/rootfs ${package} 2>&1)
682+
# Convert OS_VERSION from X.Y.Z to X.Y format
683+
OS_VERSION_XY=$(echo "$OS_VERSION" | cut -d'.' -f1-2)
684+
685+
output=$(tdnf install -y --releasever=$OS_VERSION_XY --installroot=/tmp/rootfs ${package} 2>&1)
680686
681687
if [ "$IGNORE_ERRORS" = "false" ] && [ $? -ne 0 ]; then
682688
exit $?

0 commit comments

Comments
 (0)