-
-
Notifications
You must be signed in to change notification settings - Fork 571
Using Open Build Service
Short link to this page: https://git.io/obs-ai
This page descibes how to use Open Build Service, particularly openSUSE Build Service, to generate AppImage bundles. An AppImage contains an application and everything it needs to run on various target systems (distributions) that cannot reasonably be expected to come in a recent enough version as part of the default installation of those target systems.
This page is about using Open Build Service to generate AppImages.
OBS support for AppImages was officially announced at the openSUSE Conference 2017 (talk, slides). AppImages can be built successfully on the public openSUSE Build Service (examples). You are encouraged to try to build AppImages for your own packages using this guide. Feel free to share your thoughts, ideas and experiences with us via IRC. In case you encounter problems, please report an issue, and we'll try to verify and fix it.
openSUSE chairman loves AppImage: See his talk (slides).
Open Build Service is a generic system to build and distribute packages from sources in an automatic, consistent and reproducible way. It allows you to build software for various package formats and distributions. Now it can also build AppImages that run on a variety of distributions.
The openSUSE Build Service is the public instance of the Open Build Service (OBS). This infrastructure can can be used for free by open source projects. However, you are not limited to it - you can set up your own Open Build Service instance if you like.
There are different ways to build AppImages. Why is using Open Build Service interesting?
- If you are already using Open Build Service, then also generating an AppImage should be straightforward
- You can use the public openSUSE Build Service instance and use the existing infrastructure to build and distribute your AppImage (for open source projects only)
- You can build AppImages in "automatic, consistent and reproducible way". This means that unlike when you build your AppImages on, e.g., Travis CI, where you can pull in arbitrarily changing build dependencies and AppImage ingredients from the net, your builds on Open Build Service can only use build dependencies and AppImage ingredients that have their source code in distribution repositories or on Open Build Service. While this may be a limitation in some cases (e.g., for agile/continuous builds), it means that the build result is much more reproducible
- OBS helps you to keep the ingredients of your AppImage up-to-date all the time using proven distribution methodologies and tool, relieving the person or group providing AppImages from manual work as discussed here
- OBS automatically builds a new AppImage for you if one if its ingredients is updated on OBS
- OBS automatically signs AppImages using the user's key on OBS
- OBS automatically embeds update information into AppImages to enable binary delta updates using AppImageUpdate. This means that if in a 100 MB AppImage only 1 MB changed between versions, then the user has to download only 1 MB rather than 100 MB
While OBS can be used entirely through the web interface, it can be beneficial to use the osc
command line tool. It is available as an AppImage from https://download.opensuse.org/repositories/openSUSE:/Tools/AppImage/. Since this page is mainly geared toward beginners, it mainly describes the web interface. However, using the command line tool may offer a quicker route for more experienced OBS users.
This page describes how to use the public openSUSE Build Service instance. If you use your own instance, things will probably be similar but may not be identical.
-
To set up an account, go to https://build.opensuse.org/ and click on "Sign Up" in the upper-right corner
-
Once you have an account, log in using it and click on "Home Project" in the upper-right corner. Every user has a home project. Think if it as a collection of source code packages that you build AppImages (and possibly other types of packages) from. Later on, you can add additional projects, and invite collaborators to them
On the https://build.opensuse.org/ homepage, click on "New Image".
Then select AppImage, and click "Create Appliance".
Done! An AppImage of Leafpad, a simple text editor, will be built. You can use this template as a starting point to customize for other applications.
The following sections describe how to do the same manually.
You need to tell OBS that for all source code packages in your home project you want to generate AppImages. To enable a target for AppImage, you can either use the command line tool osc meta prj -e ...
or use the OBS web interface:
- Go to your home project
- Click on "Advanced"
- Click on "Meta"
- Copy and paste the
<repository>
tags from the following:
<project name="home:probono">
<title>probono</title>
<description/>
<person userid="probono" role="maintainer"/>
<publish>
<enable/>
</publish>
<repository name="AppImage.arm">
<path project="home:probono" repository="openSUSE_13.1"/>
<path project="OBS:AppImage" repository="AppImage.arm"/>
<arch>armv7l</arch>
<arch>aarch64</arch>
</repository>
<repository name="AppImage">
<path project="home:probono" repository="openSUSE_13.1"/>
<path project="OBS:AppImage" repository="AppImage"/>
<arch>x86_64</arch>
<arch>i586</arch>
</repository>
</project>
NOTE: The AppImage.arm
repository is used for the ARM architectures for now. This will possibly change in the future.
Be sure to just insert the <repository>
tags into your existing file. For AppImage, we need to select one of the build targets that is built in your obs project. In the example above, please make sure to replace home:probono
with the actual name of the obs project where appimage.yml
should look for its resources - this can be the current project, and even RPMs created by the same package work as resources for AppImage.
Also check if openSUSE_13.1 is still alive or use something slightly newer instead.
In order to build an AppImage you need to provide a file called appimage.yml
. OBS needs to get all the required resources before building. This is needed in order to be able to track changes and to find out whether a rebuild is needed, and to provide the resources in a secured and reproducible environment without network access.
The build:
section can be used to define resources which are required to build.
This can be binary packages (currently only rpm) or URLs to any other source control management systems or file. The binary packages listed in the build section get installed to the build environment, but not extracted into the AppDir.
The packages listed in the ingredients section do not get installed into the build environment but get extracted into the AppDir.
URLs for the supported source control management systems (git, svn, cvs, hg, bzr) get handled via the appimage source service, which is a part of obs-service-tar_scm. It is downloading the sources and provides them to the build system as directory structure.
(FIXME: not yet implemented) URLs to files get handled via the download_files source service. It is handy to provide single files to the build.
Scripts can be executed in the form of the script hooks of the appimage.yml
file.
Note: Recipe
files are not supported, anything they can do can be done inside the script
sections of appimage.yml
.
Please note: It is optional to either
-
create the AppImage root via packages by using the ingredients section. This is useful especially for larger software, because it avoid the need of a recompilation and just repackages the content of binary packages.
-
create the AppImage root only from source using the scripts. This is useful when you want to avoid to build a binary package first.
Both approaches can also get combined if wanted.
Please note that it uses the following environment variables which are provided by the build system:
-
BUILD_SOURCE_DIR
: The absolute directory name where all source files or directories are hosted -
BUILD_APPDIR
: The directory which will get packaged as AppImage file
This APPIMAGE_NAME
application will get package into an .AppImage
file just
by installing the RPM_PACKAGE_NAME
. The binary can get patched automatically
when using the binpatch: true
option
Question: From which repositories can rpms be installed? Only my own or those of all OBS users? Can additional repositories be added?
app: APPIMAGE_NAME
binpatch: true
ingredients:
packages:
- RPM_PACKAGE_NAME
script:
- cd $BUILD_APPDIR/
- cp $BUILD_APPDIR/usr/share/applications/NAME.desktop $BUILD_APPDIR
- cp $BUILD_APPDIR/usr/share/pixmaps/NAME.png $BUILD_APPDIR
app: QtQuickApp
build:
packages:
- linuxdeployqt
- pkgconfig(Qt5Quick)
git:
- https://github.com/probonopd/QtQuickApp.git
script:
- cd $BUILD_SOURCE_DIR/QtQuickApp*
- qmake-qt5 PREFIX=/usr
- make INSTALL_ROOT=$BUILD_APPDIR install
- unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
- linuxdeployqt $BUILD_APPDIR/usr/share/applications/*.desktop -qmldir=$BUILD_SOURCE_DIR/ -bundle-non-qt-libs -verbose=2
- linuxdeployqt $BUILD_APPDIR/usr/share/applications/*.desktop -qmldir=$BUILD_SOURCE_DIR/ -bundle-non-qt-libs -verbose=2
We have to also upload a file called _service
containing
<services>
<service name="appimage"/>
</services>
When trying this on a private OBS instance, please make sure to have obs-service-appimage
installed. This can be done e.g. on a Leap 42.1 machine with:
zypper addrepo http://download.opensuse.org/repositories/openSUSE:Tools/openSUSE_42.1/openSUSE:Tools.repo
zypper ref
zypper in obs-service-appimage
Note: you can add multiple items in the sections.
build:
packages:
- [SINGLE BINARY PACKAGE NAME]
git: # can be also svn, cvs, hg, bzr
- [URL TO SCM REPOSITORY]
files:
- [URL TO A RESOURCE]
Be sure to download the resulting AppImage from OBS and test it on your target system(s). It is recommended to test at least on the oldest still-supported Ubuntu LTS, the recent Ubuntu, the oldest still-supported openSUSE Leap, possibly he latest openSUSE Tumbleweed, CentOS 7, and the latest Fedora release (although you may to choose to support different target systems).
Feel free to put yours here, too.
- https://build.opensuse.org/package/binaries/home:probono/QtQuickApp?repository=AppImage
- https://build.opensuse.org/package/binaries/home:probono/DSRemote?repository=AppImage
- https://build.opensuse.org/package/binaries/home:probono/Qactus?repository=AppImage
- https://build.opensuse.org/package/binaries/home:probono/leafpad?repository=AppImage
- https://github.com/olav-st/screencloud/blob/master/deploy/linux/appimage.yml
- https://build.opensuse.org/package/view_file/home:pbek:QOwnNotes/desktop/appimage.yml?expand=1
- https://build.opensuse.org/package/view_file/home:olav-st:branches:OBS:AppImage:Templates/ScreenCloud/appimage.yml?expand=1
- https://build.opensuse.org/package/view_file/home:pbartfai/LDView/_service:extract_file:appimage.yml?expand=1
- https://build.opensuse.org/package/view_file/home:lachs0r:mandelbulber2/mandelbulber2/appimage.yml?expand=1
- https://build.opensuse.org/package/view_file/home:lachs0r:taisei/taisei/appimage.yml?expand=1
If your source code lives on GitHub, then you can set up a mechanism that makes GitHub inform OBS about any changes to the source code, and trigger a rebuild automatically.
A token needs to be generated, this can be done using the osc
OBS command line client:
sudo apt update && sudo apt install osc # or your package manager's equivalent
osc token --create
If you have already generated a token in the past, you can show it with
osc token
On the GitHub project page, click on "Settings", then click on "Integrations & services", then click on "Add service", enter "Obs" and select it. For example, for the https://github.com/probonopd/QtQuickApp/ project go to https://github.com/probonopd/QtQuickApp/settings/installations, and corresponding to https://build.opensuse.org/package/show/home:probono/QtQuickApp entered home:probono
for the project and QtQuickApp
for in the Package field, as well as the token generated above in the "Token" field. Please note that you need to supply your own username and project name instead of the one in the example above.
Now, whenever you do a git push
to my https://github.com/probonopd/QtQuickApp project, OBS will build it for me.
Question: Is there a way to include the git commit hash and/or tag in the version OBS uses for the AppImage?
- Fix that zsync files on OBS have a different sha1sum than the AppImage (due to being signed after the fact)
- When the dependencies for packages from an
ingredients:
section are resolved, we should show the dependency tree in the log file similar to https://travis-ci.org/probonopd/AppImages/builds/236117828#L898-L991 shows for debs - this would greatly help to understand what gets pulled into the AppDir and why - Show AppImage downloads on pages like https://software.opensuse.org//download.html?project=isv%3AownCloud%3Atestpilot%3Anightly&package=testpilotcloud-client with an icon (icon can be obtained from here)
- When the dependencies for RPM packages from an
ingredients:
section are resolved, theexclude:
key should be observed (i.e., not only uninstall the packages listed there but assume them to be installed prior to the dependency resolution) - Set MIME types for
*.AppImage
to octet-stream or something like that on http://download.opensuse.org/repositories/home:/probono/AppImage/ so that the browser doesn't try to display it? - Fix FUSE setup on Tumbleweed and Tumbleweed Live ISOs so that it works out of the box - https://bugzilla.suse.com/show_bug.cgi?id=1041159. Can we get a test case for it in openQA?
- Get the optional
appimaged
daemon into Tumbleweed (e.g., based on https://build.opensuse.org/package/show/OBS:AppImage/appimaged or the work of marguerite) for a polished out-of-the-box AppImage experience - Get distributions/desktop environments to handle ELF files that don't have the executable bit set more cleverly when double-clicked (currently they are opened in the text editor on the archiver tool or a completely useless message appears)
- Refine excludesuselist so that basic libraries and binaries do not end up getting bundled when re-packing rpms as AppImages
- How to use linuxdeployqt on already-available RPMs? https://build.opensuse.org/package/show/home:probono/Vokoscreen currently fails
- Fix zsync_curl (used for AppImageUpdate binary delta updates) to play nicely with download.opensuse.org and its mirrors
- Build a minimal desktop Live ISO that has only a text editor and a browser but otherwise no applications installed, but has a working
appimaged
out-of-the-box. E.g., based on openSUSE LEAP or possibly openSUSE Argon which combines LEAP with recent KDE Neon (if it proves usable). Beginnings at https://build.opensuse.org/package/show/home:probono:branches:KDE:Medias/openSUSE-Argon - The generated AppImages could be tested automatically to run on various target systems (e.g., the oldest still-supported LTS versions of the major distributions)
- For AppImages released on OBS by the original application author or group (i.e., "upstream builds"), metadata about successfully built AppImages could be pushed to openDesktop.org, so that they would appear on sites like https://www.linux-appimages.org and https://www.linux-apps.com automatically
- Remove the need to upload a (pointless, as in no additional information)
_service
file - Make rpm-to-AppImage easier by removing the need for the FIXMEs in https://build.opensuse.org/package/view_file/home:probono/VLC/appimage.yml?expand=1
- Find a way to automate the conversion to AppImage of all Tumbleweed source packages that are built against LEAP as well
- https://github.com/openSUSE/open-build-service/issues/3279 appimage.yml fails when no build: packages: key is present
- https://github.com/openSUSE/open-build-service/issues/3280 "latest" zsnyc symlink does not get correct name
- https://github.com/openSUSE/open-build-service/issues/3281 files get named wrongly
- https://github.com/openSUSE/open-build-service/issues/3302 provide download page
- Presentation by Andi Sugandi https://t.co/dxVVAhdC76?amp=1
- https://download.opensuse.org/repositories/openSUSE:/Tools/AppImage/
- http://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.package_formats.html#id11575
Short link to this page: https://git.io/obs-ai