devel-importer: handle cases where remotes or factory branch not main

This commit is contained in:
Adam Majer 2024-09-18 13:51:52 +02:00
parent 530318a35b
commit c955811373

View File

@ -240,18 +240,26 @@ func main() {
} }
// check that nothing is broken with the update // check that nothing is broken with the update
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "factory") if slices.Contains(remotes, "factory") {
old_revs := strings.Split(out, "\n") head_branch := "factory"
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "factory", "^factory/factory") out, err = git.GitExecWithOutput(pkgName, "rev-list", head_branch)
added_revs := strings.Split(out, "\n") if err != nil {
added_rpm_revs := []string{} head_branch = "HEAD"
if slices.Contains(remotes, "rpm") { out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "HEAD")
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "factory", "^rpm/factory") }
added_rpm_revs = strings.Split(out, "\n") old_revs := strings.Split(out, "\n")
} added_revs := []string{}
if len(added_revs) == len(old_revs) && len(added_rpm_revs) == len(old_revs) { out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", head_branch, "^factory/factory")
log.Printf("Something is wrong with rev-ist for (len %d): %s\n", len(added_revs), pkgName) added_revs = strings.Split(out, "\n")
reposOK = false added_rpm_revs := []string{}
if slices.Contains(remotes, "rpm") {
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", head_branch, "^rpm/factory")
added_rpm_revs = strings.Split(out, "\n")
}
if len(added_revs) == len(old_revs) && len(added_rpm_revs) == len(old_revs) {
log.Printf("Something is wrong with rev-ist for (len %d): %s\n", len(added_revs), pkgName)
reposOK = false
}
} }
} }
@ -259,7 +267,7 @@ func main() {
args[0] = "-p" args[0] = "-p"
args[1] = prj args[1] = prj
args[2] = "-r" args[2] = "-r"
args[4] = git.GitPath args[3] = git.GitPath
args = append(args, develProjectPackages...) args = append(args, develProjectPackages...)
cmd = exec.Command("./git-importer", args...) cmd = exec.Command("./git-importer", args...)
out, err = cmd.CombinedOutput() out, err = cmd.CombinedOutput()