mirror of
https://github.com/Jguer/yay
synced 2024-10-31 04:12:51 +00:00
Ensure devel packages exist when updating
This commit is contained in:
parent
892d9cc752
commit
95bcea8f40
1 changed files with 32 additions and 32 deletions
40
upgrade.go
40
upgrade.go
|
@ -121,7 +121,7 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
var repoErr error
|
var repoErr error
|
||||||
var aurErr error
|
var aurErr error
|
||||||
|
|
||||||
pkgdata := make(map[string]*rpc.Pkg)
|
aurdata := make(map[string]*rpc.Pkg)
|
||||||
|
|
||||||
if mode == ModeAny || mode == ModeRepo {
|
if mode == ModeAny || mode == ModeRepo {
|
||||||
fmt.Println(bold(cyan("::") + bold(" Searching databases for updates...")))
|
fmt.Println(bold(cyan("::") + bold(" Searching databases for updates...")))
|
||||||
|
@ -134,9 +134,17 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
|
|
||||||
if mode == ModeAny || mode == ModeAUR {
|
if mode == ModeAny || mode == ModeAUR {
|
||||||
fmt.Println(bold(cyan("::") + bold(" Searching AUR for updates...")))
|
fmt.Println(bold(cyan("::") + bold(" Searching AUR for updates...")))
|
||||||
|
|
||||||
|
var _aurdata []*rpc.Pkg
|
||||||
|
_aurdata, aurErr = aurInfo(remoteNames, warnings)
|
||||||
|
if aurErr == nil {
|
||||||
|
for _, pkg := range _aurdata {
|
||||||
|
aurdata[pkg.Name] = pkg
|
||||||
|
}
|
||||||
|
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
aurUp, aurErr = upAUR(remote, remoteNames, pkgdata, warnings)
|
aurUp, aurErr = upAUR(remote, aurdata)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -144,15 +152,16 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
fmt.Println(bold(cyan("::") + bold(" Checking development packages...")))
|
fmt.Println(bold(cyan("::") + bold(" Checking development packages...")))
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
develUp = upDevel(remote)
|
develUp = upDevel(remote, aurdata)
|
||||||
wg.Done()
|
wg.Done()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
printLocalNewerThanAUR(remote, pkgdata)
|
printLocalNewerThanAUR(remote, aurdata)
|
||||||
|
|
||||||
errs := make([]string, 0)
|
errs := make([]string, 0)
|
||||||
for _, e := range []error{repoErr, aurErr} {
|
for _, e := range []error{repoErr, aurErr} {
|
||||||
|
@ -183,7 +192,7 @@ func upList(warnings *aurWarnings) (aurUp upSlice, repoUp upSlice, err error) {
|
||||||
return aurUp, repoUp, err
|
return aurUp, repoUp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func upDevel(remote []alpm.Package) (toUpgrade upSlice) {
|
func upDevel(remote []alpm.Package, aurdata map[string]*rpc.Pkg) (toUpgrade upSlice) {
|
||||||
toUpdate := make([]alpm.Package, 0)
|
toUpdate := make([]alpm.Package, 0)
|
||||||
toRemove := make([]string, 0)
|
toRemove := make([]string, 0)
|
||||||
|
|
||||||
|
@ -195,6 +204,7 @@ func upDevel(remote []alpm.Package) (toUpgrade upSlice) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
if e.needsUpdate() {
|
if e.needsUpdate() {
|
||||||
|
if _, ok := aurdata[vcsName]; ok {
|
||||||
for _, pkg := range remote {
|
for _, pkg := range remote {
|
||||||
if pkg.Name() == vcsName {
|
if pkg.Name() == vcsName {
|
||||||
mux1.Lock()
|
mux1.Lock()
|
||||||
|
@ -203,6 +213,7 @@ func upDevel(remote []alpm.Package) (toUpgrade upSlice) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mux2.Lock()
|
mux2.Lock()
|
||||||
toRemove = append(toRemove, vcsName)
|
toRemove = append(toRemove, vcsName)
|
||||||
|
@ -231,22 +242,11 @@ func upDevel(remote []alpm.Package) (toUpgrade upSlice) {
|
||||||
|
|
||||||
// upAUR gathers foreign packages and checks if they have new versions.
|
// upAUR gathers foreign packages and checks if they have new versions.
|
||||||
// Output: Upgrade type package list.
|
// Output: Upgrade type package list.
|
||||||
func upAUR(
|
func upAUR(remote []alpm.Package, aurdata map[string]*rpc.Pkg) (upSlice, error) {
|
||||||
remote []alpm.Package, remoteNames []string,
|
|
||||||
pkgdata map[string]*rpc.Pkg, warnings *aurWarnings) (upSlice, error) {
|
|
||||||
|
|
||||||
toUpgrade := make(upSlice, 0)
|
toUpgrade := make(upSlice, 0)
|
||||||
_pkgdata, err := aurInfo(remoteNames, warnings)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, pkg := range _pkgdata {
|
|
||||||
pkgdata[pkg.Name] = pkg
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, pkg := range remote {
|
for _, pkg := range remote {
|
||||||
aurPkg, ok := pkgdata[pkg.Name()]
|
aurPkg, ok := aurdata[pkg.Name()]
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -274,9 +274,9 @@ func printIgnoringPackage(pkg alpm.Package, newPkgVersion string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func printLocalNewerThanAUR(
|
func printLocalNewerThanAUR(
|
||||||
remote []alpm.Package, pkgdata map[string]*rpc.Pkg) {
|
remote []alpm.Package, aurdata map[string]*rpc.Pkg) {
|
||||||
for _, pkg := range remote {
|
for _, pkg := range remote {
|
||||||
aurPkg, ok := pkgdata[pkg.Name()]
|
aurPkg, ok := aurdata[pkg.Name()]
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue