(λ (x) (create x) '(knowledge))

toAPK

toAPK on Gitlab

What is it?

toAPK is a package conversion tool in the same vein as alien, but for Alpine Linux's APKBUILDs. It is my attempt to lower the barrier of entry for Alpine's package maintenance.

Currently toAPK is capable of converting Arch Linux PKGBUILDs with a high degree of accuracy, and to a much lesser degree VOID Linux templates & Gentoo Linux ebuilds. This has been so wonderfully successful that you can create a working APKBUILD with just about any AUR package. I've personally merged at least two packages produced with toAPK, and both have required absolutely minimal editting before being accepted [1].

Language Info

toAPK is written in Fennel, a tiny little lisp that runs on top of Lua. Fennel was chosen for a few reasons:

  • It has a Lisp-1 syntax style, much like Clojure
  • Since Fennel is built on Lua you have access to Lua's wide birth of libraries
  • At the time of toAPK's inception SBCL could not compile on musl libc outside of x86_64 implementations

I wanted to write a tool that could be used by more than just myself, that could reduce some of the overhead it takes getting new packages into Alpine. Arch Linux's AUR repo's provide a plethora of packages to work with, and while running one through toAPK doesn't ensure you'll get a 100% working APKBUILD, it gets you much closer than wildly staring at your screen trying to google the differences between the packaging systems. That's how I got started as a package maintainer, and I imagine a lot of people are turned away because of the mental gymnastics it all requires.

Because I needed the tool to be adopted, and I couldn't get SBCL to compile on all Alpine platforms (until recently!), I looked to other languages. Lua came to mind, it was simple to learn, but the syntax is less than enjoyable when you're used to lisp like languages. Fennel offers a wonderful bridge between the two, and has the added benefit of compiling the code out to Lua. If someone doesn't want to deal with Fennel itself, they can just pull the compiled Lua version. Additional work has since been done to compile Fennel to static binaries, which is how toAPK is now distributed.

Long Term

toAPK is by no means done, I'd eventually like to see Gentoo Linux Ebuild -> APKBUILD conversion, and better handling of VOID Templates. If I can really carve out the time APKBUILD -> PKGBUILD conversion is high up on my list of hopes. I package all of my software with APKBUILDs in mind, and try and make sure what I make ends up in Alpine's repos, if I could take the same packages and programmatically spit out PKGBUILDS, RPMs, and even DEBs.

That's the dream at least. There's a solid amount of work left to get to that point.

[1] For those curious those packages are Cisco Chez Scheme, and the Janet programming lang.

Contact

If you'd like to contact me about my software, ponderings, or just to chat; you can reach me at wpsinatra@gmail.com.