1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-10-30 23:58:09 +02:00

fix(aur): support wrap_in_directory (#4502)

closes #4500

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2023-12-26 08:37:28 -03:00
committed by GitHub
parent 27f0e3304b
commit 8586878fdf
4 changed files with 79 additions and 1 deletions

View File

@@ -140,8 +140,10 @@ func doRun(ctx *context.Context, aur config.AUR, cl client.ReleaseURLTemplater)
bin := artifact.ExtraOr(*art, artifact.ExtraBinary, art.Name)
pkg = fmt.Sprintf(`install -Dm755 "./%s "${pkgdir}/usr/bin/%s"`, name, bin)
case artifact.UploadableArchive:
folder := artifact.ExtraOr(*art, artifact.ExtraWrappedIn, ".")
for _, bin := range artifact.ExtraOr(*art, artifact.ExtraBinaries, []string{}) {
pkg = fmt.Sprintf(`install -Dm755 "./%s" "${pkgdir}/usr/bin/%[1]s"`, bin)
path := filepath.ToSlash(filepath.Clean(filepath.Join(folder, bin)))
pkg = fmt.Sprintf(`install -Dm755 "./%s" "${pkgdir}/usr/bin/%s"`, path, bin)
break
}
}

View File

@@ -493,6 +493,53 @@ func TestRunPipeNoBuilds(t *testing.T) {
require.False(t, client.CreatedFile)
}
func TestRunPipeWrappedInDirectory(t *testing.T) {
url := testlib.GitMakeBareRepository(t)
key := testlib.MakeNewSSHKey(t, "")
folder := t.TempDir()
ctx := testctx.NewWithCfg(
config.Project{
Dist: folder,
ProjectName: "foo",
AURs: []config.AUR{{
GitURL: url,
PrivateKey: key,
}},
},
testctx.WithVersion("1.2.1"),
testctx.WithCurrentTag("v1.2.1"),
testctx.WithSemver(1, 2, 1, ""),
)
path := filepath.Join(folder, "dist/foo_linux_amd64/foo")
ctx.Artifacts.Add(&artifact.Artifact{
Name: "foo.tar.gz",
Path: path,
Goos: "linux",
Goarch: "amd64",
Goamd64: "v1",
Type: artifact.UploadableArchive,
Extra: map[string]interface{}{
artifact.ExtraID: "foo",
artifact.ExtraFormat: "tar.gz",
artifact.ExtraBinaries: []string{"foo"},
artifact.ExtraWrappedIn: "foo",
},
})
require.NoError(t, Pipe{}.Default(ctx))
require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o755))
f, err := os.Create(path)
require.NoError(t, err)
require.NoError(t, f.Close())
client := client.NewMock()
require.NoError(t, runAll(ctx, client))
require.NoError(t, Pipe{}.Publish(ctx))
requireEqualRepoFiles(t, folder, ".", "foo", url)
}
func TestRunPipeBinaryRelease(t *testing.T) {
url := testlib.GitMakeBareRepository(t)
key := testlib.MakeNewSSHKey(t, "")

View File

@@ -0,0 +1,18 @@
# This file was generated by GoReleaser. DO NOT EDIT.
pkgname='foo-bin'
pkgver=1.2.1
pkgrel=1
pkgdesc=''
url=''
arch=('x86_64')
license=('')
provides=('foo')
conflicts=('foo')
source_x86_64=("${pkgname}_${pkgver}_x86_64.tar.gz::https://dummyhost/download/v1.2.1/foo.tar.gz")
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
package() {
install -Dm755 "./foo/foo" "${pkgdir}/usr/bin/foo"
}

View File

@@ -0,0 +1,11 @@
pkgbase = foo-bin
pkgdesc =
pkgver = 1.2.1
pkgrel = 1
conflicts = foo
provides = foo
arch = x86_64
source_x86_64 = https://dummyhost/download/v1.2.1/foo.tar.gz
sha256sums_x86_64 = e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
pkgname = foo-bin