mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2024-06-02 08:10:17 +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{
|
md.sourcesToIgnore = append(md.sourcesToIgnore, &ignoredSource{
|
||||||
name: filepath.Base(path),
|
name: path,
|
||||||
hashFunction: hasher,
|
hashFunction: hasher,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -189,9 +189,12 @@ func (g *GitMode) WriteSource(md *modeData) {
|
||||||
|
|
||||||
func (g *GitMode) PostProcess(md *modeData) {
|
func (g *GitMode) PostProcess(md *modeData) {
|
||||||
for _, source := range md.sourcesToIgnore {
|
for _, source := range md.sourcesToIgnore {
|
||||||
err := md.worktree.Filesystem.Remove(filepath.Join("SOURCES", source.name))
|
_, err := md.worktree.Filesystem.Stat(source.name)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
log.Fatalf("could not remove dist-git file: %v", err)
|
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 {
|
type ignoredSource struct {
|
||||||
name string
|
name string
|
||||||
hashFunction hash.Hash
|
hashFunction hash.Hash
|
||||||
|
expired bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type modeData struct {
|
type modeData struct {
|
||||||
|
@ -112,7 +113,9 @@ func ProcessRPM(pd *ProcessData) {
|
||||||
md.repo = &sourceRepo
|
md.repo = &sourceRepo
|
||||||
md.worktree = &sourceWorktree
|
md.worktree = &sourceWorktree
|
||||||
md.tagBranch = branch
|
md.tagBranch = branch
|
||||||
md.sourcesToIgnore = []*ignoredSource{}
|
for _, source := range md.sourcesToIgnore {
|
||||||
|
source.expired = true
|
||||||
|
}
|
||||||
|
|
||||||
rpmFile := md.rpmFile
|
rpmFile := md.rpmFile
|
||||||
// create new repo for final dist
|
// create new repo for final dist
|
||||||
|
@ -217,7 +220,11 @@ func ProcessRPM(pd *ProcessData) {
|
||||||
log.Fatalf("could not create metadata file: %v", err)
|
log.Fatalf("could not create metadata file: %v", err)
|
||||||
}
|
}
|
||||||
for _, source := range md.sourcesToIgnore {
|
for _, source := range md.sourcesToIgnore {
|
||||||
sourcePath := "SOURCES/" + source.name
|
if source.expired {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
sourcePath := source.name
|
||||||
sourceFile, err := w.Filesystem.Open(sourcePath)
|
sourceFile, err := w.Filesystem.Open(sourcePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("could not open ignored source file %s: %v", sourcePath, err)
|
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)
|
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) {
|
if strContains(alreadyUploadedBlobs, path) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user