Skip to content

Commit

Permalink
Use yumdownloader
Browse files Browse the repository at this point in the history
  • Loading branch information
brycekahle committed Oct 14, 2023
1 parent 8222190 commit 0a0c4df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkg/pkg/rhel.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (pkg *RHELPackage) Download(ctx context.Context, dir string, force bool) (s
return rpmpath, nil
}

err := yumDownload(ctx, pkg.Name, dir)
err := yumDownload(ctx, pkg.Name, pkg.Architecture, dir)
if err != nil {
os.Remove(rpmpath)
return "", fmt.Errorf("rpm download: %s", err)
Expand Down
9 changes: 2 additions & 7 deletions pkg/pkg/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,10 @@ func TarballBTF(ctx context.Context, btf string, out string) error {
// RHEL packages
//

func yumDownload(ctx context.Context, pkg string, destdir string) error {

func yumDownload(ctx context.Context, pkg string, arch string, destdir string) error {
stderr := &bytes.Buffer{}

destDirParam := fmt.Sprintf("--downloaddir=%s", destdir)

binary, args := utils.SudoCMD("yum", "install", "-y", "--downloadonly", destDirParam, pkg)
binary, args := utils.SudoCMD("yumdownloader", "--archlist="+arch, "--destdir="+destdir, pkg)
cmd := exec.CommandContext(ctx, binary, args...)

cmd.Stdout = os.Stdout
cmd.Stderr = stderr

Expand Down

0 comments on commit 0a0c4df

Please sign in to comment.