Fixes Branch Dirs
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful

This commit is contained in:
Stefan Hoffmann 2023-08-20 13:37:04 +02:00
parent 72430a2d8e
commit 97f41285c3
Signed by: stefan
GPG Key ID: 8EFC7042BF8D5CDD
2 changed files with 10 additions and 10 deletions

View File

@ -21,7 +21,7 @@ func main() {
br := *branch br := *branch
version := readVersions(*branch) version := readVersions(*branch)
var source_dir_branch string = sdir + br + "/images/" 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) { if is_firmware_folder(source_dir_branch) {
//generate manifest file for branch //generate manifest file for branch

View File

@ -19,17 +19,17 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) {
} }
sVersion := GetGluonVersion(sDir) sVersion := GetGluonVersion(sDir)
tVersion := GetGluonVersion(tDir) tVersion := GetGluonVersion(tDir)
fmt.Println("Target Version: ", tVersion) fmt.Println("Target Version:", b, tVersion)
fmt.Println("Source Version: ", sVersion) fmt.Println("Source Version:", b, sVersion)
fmt.Println("Wanted Version: ", v) fmt.Println("Wanted Version:", b, v)
//check wanted version in target //check wanted version in target
if tVersion == v { if tVersion == v {
log.Println("wanted version is already published!") log.Println(b, "wanted version is already published!")
os.Exit(0) 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 { 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) 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 // delete old firmware files in public folder
// if we are in stable branch, move images to archive // if we are in stable branch, move images to archive
if b == "stable" { if b == "stable" {
err := os.Rename(tDir+"/"+b, tDir+"/archive/v") err := os.Rename(tDir+"/*", tDir+"/archive/"+v)
if err != nil { if err != nil {
log.Fatalln(err) log.Fatalln(err)
} }
} else { } else {
for _, file := range check_tDir { for _, file := range check_tDir {
if !(dryrun) { if !(dryrun) {
err := os.RemoveAll(tDir + file.Name()) err := os.RemoveAll(tDir + "/" + file.Name())
if err != nil { if err != nil {
log.Println("error deleting file: ", err) log.Println("error deleting file: ", err)
} else { } else {
@ -69,7 +69,7 @@ func release_branch(b string, sDir string, tDir string, dryrun bool, v string) {
} }
func GetGluonVersion(path string) string { func GetGluonVersion(path string) string {
image_folder := path + "sysupgrade/" image_folder := path + "/sysupgrade/"
files, err := filepath.Glob(filepath.Join(image_folder, "gluon-tdf-*")) files, err := filepath.Glob(filepath.Join(image_folder, "gluon-tdf-*"))
if err != nil { if err != nil {
fmt.Println("Error reading directory: ", err) fmt.Println("Error reading directory: ", err)