git devel package support restored, house keeping, fixes related to config files.

This commit is contained in:
Jguer 2017-10-19 11:30:37 +09:00
parent bc7ff1799b
commit a6a0b9b441
9 changed files with 42 additions and 69 deletions

View file

@ -13,7 +13,7 @@ Yay was created with a few objectives in mind and based on the design of [yaourt
- Provide an interface for pacman.
- Have yaourt like search.
- Minimize user input
- Know when git packages are due for an upgrade. (TODO)
- Know when git packages are due for an upgrade.
## Features
- AUR Tab completion
@ -28,6 +28,7 @@ Yay was created with a few objectives in mind and based on the design of [yaourt
- `yay -Qstats` delivers system statistics
- `yay -Cd` cleans unneeded dependencies
- `yay -G` downloads PKGBuild from ABS or AUR
- `yay --gendb` generates development package DB used for devel updates.
![Yay Syu](http://jguer.github.io/yay/yayupgrade.png "yay -Syu")
![Yay Qstats](http://jguer.github.io/yay/yay2.png "yay -Qstats")
@ -35,6 +36,9 @@ Yay was created with a few objectives in mind and based on the design of [yaourt
### Changelog
#### 2.200
- Development github package support readded
#### 2.196
- XDG_CONFIG_HOME support
- XDG_CACHE_HOME support

63
cmd.go
View file

@ -14,29 +14,29 @@ import (
func usage() {
fmt.Println(`usage: yay <operation> [...]
operations:
yay {-h --help}
yay {-V --version}
yay {-D --database} <options> <package(s)>
yay {-F --files} [options] [package(s)]
yay {-Q --query} [options] [package(s)]
yay {-R --remove} [options] <package(s)>
yay {-S --sync} [options] [package(s)]
yay {-T --deptest} [options] [package(s)]
yay {-U --upgrade} [options] <file(s)>
operations:
yay {-h --help}
yay {-V --version}
yay {-D --database} <options> <package(s)>
yay {-F --files} [options] [package(s)]
yay {-Q --query} [options] [package(s)]
yay {-R --remove} [options] <package(s)>
yay {-S --sync} [options] [package(s)]
yay {-T --deptest} [options] [package(s)]
yay {-U --upgrade} [options] <file(s)>
New operations:
yay -Qstats displays system information
yay -Cd remove unneeded dependencies
yay -G [package(s)] get pkgbuild from ABS or AUR
New operations:
yay -Qstats displays system information
yay -Cd remove unneeded dependencies
yay -G [package(s)] get pkgbuild from ABS or AUR
yay --gendb generates development package DB used for updating.
New options:
--topdown shows repository's packages first and then aur's
--bottomup shows aur's packages first and then repository's
--noconfirm skip user input on package install
--devel Check -git/-svn/-hg development version
--nodevel Disable development version checking
`)
New options:
--topdown shows repository's packages first and then aur's
--bottomup shows aur's packages first and then repository's
--noconfirm skip user input on package install
--devel Check -git/-svn/-hg development version
--nodevel Disable development version checking`)
}
func init() {
@ -49,7 +49,7 @@ func init() {
}
if configHome = os.Getenv("XDG_CONFIG_HOME"); configHome != "" {
if info, err := os.Stat(configHome); err == nil && info.IsDir() == true {
if info, err := os.Stat(configHome); err == nil && info.IsDir() {
configHome = configHome + "/yay"
} else {
configHome = os.Getenv("HOME") + "/.config/yay"
@ -59,13 +59,13 @@ func init() {
}
if cacheHome = os.Getenv("XDG_CACHE_HOME"); cacheHome != "" {
if info, err := os.Stat(cacheHome); err == nil && info.IsDir() == true {
if info, err := os.Stat(cacheHome); err == nil && info.IsDir() {
cacheHome = cacheHome + "/yay"
} else {
cacheHome = os.Getenv("HOME") + "/.cache/yay"
}
} else {
cacheHome = os.Getenv("HOME") + "/.config/yay"
cacheHome = os.Getenv("HOME") + "/.cache/yay"
}
configFile = configHome + "/config.json"
@ -106,15 +106,10 @@ func init() {
updated = false
file, err := os.OpenFile(vcsFile, os.O_RDWR|os.O_CREATE, 0600)
if err != nil {
fmt.Println("error:", err)
return
}
defer file.Close()
decoder := json.NewDecoder(file)
err = decoder.Decode(&savedInfo)
if err != nil {
fmt.Println("error:", err)
if err == nil {
defer file.Close()
decoder := json.NewDecoder(file)
_ = decoder.Decode(&savedInfo)
}
/////////////////
@ -181,7 +176,7 @@ func parser() (op string, options []string, packages []string, changedConfig boo
_ = complete()
os.Exit(0)
case "--fcomplete":
config.Shell = "fish"
config.Shell = fishShell
_ = complete()
os.Exit(0)
case "--help":

View file

@ -9,6 +9,8 @@ import (
alpm "github.com/jguer/go-alpm"
)
const fishShell = "fish"
//CreateAURList creates a new completion file
func createAURList(out *os.File) (err error) {
resp, err := http.Get("https://aur.archlinux.org/packages.gz")
@ -23,7 +25,7 @@ func createAURList(out *os.File) (err error) {
for scanner.Scan() {
fmt.Print(scanner.Text())
out.WriteString(scanner.Text())
if config.Shell == "fish" {
if config.Shell == fishShell {
fmt.Print("\tAUR\n")
out.WriteString("\tAUR\n")
} else {
@ -46,7 +48,7 @@ func createRepoList(out *os.File) (err error) {
_ = db.PkgCache().ForEach(func(pkg alpm.Package) error {
fmt.Print(pkg.Name())
out.WriteString(pkg.Name())
if config.Shell == "fish" {
if config.Shell == fishShell {
fmt.Print("\t" + pkg.DB().Name() + "\n")
out.WriteString("\t" + pkg.DB().Name() + "\n")
} else {

View file

@ -30,15 +30,15 @@ type Configuration struct {
Editor string `json:"editor"`
MakepkgBin string `json:"makepkgbin"`
Shell string `json:"-"`
NoConfirm bool `json:"noconfirm"`
Devel bool `json:"devel"`
PacmanBin string `json:"pacmanbin"`
PacmanConf string `json:"pacmanconf"`
TarBin string `json:"tarbin"`
RequestSplitN int `json:"requestsplitn"`
SearchMode int `json:"-"`
SortMode int `json:"sortmode"`
TarBin string `json:"tarbin"`
TimeUpdate bool `json:"timeupdate"`
NoConfirm bool `json:"noconfirm"`
Devel bool `json:"devel"`
}
var version = "2.116"

View file

@ -9,26 +9,6 @@ import (
gopkg "github.com/mikkeloscar/gopkgbuild"
)
func newInstall(pkgs []string, flags []string) error {
aurs, repos, _ := packageSlices(pkgs)
if len(repos) != 0 {
err := passToPacman("-S", repos, flags)
if err != nil {
fmt.Println("Error installing repo packages.")
}
}
if len(aurs) != 0 {
err := aurInstall(aurs, flags)
if err != nil {
fmt.Println("Error installing aur packages.")
}
}
return nil
}
// Install handles package installs
func install(pkgs []string, flags []string) error {
aurs, repos, _ := packageSlices(pkgs)
@ -107,7 +87,6 @@ func setupPackageSpace(a *rpc.Pkg) (dir string, pkgbuild *gopkg.PKGBUILD, err er
}
}
}
return
}

View file

@ -50,8 +50,6 @@ func (q aurQuery) printSearch(start int) {
toprint += "\n " + res.Description
fmt.Println(toprint)
}
return
}
//PrintSearch receives a RepoSearch type and outputs pretty text.

View file

@ -84,7 +84,6 @@ func (q aurQuery) missingPackage(pkgS []string) {
fmt.Println("\x1b[31mUnable to find", depName, "in AUR\x1b[0m")
}
}
return
}
// NarrowSearch searches AUR and narrows based on subarguments

View file

@ -178,7 +178,6 @@ func upDevel(remoteNames []string, packageC chan upgrade, done chan bool) {
}
}
done <- true
return
}
// upAUR gathers foreign packages and checks if they have new versions.

5
vcs.go
View file

@ -79,10 +79,7 @@ func (info *Info) needsUpdate() bool {
for _, e := range newRepo {
if e.Name == "master" {
if e.Commit.SHA != info.SHA {
return true
}
return false
return e.Commit.SHA != info.SHA
}
}
return false