Skip to content

Commit

Permalink
fix(aur): version must be numbers only (#2850)
Browse files Browse the repository at this point in the history
* fix(aur): version must be numbers only

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: format

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>

* fix: revert removed line
  • Loading branch information
caarlos0 committed Jan 27, 2022
1 parent 5f36f2e commit a1447a3
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/pipe/aur/aur.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func dataFor(ctx *context.Context, cfg config.AUR, cl client.Client, artifacts [
Name: cfg.Name,
Desc: cfg.Description,
Homepage: cfg.Homepage,
Version: ctx.Version,
Version: fmt.Sprintf("%d.%d.%d", ctx.Semver.Major, ctx.Semver.Minor, ctx.Semver.Patch),
License: cfg.License,
Rel: cfg.Rel,
Maintainers: cfg.Maintainers,
Expand Down
31 changes: 29 additions & 2 deletions internal/pipe/aur/aur_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,15 @@ func TestFullPipe(t *testing.T) {
folder := t.TempDir()
ctx := &context.Context{
Git: context.GitInfo{
CurrentTag: "v1.0.1",
CurrentTag: "v1.0.1-foo",
},
Version: "1.0.1",
Semver: context.Semver{
Major: 1,
Minor: 0,
Patch: 1,
Prerelease: "foo",
},
Version: "1.0.1-foo",
Artifacts: artifact.New(),
Env: map[string]string{
"FOO": "foo_is_bar",
Expand Down Expand Up @@ -316,6 +322,11 @@ func TestRunPipe(t *testing.T) {
Git: context.GitInfo{
CurrentTag: "v1.0.1",
},
Semver: context.Semver{
Major: 1,
Minor: 0,
Patch: 1,
},
Version: "1.0.1",
Artifacts: artifact.New(),
Env: map[string]string{
Expand Down Expand Up @@ -455,6 +466,11 @@ func TestRunPipeBinaryRelease(t *testing.T) {
Git: context.GitInfo{
CurrentTag: "v1.2.1",
},
Semver: context.Semver{
Major: 1,
Minor: 2,
Patch: 1,
},
Version: "1.2.1",
Artifacts: artifact.New(),
Config: config.Project{
Expand Down Expand Up @@ -504,6 +520,12 @@ func TestRunPipeNoUpload(t *testing.T) {
})
ctx.TokenType = context.TokenTypeGitHub
ctx.Git = context.GitInfo{CurrentTag: "v1.0.1"}
ctx.Semver = context.Semver{
Major: 1,
Minor: 0,
Patch: 1,
}

path := filepath.Join(folder, "whatever.tar.gz")
f, err := os.Create(path)
require.NoError(t, err)
Expand Down Expand Up @@ -558,6 +580,11 @@ func TestRunEmptyTokenType(t *testing.T) {
},
})
ctx.Git = context.GitInfo{CurrentTag: "v1.0.1"}
ctx.Semver = context.Semver{
Major: 1,
Minor: 0,
Patch: 1,
}
path := filepath.Join(folder, "whatever.tar.gz")
f, err := os.Create(path)
require.NoError(t, err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license=('MIT')
provides=('default-gitlab')
conflicts=('default-gitlab')

source_x86_64=('https://dummyhost/download/v1.0.1/bin.tar.gz')
source_x86_64=('https://dummyhost/download/v1.0.1-foo/bin.tar.gz')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')

package() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pkgbase = default-gitlab-bin
conflicts = default-gitlab
provides = default-gitlab
arch = x86_64
source_x86_64 = https://dummyhost/download/v1.0.1/bin.tar.gz
source_x86_64 = https://dummyhost/download/v1.0.1-foo/bin.tar.gz
sha256sums_x86_64 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

pkgname = default-gitlab-bin
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license=('MIT')
provides=('default')
conflicts=('default')

source_x86_64=('https://dummyhost/download/v1.0.1/bin.tar.gz')
source_x86_64=('https://dummyhost/download/v1.0.1-foo/bin.tar.gz')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')

package() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pkgbase = default-bin
conflicts = default
provides = default
arch = x86_64
source_x86_64 = https://dummyhost/download/v1.0.1/bin.tar.gz
source_x86_64 = https://dummyhost/download/v1.0.1-foo/bin.tar.gz
sha256sums_x86_64 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

pkgname = default-bin
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ conflicts=('libcurl' 'cvs' 'blah')
depends=('curl' 'bash')
optdepends=('wget: stuff' 'foo: bar')

source_x86_64=('https://dummyhost/download/v1.0.1/bin.tar.gz')
source_x86_64=('https://dummyhost/download/v1.0.1-foo/bin.tar.gz')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')

package() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pkgbase = with-more-opts-bin
provides = git
provides = svn
arch = x86_64
source_x86_64 = https://dummyhost/download/v1.0.1/bin.tar.gz
source_x86_64 = https://dummyhost/download/v1.0.1-foo/bin.tar.gz
sha256sums_x86_64 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

pkgname = with-more-opts-bin

0 comments on commit a1447a3

Please sign in to comment.