mirror of
https://github.com/Jguer/yay
synced 2024-08-31 21:58:39 +00:00
Apply linting to patch
This commit is contained in:
parent
6913770b4d
commit
433f5b6ce1
|
@ -16,10 +16,9 @@ type depTree struct {
|
||||||
|
|
||||||
type depCatagories struct {
|
type depCatagories struct {
|
||||||
Repo []*alpm.Package
|
Repo []*alpm.Package
|
||||||
Aur[]*rpc.Pkg
|
Aur []*rpc.Pkg
|
||||||
MakeOnly stringSet
|
MakeOnly stringSet
|
||||||
Bases map[string][]*rpc.Pkg
|
Bases map[string][]*rpc.Pkg
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeDepTree() *depTree {
|
func makeDepTree() *depTree {
|
||||||
|
|
61
install.go
61
install.go
|
@ -2,9 +2,9 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"io/ioutil"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
alpm "github.com/jguer/go-alpm"
|
alpm "github.com/jguer/go-alpm"
|
||||||
|
@ -69,7 +69,7 @@ func install(parser *arguments) error {
|
||||||
//printDownloadsFromRepo("Repo Make", dc.RepoMake)
|
//printDownloadsFromRepo("Repo Make", dc.RepoMake)
|
||||||
//printDownloadsFromAur("AUR", dc.Aur)
|
//printDownloadsFromAur("AUR", dc.Aur)
|
||||||
//printDownloadsFromAur("AUR Make", dc.AurMake)
|
//printDownloadsFromAur("AUR Make", dc.AurMake)
|
||||||
|
|
||||||
//fmt.Println(dc.MakeOnly)
|
//fmt.Println(dc.MakeOnly)
|
||||||
//fmt.Println(dc.AurSet)
|
//fmt.Println(dc.AurSet)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ func install(parser *arguments) error {
|
||||||
if !continueTask("Proceed with install?", "nN") {
|
if !continueTask("Proceed with install?", "nN") {
|
||||||
return fmt.Errorf("Aborting due to user")
|
return fmt.Errorf("Aborting due to user")
|
||||||
}
|
}
|
||||||
|
|
||||||
// if !continueTask("Proceed with download?", "nN") {
|
// if !continueTask("Proceed with download?", "nN") {
|
||||||
// return fmt.Errorf("Aborting due to user")
|
// return fmt.Errorf("Aborting due to user")
|
||||||
// }
|
// }
|
||||||
|
@ -102,7 +102,7 @@ func install(parser *arguments) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(dc.Repo) > 0 {
|
if len(dc.Repo) > 0 {
|
||||||
arguments := parser.copy()
|
arguments := parser.copy()
|
||||||
arguments.delArg("u", "sysupgrade")
|
arguments.delArg("u", "sysupgrade")
|
||||||
|
@ -123,7 +123,6 @@ func install(parser *arguments) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if _, ok := arguments.options["gendb"]; ok {
|
if _, ok := arguments.options["gendb"]; ok {
|
||||||
fmt.Println("GenDB finished. No packages were installed")
|
fmt.Println("GenDB finished. No packages were installed")
|
||||||
return nil
|
return nil
|
||||||
|
@ -190,7 +189,7 @@ func askCleanBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) {
|
||||||
str = str[:len(str)-1] + ")"
|
str = str[:len(str)-1] + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
if !continueTask(str + " Directory exists. Clean Build?", "yY") {
|
if !continueTask(str+" Directory exists. Clean Build?", "yY") {
|
||||||
_ = os.RemoveAll(config.BuildDir + pkg.PackageBase)
|
_ = os.RemoveAll(config.BuildDir + pkg.PackageBase)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +266,7 @@ func checkForConflicts(aur []*rpc.Pkg, aurMake []*rpc.Pkg, repo []*alpm.Package,
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func askEditPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (error) {
|
func askEditPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) error {
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
dir := config.BuildDir + pkg.PackageBase + "/"
|
dir := config.BuildDir + pkg.PackageBase + "/"
|
||||||
|
|
||||||
|
@ -290,12 +289,11 @@ func askEditPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (error) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func parsesrcinfos(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD) error {
|
||||||
func parsesrcinfos(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD) (error) {
|
|
||||||
|
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
dir := config.BuildDir + pkg.PackageBase + "/"
|
dir := config.BuildDir + pkg.PackageBase + "/"
|
||||||
|
|
||||||
cmd := exec.Command(config.MakepkgBin, "--printsrcinfo")
|
cmd := exec.Command(config.MakepkgBin, "--printsrcinfo")
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
cmd.Dir = dir
|
cmd.Dir = dir
|
||||||
|
@ -327,7 +325,7 @@ func parsesrcinfos(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD) (error)
|
||||||
func dowloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
|
func dowloadPkgBuilds(pkgs []*rpc.Pkg, bases map[string][]*rpc.Pkg) (err error) {
|
||||||
for _, pkg := range pkgs {
|
for _, pkg := range pkgs {
|
||||||
//todo make pretty
|
//todo make pretty
|
||||||
str := "Downloading: " + pkg.PackageBase+"-"+pkg.Version
|
str := "Downloading: " + pkg.PackageBase + "-" + pkg.Version
|
||||||
if len(bases[pkg.PackageBase]) > 1 || pkg.PackageBase != pkg.Name {
|
if len(bases[pkg.PackageBase]) > 1 || pkg.PackageBase != pkg.Name {
|
||||||
str += " ("
|
str += " ("
|
||||||
for _, split := range bases[pkg.PackageBase] {
|
for _, split := range bases[pkg.PackageBase] {
|
||||||
|
@ -358,7 +356,7 @@ func downloadPkgBuildsSources(pkgs []*rpc.Pkg) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, targets stringSet, parser *arguments, bases map[string][]*rpc.Pkg) (error) {
|
func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD, targets stringSet, parser *arguments, bases map[string][]*rpc.Pkg) error {
|
||||||
//for n := len(pkgs) -1 ; n > 0; n-- {
|
//for n := len(pkgs) -1 ; n > 0; n-- {
|
||||||
for n := 0; n < len(pkgs); n++ {
|
for n := 0; n < len(pkgs); n++ {
|
||||||
pkg := pkgs[n]
|
pkg := pkgs[n]
|
||||||
|
@ -369,8 +367,8 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
||||||
srcinfo := srcinfos[pkg.PackageBase]
|
srcinfo := srcinfos[pkg.PackageBase]
|
||||||
version := srcinfo.CompleteVersion()
|
version := srcinfo.CompleteVersion()
|
||||||
|
|
||||||
for _, split:= range bases[pkg.PackageBase] {
|
for _, split := range bases[pkg.PackageBase] {
|
||||||
file, err := completeFileName(dir, split.Name + "-" + version.String())
|
file, err := completeFileName(dir, split.Name+"-"+version.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -382,7 +380,7 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
||||||
|
|
||||||
if built {
|
if built {
|
||||||
fmt.Println(boldRedFgBlackBg(arrow+" Warning:"),
|
fmt.Println(boldRedFgBlackBg(arrow+" Warning:"),
|
||||||
blackBg(pkg.Name+"-"+pkg.Version+ " Already made -- skipping build"))
|
blackBg(pkg.Name+"-"+pkg.Version+" Already made -- skipping build"))
|
||||||
} else {
|
} else {
|
||||||
err := passToMakepkg(dir, "-Cscf", "--noconfirm")
|
err := passToMakepkg(dir, "-Cscf", "--noconfirm")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -405,7 +403,7 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
||||||
depArguments.addArg("D", "asdeps")
|
depArguments.addArg("D", "asdeps")
|
||||||
|
|
||||||
for _, split := range bases[pkg.PackageBase] {
|
for _, split := range bases[pkg.PackageBase] {
|
||||||
file, err := completeFileName(dir, split.Name + "-" + version.String())
|
file, err := completeFileName(dir, split.Name+"-"+version.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -413,7 +411,7 @@ func buildInstallPkgBuilds(pkgs []*rpc.Pkg, srcinfos map[string]*gopkg.PKGBUILD,
|
||||||
if file == "" {
|
if file == "" {
|
||||||
return fmt.Errorf("Could not find built package " + split.Name + "-" + version.String())
|
return fmt.Errorf("Could not find built package " + split.Name + "-" + version.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
arguments.addTarget(file)
|
arguments.addTarget(file)
|
||||||
if !targets.get(split.Name) {
|
if !targets.get(split.Name) {
|
||||||
depArguments.addTarget(split.Name)
|
depArguments.addTarget(split.Name)
|
||||||
|
@ -443,27 +441,26 @@ func clean(pkgs []*rpc.Pkg) {
|
||||||
dir := config.BuildDir + pkg.PackageBase + "/"
|
dir := config.BuildDir + pkg.PackageBase + "/"
|
||||||
|
|
||||||
fmt.Println(boldGreenFg(arrow +
|
fmt.Println(boldGreenFg(arrow +
|
||||||
" CleanAfter enabled. Deleting " + pkg.Name +" source folder."))
|
" CleanAfter enabled. Deleting " + pkg.Name + " source folder."))
|
||||||
os.RemoveAll(dir)
|
os.RemoveAll(dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func completeFileName(dir, name string) (string, error) {
|
func completeFileName(dir, name string) (string, error) {
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := ioutil.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.HasPrefix(file.Name(), name) {
|
if strings.HasPrefix(file.Name(), name) {
|
||||||
return dir + file.Name(), nil
|
return dir + file.Name(), nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
8
print.go
8
print.go
|
@ -157,10 +157,10 @@ func printDepCatagories(dc *depCatagories) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printDownloads("Repo", repoLen, repo)
|
printDownloads("Repo", repoLen, repo)
|
||||||
printDownloads("Repo Make", repoMakeLen, repoMake)
|
printDownloads("Repo Make", repoMakeLen, repoMake)
|
||||||
printDownloads("Aur", aurLen, aur)
|
printDownloads("Aur", aurLen, aur)
|
||||||
printDownloads("Aur Make", aurMakeLen, aurMake)
|
printDownloads("Aur Make", aurMakeLen, aurMake)
|
||||||
}
|
}
|
||||||
|
|
||||||
func printDownloads(repoName string, length int, packages string) {
|
func printDownloads(repoName string, length int, packages string) {
|
||||||
|
|
Loading…
Reference in a new issue