mirror of
https://github.com/Jguer/yay
synced 2024-07-21 10:16:10 +00:00
feat(exe): AddMakepkg builder
This commit is contained in:
parent
1db50882e9
commit
3b2bb28e81
6
clean.go
6
clean.go
|
@ -173,7 +173,7 @@ func cleanUntracked() error {
|
||||||
|
|
||||||
dir := filepath.Join(config.BuildDir, file.Name())
|
dir := filepath.Join(config.BuildDir, file.Name())
|
||||||
if isGitRepository(dir) {
|
if isGitRepository(dir) {
|
||||||
if err := config.Runtime.CmdRunner.Show(passToGit(dir, "clean", "-fx")); err != nil {
|
if err := config.Runtime.CmdRunner.Show(config.Runtime.CmdBuilder.BuildGitCmd(dir, "clean", "-fx")); err != nil {
|
||||||
text.Warnln(gotext.Get("Unable to clean:"), dir)
|
text.Warnln(gotext.Get("Unable to clean:"), dir)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -198,12 +198,12 @@ func cleanAfter(bases []dep.Base) {
|
||||||
|
|
||||||
text.OperationInfoln(gotext.Get("Cleaning (%d/%d): %s", i+1, len(bases), text.Cyan(dir)))
|
text.OperationInfoln(gotext.Get("Cleaning (%d/%d): %s", i+1, len(bases), text.Cyan(dir)))
|
||||||
|
|
||||||
_, stderr, err := config.Runtime.CmdRunner.Capture(passToGit(dir, "reset", "--hard", "HEAD"), 0)
|
_, stderr, err := config.Runtime.CmdRunner.Capture(config.Runtime.CmdBuilder.BuildGitCmd(dir, "reset", "--hard", "HEAD"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
text.Errorln(gotext.Get("error resetting %s: %s", base.String(), stderr))
|
text.Errorln(gotext.Get("error resetting %s: %s", base.String(), stderr))
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := config.Runtime.CmdRunner.Show(passToGit(dir, "clean", "-fx", "--exclude='*.pkg.*'")); err != nil {
|
if err := config.Runtime.CmdRunner.Show(config.Runtime.CmdBuilder.BuildGitCmd(dir, "clean", "-fx", "--exclude='*.pkg.*'")); err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
30
download.go
30
download.go
|
@ -23,7 +23,9 @@ const gitDiffRefName = "AUR_SEEN"
|
||||||
// Update the YAY_DIFF_REVIEW ref to HEAD. We use this ref to determine which diff were
|
// Update the YAY_DIFF_REVIEW ref to HEAD. We use this ref to determine which diff were
|
||||||
// reviewed by the user
|
// reviewed by the user
|
||||||
func gitUpdateSeenRef(path, name string) error {
|
func gitUpdateSeenRef(path, name string) error {
|
||||||
_, stderr, err := config.Runtime.CmdRunner.Capture(passToGit(filepath.Join(path, name), "update-ref", gitDiffRefName, "HEAD"), 0)
|
_, stderr, err := config.Runtime.CmdRunner.Capture(
|
||||||
|
config.Runtime.CmdBuilder.BuildGitCmd(
|
||||||
|
filepath.Join(path, name), "update-ref", gitDiffRefName, "HEAD"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("%s %s", stderr, err)
|
return fmt.Errorf("%s %s", stderr, err)
|
||||||
}
|
}
|
||||||
|
@ -33,7 +35,9 @@ func gitUpdateSeenRef(path, name string) error {
|
||||||
// Return wether or not we have reviewed a diff yet. It checks for the existence of
|
// Return wether or not we have reviewed a diff yet. It checks for the existence of
|
||||||
// YAY_DIFF_REVIEW in the git ref-list
|
// YAY_DIFF_REVIEW in the git ref-list
|
||||||
func gitHasLastSeenRef(path, name string) bool {
|
func gitHasLastSeenRef(path, name string) bool {
|
||||||
_, _, err := config.Runtime.CmdRunner.Capture(passToGit(filepath.Join(path, name), "rev-parse", "--quiet", "--verify", gitDiffRefName), 0)
|
_, _, err := config.Runtime.CmdRunner.Capture(
|
||||||
|
config.Runtime.CmdBuilder.BuildGitCmd(
|
||||||
|
filepath.Join(path, name), "rev-parse", "--quiet", "--verify", gitDiffRefName), 0)
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +45,9 @@ func gitHasLastSeenRef(path, name string) bool {
|
||||||
// If it does not it will return empty tree as no diff have been reviewed yet.
|
// If it does not it will return empty tree as no diff have been reviewed yet.
|
||||||
func getLastSeenHash(path, name string) (string, error) {
|
func getLastSeenHash(path, name string) (string, error) {
|
||||||
if gitHasLastSeenRef(path, name) {
|
if gitHasLastSeenRef(path, name) {
|
||||||
stdout, stderr, err := config.Runtime.CmdRunner.Capture(passToGit(filepath.Join(path, name), "rev-parse", gitDiffRefName), 0)
|
stdout, stderr, err := config.Runtime.CmdRunner.Capture(
|
||||||
|
config.Runtime.CmdBuilder.BuildGitCmd(
|
||||||
|
filepath.Join(path, name), "rev-parse", gitDiffRefName), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("%s %s", stderr, err)
|
return "", fmt.Errorf("%s %s", stderr, err)
|
||||||
}
|
}
|
||||||
|
@ -57,7 +63,7 @@ func getLastSeenHash(path, name string) (string, error) {
|
||||||
func gitHasDiff(path, name string) (bool, error) {
|
func gitHasDiff(path, name string) (bool, error) {
|
||||||
if gitHasLastSeenRef(path, name) {
|
if gitHasLastSeenRef(path, name) {
|
||||||
stdout, stderr, err := config.Runtime.CmdRunner.Capture(
|
stdout, stderr, err := config.Runtime.CmdRunner.Capture(
|
||||||
passToGit(filepath.Join(path, name), "rev-parse", gitDiffRefName, "HEAD@{upstream}"), 0)
|
config.Runtime.CmdBuilder.BuildGitCmd(filepath.Join(path, name), "rev-parse", gitDiffRefName, "HEAD@{upstream}"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("%s%s", stderr, err)
|
return false, fmt.Errorf("%s%s", stderr, err)
|
||||||
}
|
}
|
||||||
|
@ -79,7 +85,7 @@ func gitDownloadABS(url, path, name string) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, errExist := os.Stat(filepath.Join(path, name)); os.IsNotExist(errExist) {
|
if _, errExist := os.Stat(filepath.Join(path, name)); os.IsNotExist(errExist) {
|
||||||
cmd := passToGit(path, "clone", "--no-progress", "--single-branch",
|
cmd := config.Runtime.CmdBuilder.BuildGitCmd(path, "clone", "--no-progress", "--single-branch",
|
||||||
"-b", "packages/"+name, url, name)
|
"-b", "packages/"+name, url, name)
|
||||||
_, stderr, err := config.Runtime.CmdRunner.Capture(cmd, 0)
|
_, stderr, err := config.Runtime.CmdRunner.Capture(cmd, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -91,7 +97,7 @@ func gitDownloadABS(url, path, name string) (bool, error) {
|
||||||
return false, fmt.Errorf(gotext.Get("error reading %s", filepath.Join(path, name, ".git")))
|
return false, fmt.Errorf(gotext.Get("error reading %s", filepath.Join(path, name, ".git")))
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := passToGit(filepath.Join(path, name), "pull", "--ff-only")
|
cmd := config.Runtime.CmdBuilder.BuildGitCmd(filepath.Join(path, name), "pull", "--ff-only")
|
||||||
_, stderr, err := config.Runtime.CmdRunner.Capture(cmd, 0)
|
_, stderr, err := config.Runtime.CmdRunner.Capture(cmd, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf(gotext.Get("error fetching %s: %s", name, stderr))
|
return false, fmt.Errorf(gotext.Get("error fetching %s: %s", name, stderr))
|
||||||
|
@ -103,7 +109,7 @@ func gitDownloadABS(url, path, name string) (bool, error) {
|
||||||
func gitDownload(url, path, name string) (bool, error) {
|
func gitDownload(url, path, name string) (bool, error) {
|
||||||
_, err := os.Stat(filepath.Join(path, name, ".git"))
|
_, err := os.Stat(filepath.Join(path, name, ".git"))
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
cmd := passToGit(path, "clone", "--no-progress", url, name)
|
cmd := config.Runtime.CmdBuilder.BuildGitCmd(path, "clone", "--no-progress", url, name)
|
||||||
_, stderr, errCapture := config.Runtime.CmdRunner.Capture(cmd, 0)
|
_, stderr, errCapture := config.Runtime.CmdRunner.Capture(cmd, 0)
|
||||||
if errCapture != nil {
|
if errCapture != nil {
|
||||||
return false, fmt.Errorf(gotext.Get("error cloning %s: %s", name, stderr))
|
return false, fmt.Errorf(gotext.Get("error cloning %s: %s", name, stderr))
|
||||||
|
@ -114,7 +120,7 @@ func gitDownload(url, path, name string) (bool, error) {
|
||||||
return false, fmt.Errorf(gotext.Get("error reading %s", filepath.Join(path, name, ".git")))
|
return false, fmt.Errorf(gotext.Get("error reading %s", filepath.Join(path, name, ".git")))
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := passToGit(filepath.Join(path, name), "fetch")
|
cmd := config.Runtime.CmdBuilder.BuildGitCmd(filepath.Join(path, name), "fetch")
|
||||||
_, stderr, err := config.Runtime.CmdRunner.Capture(cmd, 0)
|
_, stderr, err := config.Runtime.CmdRunner.Capture(cmd, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf(gotext.Get("error fetching %s: %s", name, stderr))
|
return false, fmt.Errorf(gotext.Get("error fetching %s: %s", name, stderr))
|
||||||
|
@ -124,12 +130,16 @@ func gitDownload(url, path, name string) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func gitMerge(path, name string) error {
|
func gitMerge(path, name string) error {
|
||||||
_, stderr, err := config.Runtime.CmdRunner.Capture(passToGit(filepath.Join(path, name), "reset", "--hard", "HEAD"), 0)
|
_, stderr, err := config.Runtime.CmdRunner.Capture(
|
||||||
|
config.Runtime.CmdBuilder.BuildGitCmd(
|
||||||
|
filepath.Join(path, name), "reset", "--hard", "HEAD"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf(gotext.Get("error resetting %s: %s", name, stderr))
|
return fmt.Errorf(gotext.Get("error resetting %s: %s", name, stderr))
|
||||||
}
|
}
|
||||||
|
|
||||||
_, stderr, err = config.Runtime.CmdRunner.Capture(passToGit(filepath.Join(path, name), "merge", "--no-edit", "--ff"), 0)
|
_, stderr, err = config.Runtime.CmdRunner.Capture(
|
||||||
|
config.Runtime.CmdBuilder.BuildGitCmd(
|
||||||
|
filepath.Join(path, name), "merge", "--no-edit", "--ff"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf(gotext.Get("error merging %s: %s", name, stderr))
|
return fmt.Errorf(gotext.Get("error merging %s: %s", name, stderr))
|
||||||
}
|
}
|
||||||
|
|
24
exec.go
24
exec.go
|
@ -81,27 +81,3 @@ func passToPacman(args *settings.Arguments) *exec.Cmd {
|
||||||
}
|
}
|
||||||
return exec.Command(argArr[0], argArr[1:]...)
|
return exec.Command(argArr[0], argArr[1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func passToMakepkg(dir string, args ...string) *exec.Cmd {
|
|
||||||
args = append(args, strings.Fields(config.MFlags)...)
|
|
||||||
|
|
||||||
if config.MakepkgConf != "" {
|
|
||||||
args = append(args, "--config", config.MakepkgConf)
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := exec.Command(config.MakepkgBin, args...)
|
|
||||||
cmd.Dir = dir
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
func passToGit(dir string, _args ...string) *exec.Cmd {
|
|
||||||
args := strings.Fields(config.GitFlags)
|
|
||||||
if dir != "" {
|
|
||||||
args = append(args, "-C", dir)
|
|
||||||
}
|
|
||||||
args = append(args, _args...)
|
|
||||||
|
|
||||||
cmd := exec.Command(config.GitBin, args...)
|
|
||||||
cmd.Env = append(os.Environ(), "GIT_TERMINAL_PROMPT=0")
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
|
|
23
install.go
23
install.go
|
@ -496,7 +496,8 @@ nextpkg:
|
||||||
}
|
}
|
||||||
|
|
||||||
func parsePackageList(dir string) (pkgdests map[string]string, pkgVersion string, err error) {
|
func parsePackageList(dir string) (pkgdests map[string]string, pkgVersion string, err error) {
|
||||||
stdout, stderr, err := config.Runtime.CmdRunner.Capture(passToMakepkg(dir, "--packagelist"), 0)
|
stdout, stderr, err := config.Runtime.CmdRunner.Capture(
|
||||||
|
config.Runtime.CmdBuilder.BuildMakepkgCmd(dir, "--packagelist"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, "", fmt.Errorf("%s %s", stderr, err)
|
return nil, "", fmt.Errorf("%s %s", stderr, err)
|
||||||
}
|
}
|
||||||
|
@ -765,7 +766,7 @@ func showPkgbuildDiffs(bases []dep.Base, cloned stringset.StringSet) error {
|
||||||
} else {
|
} else {
|
||||||
args = append(args, "--color=never")
|
args = append(args, "--color=never")
|
||||||
}
|
}
|
||||||
_ = config.Runtime.CmdRunner.Show(passToGit(dir, args...))
|
_ = config.Runtime.CmdRunner.Show(config.Runtime.CmdBuilder.BuildGitCmd(dir, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
return errMulti.Return()
|
return errMulti.Return()
|
||||||
|
@ -922,7 +923,8 @@ func downloadPkgbuildsSources(bases []dep.Base, incompatible stringset.StringSet
|
||||||
args = append(args, "--ignorearch")
|
args = append(args, "--ignorearch")
|
||||||
}
|
}
|
||||||
|
|
||||||
err = config.Runtime.CmdRunner.Show(passToMakepkg(dir, args...))
|
err = config.Runtime.CmdRunner.Show(
|
||||||
|
config.Runtime.CmdBuilder.BuildMakepkgCmd(dir, args...))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New(gotext.Get("error downloading sources: %s", text.Cyan(base.String())))
|
return errors.New(gotext.Get("error downloading sources: %s", text.Cyan(base.String())))
|
||||||
}
|
}
|
||||||
|
@ -1032,7 +1034,8 @@ func buildInstallPkgbuilds(
|
||||||
}
|
}
|
||||||
|
|
||||||
// pkgver bump
|
// pkgver bump
|
||||||
if err = config.Runtime.CmdRunner.Show(passToMakepkg(dir, args...)); err != nil {
|
if err = config.Runtime.CmdRunner.Show(
|
||||||
|
config.Runtime.CmdBuilder.BuildMakepkgCmd(dir, args...)); err != nil {
|
||||||
return errors.New(gotext.Get("error making: %s", base.String()))
|
return errors.New(gotext.Get("error making: %s", base.String()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1069,7 +1072,9 @@ func buildInstallPkgbuilds(
|
||||||
}
|
}
|
||||||
|
|
||||||
if installed {
|
if installed {
|
||||||
err = config.Runtime.CmdRunner.Show(passToMakepkg(dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
err = config.Runtime.CmdRunner.Show(
|
||||||
|
config.Runtime.CmdBuilder.BuildMakepkgCmd(
|
||||||
|
dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New(gotext.Get("error making: %s", err))
|
return errors.New(gotext.Get("error making: %s", err))
|
||||||
}
|
}
|
||||||
|
@ -1080,7 +1085,9 @@ func buildInstallPkgbuilds(
|
||||||
}
|
}
|
||||||
|
|
||||||
if built {
|
if built {
|
||||||
err = config.Runtime.CmdRunner.Show(passToMakepkg(dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
err = config.Runtime.CmdRunner.Show(
|
||||||
|
config.Runtime.CmdBuilder.BuildMakepkgCmd(
|
||||||
|
dir, "-c", "--nobuild", "--noextract", "--ignorearch"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New(gotext.Get("error making: %s", err))
|
return errors.New(gotext.Get("error making: %s", err))
|
||||||
}
|
}
|
||||||
|
@ -1093,7 +1100,9 @@ func buildInstallPkgbuilds(
|
||||||
args = append(args, "--ignorearch")
|
args = append(args, "--ignorearch")
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMake := config.Runtime.CmdRunner.Show(passToMakepkg(dir, args...)); errMake != nil {
|
if errMake := config.Runtime.CmdRunner.Show(
|
||||||
|
config.Runtime.CmdBuilder.BuildMakepkgCmd(
|
||||||
|
dir, args...)); errMake != nil {
|
||||||
return errors.New(gotext.Get("error making: %s", base.String()))
|
return errors.New(gotext.Get("error making: %s", base.String()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/leonelquinteros/gotext"
|
"github.com/leonelquinteros/gotext"
|
||||||
|
|
||||||
|
@ -196,9 +197,15 @@ func NewConfig() (*Configuration, error) {
|
||||||
SaveConfig: false,
|
SaveConfig: false,
|
||||||
CompletionPath: filepath.Join(cacheHome, completionFileName),
|
CompletionPath: filepath.Join(cacheHome, completionFileName),
|
||||||
CmdRunner: &exe.OSRunner{},
|
CmdRunner: &exe.OSRunner{},
|
||||||
CmdBuilder: exe.NewCmdBuilder(newConfig.GitBin, newConfig.GitFlags),
|
CmdBuilder: &exe.CmdBuilder{
|
||||||
PacmanConf: nil,
|
GitBin: newConfig.GitBin,
|
||||||
VCSStore: nil,
|
GitFlags: strings.Fields(newConfig.GitFlags),
|
||||||
|
MakepkgFlags: strings.Fields(newConfig.MFlags),
|
||||||
|
MakepkgConfPath: newConfig.MakepkgConf,
|
||||||
|
MakepkgBin: newConfig.MakepkgBin,
|
||||||
|
},
|
||||||
|
PacmanConf: nil,
|
||||||
|
VCSStore: nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
newConfig.Runtime.VCSStore = vcs.NewInfoStore(filepath.Join(cacheHome, vcsFileName),
|
newConfig.Runtime.VCSStore = vcs.NewInfoStore(filepath.Join(cacheHome, vcsFileName),
|
||||||
|
|
|
@ -3,22 +3,18 @@ package exe
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type CmdBuilder struct {
|
type CmdBuilder struct {
|
||||||
GitBin string
|
GitBin string
|
||||||
GitFlags []string
|
GitFlags []string
|
||||||
}
|
MakepkgFlags []string
|
||||||
|
MakepkgConfPath string
|
||||||
func NewCmdBuilder(gitBin, gitFlags string) *CmdBuilder {
|
MakepkgBin string
|
||||||
c := &CmdBuilder{GitBin: gitBin, GitFlags: strings.Fields(gitFlags)}
|
|
||||||
|
|
||||||
return c
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *CmdBuilder) BuildGitCmd(dir string, extraArgs ...string) *exec.Cmd {
|
func (c *CmdBuilder) BuildGitCmd(dir string, extraArgs ...string) *exec.Cmd {
|
||||||
args := make([]string, 0, len(c.GitFlags))
|
args := make([]string, 0, len(c.GitFlags)+len(extraArgs))
|
||||||
copy(args, c.GitFlags)
|
copy(args, c.GitFlags)
|
||||||
|
|
||||||
if dir != "" {
|
if dir != "" {
|
||||||
|
@ -31,3 +27,18 @@ func (c *CmdBuilder) BuildGitCmd(dir string, extraArgs ...string) *exec.Cmd {
|
||||||
cmd.Env = append(os.Environ(), "GIT_TERMINAL_PROMPT=0")
|
cmd.Env = append(os.Environ(), "GIT_TERMINAL_PROMPT=0")
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *CmdBuilder) BuildMakepkgCmd(dir string, extraArgs ...string) *exec.Cmd {
|
||||||
|
args := make([]string, 0, len(c.MakepkgFlags)+len(extraArgs))
|
||||||
|
copy(args, c.MakepkgFlags)
|
||||||
|
|
||||||
|
if c.MakepkgConfPath != "" {
|
||||||
|
args = append(args, "--config", c.MakepkgConfPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
args = append(args, extraArgs...)
|
||||||
|
|
||||||
|
cmd := exec.Command(c.MakepkgBin, args...)
|
||||||
|
cmd.Dir = dir
|
||||||
|
return cmd
|
||||||
|
}
|
||||||
|
|
|
@ -64,7 +64,11 @@ func TestNewInfoStore(t *testing.T) {
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "normal",
|
name: "normal",
|
||||||
args: args{"/tmp/a.json", &exe.OSRunner{}, exe.NewCmdBuilder("git", "--a --b")},
|
args: args{
|
||||||
|
"/tmp/a.json",
|
||||||
|
&exe.OSRunner{},
|
||||||
|
&exe.CmdBuilder{GitBin: "git", GitFlags: []string{"--a", "--b"}},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
|
@ -122,7 +126,7 @@ func TestInfoStore_NeedsUpdate(t *testing.T) {
|
||||||
Runner: &MockRunner{
|
Runner: &MockRunner{
|
||||||
Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HEAD"},
|
Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HEAD"},
|
||||||
},
|
},
|
||||||
CmdBuilder: exe.NewCmdBuilder("git", ""),
|
CmdBuilder: &exe.CmdBuilder{GitBin: "git", GitFlags: []string{""}},
|
||||||
},
|
},
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
|
@ -146,7 +150,7 @@ func TestInfoStore_NeedsUpdate(t *testing.T) {
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HEAD",
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HEAD",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
CmdBuilder: exe.NewCmdBuilder("git", ""),
|
CmdBuilder: &exe.CmdBuilder{GitBin: "git", GitFlags: []string{""}},
|
||||||
},
|
},
|
||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
|
@ -162,7 +166,7 @@ func TestInfoStore_NeedsUpdate(t *testing.T) {
|
||||||
Runner: &MockRunner{
|
Runner: &MockRunner{
|
||||||
Returned: []string{"991c5b4146fd27f4aacf4e3111258a848934aaa1 HEAD"},
|
Returned: []string{"991c5b4146fd27f4aacf4e3111258a848934aaa1 HEAD"},
|
||||||
},
|
},
|
||||||
CmdBuilder: exe.NewCmdBuilder("git", ""),
|
CmdBuilder: &exe.CmdBuilder{GitBin: "git", GitFlags: []string{""}},
|
||||||
},
|
},
|
||||||
want: false,
|
want: false,
|
||||||
},
|
},
|
||||||
|
@ -178,7 +182,7 @@ func TestInfoStore_NeedsUpdate(t *testing.T) {
|
||||||
Runner: &MockRunner{
|
Runner: &MockRunner{
|
||||||
Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
||||||
},
|
},
|
||||||
CmdBuilder: exe.NewCmdBuilder("git", ""),
|
CmdBuilder: &exe.CmdBuilder{GitBin: "git", GitFlags: []string{""}},
|
||||||
},
|
},
|
||||||
want: false,
|
want: false,
|
||||||
},
|
},
|
||||||
|
@ -194,7 +198,7 @@ func TestInfoStore_NeedsUpdate(t *testing.T) {
|
||||||
Runner: &MockRunner{
|
Runner: &MockRunner{
|
||||||
Returned: []string{"error"},
|
Returned: []string{"error"},
|
||||||
},
|
},
|
||||||
CmdBuilder: exe.NewCmdBuilder("git", ""),
|
CmdBuilder: &exe.CmdBuilder{GitBin: "git", GitFlags: []string{""}},
|
||||||
},
|
},
|
||||||
want: false,
|
want: false,
|
||||||
},
|
},
|
||||||
|
@ -210,7 +214,7 @@ func TestInfoStore_NeedsUpdate(t *testing.T) {
|
||||||
Runner: &MockRunner{
|
Runner: &MockRunner{
|
||||||
Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},
|
||||||
},
|
},
|
||||||
CmdBuilder: exe.NewCmdBuilder("git", ""),
|
CmdBuilder: &exe.CmdBuilder{GitBin: "git", GitFlags: []string{""}},
|
||||||
},
|
},
|
||||||
want: false,
|
want: false,
|
||||||
},
|
},
|
||||||
|
@ -247,7 +251,7 @@ func TestInfoStore_Update(t *testing.T) {
|
||||||
sources: []gosrc.ArchString{{Value: "git://github.com/jguer/yay.git#branch=master"}}},
|
sources: []gosrc.ArchString{{Value: "git://github.com/jguer/yay.git#branch=master"}}},
|
||||||
fields: fields{
|
fields: fields{
|
||||||
OriginsByPackage: make(map[string]OriginInfoByURL),
|
OriginsByPackage: make(map[string]OriginInfoByURL),
|
||||||
CmdBuilder: exe.NewCmdBuilder("git", ""),
|
CmdBuilder: &exe.CmdBuilder{GitBin: "git", GitFlags: []string{""}},
|
||||||
Runner: &MockRunner{Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HEAD"}},
|
Runner: &MockRunner{Returned: []string{"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa HEAD"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue