mirror of
https://github.com/rocky-linux/srpmproc.git
synced 2024-06-02 08:10:17 +00:00
change default branch to "main" and rollback faulty change
This commit is contained in:
parent
541f446a50
commit
0c150ed1f8
|
@ -204,7 +204,7 @@ func executePatchesRpm(pd *ProcessData, md *modeData) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
err = w.Checkout(&git.CheckoutOptions{
|
err = w.Checkout(&git.CheckoutOptions{
|
||||||
Branch: plumbing.NewRemoteReferenceName("origin", "master"),
|
Branch: plumbing.NewRemoteReferenceName("origin", "main"),
|
||||||
Force: true,
|
Force: true,
|
||||||
})
|
})
|
||||||
// common patches found, apply them
|
// common patches found, apply them
|
||||||
|
@ -303,6 +303,9 @@ func patchModuleYaml(pd *ProcessData, md *modeData) {
|
||||||
pushBranch = strings.Replace(md.pushBranch, repString, newString, 1)
|
pushBranch = strings.Replace(md.pushBranch, repString, newString, 1)
|
||||||
} else if strings.HasPrefix(rpm.Ref, "stream-") && len(split) == 2 {
|
} else if strings.HasPrefix(rpm.Ref, "stream-") && len(split) == 2 {
|
||||||
pushBranch = md.pushBranch
|
pushBranch = md.pushBranch
|
||||||
|
} else if strings.HasPrefix(rpm.Ref, "stream-") && len(split) == 3 {
|
||||||
|
// example: ant
|
||||||
|
pushBranch = fmt.Sprintf("%s%d-stream-%s", pd.BranchPrefix, pd.Version, split[2])
|
||||||
} else if strings.HasPrefix(rpm.Ref, "stream-") {
|
} else if strings.HasPrefix(rpm.Ref, "stream-") {
|
||||||
pushBranch = fmt.Sprintf("%s%s-stream-%s", pd.BranchPrefix, string(split[3][0]), split[1])
|
pushBranch = fmt.Sprintf("%s%s-stream-%s", pd.BranchPrefix, string(split[3][0]), split[1])
|
||||||
} else if strings.HasPrefix(rpm.Ref, "rhel-") {
|
} else if strings.HasPrefix(rpm.Ref, "rhel-") {
|
||||||
|
|
|
@ -79,7 +79,7 @@ func ProcessRPM(pd *ProcessData) {
|
||||||
remotePrefix = "modules"
|
remotePrefix = "modules"
|
||||||
}
|
}
|
||||||
|
|
||||||
var pushedHashes []string
|
latestHashForBranch := map[string]string{}
|
||||||
|
|
||||||
// already uploaded blobs are skipped
|
// already uploaded blobs are skipped
|
||||||
var alreadyUploadedBlobs []string
|
var alreadyUploadedBlobs []string
|
||||||
|
@ -122,7 +122,6 @@ func ProcessRPM(pd *ProcessData) {
|
||||||
sourceWorktree := *md.worktree
|
sourceWorktree := *md.worktree
|
||||||
|
|
||||||
for _, branch := range md.branches {
|
for _, branch := range md.branches {
|
||||||
md.sourcesToIgnore = []*ignoredSource{}
|
|
||||||
md.repo = &sourceRepo
|
md.repo = &sourceRepo
|
||||||
md.worktree = &sourceWorktree
|
md.worktree = &sourceWorktree
|
||||||
md.tagBranch = branch
|
md.tagBranch = branch
|
||||||
|
@ -130,6 +129,10 @@ func ProcessRPM(pd *ProcessData) {
|
||||||
source.expired = true
|
source.expired = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.Contains(md.tagBranch, "-beta") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
rpmFile := md.rpmFile
|
rpmFile := md.rpmFile
|
||||||
// create new repo for final dist
|
// create new repo for final dist
|
||||||
repo, err := git.Init(memory.NewStorage(), memfs.New())
|
repo, err := git.Init(memory.NewStorage(), memfs.New())
|
||||||
|
@ -292,6 +295,18 @@ func ProcessRPM(pd *ProcessData) {
|
||||||
status, _ := w.Status()
|
status, _ := w.Status()
|
||||||
log.Printf("successfully processed:\n%s", status)
|
log.Printf("successfully processed:\n%s", status)
|
||||||
|
|
||||||
|
statusLines := strings.Split(status.String(), "\n")
|
||||||
|
for _, line := range statusLines {
|
||||||
|
trimmed := strings.TrimSpace(line)
|
||||||
|
if strings.HasPrefix(trimmed, "D") {
|
||||||
|
path := strings.TrimPrefix(trimmed, "D ")
|
||||||
|
_, err := w.Remove(path)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("could not delete extra file %s: %v", path, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var hashes []plumbing.Hash
|
var hashes []plumbing.Hash
|
||||||
var pushRefspecs []config.RefSpec
|
var pushRefspecs []config.RefSpec
|
||||||
|
|
||||||
|
@ -353,10 +368,10 @@ func ProcessRPM(pd *ProcessData) {
|
||||||
}
|
}
|
||||||
|
|
||||||
hashString := obj.Hash.String()
|
hashString := obj.Hash.String()
|
||||||
pushedHashes = append(pushedHashes, fmt.Sprintf("%s:%s", md.pushBranch, hashString))
|
latestHashForBranch[md.pushBranch] = hashString
|
||||||
}
|
}
|
||||||
|
|
||||||
err := json.NewEncoder(os.Stdout).Encode(pushedHashes)
|
err := json.NewEncoder(os.Stdout).Encode(latestHashForBranch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("could not print hashes")
|
log.Fatalf("could not print hashes")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user