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

dnfjson: enable loading of optional metadata when needed #702

Merged
merged 2 commits into from
May 29, 2024
Merged
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
25 changes: 22 additions & 3 deletions pkg/dnfjson/dnfjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,12 @@ func (s *Solver) makeDepsolveRequest(pkgSets []rpmmd.PackageSet) (*Request, map[
if err != nil {
return nil, nil, err
}

args := arguments{
Repos: dnfRepoMap,
RootDir: s.rootDir,
Transactions: transactions,
Repos: dnfRepoMap,
RootDir: s.rootDir,
Transactions: transactions,
OptionalMetadata: s.optionalMetadataForDistro(),
}

req := Request{
Expand All @@ -479,6 +481,20 @@ func (s *Solver) makeDepsolveRequest(pkgSets []rpmmd.PackageSet) (*Request, map[
return &req, rhsmMap, nil
}

func (s *Solver) optionalMetadataForDistro() []string {
// filelist repo metadata is required when using newer versions of libdnf
// with old repositories or packages that specify dependencies on files.
// EL10+ and Fedora 40+ packaging guidelines prohibit depending on
// filepaths so filelist downloads are disabled by default and are not
// required when depsolving for those distros. Explicitly enable the option
// for older distro versions in case we are using a newer libdnf.
switch s.modulePlatformID {
case "platform:f39", "platform:el7", "platform:el8", "platform:el9":
return []string{"filelists"}
}
return nil
}

// Helper function for creating a dump request payload
func (s *Solver) makeDumpRequest(repos []rpmmd.RepoConfig) (*Request, error) {
dnfRepos, err := s.reposFromRPMMD(repos)
Expand Down Expand Up @@ -640,6 +656,9 @@ type arguments struct {
// Load repository configurations, gpg keys, and vars from an os-root-like
// tree.
RootDir string `json:"root_dir"`

// Optional metadata to download for the repositories
OptionalMetadata []string `json:"optional-metadata,omitempty"`
}

type searchArgs struct {
Expand Down
Loading