mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +00:00
Add symlink creation on release and simplify version selection
This commit is contained in:
parent
6b85fe1501
commit
7bf7662661
1 changed files with 33 additions and 14 deletions
|
@ -47,10 +47,31 @@ func release(cmd *cobra.Command, args []string) error {
|
||||||
return removeFilesFromIndex(getChannelVersions(channel, preReleaseFrom, true))
|
return removeFilesFromIndex(getChannelVersions(channel, preReleaseFrom, true))
|
||||||
}
|
}
|
||||||
|
|
||||||
return writeIndex(
|
// Write new index.
|
||||||
|
err := writeIndex(
|
||||||
channel,
|
channel,
|
||||||
getChannelVersions(channel, preReleaseFrom, false),
|
getChannelVersions(channel, preReleaseFrom, false),
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only when doing a release:
|
||||||
|
if preReleaseFrom == "" {
|
||||||
|
// Create symlinks to latest stable versions.
|
||||||
|
if !confirm("\nDo you want to write latest symlinks?") {
|
||||||
|
fmt.Println("aborted...")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
symlinksDir := registry.StorageDir().ChildDir("latest", 0o755)
|
||||||
|
err = registry.CreateSymlinks(symlinksDir)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println("written latest symlinks")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeIndex(channel string, versions map[string]string) error {
|
func writeIndex(channel string, versions map[string]string) error {
|
||||||
|
@ -103,8 +124,8 @@ func removeFilesFromIndex(versions map[string]string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("deleted")
|
fmt.Println("deleted")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,20 +148,18 @@ func getChannelVersions(channel string, prereleaseFrom string, storagePath bool)
|
||||||
// Go through all versions and save the highest version, if not stable or beta.
|
// Go through all versions and save the highest version, if not stable or beta.
|
||||||
versions := make(map[string]string)
|
versions := make(map[string]string)
|
||||||
for _, rv := range export {
|
for _, rv := range export {
|
||||||
for _, v := range rv.Versions {
|
highestVersion := rv.Versions[0]
|
||||||
// Ignore versions that are in the reference release channel.
|
|
||||||
if v.CurrentRelease {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add highest version of matching release channel.
|
// Ignore versions that are in the reference release channel.
|
||||||
if storagePath {
|
if highestVersion.CurrentRelease {
|
||||||
versions[rv.Identifier] = rv.GetFile().Path()
|
continue
|
||||||
} else {
|
}
|
||||||
versions[rv.Identifier] = v.VersionNumber
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
// Add highest version of matching release channel.
|
||||||
|
if storagePath {
|
||||||
|
versions[rv.Identifier] = rv.GetFile().Path()
|
||||||
|
} else {
|
||||||
|
versions[rv.Identifier] = highestVersion.VersionNumber
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue