1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00

fix(aur): improve yay caching (#2965)

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2022-03-09 09:50:57 -03:00 committed by GitHub
parent 2d9acf65b5
commit c17ff3b966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 16 deletions

View File

@ -312,6 +312,7 @@ func dataFor(ctx *context.Context, cfg config.AUR, cl client.Client, artifacts [
DownloadURL: url, DownloadURL: url,
SHA256: sum, SHA256: sum,
Arch: toPkgBuildArch(art.Goarch + art.Goarm), Arch: toPkgBuildArch(art.Goarch + art.Goarm),
Format: art.ExtraOr(artifact.ExtraFormat, "").(string),
} }
result.ReleasePackages = append(result.ReleasePackages, releasePackage) result.ReleasePackages = append(result.ReleasePackages, releasePackage)
result.Arches = append(result.Arches, releasePackage.Arch) result.Arches = append(result.Arches, releasePackage.Arch)

View File

@ -64,26 +64,31 @@ func createTemplateData() templateData {
Arch: "x86_64", Arch: "x86_64",
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz", DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz",
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67", SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
Format: "tar.gz",
}, },
{ {
Arch: "armv6h", Arch: "armv6h",
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm6.tar.gz", DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm6.tar.gz",
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67", SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
Format: "tar.gz",
}, },
{ {
Arch: "aarch64", Arch: "aarch64",
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm64.tar.gz", DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm64.tar.gz",
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67", SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
Format: "tar.gz",
}, },
{ {
Arch: "i686", Arch: "i686",
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_386.tar.gz", DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_386.tar.gz",
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67", SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
Format: "tar.gz",
}, },
{ {
Arch: "armv7h", Arch: "armv7h",
DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_arm7.tar.gz", DownloadURL: "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_arm7.tar.gz",
SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67", SHA256: "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67",
Format: "tar.gz",
}, },
}, },
} }
@ -108,7 +113,7 @@ func TestAurSimple(t *testing.T) {
require.Contains(t, pkg, `# Contributor: Beltrano <beltrano@example.com>`) require.Contains(t, pkg, `# Contributor: Beltrano <beltrano@example.com>`)
require.Contains(t, pkg, `pkgname='test-bin'`) require.Contains(t, pkg, `pkgname='test-bin'`)
require.Contains(t, pkg, `url='https://example.com'`) require.Contains(t, pkg, `url='https://example.com'`)
require.Contains(t, pkg, `source_x86_64=('https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz')`) require.Contains(t, pkg, `source_x86_64=('${pkgname}_${pkgver}_x86_64.tar.gz::https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz')`)
require.Contains(t, pkg, `sha256sums_x86_64=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')`) require.Contains(t, pkg, `sha256sums_x86_64=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')`)
require.Contains(t, pkg, `pkgver=0.1.3`) require.Contains(t, pkg, `pkgver=0.1.3`)
} }

View File

@ -16,19 +16,19 @@ conflicts=('nope')
depends=('nope') depends=('nope')
optdepends=('nfpm') optdepends=('nfpm')
source_x86_64=('https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz') source_x86_64=('${pkgname}_${pkgver}_x86_64.tar.gz::https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_x86_64.tar.gz')
sha256sums_x86_64=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67') sha256sums_x86_64=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')
source_armv6h=('https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm6.tar.gz') source_armv6h=('${pkgname}_${pkgver}_armv6h.tar.gz::https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm6.tar.gz')
sha256sums_armv6h=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67') sha256sums_armv6h=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')
source_aarch64=('https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm64.tar.gz') source_aarch64=('${pkgname}_${pkgver}_aarch64.tar.gz::https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_Arm64.tar.gz')
sha256sums_aarch64=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67') sha256sums_aarch64=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')
source_i686=('https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_386.tar.gz') source_i686=('${pkgname}_${pkgver}_i686.tar.gz::https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_386.tar.gz')
sha256sums_i686=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67') sha256sums_i686=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')
source_armv7h=('https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_arm7.tar.gz') source_armv7h=('${pkgname}_${pkgver}_armv7h.tar.gz::https://github.com/caarlos0/test/releases/download/v0.1.3/test_Linux_arm7.tar.gz')
sha256sums_armv7h=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67') sha256sums_armv7h=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')
package() { package() {

View File

@ -10,7 +10,7 @@ license=('MIT')
provides=('default-gitlab') provides=('default-gitlab')
conflicts=('default-gitlab') conflicts=('default-gitlab')
source_x86_64=('https://dummyhost/download/v1.0.1-foo/bin.tar.gz') source_x86_64=('${pkgname}_${pkgver}_x86_64.tar.gz::https://dummyhost/download/v1.0.1-foo/bin.tar.gz')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
package() { package() {

View File

@ -10,7 +10,7 @@ license=('MIT')
provides=('default') provides=('default')
conflicts=('default') conflicts=('default')
source_x86_64=('https://dummyhost/download/v1.0.1-foo/bin.tar.gz') source_x86_64=('${pkgname}_${pkgver}_x86_64.tar.gz::https://dummyhost/download/v1.0.1-foo/bin.tar.gz')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
package() { package() {

View File

@ -14,7 +14,7 @@ conflicts=('libcurl' 'cvs' 'blah')
depends=('curl' 'bash') depends=('curl' 'bash')
optdepends=('wget: stuff' 'foo: bar') optdepends=('wget: stuff' 'foo: bar')
source_x86_64=('https://dummyhost/download/v1.0.1-foo/bin.tar.gz') source_x86_64=('${pkgname}_${pkgver}_x86_64.tar.gz::https://dummyhost/download/v1.0.1-foo/bin.tar.gz')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
package() { package() {

View File

@ -10,19 +10,19 @@ license=('MIT')
provides=('foo') provides=('foo')
conflicts=('foo') conflicts=('foo')
source_aarch64=('https://dummyhost/download/v1.0.1/arm64.tar.gz') source_aarch64=('${pkgname}_${pkgver}_aarch64.tar.gz::https://dummyhost/download/v1.0.1/arm64.tar.gz')
sha256sums_aarch64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_aarch64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
source_armv6h=('https://dummyhost/download/v1.0.1/armv6.tar.gz') source_armv6h=('${pkgname}_${pkgver}_armv6h.tar.gz::https://dummyhost/download/v1.0.1/armv6.tar.gz')
sha256sums_armv6h=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_armv6h=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
source_armv7h=('https://dummyhost/download/v1.0.1/armv7.tar.gz') source_armv7h=('${pkgname}_${pkgver}_armv7h.tar.gz::https://dummyhost/download/v1.0.1/armv7.tar.gz')
sha256sums_armv7h=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_armv7h=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
source_i686=('https://dummyhost/download/v1.0.1/bin.tar.gz') source_i686=('${pkgname}_${pkgver}_i686.tar.gz::https://dummyhost/download/v1.0.1/bin.tar.gz')
sha256sums_i686=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_i686=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
source_x86_64=('https://dummyhost/download/v1.0.1/bin.tar.gz') source_x86_64=('${pkgname}_${pkgver}_x86_64.tar.gz::https://dummyhost/download/v1.0.1/bin.tar.gz')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
package() { package() {

View File

@ -10,7 +10,7 @@ license=('')
provides=('foo') provides=('foo')
conflicts=('foo') conflicts=('foo')
source_x86_64=('https://dummyhost/download/v1.2.1/foo_linux_amd64') source_x86_64=('${pkgname}_${pkgver}_x86_64.binary::https://dummyhost/download/v1.2.1/foo_linux_amd64')
sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855') sha256sums_x86_64=('e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855')
package() { package() {

View File

@ -22,6 +22,7 @@ type releasePackage struct {
DownloadURL string DownloadURL string
SHA256 string SHA256 string
Arch string Arch string
Format string
} }
const aurTemplateData = `# This file was generated by GoReleaser. DO NOT EDIT. const aurTemplateData = `# This file was generated by GoReleaser. DO NOT EDIT.
@ -54,7 +55,7 @@ optdepends=({{ pkgArray . }})
{{- end }} {{- end }}
{{ range .ReleasePackages -}} {{ range .ReleasePackages -}}
source_{{ .Arch }}=('{{ .DownloadURL }}') source_{{ .Arch }}=('${pkgname}_${pkgver}_{{ .Arch }}.{{ .Format }}::{{ .DownloadURL }}')
sha256sums_{{ .Arch }}=('{{ .SHA256 }}') sha256sums_{{ .Arch }}=('{{ .SHA256 }}')
{{ printf "" }} {{ printf "" }}
{{ end }} {{ end }}