rpmmd/toDNFRepoConfig: use an increasing counter for the ID
The ID needs only be unique in the calling function, so replace the UUID with an increasing counter. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
5938276d3b
commit
3edada6664
1 changed files with 9 additions and 9 deletions
|
|
@ -8,11 +8,11 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gobwas/glob"
|
"github.com/gobwas/glob"
|
||||||
"github.com/google/uuid"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type repository struct {
|
type repository struct {
|
||||||
|
|
@ -25,7 +25,7 @@ type repository struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type dnfRepoConfig struct {
|
type dnfRepoConfig struct {
|
||||||
Id string `json:"id"`
|
ID string `json:"id"`
|
||||||
BaseURL string `json:"baseurl,omitempty"`
|
BaseURL string `json:"baseurl,omitempty"`
|
||||||
Metalink string `json:"metalink,omitempty"`
|
Metalink string `json:"metalink,omitempty"`
|
||||||
MirrorList string `json:"mirrorlist,omitempty"`
|
MirrorList string `json:"mirrorlist,omitempty"`
|
||||||
|
|
@ -294,10 +294,10 @@ func NewRPMMD(cacheDir string) RPMMD {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (repo RepoConfig) toDNFRepoConfig() (dnfRepoConfig, error) {
|
func (repo RepoConfig) toDNFRepoConfig(i int) (dnfRepoConfig, error) {
|
||||||
id := uuid.New().String()
|
id := strconv.Itoa(i)
|
||||||
dnfRepo := dnfRepoConfig{
|
dnfRepo := dnfRepoConfig{
|
||||||
Id: id,
|
ID: id,
|
||||||
BaseURL: repo.BaseURL,
|
BaseURL: repo.BaseURL,
|
||||||
Metalink: repo.Metalink,
|
Metalink: repo.Metalink,
|
||||||
MirrorList: repo.MirrorList,
|
MirrorList: repo.MirrorList,
|
||||||
|
|
@ -319,8 +319,8 @@ func (repo RepoConfig) toDNFRepoConfig() (dnfRepoConfig, error) {
|
||||||
|
|
||||||
func (r *rpmmdImpl) FetchMetadata(repos []RepoConfig, modulePlatformID string, arch string) (PackageList, map[string]string, error) {
|
func (r *rpmmdImpl) FetchMetadata(repos []RepoConfig, modulePlatformID string, arch string) (PackageList, map[string]string, error) {
|
||||||
var dnfRepoConfigs []dnfRepoConfig
|
var dnfRepoConfigs []dnfRepoConfig
|
||||||
for _, repo := range repos {
|
for i, repo := range repos {
|
||||||
dnfRepo, err := repo.toDNFRepoConfig()
|
dnfRepo, err := repo.toDNFRepoConfig(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -350,11 +350,11 @@ func (r *rpmmdImpl) Depsolve(specs, excludeSpecs []string, repos []RepoConfig, m
|
||||||
repoMap := make(map[string]RepoConfig)
|
repoMap := make(map[string]RepoConfig)
|
||||||
var dnfRepoConfigs []dnfRepoConfig
|
var dnfRepoConfigs []dnfRepoConfig
|
||||||
|
|
||||||
for _, repo := range repos {
|
for i, repo := range repos {
|
||||||
id := repo.Id
|
id := repo.Id
|
||||||
repoMap[id] = repo
|
repoMap[id] = repo
|
||||||
|
|
||||||
dnfRepo, err := repo.toDNFRepoConfig()
|
dnfRepo, err := repo.toDNFRepoConfig(i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue