Yesterday I released xdg-app 0.4.6 and I wanted to take some time to talk about what is new in this version what is happening around xdg-app.
libxdg-app and gnome-software integration
In the release, but disabled by default, is a new library called “libxdg-app”. It is intended for applications that want to present a user interface for managing xdg-app applications. We’re working on integrating this with gnome-software so that we can have graphical installation and updating of applications. This is work in progress, and the APIs are not yet stable, but it is very important progress that we will continue working on in the near future.
New xdg-app-builder tool
The basics of how to bundle and application with xdg-app is very simple. You initialize an application directory with build-init. For example:
$ xdg-app build-init appdir org.example.ExampleApp org.gnome.Sdk org.gnome.Platform 3.18
This gives you an place where you can both run the build, and store the application being build. Typically you then go to your source directory and run something like:
$ xdg-app build appdir ./configure --prefix=/app $ xdg-app build appdir make $ xdg-app build appdir make install
At this point the application is mostly done, but you need to run build-finish in order to export things like desktop files and icons as well as configure some application metadata and permissions, and then export the directory to an ostree repository that your users can install it from:
$ xdg-app build-finish appdir --command=run-example --socket=x11 --share=network --filesystem=host $ xdg-app build-export appdir /path/to/repo
This is pretty easy, as long as all the tools you need to build your app are in the sdk, and all the dependencies the app needs are in the runtime. However, most apps need a few extra dependencies, which was a large pain point for people experimenting with xdg-app.
I decided to write a tool that automates this, and thus xdg-app-builder was born. It builds on experience from the Gnome continuous integration system and the nightly xdg-app build work that I did a while ago. Its based on the build-api proposal from Colin Walters, and the idea is to push as much build-knowledge upstream as possible, so that all you need to do is list your dependencies.
Here is an example json manifest that describes the above steps, plus adds a dependency:
{ "app-id": "org.example.ExampleApp", "version": "master", "runtime": "org.gnome.Platform", "runtime-version": "3.18", "sdk": "org.gnome.Sdk", "command": "run-example", "finish-args": ["--socket=x11", "--share=network", "--filesystem=host" ], "build-options" : { "cflags": "-O2 -g", "env": { "V": "1" } }, "cleanup": ["/include", "*.a"], "modules": [ { "name": "some-dependency", "config-opts": [ "--disable-something" ], "cleanup": [ "/bin" ], "sources": [ { "type": "archive", "url": "http://someting.org/somethinbg-1.0.tar.xz", "sha256": "93cc067b23c4ef7421380d3e8bd7c940b2027668446750787d7c1cb42720248e" } ] }, { "name": "example-app", "sources": [ { "type": "git", "url": "git://git.gnome.org/gimp" } ] } ] }
In addition to just building things this will also automatically download tarballs and pull git/bzr repos and clean up and strip things after install. It even has a caching system so that any module that did not change (in the manifest, or in the git repos) will have the results taken from the cache on consecutive builds, rather than rebuilding.
Some people have started using this, including the pitivi and glom developers, and I’ve converted the existing nightly builds of gimp and inkscape to use this instead of the custom scripts that was used before. If you’re interested in playing with xdg-app-builder those links should give you some examples to work from. There is also pretty complete docs in the manpages for xdg-app-builder.
Updated nightly builds
As I mentioned above the nightly builds were converted to xdg-app-builder, but I have also extended the set of builds with Darktable, MyPaint and Scribus, in addition to the old Gimp and Inkscape builds. The scribus build have some issues which I don’t understand (help needed), but the others seem to work well.
If you’re interested in using these, take a look at https://wiki.gnome.org/Projects/SandboxedApps/NightlyBuilds which has instructions on how to get builds of xdg-app for your distro and how to use it to test the nightly builds.
Updated runtime and sdk
Since more people have started testing the Gnome runtimes I’ve fixed quite a few issues that were found in them, as well as added some new tools to the sdk. If you installed the old one, make sure to update it.
Upcoming work
The basic functionality of xdg-app is pretty much there, at least for non-sandboxed applications. The main focus of the work right now is to finish the integration with gnome-software. But after that I will return to work on sandboxing, finishing the work on the file chooser portal and the other APIs required to run apps in a sandboxed fashion.
Great work on xdg-app, finally a sound approach to applications on Linux. And thanks for packaging MyPaint!
Good to hear that. I recently started to run xdg-app nightly Gimp and Inkscape which greatly helps at reporting bugs. Scribus is the app I am really interested as there are no rpm version of 1.5.x available anywhere other than Mageia.
Great to see progress on this!
xdg-app-builder looks good, however, we discovered in Baserock early on that JSON is actually awful for humans to write and YAML is a bit nicer. Both formats are vulnerable to hard-to-find syntax errors, but YAML has some pretty important features that JSON lacks such as multiline strings, comments, and escaping rules that don’t leave you with six backslashes in a row. And it is much faster to type 🙂
That said, JSON is already a huge improvement over describing build instructions in shell scripts! And I guess it would be easy-ish for developers to write build instructions in YAML, then feed them thru a Python wrapper script that spits out JSON.
That got me thinking – do you have any plans for supporting CRIU for samdboxed apps?
There a 2 types of apps essentially – “browser” and “mplayer”. The last one is started, do the job (show the movie), dead. The first one should only be restarted if there is some bug found. Otherwise it’s the first thing I start after boot and the last thing I close before shutdown. Instead of constant start/stop which just waste of CPU cycles I can use CRIU to save it to disk and than continue.
I wouldn’t be surprised if starting firefox with hundred tabs and plugins would take significantly longer than bringing it up from CRIU stasis.
xdg-app uninstall-app doesn’t work. At all.
John: It seems to work here. Note that you have to specify “–user” to uninstall a user installed app.