Browse Source

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

Jguer 7 years ago
parent
commit
a6a0b9b441
9 changed files with 44 additions and 71 deletions
  1. 5 1
      README.md
  2. 31 36
      cmd.go
  3. 4 2
      completions.go
  4. 3 3
      config.go
  5. 0 21
      install.go
  6. 0 2
      print.go
  7. 0 1
      query.go
  8. 0 1
      upgrade.go
  9. 1 4
      vcs.go

+ 5 - 1
README.md

@@ -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

+ 31 - 36
cmd.go

@@ -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)>
-
-    New operations:
-    yay -Qstats          displays system information
-    yay -Cd              remove unneeded dependencies
-    yay -G [package(s)]  get pkgbuild from ABS or AUR
-
-    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
-`)
+	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
+	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`)
 }
 
 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":

+ 4 - 2
completions.go

@@ -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 {

+ 3 - 3
config.go

@@ -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"

+ 0 - 21
install.go

@@ -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
 }
 

+ 0 - 2
print.go

@@ -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.

+ 0 - 1
query.go

@@ -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

+ 0 - 1
upgrade.go

@@ -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.

+ 1 - 4
vcs.go

@@ -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