mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-12-21 02:08:29 +00:00
Add support for deleting builds from yumrepofs
This commit is contained in:
parent
be2b871fff
commit
c6bec99698
@ -79,7 +79,6 @@ type UpdateRepoRequest struct {
|
||||
BuildIDs []string `json:"buildId"`
|
||||
TaskID *string `json:"taskId"`
|
||||
ForceRepoId string `json:"forceRepoId"`
|
||||
// todo(mustafa): Add support for deleting packages
|
||||
Delete bool `json:"delete"`
|
||||
ForceNonModular bool `json:"forceNonModular"`
|
||||
DisableSigning bool `json:"disableSigning"`
|
||||
@ -1012,9 +1011,11 @@ func (c *Controller) makeRepoChanges(tx peridotdb.Access, req *UpdateRepoRequest
|
||||
}
|
||||
|
||||
// Get artifacts to skip deletion
|
||||
if !req.Delete {
|
||||
for _, artifact := range artifacts {
|
||||
skipDeleteArtifacts = append(skipDeleteArtifacts, strings.TrimSuffix(filepath.Base(artifact.Name), ".rpm"))
|
||||
}
|
||||
}
|
||||
|
||||
var repos models.Repositories
|
||||
|
||||
@ -1308,8 +1309,8 @@ func (c *Controller) makeRepoChanges(tx peridotdb.Access, req *UpdateRepoRequest
|
||||
archName = fmt.Sprintf("%s.%s", noDebugInfoName, artifact.Arch)
|
||||
}
|
||||
|
||||
shouldAdd := true
|
||||
if arch != "src" && moduleStream == nil {
|
||||
shouldAdd := !req.Delete
|
||||
if arch != "src" && moduleStream == nil && !req.Delete {
|
||||
// If repo has a list for inclusion, then the artifact has to pass that first
|
||||
if len(repo.IncludeFilter) > 0 {
|
||||
// If the artifact isn't forced, it should be in the include list or additional multilib list
|
||||
@ -1491,15 +1492,17 @@ func (c *Controller) makeRepoChanges(tx peridotdb.Access, req *UpdateRepoRequest
|
||||
var nFilelists []*yummeta.FilelistsPackage
|
||||
var nOther []*yummeta.OtherPackage
|
||||
var deleteIds []string
|
||||
if !req.NoDeletePrevious || moduleStream != nil {
|
||||
if (!req.NoDeletePrevious || moduleStream != nil) || req.Delete {
|
||||
for _, pkg := range primaryRoot.Packages {
|
||||
shouldAdd := true
|
||||
shouldAdd := !req.Delete
|
||||
if !req.Delete {
|
||||
for _, artifact := range currentActiveArtifacts {
|
||||
noRpmName := strings.TrimSuffix(filepath.Base(artifact.Name), ".rpm")
|
||||
if filepath.Base(artifact.Name) == filepath.Base(pkg.Location.Href) && !utils.StrContains(noRpmName, changes.ModifiedPackages) && !utils.StrContains(noRpmName, changes.AddedPackages) && !utils.StrContains(noRpmName, skipDeleteArtifacts) {
|
||||
shouldAdd = false
|
||||
}
|
||||
}
|
||||
}
|
||||
if !shouldAdd {
|
||||
c.log.Infof("deleting %s", pkg.Location.Href)
|
||||
deleteIds = append(deleteIds, pkg.Checksum.Value)
|
||||
|
Loading…
Reference in New Issue
Block a user