func (*Apk) Package(info *nfpm.Info, apk io.Writer) (err error) {
	arch, ok := archToAlpine[info.Arch]
	if ok {
		info.Arch = arch
	}
	if info.Arch == "" {
		info.Arch = archToAlpine["amd64"]
	}
	if err = info.Validate(); err != nil {
		return err
	}
	var bufData bytes.Buffer
	size := int64(0)
	dataDigest, err := createData(&bufData, info, &size)
	if err != nil {
		return err
	}
	var bufControl bytes.Buffer
	controlDigest, err := createControl(&bufControl, info, size, dataDigest)
	if err != nil {
		return err
	}
	if info.APK.Signature.KeyFile == "" {
		return combineToApk(apk, &bufControl, &bufData)
	}
	var bufSignature bytes.Buffer
	if err = createSignature(&bufSignature, info, controlDigest); err != nil {
		return err
	}
	return combineToApk(apk, &bufSignature, &bufControl, &bufData)
}
Package writes a new apk package to the given writer using the given info.
package apk
import (
	"archive/tar"
	"bufio"
	"bytes"
	"compress/gzip"
	"crypto/sha1"
	"crypto/sha256"
	"encoding/hex"
	"errors"
	"fmt"
	"hash"
	"io"
	"io/ioutil"
	"net/mail"
	"os"
	"path/filepath"
	"strings"
	"sync/atomic"
	"text/template"
	"time"
	"github.com/goreleaser/nfpm/v2"
	"github.com/goreleaser/nfpm/v2/files"
	"github.com/goreleaser/nfpm/v2/internal/sign"
)
const packagerName = "apk"
func init() {
	nfpm.RegisterPackager(packagerName, Default)
}
var archToAlpine = map[string]string{
	"386":   "x86",
	"amd64": "x86_64",
	"arm":   "armhf",
	"arm6":  "armhf",
	"arm7":  "armhf",
	"arm64": "aarch64",
}
var Default = &Apk{}
type Apk struct{}
func (a *Apk) ConventionalFileName(info *nfpm.Info) string {
	arch, ok := archToAlpine[info.Arch]
	if !ok {
		arch = info.Arch
	}
	version := info.Version
	if info.Release != "" {
		version += "-" + info.Release
	}
	if info.Prerelease != "" {
		version += "~" + info.Prerelease
	}
	if info.VersionMetadata != "" {
		version += "+" + info.VersionMetadata
	}
	return fmt.Sprintf("%s_%s_%s.apk", info.Name, version, arch)
}