Skip to content

Commit

Permalink
dnfjson: enable filelists for older distro versions
Browse files Browse the repository at this point in the history
Enable filelists in the optional metadata for EL7, EL8, EL9, and Fedora
39.

When running osbuild-depsolve-dnf with the libdnf version that's
included in these distro versions, this option will have no effect since
it is enabled by default.  However, when depsolving packages for these
distro versions with newer versions of libdnf, the filelists are
disabled and can cause issues with packages that declare dependencies on
filepaths.

The cutoff point is a little fuzzy for CentOS and Fedora.  Depsolving
all our test manifests for Fedora 39 and CentOS Stream 9 without
filelists works, but since the packaging guidelines of not depending on
filepaths went into effect in EL10 and Fedora 40, it's possible there
are packages in F39 and C9S that don't conform yet, so it's probably
safer to keep filelists enabled for these distro versions.
  • Loading branch information
achilleas-k committed May 23, 2024
1 parent edee43c commit 7fa242f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 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

0 comments on commit 7fa242f

Please sign in to comment.