mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2024-12-04 18:36:26 +00:00
prune lookaside files that change in the same stream
This commit is contained in:
parent
059cb525a7
commit
9de0f812f5
@ -175,7 +175,7 @@ func (g *GitMode) WriteSource(md *modeData) {
|
||||
}
|
||||
|
||||
md.sourcesToIgnore = append(md.sourcesToIgnore, &ignoredSource{
|
||||
name: filepath.Base(path),
|
||||
name: path,
|
||||
hashFunction: hasher,
|
||||
})
|
||||
|
||||
@ -189,9 +189,12 @@ func (g *GitMode) WriteSource(md *modeData) {
|
||||
|
||||
func (g *GitMode) PostProcess(md *modeData) {
|
||||
for _, source := range md.sourcesToIgnore {
|
||||
err := md.worktree.Filesystem.Remove(filepath.Join("SOURCES", source.name))
|
||||
if err != nil {
|
||||
log.Fatalf("could not remove dist-git file: %v", err)
|
||||
_, err := md.worktree.Filesystem.Stat(source.name)
|
||||
if err == nil {
|
||||
err := md.worktree.Filesystem.Remove(source.name)
|
||||
if err != nil {
|
||||
log.Fatalf("could not remove dist-git file: %v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@ type ProcessData struct {
|
||||
type ignoredSource struct {
|
||||
name string
|
||||
hashFunction hash.Hash
|
||||
expired bool
|
||||
}
|
||||
|
||||
type modeData struct {
|
||||
@ -112,7 +113,9 @@ func ProcessRPM(pd *ProcessData) {
|
||||
md.repo = &sourceRepo
|
||||
md.worktree = &sourceWorktree
|
||||
md.tagBranch = branch
|
||||
md.sourcesToIgnore = []*ignoredSource{}
|
||||
for _, source := range md.sourcesToIgnore {
|
||||
source.expired = true
|
||||
}
|
||||
|
||||
rpmFile := md.rpmFile
|
||||
// create new repo for final dist
|
||||
@ -217,7 +220,11 @@ func ProcessRPM(pd *ProcessData) {
|
||||
log.Fatalf("could not create metadata file: %v", err)
|
||||
}
|
||||
for _, source := range md.sourcesToIgnore {
|
||||
sourcePath := "SOURCES/" + source.name
|
||||
if source.expired {
|
||||
continue
|
||||
}
|
||||
|
||||
sourcePath := source.name
|
||||
sourceFile, err := w.Filesystem.Open(sourcePath)
|
||||
if err != nil {
|
||||
log.Fatalf("could not open ignored source file %s: %v", sourcePath, err)
|
||||
@ -239,7 +246,7 @@ func ProcessRPM(pd *ProcessData) {
|
||||
log.Fatalf("could not write to metadata file: %v", err)
|
||||
}
|
||||
|
||||
path := fmt.Sprintf("%s/%s", rpmFile.Name(), checksum)
|
||||
path := fmt.Sprintf("%s", checksum)
|
||||
if strContains(alreadyUploadedBlobs, path) {
|
||||
continue
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user