-
Notifications
You must be signed in to change notification settings - Fork 71
Pharo on Open Build Service
This page gathers all the knowledge and documentation on the effort to have Pharo building on the Open Build Service for *nixes, started by Esteban Lorenzano.
Everything is here: https://build.opensuse.org/project/show/home:estebanlm
In general lines, the real problem is that OBS gives you an infrastucture to build, but it will not give you a single description mechanism that will build all distros, you need to do all that by yourself. Which means in practice:
- learn 3 ways of packaging: deb, rpm, arch
- learn also what OBS previews to handle differences for each distro type (deb, rpm) in different versions.
- Ubuntu 18.04, 19.04, 20.04
- Debian 9, 10, Testing
- Fedora 31, 32
- OpenSuse Leap 15.1, 15.2, Thumbleweed
- Arch (Manjaro)
NOTE: I let out ubuntu the .10 versions because they are not needed, the .04 versions will work too
NOTE: I just added Fedora 33, but it need to be verified
NOTE: OBS supports aarch64
(for those distros that support it). Which means we will also be available to distribute our ARMv64 vms too).
We build two main packages:
- pharoMAJORVERSION
- pharoMAJORVERSION-ui
Includes the VM + plugins. It will install them into:
/usr/lib64/pharoMAJORVERSION
and it will create a symlink pharo
in /usr/bin
.
Also, some platforms require to build some dependencies (because they do not include them, or include different versions than those needed). This is the origin of the packages libffi7
, libgit2-1
.
We also have a package pharo9-plugin-tffi
but this will be removed since is not needed anymore.
This is (almost) a metapackage. It declares dependencies on pharoMAJORVERSION
and SDL2
.
It also install the pharo-ui
file and symlink to it at /usr/bin
.
NOTE: Both scripts pharo
and pharo-ui
are modified versions from what exist now in the pharo distribution.
To build, OBS uses
- a set of descriptions (depending on distros), and
- a set of sources (defined by the user).
OBS will not download anything when building, which means all elements needed to create the VM need to be there (there are some mechanism defined to be able to take things from a repository, but a) I did not dig into it and b) it would not solve our problem either).
To build the VM, I follow this steps
- generate VM sources.
- pack them into a package called as the OBS package plus OBS package version info (this version info is defined in the packaging description files). E.g.
pharo9-9.0.tar.gz
. Compressed file has to have thebuild
structure of pharovm, we do not modify that. - copy them to OBS package subdirectory, and (since OBS works as a vcs), commit the changes.
This will trigger the build.
WARNING: It will not trigger dependent builds (like pharo9-ui
)
There are four files named debian.(rules|compat|control|changelog)
that control the build.
There is also a prefix schema for differences between distributions and/or versions. For example: pharo9-Debian_Testing.dsc
is a special rule for debian testing.
New rules could be added using other prefixes, e.g., pharo9-xUbuntu_20.04.dsc
.
The files with extensions .dsc
and .spec
are for rpm based systems.
In rpm, there is a single descriptor pharo9.spec
that manages the differences between all rpm based distributions and versions.
In our current version suse 15.1, 15.2 and Thumbleweed, and Fedora 31, 32:
%if 0%{?suse_version} || 0%{?sle_version} >= 150100
BuildRequires: clang
BuildRequires: libopenssl-1_0_0-devel libuuid-devel
Requires: glibc libopenssl1_0_0 libuuid %{name}-plugin-tffi
%endif
%if 0%{?fedora}
BuildRequires: clang
BuildRequires: openssl-devel libuuid-devel
Requires: glibc openssl libuuid %{name}-plugin-tffi
%endif
Another important aspect is the following workaround to bypass test phase on OSL versions, because rpath is no valid there:
# Workaround to bypass test phase on OSL versions (rpath is no valid there, but
# we do not care as it will be ignored)
%if (0%{?sle_version} >= 150100)
export NO_BRP_CHECK_RPATH=true
%endif
arch -> arch y manjaro (no se si hay otros) PKGBUILD es el de arch
To run the build locally it is required to install the following packages:
- osc
- obs-build
Also it is needed to add a library to the Perl lookup:
export PERL5LIB=/usr/lib/obs-build/
And then as there is a problem with SSL certificate chain, we need to put a configuration to skip the validation of those. In the file ~/.config/osc/oscrc we need to add some configuration in the "api.opensuse.org" section:
sslcertck = 0
It will result in something like:
[https://api.opensuse.org]
sslcertck = 0
user=tesonep
...
Once we have correctly configured OSC and it is running, we can run the build locally by doing:
osc build Debian_10 pharo9.dsc
This is the build for Debian_10 but we can change different options there. This is always building for the same architecture of the local machine.
When the build ends, it lists the paths of the resulting packages, as an example:
/var/tmp/build-root/Debian_10-x86_64/usr/src/packages/SOURCES.DEB/pharo9_9.0.orig.tar.gz
/var/tmp/build-root/Debian_10-x86_64/usr/src/packages/SOURCES.DEB/pharo9_9.0.dsc
/var/tmp/build-root/Debian_10-x86_64/usr/src/packages/SOURCES.DEB/pharo9_9.0.diff.gz
/var/tmp/build-root/Debian_10-x86_64/usr/src/packages/DEBS/pharo9_9.0_amd64.deb
/var/tmp/build-root/Debian_10-x86_64/usr/src/packages/DEBS/pharo9-dbgsym_9.0_amd64.deb
As you can see, this worked fine as a PoC. To work properly, we need to:
- take the description files and transform them into templates (putting them in pharovm sources, also).
- a script that will a. generate sources and package them, b. generate description files from templates, c. copy all that into an OBS structure and commit them
- put all this as a jenkins step, maybe.
- move from
home:estebanlm
topharo
OBS group
- How does the updates (with obsoletes, conflicts and replacements) work?