devel-importer update

This commit is contained in:
2025-02-21 17:18:37 +01:00
parent ee6d704e1e
commit 9bac2e924c
2 changed files with 9 additions and 7 deletions

View File

@@ -45,6 +45,7 @@ type GitStatusLister interface {
}
type Git interface {
GitParseCommits(cwd string, commitIDs []string) (parsedCommits []commit, err error)
GitCatFile(cwd, commitId, filename string) (data []byte, err error)
GetPath() string

View File

@@ -69,16 +69,17 @@ func main() {
debugGitPath := flag.String("git-path", "", "Path for temporary git directory. Only used if DebugMode")
flag.Parse()
git, err := common.CreateGitHandler("Autogits - Devel Importer", "not.exist", "devel-importer")
gh := common.GitHandlerGeneratorImpl{}
git, err := gh.CreateGitHandler("Autogits - Devel Importer", "not.exist", "devel-importer")
if err != nil {
log.Panicln("Failed to allocate git handler. Err:", err)
}
if DebugMode {
log.Println(" - working directory:" + git.GitPath)
if len(*debugGitPath) > 0 {
git.Close()
git.GitPath = *debugGitPath
gh.ReadExistingPath("Autogits - Devel Importer", "not.exist", *debugGitPath)
}
log.Println(" - working directory:" + git.GetPath())
} else {
defer git.Close()
}
@@ -164,7 +165,7 @@ func main() {
log.Println("Num of old packages:", len(oldPackageNames))
// fork packags from pool
cmd := exec.Command("./git-importer", append([]string{"-r", git.GitPath}, oldPackageNames...)...)
cmd := exec.Command("./git-importer", append([]string{"-r", git.GetPath()}, oldPackageNames...)...)
out, err := cmd.CombinedOutput()
log.Println(string(out))
if err != nil {
@@ -177,7 +178,7 @@ func main() {
pkg := factoryRepos[i]
// verify that package was created by `git-importer`, or it's scmsync package and clone it
fi, err := os.Stat(filepath.Join(git.GitPath, pkg.Name))
fi, err := os.Stat(filepath.Join(git.GetPath(), pkg.Name))
if os.IsNotExist(err) {
// scmsync?
devel_project, err := runObsCommand("develproject", "openSUSE:Factory", pkg.Name)
@@ -197,7 +198,7 @@ func main() {
}
// try again, should now exist
if fi, err = os.Stat(filepath.Join(git.GitPath, pkg.Name)); err != nil {
if fi, err = os.Stat(filepath.Join(git.GetPath(), pkg.Name)); err != nil {
log.Panicln(err)
}
} else if err != nil {
@@ -300,7 +301,7 @@ func main() {
args[0] = "-p"
args[1] = prj
args[2] = "-r"
args[3] = git.GitPath
args[3] = git.GetPath()
args = append(args, develProjectPackages...)
cmd = exec.Command("./git-importer", args...)
out, err = cmd.CombinedOutput()