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
@ -75,16 +75,15 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type UpdateRepoRequest struct {
|
type UpdateRepoRequest struct {
|
||||||
ProjectID string `json:"projectId"`
|
ProjectID string `json:"projectId"`
|
||||||
BuildIDs []string `json:"buildId"`
|
BuildIDs []string `json:"buildId"`
|
||||||
TaskID *string `json:"taskId"`
|
TaskID *string `json:"taskId"`
|
||||||
ForceRepoId string `json:"forceRepoId"`
|
ForceRepoId string `json:"forceRepoId"`
|
||||||
// todo(mustafa): Add support for deleting packages
|
Delete bool `json:"delete"`
|
||||||
Delete bool `json:"delete"`
|
ForceNonModular bool `json:"forceNonModular"`
|
||||||
ForceNonModular bool `json:"forceNonModular"`
|
DisableSigning bool `json:"disableSigning"`
|
||||||
DisableSigning bool `json:"disableSigning"`
|
DisableSetActive bool `json:"disableSetActive"`
|
||||||
DisableSetActive bool `json:"disableSetActive"`
|
NoDeletePrevious bool `json:"noDeletePrevious"`
|
||||||
NoDeletePrevious bool `json:"noDeletePrevious"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompiledGlobFilter struct {
|
type CompiledGlobFilter struct {
|
||||||
@ -1012,8 +1011,10 @@ func (c *Controller) makeRepoChanges(tx peridotdb.Access, req *UpdateRepoRequest
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get artifacts to skip deletion
|
// Get artifacts to skip deletion
|
||||||
for _, artifact := range artifacts {
|
if !req.Delete {
|
||||||
skipDeleteArtifacts = append(skipDeleteArtifacts, strings.TrimSuffix(filepath.Base(artifact.Name), ".rpm"))
|
for _, artifact := range artifacts {
|
||||||
|
skipDeleteArtifacts = append(skipDeleteArtifacts, strings.TrimSuffix(filepath.Base(artifact.Name), ".rpm"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var repos models.Repositories
|
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)
|
archName = fmt.Sprintf("%s.%s", noDebugInfoName, artifact.Arch)
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldAdd := true
|
shouldAdd := !req.Delete
|
||||||
if arch != "src" && moduleStream == nil {
|
if arch != "src" && moduleStream == nil && !req.Delete {
|
||||||
// If repo has a list for inclusion, then the artifact has to pass that first
|
// If repo has a list for inclusion, then the artifact has to pass that first
|
||||||
if len(repo.IncludeFilter) > 0 {
|
if len(repo.IncludeFilter) > 0 {
|
||||||
// If the artifact isn't forced, it should be in the include list or additional multilib list
|
// If the artifact isn't forced, it should be in the include list or additional multilib list
|
||||||
@ -1491,13 +1492,15 @@ func (c *Controller) makeRepoChanges(tx peridotdb.Access, req *UpdateRepoRequest
|
|||||||
var nFilelists []*yummeta.FilelistsPackage
|
var nFilelists []*yummeta.FilelistsPackage
|
||||||
var nOther []*yummeta.OtherPackage
|
var nOther []*yummeta.OtherPackage
|
||||||
var deleteIds []string
|
var deleteIds []string
|
||||||
if !req.NoDeletePrevious || moduleStream != nil {
|
if (!req.NoDeletePrevious || moduleStream != nil) || req.Delete {
|
||||||
for _, pkg := range primaryRoot.Packages {
|
for _, pkg := range primaryRoot.Packages {
|
||||||
shouldAdd := true
|
shouldAdd := !req.Delete
|
||||||
for _, artifact := range currentActiveArtifacts {
|
if !req.Delete {
|
||||||
noRpmName := strings.TrimSuffix(filepath.Base(artifact.Name), ".rpm")
|
for _, artifact := range currentActiveArtifacts {
|
||||||
if filepath.Base(artifact.Name) == filepath.Base(pkg.Location.Href) && !utils.StrContains(noRpmName, changes.ModifiedPackages) && !utils.StrContains(noRpmName, changes.AddedPackages) && !utils.StrContains(noRpmName, skipDeleteArtifacts) {
|
noRpmName := strings.TrimSuffix(filepath.Base(artifact.Name), ".rpm")
|
||||||
shouldAdd = false
|
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 {
|
if !shouldAdd {
|
||||||
|
Loading…
Reference in New Issue
Block a user