Commit 9de0f812 authored by Mustafa Gezen's avatar Mustafa Gezen
Browse files

prune lookaside files that change in the same stream

parent 059cb525
......@@ -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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment