Skip to content
Permalink
Browse files
feat: nfpm for ios (#3436)
Jailbroken iOS can install deb packages, and it seems the only change
needed is to set the OS to `ios` instead of `linux`.

Closes #3410

cc/ @blacktop

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Oct 13, 2022
1 parent 13bb053 commit 080ccff8dbcd52cbcf082f95b6d023aaa55ad8cf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
@@ -82,7 +82,10 @@ func (Pipe) Run(ctx *context.Context) error {
func doRun(ctx *context.Context, fpm config.NFPM) error {
filters := []artifact.Filter{
artifact.ByType(artifact.Binary),
artifact.ByGoos("linux"),
artifact.Or(
artifact.ByGoos("linux"),
artifact.ByGoos("ios"),
),
}
if len(fpm.Builds) > 0 {
filters = append(filters, artifact.ByIDs(fpm.Builds...))
@@ -136,6 +139,10 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar
// TODO: improve mips handling on nfpm
infoArch := binaries[0].Goarch + binaries[0].Goarm + binaries[0].Gomips // key used for the ConventionalFileName et al
arch := infoArch + binaries[0].Goamd64 // unique arch key
infoPlatform := binaries[0].Goos
if infoPlatform == "ios" {
infoPlatform = "iphoneos-arm64"
}

bindDir := fpm.Bindir
if format == termuxFormat {
@@ -266,7 +273,7 @@ func create(ctx *context.Context, fpm config.NFPM, format string, binaries []*ar

info := &nfpm.Info{
Arch: infoArch,
Platform: "linux",
Platform: infoPlatform,
Name: fpm.PackageName,
Version: ctx.Version,
Section: fpm.Section,
@@ -159,8 +159,11 @@ func TestRunPipe(t *testing.T) {
})
ctx.Version = "1.0.0"
ctx.Git = context.GitInfo{CurrentTag: "v1.0.0"}
for _, goos := range []string{"linux", "darwin"} {
for _, goos := range []string{"linux", "darwin", "ios"} {
for _, goarch := range []string{"amd64", "386", "arm64", "arm", "mips"} {
if goos == "ios" && goarch != "arm64" {
continue
}
switch goarch {
case "arm":
for _, goarm := range []string{"6", "7"} {
@@ -220,7 +223,7 @@ func TestRunPipe(t *testing.T) {
}
require.NoError(t, Pipe{}.Run(ctx))
packages := ctx.Artifacts.Filter(artifact.ByType(artifact.LinuxPackage)).List()
require.Len(t, packages, 36)
require.Len(t, packages, 40)
for _, pkg := range packages {
format := pkg.Format()
require.NotEmpty(t, format)
@@ -234,7 +237,11 @@ func TestRunPipe(t *testing.T) {
if pkg.Gomips != "" {
arch += "_" + pkg.Gomips
}
require.Equal(t, "foo_1.0.0_Tux_"+arch+"-10-20."+format, pkg.Name)
if pkg.Goos == "linux" {
require.Equal(t, "foo_1.0.0_Tux_"+arch+"-10-20."+format, pkg.Name)
} else {
require.Equal(t, "foo_1.0.0_ios_arm64-10-20."+format, pkg.Name)
}
require.Equal(t, "someid", pkg.ID())
require.ElementsMatch(t, []string{
"./testdata/testfile.txt",

0 comments on commit 080ccff

Please sign in to comment.