2016-09-13 03:06:24 +02:00
|
|
|
package aur
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"sort"
|
|
|
|
"strings"
|
2016-10-17 00:02:48 +02:00
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
"github.com/jguer/yay/pacman"
|
2016-09-13 03:06:24 +02:00
|
|
|
)
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
// TarBin describes the default installation point of tar command.
|
2016-09-13 03:06:24 +02:00
|
|
|
const TarBin string = "/usr/bin/tar"
|
|
|
|
|
2016-09-18 03:32:13 +02:00
|
|
|
// BaseURL givers the AUR default address.
|
2016-09-13 03:06:24 +02:00
|
|
|
const BaseURL string = "https://aur.archlinux.org"
|
|
|
|
|
2016-09-18 03:32:13 +02:00
|
|
|
// MakepkgBin describes the default installation point of makepkg command.
|
2016-09-13 03:06:24 +02:00
|
|
|
const MakepkgBin string = "/usr/bin/makepkg"
|
|
|
|
|
2016-09-18 03:32:13 +02:00
|
|
|
// SearchMode is search without numbers.
|
|
|
|
const SearchMode int = -1
|
|
|
|
|
2016-12-05 01:26:01 +01:00
|
|
|
// NoConfirm ignores prompts.
|
|
|
|
var NoConfirm = false
|
|
|
|
|
2016-12-02 13:19:03 +01:00
|
|
|
// SortMode determines top down package or down top package display
|
|
|
|
var SortMode = DownTop
|
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
// BaseDir is the default building directory for yay
|
|
|
|
var BaseDir = "/tmp/yaytmp/"
|
|
|
|
|
2016-12-02 13:19:03 +01:00
|
|
|
// Describes Sorting method for numberdisplay
|
|
|
|
const (
|
|
|
|
DownTop = iota
|
|
|
|
TopDown
|
|
|
|
)
|
|
|
|
|
2016-09-18 03:32:13 +02:00
|
|
|
// Result describes an AUR package.
|
2016-09-13 03:06:24 +02:00
|
|
|
type Result struct {
|
2016-12-01 00:08:28 +01:00
|
|
|
ID int `json:"ID"`
|
|
|
|
Name string `json:"Name"`
|
|
|
|
PackageBaseID int `json:"PackageBaseID"`
|
|
|
|
PackageBase string `json:"PackageBase"`
|
|
|
|
Version string `json:"Version"`
|
|
|
|
Description string `json:"Description"`
|
|
|
|
URL string `json:"URL"`
|
|
|
|
NumVotes int `json:"NumVotes"`
|
|
|
|
Popularity float32 `json:"Popularity"`
|
|
|
|
OutOfDate int `json:"OutOfDate"`
|
|
|
|
Maintainer string `json:"Maintainer"`
|
|
|
|
FirstSubmitted int `json:"FirstSubmitted"`
|
|
|
|
LastModified int64 `json:"LastModified"`
|
|
|
|
URLPath string `json:"URLPath"`
|
|
|
|
Installed bool
|
2016-11-30 18:55:56 +01:00
|
|
|
Depends []string `json:"Depends"`
|
|
|
|
MakeDepends []string `json:"MakeDepends"`
|
|
|
|
OptDepends []string `json:"OptDepends"`
|
|
|
|
Conflicts []string `json:"Conflicts"`
|
2016-12-01 00:08:28 +01:00
|
|
|
Provides []string `json:"Provides"`
|
2016-11-30 18:55:56 +01:00
|
|
|
License []string `json:"License"`
|
|
|
|
Keywords []string `json:"Keywords"`
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
// Query is a collection of Results
|
|
|
|
type Query []Result
|
2016-09-13 03:06:24 +02:00
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
func (q Query) Len() int {
|
|
|
|
return len(q)
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
func (q Query) Less(i, j int) bool {
|
2016-12-02 13:19:03 +01:00
|
|
|
if SortMode == DownTop {
|
|
|
|
return q[i].NumVotes < q[j].NumVotes
|
|
|
|
}
|
|
|
|
return q[i].NumVotes > q[j].NumVotes
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
func (q Query) Swap(i, j int) {
|
|
|
|
q[i], q[j] = q[j], q[i]
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-09-13 18:43:56 +02:00
|
|
|
// PrintSearch handles printing search results in a given format
|
2016-11-30 18:55:56 +01:00
|
|
|
func (q Query) PrintSearch(start int) {
|
|
|
|
for i, res := range q {
|
2016-12-02 13:19:03 +01:00
|
|
|
var toprint string
|
|
|
|
if start != SearchMode {
|
|
|
|
if SortMode == DownTop {
|
|
|
|
toprint += fmt.Sprintf("%d ", len(q)+start-i-1)
|
|
|
|
} else {
|
|
|
|
toprint += fmt.Sprintf("%d ", start+i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
toprint += fmt.Sprintf("\x1b[1m%s/\x1b[33m%s \x1b[36m%s \x1b[0m(%d) ", "aur", res.Name, res.Version, res.NumVotes)
|
2016-12-10 00:33:21 +01:00
|
|
|
if res.Maintainer == "" {
|
|
|
|
toprint += fmt.Sprintf("\x1b[31;40m(Orphaned)\x1b[0m ")
|
|
|
|
}
|
|
|
|
|
2016-12-02 13:19:03 +01:00
|
|
|
if res.Installed == true {
|
|
|
|
toprint += fmt.Sprintf("\x1b[32;40mInstalled\x1b[0m")
|
2016-09-13 18:43:56 +02:00
|
|
|
}
|
2016-12-02 13:19:03 +01:00
|
|
|
toprint += "\n" + res.Description
|
|
|
|
fmt.Println(toprint)
|
2016-09-13 18:43:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
// Search returns an AUR search
|
|
|
|
func Search(pkg string, sortS bool) (Query, int, error) {
|
|
|
|
type returned struct {
|
|
|
|
Results Query `json:"results"`
|
|
|
|
ResultCount int `json:"resultcount"`
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
2016-11-30 18:55:56 +01:00
|
|
|
r := returned{}
|
|
|
|
err := getJSON("https://aur.archlinux.org/rpc/?v=5&type=search&arg="+pkg, &r)
|
2016-09-13 03:06:24 +02:00
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
if sortS {
|
|
|
|
sort.Sort(r.Results)
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
2016-12-02 13:19:03 +01:00
|
|
|
setter := pacman.PFactory(pFSetTrue)
|
2016-09-13 03:06:24 +02:00
|
|
|
|
2016-12-02 13:19:03 +01:00
|
|
|
for i, res := range r.Results {
|
|
|
|
if i == len(r.Results)-1 {
|
|
|
|
setter(res.Name, &r.Results[i], true)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
setter(res.Name, &r.Results[i], false)
|
|
|
|
}
|
2016-11-30 18:55:56 +01:00
|
|
|
return r.Results, r.ResultCount, err
|
|
|
|
}
|
|
|
|
|
2016-12-02 13:19:03 +01:00
|
|
|
// This is very dirty but it works so good.
|
|
|
|
func pFSetTrue(res interface{}) {
|
|
|
|
f, ok := res.(*Result)
|
|
|
|
if !ok {
|
|
|
|
fmt.Println("Unable to convert back to Result")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
f.Installed = true
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
// Info returns an AUR search with package details
|
|
|
|
func Info(pkg string) (Query, int, error) {
|
|
|
|
type returned struct {
|
|
|
|
Results Query `json:"results"`
|
|
|
|
ResultCount int `json:"resultcount"`
|
|
|
|
}
|
|
|
|
r := returned{}
|
|
|
|
|
|
|
|
err := getJSON("https://aur.archlinux.org/rpc/?v=5&type=info&arg[]="+pkg, &r)
|
|
|
|
|
|
|
|
return r.Results, r.ResultCount, err
|
|
|
|
}
|
|
|
|
|
2016-11-30 20:07:17 +01:00
|
|
|
// MultiInfo takes a slice of strings and returns a slice with the info of each package
|
|
|
|
func MultiInfo(pkgS []string) (Query, int, error) {
|
|
|
|
type returned struct {
|
|
|
|
Results Query `json:"results"`
|
|
|
|
ResultCount int `json:"resultcount"`
|
|
|
|
}
|
|
|
|
r := returned{}
|
|
|
|
|
|
|
|
var pkg string
|
|
|
|
for _, pkgn := range pkgS {
|
|
|
|
pkg += "&arg[]=" + pkgn
|
|
|
|
}
|
|
|
|
|
|
|
|
err := getJSON("https://aur.archlinux.org/rpc/?v=5&type=info"+pkg, &r)
|
|
|
|
|
|
|
|
return r.Results, r.ResultCount, err
|
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
// Install sends system commands to make and install a package from pkgName
|
2016-12-10 00:33:21 +01:00
|
|
|
func Install(pkg string, flags []string) (err error) {
|
2016-11-30 18:55:56 +01:00
|
|
|
q, n, err := Info(pkg)
|
2016-09-13 03:06:24 +02:00
|
|
|
if err != nil {
|
2016-11-30 18:55:56 +01:00
|
|
|
return
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
if n == 0 {
|
|
|
|
return fmt.Errorf("Package %s does not exist", pkg)
|
|
|
|
}
|
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
q[0].Install(flags)
|
2016-11-30 18:55:56 +01:00
|
|
|
return err
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
// Upgrade tries to update every foreign package installed in the system
|
2016-12-10 00:33:21 +01:00
|
|
|
func Upgrade(flags []string) error {
|
2016-11-30 18:55:56 +01:00
|
|
|
fmt.Println("\x1b[1;36;1m::\x1b[0m\x1b[1m Starting AUR upgrade...\x1b[0m")
|
|
|
|
|
2016-11-30 20:07:17 +01:00
|
|
|
foreign, n, err := pacman.ForeignPackages()
|
|
|
|
if err != nil || n == 0 {
|
2016-09-13 03:06:24 +02:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2016-11-30 20:07:17 +01:00
|
|
|
keys := make([]string, len(foreign))
|
|
|
|
i := 0
|
|
|
|
for k := range foreign {
|
|
|
|
keys[i] = k
|
|
|
|
i++
|
|
|
|
}
|
2016-11-30 18:55:56 +01:00
|
|
|
|
2016-11-30 20:07:17 +01:00
|
|
|
q, _, err := MultiInfo(keys)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2016-11-30 18:55:56 +01:00
|
|
|
|
2016-11-30 20:07:17 +01:00
|
|
|
outdated := q[:0]
|
|
|
|
for _, res := range q {
|
|
|
|
if _, ok := foreign[res.Name]; ok {
|
2016-11-30 18:55:56 +01:00
|
|
|
// Leaving this here for now, warn about downgrades later
|
2016-11-30 20:07:17 +01:00
|
|
|
if res.LastModified > foreign[res.Name].Date {
|
|
|
|
fmt.Printf("\x1b[1m\x1b[32m==>\x1b[33;1m %s: \x1b[0m%s \x1b[33;1m-> \x1b[0m%s\n",
|
2016-12-02 14:34:14 +01:00
|
|
|
res.Name, foreign[res.Name].Version, res.Version)
|
2016-11-30 20:07:17 +01:00
|
|
|
outdated = append(outdated, res)
|
2016-11-30 18:55:56 +01:00
|
|
|
}
|
|
|
|
}
|
2016-10-02 18:23:55 +02:00
|
|
|
}
|
2016-09-13 03:06:24 +02:00
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
//If there are no outdated packages, don't prompt
|
|
|
|
if len(outdated) == 0 {
|
|
|
|
fmt.Println(" there is nothing to do")
|
|
|
|
return nil
|
|
|
|
}
|
2016-09-13 03:06:24 +02:00
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
// Install updated packages
|
2016-12-10 00:33:21 +01:00
|
|
|
if !continueTask("Proceed with upgrade?", "n & N") {
|
|
|
|
return nil
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
for _, pkg := range outdated {
|
2016-12-10 00:33:21 +01:00
|
|
|
pkg.Install(flags)
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-11-30 18:55:56 +01:00
|
|
|
return nil
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
func (a *Result) setupWorkspace() (err error) {
|
2016-09-13 03:06:24 +02:00
|
|
|
// No need to use filepath.separators because it won't run on inferior platforms
|
2016-12-10 00:33:21 +01:00
|
|
|
err = os.MkdirAll(BaseDir+"builds", 0755)
|
2016-09-13 03:06:24 +02:00
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
tarLocation := BaseDir + a.PackageBase + ".tar.gz"
|
|
|
|
defer os.Remove(BaseDir + a.PackageBase + ".tar.gz")
|
2016-09-13 03:06:24 +02:00
|
|
|
|
|
|
|
err = downloadFile(tarLocation, BaseURL+a.URLPath)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
err = exec.Command(TarBin, "-xf", tarLocation, "-C", BaseDir).Run()
|
2016-09-13 03:06:24 +02:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// Install handles install from Info Result
|
|
|
|
func (a *Result) Install(flags []string) (err error) {
|
|
|
|
fmt.Printf("\x1b[1;32m==> Installing\x1b[33m %s\x1b[0m\n", a.Name)
|
|
|
|
if a.Maintainer == "" {
|
|
|
|
fmt.Println("\x1b[1;31;40m==> Warning:\x1b[0;;40m This package is orphaned.\x1b[0m")
|
|
|
|
}
|
|
|
|
dir := BaseDir + a.PackageBase + "/"
|
|
|
|
|
|
|
|
if _, err = os.Stat(dir); os.IsNotExist(err) {
|
|
|
|
if err = a.setupWorkspace(); err != nil {
|
|
|
|
return
|
2016-10-05 02:19:13 +02:00
|
|
|
}
|
|
|
|
}
|
2016-12-10 00:33:21 +01:00
|
|
|
|
|
|
|
// defer os.RemoveAll(BaseDir + a.PackageBase)
|
|
|
|
|
|
|
|
if !continueTask("Edit PKGBUILD?", "y & Y") {
|
|
|
|
editcmd := exec.Command(Editor, dir+"PKGBUILD")
|
|
|
|
editcmd.Stdin, editcmd.Stdout, editcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
|
|
|
editcmd.Run()
|
|
|
|
}
|
|
|
|
|
2016-12-15 21:50:22 +01:00
|
|
|
runDeps, makeDeps, err := a.Dependencies()
|
2016-11-04 11:52:11 +01:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2016-10-02 22:50:23 +02:00
|
|
|
|
2016-12-15 21:50:22 +01:00
|
|
|
repoDeps := append(runDeps[0], makeDeps[0]...)
|
|
|
|
aurDeps := append(runDeps[1], makeDeps[1]...)
|
2016-12-10 00:33:21 +01:00
|
|
|
|
|
|
|
if len(aurDeps) != 0 || len(repoDeps) != 0 {
|
|
|
|
if !continueTask("Continue?", "n & N") {
|
2016-12-05 01:26:01 +01:00
|
|
|
return fmt.Errorf("user did not like the dependencies")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 00:08:28 +01:00
|
|
|
aurQ, n, err := MultiInfo(aurDeps)
|
|
|
|
if n != len(aurDeps) {
|
2016-12-10 00:33:21 +01:00
|
|
|
MissingPackage(aurDeps, aurQ)
|
|
|
|
if !continueTask("Continue?", "n & N") {
|
|
|
|
return fmt.Errorf("unable to install dependencies")
|
2016-12-05 01:26:01 +01:00
|
|
|
}
|
2016-12-01 00:08:28 +01:00
|
|
|
}
|
2016-11-15 02:46:11 +01:00
|
|
|
|
2016-12-01 00:08:28 +01:00
|
|
|
// Handle AUR dependencies first
|
|
|
|
for _, dep := range aurQ {
|
2016-12-10 00:33:21 +01:00
|
|
|
errA := dep.Install([]string{"--asdeps", "--noconfirm"})
|
2016-12-05 01:26:01 +01:00
|
|
|
if errA != nil {
|
|
|
|
return errA
|
|
|
|
}
|
2016-11-15 02:46:11 +01:00
|
|
|
}
|
|
|
|
|
2016-12-01 00:08:28 +01:00
|
|
|
// Repo dependencies
|
2016-12-01 20:57:53 +01:00
|
|
|
if len(repoDeps) != 0 {
|
2016-12-05 01:26:01 +01:00
|
|
|
errR := pacman.Install(repoDeps, []string{"--asdeps", "--noconfirm"})
|
|
|
|
if errR != nil {
|
|
|
|
pacman.CleanRemove(aurDeps)
|
|
|
|
return errR
|
|
|
|
}
|
2016-12-01 20:57:53 +01:00
|
|
|
}
|
2016-12-01 00:08:28 +01:00
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
err = os.Chdir(dir)
|
2016-09-13 03:06:24 +02:00
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
2016-09-18 03:32:13 +02:00
|
|
|
|
|
|
|
var makepkgcmd *exec.Cmd
|
2016-10-05 18:04:16 +02:00
|
|
|
var args []string
|
|
|
|
args = append(args, "-sri")
|
|
|
|
args = append(args, flags...)
|
|
|
|
makepkgcmd = exec.Command(MakepkgBin, args...)
|
2016-12-10 00:33:21 +01:00
|
|
|
makepkgcmd.Stdin, makepkgcmd.Stdout, makepkgcmd.Stderr = os.Stdin, os.Stdout, os.Stderr
|
2016-09-13 03:06:24 +02:00
|
|
|
err = makepkgcmd.Run()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-12-10 00:33:21 +01:00
|
|
|
func continueTask(s string, def string) (cont bool) {
|
|
|
|
if NoConfirm {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
var postFix string
|
|
|
|
|
|
|
|
if def == "n & N" {
|
|
|
|
postFix = "(Y/n)"
|
|
|
|
} else {
|
|
|
|
postFix = "(y/N)"
|
|
|
|
}
|
|
|
|
|
|
|
|
var response string
|
|
|
|
fmt.Printf("\x1b[1;32m==> %s\x1b[1;37m %s\x1b[0m\n", s, postFix)
|
|
|
|
|
|
|
|
fmt.Scanln(&response)
|
|
|
|
if strings.ContainsAny(response, def) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// MissingPackage warns if the Query was unable to find a package
|
|
|
|
func MissingPackage(aurDeps []string, aurQ Query) {
|
2016-12-05 01:26:01 +01:00
|
|
|
for _, depName := range aurDeps {
|
|
|
|
found := false
|
|
|
|
for _, dep := range aurQ {
|
|
|
|
if dep.Name == depName {
|
|
|
|
found = true
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if !found {
|
|
|
|
fmt.Println("\x1b[31mUnable to find", depName, "in AUR\x1b[0m")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-12-01 00:08:28 +01:00
|
|
|
// Dependencies returns package dependencies not installed belonging to AUR
|
2016-12-15 21:50:22 +01:00
|
|
|
// 0 is Repo, 1 is Foreign.
|
|
|
|
func (a *Result) Dependencies() (runDeps [2][]string, makeDeps [2][]string, err error) {
|
2016-12-01 00:08:28 +01:00
|
|
|
var q Query
|
|
|
|
if len(a.Depends) == 0 && len(a.MakeDepends) == 0 {
|
|
|
|
var n int
|
|
|
|
q, n, err = Info(a.Name)
|
|
|
|
if n == 0 || err != nil {
|
|
|
|
err = fmt.Errorf("Unable to search dependencies, %s", err)
|
|
|
|
return
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
2016-12-01 00:08:28 +01:00
|
|
|
} else {
|
|
|
|
q = append(q, *a)
|
2016-09-13 03:06:24 +02:00
|
|
|
}
|
2016-12-01 00:08:28 +01:00
|
|
|
|
2016-12-16 01:40:12 +01:00
|
|
|
depSearch := pacman.BuildDependencies(a.Depends)
|
2016-12-15 21:50:22 +01:00
|
|
|
if len(a.Depends) != 0 {
|
2016-12-16 01:40:12 +01:00
|
|
|
runDeps[0], runDeps[1] = depSearch(q[0].Depends, true, false)
|
|
|
|
if len(runDeps[0]) != 0 || len(runDeps[1]) != 0 {
|
|
|
|
fmt.Println("\x1b[1;32m=>\x1b[1;33m Run Dependencies: \x1b[0m")
|
|
|
|
printDeps(runDeps[0], runDeps[1])
|
|
|
|
}
|
2016-12-15 21:50:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if len(a.MakeDepends) != 0 {
|
2016-12-16 01:40:12 +01:00
|
|
|
makeDeps[0], makeDeps[1] = depSearch(q[0].MakeDepends, false, false)
|
|
|
|
if len(makeDeps[0]) != 0 || len(makeDeps[1]) != 0 {
|
|
|
|
fmt.Println("\x1b[1;32m=>\x1b[1;33m Make Dependencies: \x1b[0m")
|
|
|
|
printDeps(makeDeps[0], makeDeps[1])
|
|
|
|
}
|
2016-12-15 21:50:22 +01:00
|
|
|
}
|
2016-12-16 01:40:12 +01:00
|
|
|
depSearch(a.MakeDepends, false, true)
|
|
|
|
|
2016-12-15 21:50:22 +01:00
|
|
|
err = nil
|
2016-09-13 03:06:24 +02:00
|
|
|
return
|
|
|
|
}
|
2016-12-15 21:50:22 +01:00
|
|
|
|
|
|
|
func printDeps(repoDeps []string, aurDeps []string) {
|
|
|
|
if len(repoDeps) != 0 {
|
|
|
|
fmt.Print("\x1b[1;32m==> Repository dependencies: \x1b[0m")
|
|
|
|
for _, repoD := range repoDeps {
|
|
|
|
fmt.Print("\x1b[33m", repoD, " \x1b[0m")
|
|
|
|
}
|
|
|
|
fmt.Print("\n")
|
|
|
|
|
|
|
|
}
|
|
|
|
if len(aurDeps) != 0 {
|
|
|
|
fmt.Print("\x1b[1;32m==> AUR dependencies: \x1b[0m")
|
|
|
|
for _, aurD := range aurDeps {
|
|
|
|
fmt.Print("\x1b[33m", aurD, " \x1b[0m")
|
|
|
|
}
|
|
|
|
fmt.Print("\n")
|
|
|
|
}
|
|
|
|
}
|