Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove build number from SUSE filenames #107

Merged
merged 2 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/pkg/centos.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func (pkg *CentOSPackage) Filename() string {
return pkg.NameOfFile
}

func (pkg *CentOSPackage) BTFFilename() string {
return pkg.NameOfFile
}

func (pkg *CentOSPackage) Version() kernel.Version {
return pkg.KernelVersion
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/pkg/fedora.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func (pkg *FedoraPackage) Filename() string {
return pkg.NameOfFile
}

func (pkg *FedoraPackage) BTFFilename() string {
return pkg.NameOfFile
}

func (pkg *FedoraPackage) Version() kernel.Version {
return pkg.KernelVersion
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/pkg/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ import (
type Package interface {
String() string
Filename() string
BTFFilename() string
Version() kernel.Version
Download(ctx context.Context, dir string, force bool) (string, error)
ExtractKernel(ctx context.Context, pkgpath string, vmlinuxPath string) error
}

func PackageBTFExists(p Package, workDir string) bool {
fp := filepath.Join(workDir, fmt.Sprintf("%s.btf.tar.xz", p.Filename()))
fp := filepath.Join(workDir, fmt.Sprintf("%s.btf.tar.xz", p.BTFFilename()))
return utils.Exists(fp)
}

func PackageFailed(p Package, workDir string) bool {
fp := filepath.Join(workDir, fmt.Sprintf("%s.failed", p.Filename()))
fp := filepath.Join(workDir, fmt.Sprintf("%s.failed", p.BTFFilename()))
return utils.Exists(fp)
}

func hasBTFPath(p Package, workDir string) string {
return filepath.Join(workDir, fmt.Sprintf("%s.hasbtf", p.Filename()))
return filepath.Join(workDir, fmt.Sprintf("%s.hasbtf", p.BTFFilename()))
}

func MarkPackageHasBTF(p Package, workDir string) error {
Expand Down
4 changes: 4 additions & 0 deletions pkg/pkg/rhel.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ func (pkg *RHELPackage) Filename() string {
return pkg.NameOfFile
}

func (pkg *RHELPackage) BTFFilename() string {
return pkg.NameOfFile
}

func (pkg *RHELPackage) Version() kernel.Version {
return pkg.KernelVersion
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/pkg/suse.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
type SUSEPackage struct {
Name string
NameOfFile string
NameOfBTFFile string
Architecture string
KernelVersion kernel.Version
Repo string
Expand All @@ -24,6 +25,10 @@ func (pkg *SUSEPackage) Filename() string {
return pkg.NameOfFile
}

func (pkg *SUSEPackage) BTFFilename() string {
return pkg.NameOfBTFFile
}

func (pkg *SUSEPackage) Version() kernel.Version {
return pkg.KernelVersion
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/pkg/ubuntu.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ func (pkg *UbuntuPackage) Filename() string {
return pkg.NameOfFile
}

func (pkg *UbuntuPackage) BTFFilename() string {
return pkg.NameOfFile
}

func (pkg *UbuntuPackage) Version() kernel.Version {
return pkg.KernelVersion
}
Expand Down
10 changes: 9 additions & 1 deletion pkg/repo/suse.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ func (d *suseRepo) GetKernelPackages(ctx context.Context, dir string, release st
var repos []string

switch release {
case "12.3":
repos = append(repos, fmt.Sprintf("SUSE_Linux_Enterprise_Server_12_SP3_%s:SLES12-SP3-Debuginfo-Pool", arch))
repos = append(repos, fmt.Sprintf("SUSE_Linux_Enterprise_Server_12_SP3_%s:SLES12-SP3-Debuginfo-Updates", arch))
case "12.5":
repos = append(repos, fmt.Sprintf("SUSE_Linux_Enterprise_Server_%s:SLES12-SP5-Debuginfo-Pool", arch))
repos = append(repos, fmt.Sprintf("SUSE_Linux_Enterprise_Server_%s:SLES12-SP5-Debuginfo-Updates", arch))
Expand Down Expand Up @@ -178,9 +181,14 @@ func (d *suseRepo) parseZypperPackages(rdr io.Reader, arch string) ([]*pkg.SUSEP
continue
}

// remove final .x because it is just a build counter and not included in `uname -r`
parts := strings.Split(ver, ".")
btfver := strings.Join(parts[:len(parts)-1], ".")

p := &pkg.SUSEPackage{
Name: name,
NameOfFile: fmt.Sprintf("%s-%s", ver, match[1]),
NameOfFile: fmt.Sprintf("%s-%s", ver, flavor),
NameOfBTFFile: fmt.Sprintf("%s-%s", btfver, flavor),
KernelVersion: kernel.NewKernelVersion(ver),
Architecture: pkgarch,
Repo: repo,
Expand Down
4 changes: 2 additions & 2 deletions pkg/repo/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ func processPackage(
jobChan chan<- job.Job,
) error {

btfName := fmt.Sprintf("%s.btf", p.Filename())
btfName := fmt.Sprintf("%s.btf", p.BTFFilename())
btfPath := filepath.Join(workDir, btfName)
btfTarName := fmt.Sprintf("%s.btf.tar.xz", p.Filename())
btfTarName := fmt.Sprintf("%s.btf.tar.xz", p.BTFFilename())
btfTarPath := filepath.Join(workDir, btfTarName)

if pkg.PackageHasBTF(p, workDir) {
Expand Down
Loading