Skip to content
2 changes: 1 addition & 1 deletion internal/ospackage/rpmutils/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ func DownloadPackagesComplete(pkgList []string, destDir, dotFile string, pkgSour
urls := make([]string, len(sorted_pkgs))
for i, pkg := range sorted_pkgs {
urls[i] = pkg.URL
downloadPkgList = append(downloadPkgList, pkg.Name)
downloadPkgList = append(downloadPkgList, filepath.Base(pkg.URL))
}

// Ensure dest directory exists
Expand Down
5 changes: 2 additions & 3 deletions internal/ospackage/rpmutils/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"fmt"
"io"
"os"
"path"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -254,11 +253,11 @@ func ParseRepositoryMetadata(baseURL, gzHref string) ([]ospackage.PackageInfo, e
}

case "location":
// read the href and build full URL + infer Name (filename)
// read the href and build full URL
for _, a := range elem.Attr {
if a.Name.Local == "href" {
curInfo.URL = strings.TrimRight(baseURL, "/") + "/" + strings.TrimLeft(a.Value, "/")
curInfo.Name = path.Base(a.Value)
// Note: Don't set Name from location href - it should come from <name> element
break
}
}
Expand Down
6 changes: 3 additions & 3 deletions internal/ospackage/rpmutils/resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func TestParsePrimary(t *testing.T) {
filename: "primary.xml.gz",
expectedError: false,
expectedCount: 2,
expectedNames: []string{"bash-5.1-8.el9.x86_64.rpm", "glibc-2.32-1.el9.x86_64.rpm"},
expectedNames: []string{"bash", "glibc"},
},
{
name: "empty metadata",
Expand Down Expand Up @@ -330,13 +330,13 @@ func TestParsePrimary(t *testing.T) {
// Check bash package details
var bashPkg *ospackage.PackageInfo
for _, pkg := range packages {
if pkg.Name == "bash-5.1-8.el9.x86_64.rpm" {
if pkg.Name == "bash" {
bashPkg = &pkg
break
}
}
if bashPkg == nil {
t.Fatal("bash-5.1-8.el9.x86_64.rpm package not found")
t.Fatal("bash package not found")
}

if bashPkg.License != "GPLv3+" {
Expand Down
Loading