1
0
mirror of https://github.com/Jguer/yay.git synced 2025-08-15 02:57:21 +02:00

Merge pull request #360 from Morganamilo/fixup

Small fixups
This commit is contained in:
Anna 2018-04-17 18:26:40 +01:00 committed by GitHub
commit 5fb61731a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 25 additions and 21 deletions

View File

@ -25,7 +25,7 @@ func questionCallback(question alpm.QuestionAny) {
}) })
fmt.Print(bold(cyan(":: "))) fmt.Print(bold(cyan(":: ")))
str := bold(fmt.Sprintf(bold("There are %d providers avalable for %s:"), size, qp.Dep())) str := bold(fmt.Sprintf(bold("There are %d providers available for %s:"), size, qp.Dep()))
size = 1 size = 1
var db string var db string

6
cmd.go
View File

@ -199,14 +199,14 @@ func handleHelp() error {
if cmdArgs.op == "Y" || cmdArgs.op == "yay" { if cmdArgs.op == "Y" || cmdArgs.op == "yay" {
usage() usage()
return nil return nil
} else {
return passToPacman(cmdArgs)
} }
return passToPacman(cmdArgs)
} }
//this function should only set config options //this function should only set config options
//but currently still uses the switch left over from old code //but currently still uses the switch left over from old code
//eventually this should be refactored out futher //eventually this should be refactored out further
//my current plan is to have yay specific operations in its own operator //my current plan is to have yay specific operations in its own operator
//e.g. yay -Y --gendb //e.g. yay -Y --gendb
//e.g yay -Yg //e.g yay -Yg

View File

@ -301,7 +301,7 @@ func depCatagoriesRecursive(_pkg *rpc.Pkg, dc *depCatagories, dt *depTree, isMak
// //
// For Aur dependencies depends, makedepends and checkdepends are resolved but // For Aur dependencies depends, makedepends and checkdepends are resolved but
// for repo packages only depends are resolved as they are prebuilt. // for repo packages only depends are resolved as they are prebuilt.
// The return will be split into three catagories: Repo, Aur and Missing. // The return will be split into three categories: Repo, Aur and Missing.
// The return is in no way ordered. This step is is just aimed at gathering the // The return is in no way ordered. This step is is just aimed at gathering the
// packages we need. // packages we need.
// //

View File

@ -566,12 +566,12 @@ func downloadPkgBuilds(pkgs []*rpc.Pkg, targets stringSet, bases map[string][]*r
return nil return nil
} }
func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, incompatable stringSet) (err error) { func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, incompatible stringSet) (err error) {
for _, pkg := range pkgs { for _, pkg := range pkgs {
dir := filepath.Join(config.BuildDir, pkg.PackageBase) dir := filepath.Join(config.BuildDir, pkg.PackageBase)
args := []string{"--verifysource", "-Ccf"} args := []string{"--verifysource", "-Ccf"}
if incompatable.get(pkg.PackageBase) { if incompatible.get(pkg.PackageBase) {
args = append(args, "--ignorearch") args = append(args, "--ignorearch")
} }
@ -584,7 +584,7 @@ func downloadPkgBuildsSources(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg, inco
return return
} }
func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, targets stringSet, parser *arguments, bases map[string][]*rpc.Pkg, incompatable stringSet) error { func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, targets stringSet, parser *arguments, bases map[string][]*rpc.Pkg, incompatible stringSet) error {
arch, err := alpmHandle.Arch() arch, err := alpmHandle.Arch()
if err != nil { if err != nil {
return err return err
@ -635,7 +635,7 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
} else { } else {
args := []string{"-Ccf", "--noconfirm"} args := []string{"-Ccf", "--noconfirm"}
if incompatable.get(pkg.PackageBase) { if incompatible.get(pkg.PackageBase) {
args = append(args, "--ignorearch") args = append(args, "--ignorearch")
} }

View File

@ -150,7 +150,7 @@ func TestCheckPgpKeys(t *testing.T) {
// 487EACC08557AD082088DABA1EB2638FF56C0C53: Dave Reisner. // 487EACC08557AD082088DABA1EB2638FF56C0C53: Dave Reisner.
{ {
pkgs: []*rpc.Pkg{newPkg("cower")}, pkgs: []*rpc.Pkg{newPkg("cower")},
srcinfos: map[string]*gopkg.PKGBUILD{"cower": &gopkg.PKGBUILD{Pkgbase: "cower", Validpgpkeys: []string{"487EACC08557AD082088DABA1EB2638FF56C0C53"}}}, srcinfos: map[string]*gopkg.PKGBUILD{"cower": {Pkgbase: "cower", Validpgpkeys: []string{"487EACC08557AD082088DABA1EB2638FF56C0C53"}}},
bases: map[string][]*rpc.Pkg{"cower": {newPkg("cower")}}, bases: map[string][]*rpc.Pkg{"cower": {newPkg("cower")}},
wantError: false, wantError: false,
}, },
@ -159,7 +159,7 @@ func TestCheckPgpKeys(t *testing.T) {
// B6C8F98282B944E3B0D5C2530FC3042E345AD05D: Hans Wennborg. // B6C8F98282B944E3B0D5C2530FC3042E345AD05D: Hans Wennborg.
{ {
pkgs: []*rpc.Pkg{newPkg("libc++")}, pkgs: []*rpc.Pkg{newPkg("libc++")},
srcinfos: map[string]*gopkg.PKGBUILD{"libc++": &gopkg.PKGBUILD{Pkgbase: "libc++", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "B6C8F98282B944E3B0D5C2530FC3042E345AD05D"}}}, srcinfos: map[string]*gopkg.PKGBUILD{"libc++": {Pkgbase: "libc++", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "B6C8F98282B944E3B0D5C2530FC3042E345AD05D"}}},
bases: map[string][]*rpc.Pkg{"libc++": {newPkg("libc++")}}, bases: map[string][]*rpc.Pkg{"libc++": {newPkg("libc++")}},
wantError: false, wantError: false,
}, },
@ -167,7 +167,7 @@ func TestCheckPgpKeys(t *testing.T) {
// ABAF11C65A2970B130ABE3C479BE3E4300411886: Linus Torvalds. // ABAF11C65A2970B130ABE3C479BE3E4300411886: Linus Torvalds.
{ {
pkgs: []*rpc.Pkg{newPkg("dummy-1"), newPkg("dummy-2")}, pkgs: []*rpc.Pkg{newPkg("dummy-1"), newPkg("dummy-2")},
srcinfos: map[string]*gopkg.PKGBUILD{"dummy-1": &gopkg.PKGBUILD{Pkgbase: "dummy-1", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}, "dummy-2": &gopkg.PKGBUILD{Pkgbase: "dummy-2", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}}, srcinfos: map[string]*gopkg.PKGBUILD{"dummy-1": {Pkgbase: "dummy-1", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}, "dummy-2": {Pkgbase: "dummy-2", Validpgpkeys: []string{"ABAF11C65A2970B130ABE3C479BE3E4300411886"}}},
bases: map[string][]*rpc.Pkg{"dummy-1": {newPkg("dummy-1")}, "dummy-2": {newPkg("dummy-2")}}, bases: map[string][]*rpc.Pkg{"dummy-1": {newPkg("dummy-1")}, "dummy-2": {newPkg("dummy-2")}},
wantError: false, wantError: false,
}, },
@ -177,21 +177,21 @@ func TestCheckPgpKeys(t *testing.T) {
// C52048C0C0748FEE227D47A2702353E0F7E48EDB: Thomas Dickey. // C52048C0C0748FEE227D47A2702353E0F7E48EDB: Thomas Dickey.
{ {
pkgs: []*rpc.Pkg{newPkg("dummy-3")}, pkgs: []*rpc.Pkg{newPkg("dummy-3")},
srcinfos: map[string]*gopkg.PKGBUILD{"dummy-3": &gopkg.PKGBUILD{Pkgbase: "dummy-3", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}}, srcinfos: map[string]*gopkg.PKGBUILD{"dummy-3": {Pkgbase: "dummy-3", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294", "C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}},
bases: map[string][]*rpc.Pkg{"dummy-3": {newPkg("dummy-3")}}, bases: map[string][]*rpc.Pkg{"dummy-3": {newPkg("dummy-3")}},
wantError: false, wantError: false,
}, },
// Two dummy packages with existing keys. // Two dummy packages with existing keys.
{ {
pkgs: []*rpc.Pkg{newPkg("dummy-4"), newPkg("dummy-5")}, pkgs: []*rpc.Pkg{newPkg("dummy-4"), newPkg("dummy-5")},
srcinfos: map[string]*gopkg.PKGBUILD{"dummy-4": &gopkg.PKGBUILD{Pkgbase: "dummy-4", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294"}}, "dummy-5": &gopkg.PKGBUILD{Pkgbase: "dummy-5", Validpgpkeys: []string{"C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}}, srcinfos: map[string]*gopkg.PKGBUILD{"dummy-4": {Pkgbase: "dummy-4", Validpgpkeys: []string{"11E521D646982372EB577A1F8F0871F202119294"}}, "dummy-5": {Pkgbase: "dummy-5", Validpgpkeys: []string{"C52048C0C0748FEE227D47A2702353E0F7E48EDB"}}},
bases: map[string][]*rpc.Pkg{"dummy-4": {newPkg("dummy-4")}, "dummy-5": {newPkg("dummy-5")}}, bases: map[string][]*rpc.Pkg{"dummy-4": {newPkg("dummy-4")}, "dummy-5": {newPkg("dummy-5")}},
wantError: false, wantError: false,
}, },
// Dummy package with invalid key, should fail. // Dummy package with invalid key, should fail.
{ {
pkgs: []*rpc.Pkg{newPkg("dummy-7")}, pkgs: []*rpc.Pkg{newPkg("dummy-7")},
srcinfos: map[string]*gopkg.PKGBUILD{"dummy-7": &gopkg.PKGBUILD{Pkgbase: "dummy-7", Validpgpkeys: []string{"THIS-SHOULD-FAIL"}}}, srcinfos: map[string]*gopkg.PKGBUILD{"dummy-7": {Pkgbase: "dummy-7", Validpgpkeys: []string{"THIS-SHOULD-FAIL"}}},
bases: map[string][]*rpc.Pkg{"dummy-7": {newPkg("dummy-7")}}, bases: map[string][]*rpc.Pkg{"dummy-7": {newPkg("dummy-7")}},
wantError: true, wantError: true,
}, },
@ -199,7 +199,7 @@ func TestCheckPgpKeys(t *testing.T) {
// A314827C4E4250A204CE6E13284FC34C8E4B1A25: Thomas Bächler. // A314827C4E4250A204CE6E13284FC34C8E4B1A25: Thomas Bächler.
{ {
pkgs: []*rpc.Pkg{newPkg("dummy-8")}, pkgs: []*rpc.Pkg{newPkg("dummy-8")},
srcinfos: map[string]*gopkg.PKGBUILD{"dummy-8": &gopkg.PKGBUILD{Pkgbase: "dummy-8", Validpgpkeys: []string{"A314827C4E4250A204CE6E13284FC34C8E4B1A25", "THIS-SHOULD-FAIL"}}}, srcinfos: map[string]*gopkg.PKGBUILD{"dummy-8": {Pkgbase: "dummy-8", Validpgpkeys: []string{"A314827C4E4250A204CE6E13284FC34C8E4B1A25", "THIS-SHOULD-FAIL"}}},
bases: map[string][]*rpc.Pkg{"dummy-8": {newPkg("dummy-8")}}, bases: map[string][]*rpc.Pkg{"dummy-8": {newPkg("dummy-8")}},
wantError: true, wantError: true,
}, },

View File

@ -148,7 +148,7 @@ func initAlpm() (err error) {
return return
} }
value, _, exists = cmdArgs.getArg("color") value, _, _ = cmdArgs.getArg("color")
if value == "always" || value == "auto" { if value == "always" || value == "auto" {
useColor = true useColor = true
} else if value == "never" { } else if value == "never" {

View File

@ -246,6 +246,7 @@ func (parser *arguments) getArg(options ...string) (arg string, double bool, exi
} }
double = existCount >= 2 double = existCount >= 2
exists = existCount >= 1
return return
} }
@ -613,7 +614,7 @@ func (parser *arguments) parseCommandLine() (err error) {
//supports negation: ^1 ^1-4 //supports negation: ^1 ^1-4
// //
//include and excule holds numbers that should be added and should not be added //include and excule holds numbers that should be added and should not be added
//respectively. other holds anythign that can't be parsed as an int. This is //respectively. other holds anything that can't be parsed as an int. This is
//intended to allow words inside of number menus. e.g. 'all' 'none' 'abort' //intended to allow words inside of number menus. e.g. 'all' 'none' 'abort'
//of course the implementation is up to the caller, this function mearley parses //of course the implementation is up to the caller, this function mearley parses
//the input and organizes it //the input and organizes it

View File

@ -117,8 +117,8 @@ func getVersionDiff(oldVersion, newversion string) (left, right string) {
samePart := oldVersion[0:diffPosition] samePart := oldVersion[0:diffPosition]
left = samePart + red(oldVersion[diffPosition:len(oldVersion)]) left = samePart + red(oldVersion[diffPosition:])
right = samePart + green(newVersion[diffPosition:len(newVersion)]) right = samePart + green(newVersion[diffPosition:])
} }
return return

5
vcs.go
View File

@ -152,11 +152,14 @@ func getCommit(url string, branch string, protocols []string) string {
err = cmd.Wait() err = cmd.Wait()
timer.Stop() timer.Stop()
if err != nil { if err != nil {
continue continue
} }
err = cmd.Run() err = cmd.Run()
if err != nil {
continue
}
stdout := outbuf.String() stdout := outbuf.String()
split := strings.Fields(stdout) split := strings.Fields(stdout)