Skip to content

Commit

Permalink
dnfjson: SetReposDir() on Solver and request
Browse files Browse the repository at this point in the history
Support setting a repos directory on the Solver and add it to the
depsolve request when set.
  • Loading branch information
achilleas-k committed Mar 20, 2024
1 parent 04d6cb6 commit 8adfb29
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/dnfjson/dnfjson.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ type Solver struct {
// for each distribution.
distro string

reposDir string

subscriptions *rhsm.Subscriptions
}

Expand All @@ -148,6 +150,13 @@ func NewSolver(modulePlatformID, releaseVer, arch, distro, cacheDir string) *Sol
return s.NewWithConfig(modulePlatformID, releaseVer, arch, distro)
}

// SetReposDir sets a path from which repository configurations are loaded
// during depsolve, instead of (or in addition to) the repositories included in
// each depsolve request.
func (s *Solver) SetReposDir(path string) {
s.reposDir = path
}

// GetCacheDir returns a distro specific rpm cache directory
// It ensures that the distro name is below the root cache directory, and if there is
// a problem it returns the root cache instead of an error.
Expand Down Expand Up @@ -426,6 +435,7 @@ func (s *Solver) makeDepsolveRequest(pkgSets []rpmmd.PackageSet) (*Request, map[
}
args := arguments{
Repos: dnfRepoMap,
ReposDir: s.reposDir,
Transactions: transactions,
}

Expand Down Expand Up @@ -570,6 +580,9 @@ type arguments struct {

// Depsolve package sets and repository mappings for this request
Transactions []transactionArgs `json:"transactions"`

// Load repository configurations from a directory
ReposDir string `json:"repos_dir"`
}

type searchArgs struct {
Expand Down

0 comments on commit 8adfb29

Please sign in to comment.