Refactoring

This commit is contained in:
Jguer 2017-06-14 08:47:17 +01:00
parent bdbf9c6107
commit 5bae8e81a6
2 changed files with 7 additions and 6 deletions

View file

@ -66,7 +66,7 @@ func printDeps(repoDeps []string, aurDeps []string) {
} }
} }
func setupPackageSpace(a *rpc.Pkg) (err error) { func setupPackageSpace(a *rpc.Pkg) (pkgbuild *gopkg.PKGBUILD, err error) {
dir := config.YayConf.BuildDir + a.PackageBase + "/" dir := config.YayConf.BuildDir + a.PackageBase + "/"
if _, err = os.Stat(dir); !os.IsNotExist(err) { if _, err = os.Stat(dir); !os.IsNotExist(err) {
@ -85,9 +85,9 @@ func setupPackageSpace(a *rpc.Pkg) (err error) {
editcmd.Run() editcmd.Run()
} }
pkgb, err := gopkg.ParseSRCINFO(dir + ".SRCINFO") pkgbuild, err = gopkg.ParseSRCINFO(dir + ".SRCINFO")
if err == nil { if err == nil {
for _, pkgsource := range pkgb.Source { for _, pkgsource := range pkgbuild.Source {
owner, repo := vcs.ParseSource(pkgsource) owner, repo := vcs.ParseSource(pkgsource)
if owner != "" && repo != "" { if owner != "" && repo != "" {
err = vcs.BranchInfo(a.Name, owner, repo) err = vcs.BranchInfo(a.Name, owner, repo)
@ -113,7 +113,8 @@ func PkgInstall(a *rpc.Pkg, flags []string) (finalmdeps []string, err error) {
fmt.Println("\x1b[1;31;40m==> Warning:\x1b[0;;40m This package is orphaned.\x1b[0m") fmt.Println("\x1b[1;31;40m==> Warning:\x1b[0;;40m This package is orphaned.\x1b[0m")
} }
if err = setupPackageSpace(a); err != nil { _, err = setupPackageSpace(a)
if err != nil {
return return
} }
@ -236,7 +237,6 @@ func PrintInfo(a *rpc.Pkg) {
if a.OutOfDate != 0 { if a.OutOfDate != 0 {
fmt.Println("\x1b[1;37mOut-of-date :\x1b[0m", "Yes") fmt.Println("\x1b[1;37mOut-of-date :\x1b[0m", "Yes")
} }
} }
// RemoveMakeDeps receives a make dependency list and removes those // RemoveMakeDeps receives a make dependency list and removes those

3
yay.go
View file

@ -35,6 +35,8 @@ func usage() {
--topdown shows repository's packages first and then aur's --topdown shows repository's packages first and then aur's
--bottomup shows aur's packages first and then repository's --bottomup shows aur's packages first and then repository's
--noconfirm skip user input on package install --noconfirm skip user input on package install
--devel Check -git/-svn/-hg development version
--nodevel Disable development version checking
`) `)
} }
@ -91,7 +93,6 @@ func parser() (op string, options []string, packages []string, changedConfig boo
} }
continue continue
} }
packages = append(packages, arg) packages = append(packages, arg)
} }
return return