Skip to content

Commit

Permalink
sdk: Use new manifests location
Browse files Browse the repository at this point in the history
  • Loading branch information
krnowak committed Oct 26, 2023
1 parent 9eef5e9 commit 2776347
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions sdk/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,15 @@ func OSRelease(root string) (ver Versions, err error) {
}

func SetManifestSDKVersion(version string) error {
versionPath := filepath.Join(RepoRoot(), ".repo", "manifests", "version.txt")
versionPath := filepath.Join(RepoRoot(), "src", "scripts", "manifests", "version.txt")
originalContent, err := ioutil.ReadFile(versionPath)
if err != nil {
return err
// Try old location.
versionPath = filepath.Join(RepoRoot(), ".repo", "manifests", "version.txt")
originalContent, err = ioutil.ReadFile(versionPath)
if err != nil {
return err
}
}

re := regexp.MustCompile(`FLATCAR_SDK_VERSION=.*`)
Expand Down Expand Up @@ -123,7 +128,11 @@ func VersionsFromDir(dir string) (ver Versions, err error) {
}

func VersionsFromManifest() (Versions, error) {
return VersionsFromDir(filepath.Join(RepoRoot(), ".repo", "manifests"))
versions, err := VersionsFromDir(filepath.Join(RepoRoot(), "src", "scripts", "manifests"))
if err != nil {
versions, err = VersionsFromDir(filepath.Join(RepoRoot(), ".repo", "manifests"))
}
return versions, err
}

func versionsFromRemoteRepoMaybeVerify(url, branch string, verify bool) (ver Versions, err error) {
Expand Down

0 comments on commit 2776347

Please sign in to comment.