From 48cd82b759bbd1f60bd7a39026fb80159813448d Mon Sep 17 00:00:00 2001 From: Peter Verraedt Date: Fri, 21 Jul 2023 21:41:38 +0200 Subject: [PATCH] Fix version in rpm repodata/primary.xml.gz (#26009) The version listed in rpm repodata should only contain the rpm version (1.0.0) and not the combination of version and release (1.0.0-2). We correct this behaviour in primary.xml.gz, filelists.xml.gz and others.xml.gz. Signed-off-by: Peter Verraedt --- services/packages/rpm/repository.go | 6 +++--- tests/integration/api_packages_rpm_test.go | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/services/packages/rpm/repository.go b/services/packages/rpm/repository.go index fb78e2b1135..774613509e7 100644 --- a/services/packages/rpm/repository.go +++ b/services/packages/rpm/repository.go @@ -378,7 +378,7 @@ func buildPrimary(pv *packages_model.PackageVersion, pfs []*packages_model.Packa Architecture: pd.FileMetadata.Architecture, Version: Version{ Epoch: pd.FileMetadata.Epoch, - Version: pd.Version.Version, + Version: pd.FileMetadata.Version, Release: pd.FileMetadata.Release, }, Checksum: Checksum{ @@ -466,7 +466,7 @@ func buildFilelists(pv *packages_model.PackageVersion, pfs []*packages_model.Pac Architecture: pd.FileMetadata.Architecture, Version: Version{ Epoch: pd.FileMetadata.Epoch, - Version: pd.Version.Version, + Version: pd.FileMetadata.Version, Release: pd.FileMetadata.Release, }, Files: pd.FileMetadata.Files, @@ -513,7 +513,7 @@ func buildOther(pv *packages_model.PackageVersion, pfs []*packages_model.Package Architecture: pd.FileMetadata.Architecture, Version: Version{ Epoch: pd.FileMetadata.Epoch, - Version: pd.Version.Version, + Version: pd.FileMetadata.Version, Release: pd.FileMetadata.Release, }, Changelogs: pd.FileMetadata.Changelogs, diff --git a/tests/integration/api_packages_rpm_test.go b/tests/integration/api_packages_rpm_test.go index e66460899f6..fc4c4d1c4b6 100644 --- a/tests/integration/api_packages_rpm_test.go +++ b/tests/integration/api_packages_rpm_test.go @@ -196,15 +196,15 @@ gpgkey=%sapi/packages/%s/rpm/repository.key`, user.Name, user.Name, setting.AppN switch d.Type { case "primary": assert.EqualValues(t, 718, d.Size) - assert.EqualValues(t, 1731, d.OpenSize) + assert.EqualValues(t, 1729, d.OpenSize) assert.Equal(t, "repodata/primary.xml.gz", d.Location.Href) case "filelists": - assert.EqualValues(t, 258, d.Size) - assert.EqualValues(t, 328, d.OpenSize) + assert.EqualValues(t, 257, d.Size) + assert.EqualValues(t, 326, d.OpenSize) assert.Equal(t, "repodata/filelists.xml.gz", d.Location.Href) case "other": - assert.EqualValues(t, 308, d.Size) - assert.EqualValues(t, 396, d.OpenSize) + assert.EqualValues(t, 306, d.Size) + assert.EqualValues(t, 394, d.OpenSize) assert.Equal(t, "repodata/other.xml.gz", d.Location.Href) } }