Skip to content

Commit

Permalink
feat: add support for Arch Linux packages (#543)
Browse files Browse the repository at this point in the history
* feat: add support for Arch Linux packages

* test: Add initial tests

* test: Increase coverage by modifying example info

* test: Add test for ArchLinux.ConventionalFileName()

* docs: Return error if package name is invalid

* fix: Make empty name invalid

* fix: Add replaces field to .PKGINFO generator

* test: Add additional tests

* test: Test for added replaces field

* docs: Add more comments

* style: Run gofumpt

* fix: Handle errors as recommended by linter

* fix: Allow changing the pkgbase

* style: Resolve semgrep findings

* docs: Change docs to reflect new Arch Linux packager

* docs: Fix spelling mistake in comment

Co-authored-by: Dj Gilcrease <digitalxero@gmail.com>

* docs: use aspell to fix all spelling mistakes

* feat: Handle packaging formats with non-distinct file extensions as described in #546

* fix: Add newline to generated .INSTALL file

* fix: Take into account provided info for non-symlink files

* docs: Fix names for arch-specific scripts in documentation

* fix: Only consider files with the correct packager field

* fix: Use correct scripts field for post_remove script

* test: Implement archlinux acceptance tests

* test: Add archlinux to acceptance_test.go

* test: Add archlinux to github test matrix

* test: Use updated build.yml from main branch

* Fix ConventionalExtension() for apk

* fix: Take epoch value into account

* fix: Add arm5 and arm6 architectures

Co-authored-by: Dj Gilcrease <digitalxero@gmail.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 15, 2022
1 parent 1a66c73 commit a18661b
Show file tree
Hide file tree
Showing 18 changed files with 1,201 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
acceptance-tests:
strategy:
matrix:
pkgFormat: [ deb, rpm, apk ]
pkgFormat: [ deb, rpm, apk, archlinux ]
pkgPlatform: [ amd64, arm64, 386, ppc64le, armv6, armv7, s390x ]
runs-on: ubuntu-latest
env:
Expand All @@ -88,4 +88,3 @@ jobs:
run: ./scripts/test.sh acceptance ubuntu-latest
env:
TEST_PATTERN: "/${{ matrix.pkgFormat }}/${{ matrix.pkgPlatform }}/"

8 changes: 5 additions & 3 deletions acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ import (

"github.com/goreleaser/nfpm/v2"
_ "github.com/goreleaser/nfpm/v2/apk"
_ "github.com/goreleaser/nfpm/v2/arch"
_ "github.com/goreleaser/nfpm/v2/deb"
_ "github.com/goreleaser/nfpm/v2/rpm"
"github.com/stretchr/testify/require"
)

// nolint: gochecknoglobals
var formatArchs = map[string][]string{
"apk": {"amd64", "arm64", "386", "ppc64le", "armv6", "armv7", "s390x"},
"deb": {"amd64", "arm64", "ppc64le", "armv7", "s390x"},
"rpm": {"amd64", "arm64", "ppc64le", "armv7"},
"apk": {"amd64", "arm64", "386", "ppc64le", "armv6", "armv7", "s390x"},
"deb": {"amd64", "arm64", "ppc64le", "armv7", "s390x"},
"rpm": {"amd64", "arm64", "ppc64le", "armv7"},
"archlinux": {"amd64"},
}

func TestCore(t *testing.T) {
Expand Down
5 changes: 5 additions & 0 deletions apk/apk.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ func (a *Apk) ConventionalFileName(info *nfpm.Info) string {
return fmt.Sprintf("%s_%s_%s.apk", info.Name, version, info.Arch)
}

// ConventionalExtension returns the file name conventionally used for Apk packages
func (*Apk) ConventionalExtension() string {
return ".apk"
}

// Package writes a new apk package to the given writer using the given info.
func (*Apk) Package(info *nfpm.Info, apk io.Writer) (err error) {
info = ensureValidArch(info)
Expand Down
Loading

0 comments on commit a18661b

Please sign in to comment.