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
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "factory")
old_revs := strings.Split(out, "\n")
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "factory", "^factory/factory")
added_revs := strings.Split(out, "\n")
added_rpm_revs := []string{}
if slices.Contains(remotes, "rpm") {
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "factory", "^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
if slices.Contains(remotes, "factory") {
head_branch := "factory"
out, err = git.GitExecWithOutput(pkgName, "rev-list", head_branch)
if err != nil {
head_branch = "HEAD"
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", "HEAD")
}
old_revs := strings.Split(out, "\n")
added_revs := []string{}
out = git.GitExecWithOutputOrPanic(pkgName, "rev-list", head_branch, "^factory/factory")
added_revs = strings.Split(out, "\n")
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[1] = prj
args[2] = "-r"
args[4] = git.GitPath
args[3] = git.GitPath
args = append(args, develProjectPackages...)
cmd = exec.Command("./git-importer", args...)
out, err = cmd.CombinedOutput()