Bug fixes and added pre_update.sh pacakge scripts #7

Merged
EnumDev merged 5 commits from develop into master 2024-10-23 06:18:01 +00:00
Showing only changes of commit 4793424f3d - Show all commits

56
main.go
View File

@ -273,15 +273,15 @@ func resolveCommand() {
if installedInfo == nil { if installedInfo == nil {
fmt.Printf("%s: %s (Install) %s\n", pkgInfo.Name, pkgInfo.GetFullVersion(), sourceInfo) fmt.Printf("%s: %s (Install) %s\n", pkgInfo.Name, pkgInfo.GetFullVersion(), sourceInfo)
}
comparison := utils.ComparePackageVersions(*pkgInfo, *installedInfo)
if comparison < 0 {
fmt.Printf("%s: %s -> %s (Downgrade) %s\n", pkgInfo.Name, installedInfo.GetFullVersion(), pkgInfo.GetFullVersion(), sourceInfo)
} else if comparison > 0 {
fmt.Printf("%s: %s -> %s (Upgrade) %s\n", pkgInfo.Name, installedInfo.GetFullVersion(), pkgInfo.GetFullVersion(), sourceInfo)
} else { } else {
fmt.Printf("%s: %s (Reinstall) %s\n", pkgInfo.Name, pkgInfo.GetFullVersion(), sourceInfo) comparison := utils.ComparePackageVersions(*pkgInfo, *installedInfo)
if comparison < 0 {
fmt.Printf("%s: %s -> %s (Downgrade) %s\n", pkgInfo.Name, installedInfo.GetFullVersion(), pkgInfo.GetFullVersion(), sourceInfo)
} else if comparison > 0 {
fmt.Printf("%s: %s -> %s (Upgrade) %s\n", pkgInfo.Name, installedInfo.GetFullVersion(), pkgInfo.GetFullVersion(), sourceInfo)
} else {
fmt.Printf("%s: %s (Reinstall) %s\n", pkgInfo.Name, pkgInfo.GetFullVersion(), sourceInfo)
}
} }
} }
if rootDir != "/" { if rootDir != "/" {
@ -386,19 +386,19 @@ func resolveCommand() {
installedInfo := utils.GetPackageInfo(pkg, rootDir, true) installedInfo := utils.GetPackageInfo(pkg, rootDir, true)
if installedInfo == nil { if installedInfo == nil {
log.Fatalf("Error: could not get package info for (%s)\n", pkg) log.Fatalf("Error: could not get package info for (%s)\n", pkg)
} } else {
comparison := utils.ComparePackageVersions(*entry.Info, *installedInfo)
comparison := utils.ComparePackageVersions(*entry.Info, *installedInfo) if comparison > 0 {
if comparison > 0 { toUpdate.Set(entry.Info.Name, &struct {
toUpdate.Set(entry.Info.Name, &struct { isDependency bool
isDependency bool entry *utils.RepositoryEntry
entry *utils.RepositoryEntry }{isDependency: false, entry: entry})
}{isDependency: false, entry: entry}) } else if reinstall {
} else if reinstall { toUpdate.Set(entry.Info.Name, &struct {
toUpdate.Set(entry.Info.Name, &struct { isDependency bool
isDependency bool entry *utils.RepositoryEntry
entry *utils.RepositoryEntry }{isDependency: false, entry: entry})
}{isDependency: false, entry: entry}) }
} }
} }
if toUpdate.Len() == 0 { if toUpdate.Len() == 0 {
@ -445,13 +445,13 @@ func resolveCommand() {
if installedInfo == nil { if installedInfo == nil {
fmt.Printf("%s: %s (Install) %s\n", value.entry.Info.Name, value.entry.Info.GetFullVersion(), sourceInfo) fmt.Printf("%s: %s (Install) %s\n", value.entry.Info.Name, value.entry.Info.GetFullVersion(), sourceInfo)
continue continue
} } else {
comparison := utils.ComparePackageVersions(*value.entry.Info, *installedInfo)
comparison := utils.ComparePackageVersions(*value.entry.Info, *installedInfo) if comparison > 0 {
if comparison > 0 { fmt.Printf("%s: %s -> %s (Upgrade) %s\n", value.entry.Info.Name, installedInfo.GetFullVersion(), value.entry.Info.GetFullVersion(), sourceInfo)
fmt.Printf("%s: %s -> %s (Upgrade) %s\n", value.entry.Info.Name, installedInfo.GetFullVersion(), value.entry.Info.GetFullVersion(), sourceInfo) } else if reinstall {
} else if reinstall { fmt.Printf("%s: %s -> %s (Reinstall) %s\n", value.entry.Info.Name, installedInfo.GetFullVersion(), value.entry.Info.GetFullVersion(), sourceInfo)
fmt.Printf("%s: %s -> %s (Reinstall) %s\n", value.entry.Info.Name, installedInfo.GetFullVersion(), value.entry.Info.GetFullVersion(), sourceInfo) }
} }
} }