Merge pull request #1068 from Morganamilo/abs

Move abs cloning to it's own directory
This commit is contained in:
Anna 2019-10-21 12:34:35 +01:00 committed by GitHub
commit 169d0a07fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View file

@ -38,6 +38,7 @@ type targetMode int
type Configuration struct {
AURURL string `json:"aururl"`
BuildDir string `json:"buildDir"`
ABSDir string `json:"absdir"`
Editor string `json:"editor"`
EditorFlags string `json:"editorflags"`
MakepkgBin string `json:"makepkgbin"`
@ -143,6 +144,7 @@ func defaultSettings() *Configuration {
config := &Configuration{
AURURL: "https://aur.archlinux.org",
BuildDir: "$HOME/.cache/yay",
ABSDir: "$HOME/.cache/yay/abs",
CleanAfter: false,
Editor: "",
EditorFlags: "",

View file

@ -103,7 +103,12 @@ func gitHasDiff(path string, name string) (bool, error) {
// TODO: yay-next passes args through the header, use that to unify ABS and AUR
func gitDownloadABS(url string, path string, name string) (bool, error) {
_, err := os.Stat(filepath.Join(path, name))
err := os.MkdirAll(path, 0755)
if err != nil {
return false, err
}
_, err = os.Stat(filepath.Join(path, name))
if os.IsNotExist(err) {
cmd := passToGit(path, "clone", "--no-progress", "--single-branch",
"-b", "packages/"+name, url, name)
@ -340,7 +345,7 @@ func getPkgbuildsfromABS(pkgs []string, path string) (bool, error) {
download := func(pkg string, url string) {
defer wg.Done()
if _, err := gitDownloadABS(url, config.BuildDir, pkg); err != nil {
if _, err := gitDownloadABS(url, config.ABSDir, pkg); err != nil {
errs.Add(fmt.Errorf("%s Failed to get pkgbuild: %s: %s", bold(red(arrow)), bold(cyan(pkg)), bold(red(err.Error()))))
return
}

View file

@ -537,6 +537,8 @@ func handleConfig(option, value string) bool {
config.GitFlags = value
case "builddir":
config.BuildDir = value
case "absdir":
config.ABSDir = value
case "editor":
config.Editor = value
case "editorflags":
@ -680,6 +682,7 @@ func hasParam(arg string) bool {
case "gpgflags":
case "gitflags":
case "builddir":
case "absdir":
case "editor":
case "editorflags":
case "makepkg":