Skip to content

Commit

Permalink
Update go-alpm
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo committed Feb 14, 2019
1 parent a645353 commit 895788e
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 39 deletions.
2 changes: 1 addition & 1 deletion cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func syncList(parser *arguments) error {
} else {
fmt.Printf("%s %s %s", magenta("aur"), bold(name), bold(green("unknown-version")))

if _, err := localDB.Pkg(name); err == nil {
if localDB.Pkg(name) != nil {
fmt.Print(bold(blue(" [Installed]")))
}

Expand Down
8 changes: 4 additions & 4 deletions depPool.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ func (dp *depPool) ResolveTargets(pkgs []string) error {
//the user specified a db but there's no easy way to do
//it without making alpm_lists so don't bother for now
//db/group is probably a rare use case
group, err := dp.SyncDB.FindGroupPkgs(target.Name)
if err == nil {
group := dp.SyncDB.FindGroupPkgs(target.Name)
if !group.Empty() {
dp.Groups = append(dp.Groups, target.String())
group.ForEach(func(pkg alpm.Package) error {
dp.Explicit.set(pkg.Name())
Expand Down Expand Up @@ -207,7 +207,7 @@ func (dp *depPool) findProvides(pkgs stringSet) error {
}

for pkg := range pkgs {
if _, err := dp.LocalDB.Pkg(pkg); err == nil {
if dp.LocalDB.Pkg(pkg) != nil {
continue
}
wg.Add(1)
Expand Down Expand Up @@ -389,7 +389,7 @@ func (dp *depPool) findSatisfierAurCache(dep string) *rpc.Pkg {
seen := make(stringSet)
providers := makeProviders(depName)

if _, err := dp.LocalDB.Pkg(depName); err == nil {
if dp.LocalDB.Pkg(depName) != nil {
if pkg, ok := dp.AurCache[dep]; ok && pkgSatisfies(pkg.Name, pkg.Version, dep) {
return pkg
}
Expand Down
4 changes: 2 additions & 2 deletions download.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,11 @@ func getPkgbuildsfromABS(pkgs []string, path string) (bool, error) {

if pkgDB != "" {
if db, err := alpmHandle.SyncDBByName(pkgDB); err == nil {
pkg, err = db.Pkg(name)
pkg = db.Pkg(name)
}
} else {
dbList.ForEach(func(db alpm.DB) error {
if pkg, err = db.Pkg(name); err == nil {
if pkg = db.Pkg(name); pkg != nil {
return fmt.Errorf("")
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/Jguer/yay/v9
require (
github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f
github.com/Morganamilo/go-srcinfo v0.0.0-20180702014333-368edc79b2c5
github.com/jguer/go-alpm v0.0.0-20181021002825-676ad6bbf3c0
github.com/jguer/go-alpm v0.0.0-20190214204021-327c7630865b
github.com/mikkeloscar/aur v0.0.0-20181111113612-b71516da3ae9
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5 h1:JPIXUHXLZYwYUTlGp
github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5/go.mod h1:1F60/e8oQFVJrZRH0TBqwtiB5ajJ5avOc4MoGRY9CFU=
github.com/jguer/go-alpm v0.0.0-20181021002825-676ad6bbf3c0 h1:MtH4SM1pw+23QhMERYK38DyGNqf6F3zUhxeKmQhuHC0=
github.com/jguer/go-alpm v0.0.0-20181021002825-676ad6bbf3c0/go.mod h1:1F60/e8oQFVJrZRH0TBqwtiB5ajJ5avOc4MoGRY9CFU=
github.com/jguer/go-alpm v0.0.0-20190214204021-327c7630865b h1:lQICb6Gw0HDAZlAGdveIp/zww2TVBwQvOM5VtAMpulc=
github.com/jguer/go-alpm v0.0.0-20190214204021-327c7630865b/go.mod h1:1F60/e8oQFVJrZRH0TBqwtiB5ajJ5avOc4MoGRY9CFU=
github.com/mikkeloscar/aur v0.0.0-20180725140122-f998dbf94dc4 h1:qgHSZbD0g3W7KAkZFzXlSqgriYnzEUFS1gkgEiv2GrE=
github.com/mikkeloscar/aur v0.0.0-20180725140122-f998dbf94dc4/go.mod h1:n1NKHoldRNhIEufSx1PiDYcd2W+wpbz5/5K+p2eNDVk=
github.com/mikkeloscar/aur v0.0.0-20181111113612-b71516da3ae9 h1:g4TBYa1sjv/TZfU9t82oYlRneu8cCVr3dnazE7os5vw=
Expand Down
9 changes: 2 additions & 7 deletions install.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,7 @@ func inRepos(syncDB alpm.DBList, pkg string) bool {
return true
}

_, err = syncDB.FindGroupPkgs(target.Name)
if err == nil {
return true
}

return false
return !syncDB.FindGroupPkgs(target.Name).Empty()
}

func earlyPacmanCall(parser *arguments) error {
Expand Down Expand Up @@ -950,7 +945,7 @@ func buildInstallPkgbuilds(dp *depPool, do *depOrder, srcinfos map[string]*gosrc
if cmdArgs.existsArg("needed") {
installed := true
for _, split := range base {
if alpmpkg, err := dp.LocalDB.Pkg(split.Name); err != nil || alpmpkg.Version() != version {
if alpmpkg := dp.LocalDB.Pkg(split.Name); alpmpkg == nil || alpmpkg.Version() != version {
installed = false
}
}
Expand Down
4 changes: 2 additions & 2 deletions print.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (q aurQuery) printSearch(start int) {
toprint += bold(red("(Out-of-date "+formatTime(res.OutOfDate)+")")) + " "
}

if pkg, err := localDB.Pkg(res.Name); err == nil {
if pkg := localDB.Pkg(res.Name); pkg != nil {
if pkg.Version() != res.Version {
toprint += bold(green("(Installed: " + pkg.Version() + ")"))
} else {
Expand Down Expand Up @@ -126,7 +126,7 @@ func (s repoQuery) printSearch() {

localDB, err := alpmHandle.LocalDB()
if err == nil {
if pkg, err := localDB.Pkg(res.Name()); err == nil {
if pkg := localDB.Pkg(res.Name()); pkg != nil {
if pkg.Version() != res.Version() {
toprint += bold(green("(Installed: " + pkg.Version() + ")"))
} else {
Expand Down
11 changes: 4 additions & 7 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func filterPackages() (local []alpm.Package, remote []alpm.Package,
if found {
return nil
}
_, err := d.Pkg(k.Name())
if err == nil {

if d.Pkg(k.Name()) != nil {
found = true
local = append(local, k)
localNames = append(localNames, k.Name())
Expand Down Expand Up @@ -301,9 +301,7 @@ func packageSlices(toCheck []string) (aur []string, repo []string, err error) {
}

_ = dbList.ForEach(func(db alpm.DB) error {
_, err := db.Pkg(name)

if err == nil {
if db.Pkg(name) != nil {
found = true
return fmt.Errorf("")

Expand All @@ -312,8 +310,7 @@ func packageSlices(toCheck []string) (aur []string, repo []string, err error) {
})

if !found {
_, errdb := dbList.FindGroupPkgs(name)
found = errdb == nil
found = !dbList.FindGroupPkgs(name).Empty()
}

if found {
Expand Down
3 changes: 1 addition & 2 deletions upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,9 @@ func upRepo(local []alpm.Package) (upSlice, error) {

alpmHandle.SyncSysupgrade(cmdArgs.existsDouble("u", "sysupgrade"))
alpmHandle.TransGetAdd().ForEach(func(pkg alpm.Package) error {
localPkg, err := localDB.Pkg(pkg.Name())
localVer := "-"

if err == nil {
if localPkg := localDB.Pkg(pkg.Name()); localPkg != nil {
localVer = localPkg.Version()
}

Expand Down
16 changes: 4 additions & 12 deletions vendor/github.com/jguer/go-alpm/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions vendor/github.com/jguer/go-alpm/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ github.com/Morganamilo/go-pacmanconf
github.com/Morganamilo/go-pacmanconf/ini
# github.com/Morganamilo/go-srcinfo v0.0.0-20180702014333-368edc79b2c5
github.com/Morganamilo/go-srcinfo
# github.com/jguer/go-alpm v0.0.0-20181021002825-676ad6bbf3c0
# github.com/jguer/go-alpm v0.0.0-20190214204021-327c7630865b
github.com/jguer/go-alpm
# github.com/mikkeloscar/aur v0.0.0-20181111113612-b71516da3ae9
github.com/mikkeloscar/aur

0 comments on commit 895788e

Please sign in to comment.