facebookincubator / xar

executable archive format
Other
1.57k stars 55 forks source link

Is xar limited to Python? #9

Closed probonopd closed 6 years ago

probonopd commented 6 years ago

Is xar limited to Python or could it be used for other types of payloads as well? Could it be used as more generic image format for something like AppImage?

cooperlees commented 6 years ago

We've used it internally for other payloads, e.g. Rust and I've heard talk about JAR like usages. but Python was it's major use case as we've historically used PARS (basically PEXs). https://www.youtube.com/watch?v=56C-0o0zwZ4 - Dan talks about them here.

What do you have in mind to use it for? Extend how AppImage works / use some of the primitives here? Happy to answer any questions.

probonopd commented 6 years ago

An AppImage is essentially a self-mounting squashfs file that has a tiny ELF header that does the mounting using FUSE, and then executes whatever payload (e.g., ELF binaries along with libraries, icons, fonts, images) is stored inside. This has been used to ship rather complex Python applications such as the 3D printing slicing software Ultimaker Cura which is built using PyQt.

The end user just gets one file, sets the executable bit, and executes it. The AppImage mounts itself, executes Cura using the bundled Python and PyQt stored inside the squashfs, and unmounts itself after the application exits.

Advantages of shipping software inside AppImages include:

Here is an overview of projects that are already distributing upstream-provided, official AppImages.

I am wondering how similar this is to xar, and whether there is potential for collaboration here. Especially as in the AppImage project we are looking into using zstandard, and Python app bundling.

AppImage developers are frequently on #AppImage on irc.freenode.net.

chipturner commented 6 years ago

XAR and AppImage do indeed have some similar use cases and implementation details; however, both evolved independently to solve different problems.

XAR is intended to be a simpler solution mainly for command line tools; it has no opinion or awareness of, say, desktop standards for icons or self-updating. It is not intended to replace security mechanisms supplied by OS level package management.

I suspect something like AppImage could use XARs as the delivery vehicle, but I don't think that adds much to AppImage. Likewise, XARs are pretty simple and the added complexity of AppImage isn't something we'd want to add or replace XARs with.