Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions apk/apk.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,20 @@
// https://github.com/golang/go/blob/master/src/internal/syslist/syslist.go
// nolint: gochecknoglobals
var archToAlpine = map[string]string{
"all": "noarch",
"386": "x86",
"amd64": "x86_64",
"arm64": "aarch64",
"arm6": "armhf",
"arm7": "armv7",
"ppc64le": "ppc64le",
"s390": "s390x",
"loong64": "loongarch64",
"aarch64": "aarch64",
"x86_64": "x86_64",
"i386": "x86",
"i686": "x86",
"all": "noarch",

Check failure on line 64 in apk/apk.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofumpt)
"386": "x86",
"amd64": "x86_64",
"arm64": "aarch64",
"arm6": "armhf",
"arm7": "armv7",
"ppc64le": "ppc64le",
"s390": "s390x",
"loong64": "loongarch64",
"aarch64": "aarch64",
"x86_64": "x86_64",
"i386": "x86",
"i686": "x86",
"riscv64": "riscv64",
}

func ensureValidArch(info *nfpm.Info) *nfpm.Info {
Expand Down
2 changes: 1 addition & 1 deletion apk/apk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestDefaultWithArch(t *testing.T) {
"etc/fake/fake2.conf": "96c335dc28122b5f09a4cef74b156cd24c23784c",
"etc/fake/fake3.conf": "96c335dc28122b5f09a4cef74b156cd24c23784c",
}
for _, arch := range []string{"386", "amd64"} {
for _, arch := range []string{"386", "amd64", "riscv64"} {
t.Run(arch, func(t *testing.T) {
info := exampleInfo()
info.Arch = arch
Expand Down
21 changes: 11 additions & 10 deletions arch/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@

// nolint: gochecknoglobals
var archToArchLinux = map[string]string{
"all": "any",
"amd64": "x86_64",
"386": "i686",
"arm64": "aarch64",
"arm7": "armv7h",
"arm6": "armv6h",
"arm5": "arm",
"x86_64": "x86_64",
"aarch64": "aarch64",
"i386": "i686",
"all": "any",

Check failure on line 45 in arch/arch.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofumpt)
"amd64": "x86_64",
"386": "i686",
"arm64": "aarch64",
"arm7": "armv7h",
"arm6": "armv6h",
"arm5": "arm",
"x86_64": "x86_64",
"aarch64": "aarch64",
"i386": "i686",
"riscv64": "riscv64",
}

func ensureValidArch(info *nfpm.Info) *nfpm.Info {
Expand Down
4 changes: 2 additions & 2 deletions arch/arch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func TestConventionalExtension(t *testing.T) {
}

func TestArch(t *testing.T) {
for _, arch := range []string{"386", "amd64", "arm64"} {
for _, arch := range []string{"386", "amd64", "arm64", "riscv64"} {
t.Run(arch, func(t *testing.T) {
info := exampleInfo()
info.Arch = arch
Expand Down Expand Up @@ -129,7 +129,7 @@ func TestArchNoInfo(t *testing.T) {
}

func TestArchConventionalFileName(t *testing.T) {
for _, arch := range []string{"386", "amd64", "arm64"} {
for _, arch := range []string{"386", "amd64", "arm64", "riscv64"} {
t.Run(arch, func(t *testing.T) {
info := exampleInfo()
info.Arch = arch
Expand Down
23 changes: 12 additions & 11 deletions deb/deb.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@
// https://wiki.debian.org/ArchitectureSpecificsMemo
// nolint: gochecknoglobals
var archToDebian = map[string]string{
"386": "i386",
"arm64": "arm64",
"arm5": "armel",
"arm6": "armhf",
"arm7": "armhf",
"mips64le": "mips64el",
"mipsle": "mipsel",
"ppc64le": "ppc64el",
"s390": "s390x",
"x86_64": "amd64",
"aarch64": "arm64",
"386": "i386",

Check failure on line 46 in deb/deb.go

View workflow job for this annotation

GitHub Actions / lint

File is not properly formatted (gofumpt)
"arm64": "arm64",
"arm5": "armel",
"arm6": "armhf",
"arm7": "armhf",
"mips64le": "mips64el",
"mipsle": "mipsel",
"ppc64le": "ppc64el",
"s390": "s390x",
"x86_64": "amd64",
"aarch64": "arm64",
"riscv64": "riscv64",
}

func ensureValidArch(info *nfpm.Info) *nfpm.Info {
Expand Down
2 changes: 1 addition & 1 deletion deb/deb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func TestConventionalExtension(t *testing.T) {
}

func TestDeb(t *testing.T) {
for _, arch := range []string{"386", "amd64"} {
for _, arch := range []string{"386", "amd64", "riscv64"} {
t.Run(arch, func(t *testing.T) {
info := exampleInfo()
info.Arch = arch
Expand Down
27 changes: 14 additions & 13 deletions ipk/ipk.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ func init() {
// nolint: gochecknoglobals
var archToIPK = map[string]string{
// all --> all
"386": "i386",
"amd64": "x86_64",
"arm64": "arm64",
"arm5": "armel",
"arm6": "armhf",
"arm7": "armhf",
"mips64le": "mips64el",
"mipsle": "mipsel",
"ppc64le": "ppc64el",
"s390": "s390x",
"x86_64": "x86_64",
"aarch64": "arm64",
"i386": "i386",
"386": "i386",
"amd64": "x86_64",
"arm64": "arm64",
"arm5": "armel",
"arm6": "armhf",
"arm7": "armhf",
"mips64le": "mips64el",
"mipsle": "mipsel",
"ppc64le": "ppc64el",
"s390": "s390x",
"x86_64": "x86_64",
"aarch64": "arm64",
"i386": "i386",
"riscv64": "riscv64_generic",
}

func ensureValidArch(info *nfpm.Info) *nfpm.Info {
Expand Down
2 changes: 1 addition & 1 deletion ipk/ipk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestConventionalExtension(t *testing.T) {
}

func TestIPK(t *testing.T) {
for _, arch := range []string{"386", "amd64"} {
for _, arch := range []string{"386", "amd64", "riscv64"} {
t.Run(arch, func(t *testing.T) {
info := exampleInfo()
info.Arch = arch
Expand Down
23 changes: 12 additions & 11 deletions rpm/rpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,18 @@ type RPM struct {
// https://github.com/rpm-software-management/rpm/blob/4a9b7b5908d8b463a836b51322242677677bd8b7/lib/rpmrc.cc#L1167
// nolint: gochecknoglobals
var archToRPM = map[string]string{
"all": "noarch",
"amd64": "x86_64",
"386": "i386",
"arm64": "aarch64",
"arm5": "armv5tel",
"arm6": "armv6hl",
"arm7": "armv7hl",
"mips64le": "mips64el",
"mipsle": "mipsel",
"mips": "mips",
"loong64": "loongarch64",
"all": "noarch",
"amd64": "x86_64",
"386": "i386",
"arm64": "aarch64",
"arm5": "armv5tel",
"arm6": "armv6hl",
"arm7": "armv7hl",
"mips64le": "mips64el",
"mipsle": "mipsel",
"mips": "mips",
"loong64": "loongarch64",
"riscv64": "riscv64",
}

func setDefaults(info *nfpm.Info) *nfpm.Info {
Expand Down
46 changes: 46 additions & 0 deletions rpm/rpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,52 @@ func TestRPM(t *testing.T) {
require.Equal(t, "Foo does things", description)
}

func TestRPMRiscv64(t *testing.T) {
f, err := os.CreateTemp(t.TempDir(), "test-riscv.rpm")
require.NoError(t, err)
info := exampleInfo()
info.Arch = "riscv64"
require.NoError(t, DefaultRPM.Package(info, f))

file, err := os.OpenFile(f.Name(), os.O_RDONLY, 0o600) //nolint:gosec
require.NoError(t, err)
defer func() {
f.Close()
file.Close()
err = os.Remove(file.Name())
require.NoError(t, err)
}()
rpm, err := rpmutils.ReadRpm(file)
require.NoError(t, err)

arch, err := rpm.Header.GetString(rpmutils.ARCH)
require.NoError(t, err)
require.Equal(t, archToRPM["riscv64"], arch)
}

func TestSRPMRiscv64(t *testing.T) {
f, err := os.CreateTemp(t.TempDir(), "test-riscv.src.rpm")
require.NoError(t, err)
info := exampleInfo()
info.Arch = "riscv64"
require.NoError(t, DefaultSRPM.Package(info, f))

file, err := os.OpenFile(f.Name(), os.O_RDONLY, 0o600) //nolint:gosec
require.NoError(t, err)
defer func() {
f.Close()
file.Close()
err = os.Remove(file.Name())
require.NoError(t, err)
}()
rpm, err := rpmutils.ReadRpm(file)
require.NoError(t, err)

arch, err := rpm.Header.GetString(rpmutils.ARCH)
require.NoError(t, err)
require.Equal(t, archToRPM["riscv64"], arch)
}

func TestIssue952(t *testing.T) {
info := exampleInfo()
info.MTime = time.Time{}
Expand Down
59 changes: 32 additions & 27 deletions www/content/docs/arch-mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Thank you!
| `mips64le` | `mips64el` |
| `ppc64le` | `ppc64el` |
| `s390` | `s390x` |
| `riscv64` | `riscv64` |

{{< /tab >}}

Expand All @@ -56,6 +57,7 @@ Thank you!
| `mipsle` | `mipsel` |
| `mips64le` | `mips64el` |
| `loong64` | `loongarch64` |
| `riscv64` | `riscv64` |

{{< /tab >}}

Expand All @@ -75,6 +77,7 @@ Thank you!
| `ppc64le` | `ppc64le` |
| `s390` | `s390x` |
| `loong64` | `loongarch64` |
| `riscv64` | `riscv64` |

{{< /tab >}}

Expand All @@ -91,43 +94,45 @@ Thank you!
| `arm5` | `arm` |
| `arm6` | `armv6h` |
| `arm7` | `armv7h` |
| `riscv64` | `riscv64` |

{{< /tab >}}

{{< tab >}}

| Input | Value |
| :--------: | :--------: |
| `amd64` | `x86_64` |
| `x86_64` | `x86_64` |
| `386` | `i386` |
| `i386` | `i386` |
| `arm64` | `arm64` |
| `aarch64` | `arm64` |
| `arm5` | `armel` |
| `arm6` | `armhf` |
| `arm7` | `armhf` |
| `mipsle` | `mipsel` |
| `mips64le` | `mips64el` |
| `ppc64le` | `ppc64el` |
| `s390` | `s390x` |
| Input | Value |
| :--------: | :---------------: |
| `amd64` | `x86_64` |
| `x86_64` | `x86_64` |
| `386` | `i386` |
| `i386` | `i386` |
| `arm64` | `arm64` |
| `aarch64` | `arm64` |
| `arm5` | `armel` |
| `arm6` | `armhf` |
| `arm7` | `armhf` |
| `mipsle` | `mipsel` |
| `mips64le` | `mips64el` |
| `ppc64le` | `ppc64el` |
| `s390` | `s390x` |
| `riscv64` | `riscv64_generic` |

{{< /tab >}}

{{< tab >}}

| Input | Value |
| :--------: | :-------: |
| `amd64` | `x64` |
| `x86_64` | `x64` |
| `386` | `x86` |
| `i386` | `x86` |
| `i686` | `x86` |
| `arm64` | `arm64` |
| `aarch64` | `arm64` |
| `arm` | `arm` |
| `arm7` | `arm` |
| `all` | `neutral` |
| Input | Value |
| :-------: | :-------: |
| `amd64` | `x64` |
| `x86_64` | `x64` |
| `386` | `x86` |
| `i386` | `x86` |
| `i686` | `x86` |
| `arm64` | `arm64` |
| `aarch64` | `arm64` |
| `arm` | `arm` |
| `arm7` | `arm` |
| `all` | `neutral` |

{{< /tab >}}

Expand Down
2 changes: 1 addition & 1 deletion www/content/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ name: foo
# to the platform specific equivalent. In order to manually set the architecture
# to a platform specific value, set `{format}.arch`.
# Examples: `all`, `amd64`, `386`, `arm5`, `arm6`, `arm7`, `arm64`, `mips`,
# `mipsle`, `mips64le`, `ppc64le`, `s390`
# `mipsle`, `mips64le`, `ppc64le`, `s390`, `riscv64`
arch: amd64

# Platform.
Expand Down
Loading