From 97f41285c33abb3ad5527cf43d5b33405c5d214d Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 20 Aug 2023 13:37:04 +0200 Subject: [PATCH] Fixes Branch Dirs --- main.go | 2 +- release.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 53c277c..4f85c53 100644 --- a/main.go +++ b/main.go @@ -21,7 +21,7 @@ func main() { br := *branch version := readVersions(*branch) var source_dir_branch string = sdir + br + "/images/" - var target_dir_branch string = tdir + br + "/" + var target_dir_branch string = tdir + br if is_firmware_folder(source_dir_branch) { //generate manifest file for branch diff --git a/release.go b/release.go index a2dc804..beb8a50 100644 --- a/release.go +++ b/release.go @@ -19,17 +19,17 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) { } sVersion := GetGluonVersion(sDir) tVersion := GetGluonVersion(tDir) - fmt.Println("Target Version: ", tVersion) - fmt.Println("Source Version: ", sVersion) - fmt.Println("Wanted Version: ", v) + fmt.Println("Target Version:", b, tVersion) + fmt.Println("Source Version:", b, sVersion) + fmt.Println("Wanted Version:", b, v) //check wanted version in target if tVersion == v { - log.Println("wanted version is already published!") + log.Println(b, "wanted version is already published!") os.Exit(0) } - log.Println("published version is outdated, try to update from source folder") + log.Println(b, "published version is outdated, try to update from source folder") if sVersion != v { - log.Println("wanted Version is not availible in source folder") + log.Println(b, "wanted Version is not availible in source folder") os.Exit(1) } @@ -37,14 +37,14 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) { // delete old firmware files in public folder // if we are in stable branch, move images to archive if b == "stable" { - err := os.Rename(tDir+"/"+b, tDir+"/archive/v") + err := os.Rename(tDir+"/*", tDir+"/archive/"+v) if err != nil { log.Fatalln(err) } } else { for _, file := range check_tDir { if !(dryrun) { - err := os.RemoveAll(tDir + file.Name()) + err := os.RemoveAll(tDir + "/" + file.Name()) if err != nil { log.Println("error deleting file: ", err) } else { @@ -69,7 +69,7 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) { } func GetGluonVersion(path string) string { - image_folder := path + "sysupgrade/" + image_folder := path + "/sysupgrade/" files, err := filepath.Glob(filepath.Join(image_folder, "gluon-tdf-*")) if err != nil { fmt.Println("Error reading directory: ", err)