Project

General

Profile

OBS Maintenance » History » Version 30

osmith, 04/15/2024 08:21 AM

1 3 osmith
h1. OBS Maintenance
2
3 2 osmith
{{>toc}}
4 1 osmith
5
6 14 laforge
The Osmocom [[binary packages]] are built with [[OBS]] (Open Build Service) hosted on "obs.osmocom.org":https://obs.osmocom.org. In order to do that, the jenkins jobs "Osmocom_OBS_latest":https://jenkins.osmocom.org/jenkins/job/Osmocom_OBS_latest_obs.osmocom.org/ / "_nightly":https://jenkins.osmocom.org/jenkins/job/Osmocom_OBS_nightly_obs.osmocom.org/ ("config":https://gitea.osmocom.org/osmocom/osmo-ci/src/branch/master/jobs/osmocom-obs.yml) checkout the source repositories and build debian *source* packages, then upload these to OBS.
7 1 osmith
8
h2. Install osc
9
10
Get the command-line client for managing OBS. When using for the first time, it will ask for the credentials.
11
12
<pre>
13
$ sudo apt install osc
14
$ osc ls
15
</pre>
16
17 21 osmith
h2. Using openSUSE.org-mirror in meta configs
18
19
Each OBS project with packages (e.g. osmocom:nightly, your home: project) depends on other projects for the Linux distributions that the packages should be built for (Debian:12 etc.).
20
21
This is defined in the "meta" configuration, e.g. here: https://obs.osmocom.org/projects/osmocom:nightly/meta
22
23
In the past we had a direct dependency on openSUSE's OBS instance for these. This had the disadvantage that we couldn't build packages whenever there was an outage at openSUSE's OBS instance.
24
25
<pre><code class="xml">
26
<path project="openSUSE.org:Debian:12" repository="standard"/>
27
</code></pre>
28
29
Nowadays we have a "jenkins job":https://jenkins.osmocom.org/jenkins/view/OBS/job/Osmocom_OBS_sync that syncs the projects from openSUSE's OBS to our OBS once a day. These synchronized projects are under "openSUSE.org-mirror":https://obs.osmocom.org/project/subprojects/openSUSE.org-mirror and can be used as follows:
30
31
<pre><code class="xml">
32
<path project="openSUSE.org-mirror:Debian:12" repository="standard"/>
33
</code></pre>
34
35 27 osmith
Adding or removing distributions is described in [[Add_a_new_distribution_to_OBS|this]] article.
36
37 15 osmith
h2. Upgrading specific packages
38
39
h3. eclipse-titan
40
41
See the article [[upgrading eclipse-titan in the Osmocom OBS]].
42
43
h3. nftables / libnftnl
44
45 19 osmith
Eventually the nftables version >= 1.0.2 that osmo-upf requires should make it into the distributions we support, at which point we can remove the nftables and libnftnl packages. Until then we build these packages in OBS, this section describes how to upgrad them.
46
47
h4. rpm
48
49 15 osmith
As of writing, the nftables and libnftnl packages from the Osmocom OBS are linked to openSUSE.org:security:netfilter. When the package gets upgraded there, the build will fail in the Osmocom OBS with:
50
51
<pre>
52
[   29s] error: Bad source: /home/abuild/rpmbuild/SOURCES/libnftnl-1.2.4.tar.bz2: No such file or directory
53
</pre>
54
55
That is because the source tarballs get upgraded, but the spec file has differences and so it does not get upgraded automatically.
56
57
Diff the "upstream spec file":https://build.opensuse.org/package/view_file/security:netfilter/libnftnl/libnftnl.spec?expand=1 against the one in the Osmocom OBS and apply the changes, then it should work again.
58
59 16 osmith
<pre>
60
$ $EDITOR /tmp/upstream.spec  # put the upstream spec file here
61
$ mkdir /tmp/obs
62
$ cd /tmp/obs
63
$ osc co osmocom:nightly libnftnl
64
$ cd osmocom:nightly/libnftnl
65
$ diff libnftnl.spec /tmp/upstream.spec
66
$ $EDITOR libnftnl.spec  # apply changes
67
$ diff libnftnl.spec /tmp/upstream.spec  # verify
68
$ osc commit
69
$ rm -rf /tmp/obs
70
</pre>
71 1 osmith
72 16 osmith
Wait until the package has built, then copy it to the other feeds:
73
<pre>
74
$ osc copypac osmocom:nightly libnftnl osmocom:latest
75
$ osc copypac osmocom:nightly libnftnl osmocom:master
76
</pre>
77 1 osmith
78 19 osmith
h4. deb
79
80
<pre>
81
$ mkdir /tmp/obs
82
$ cd /tmp/obs
83
$ osc co osmocom:nightly libnftnl-deb
84
$ cd osmocom:nightly/libnftnl-deb
85
$ osc del *
86
</pre>
87
88
Download the debian "source package files":https://packages.debian.org/source/sid/libnftnl into the directory and add them.
89
90
<pre>
91
$ osc add *
92
$ osc commit -m "upgrade to 1.25"
93
$ rm -rf /tmp/obs
94
</pre>
95
96
Wait until the package has built, then copy it to the other feeds (see rpm).
97 15 osmith
98 1 osmith
h2. Workflow for testing OBS configurations
99
100 4 osmith
OBS has a "project configuration":https://en.opensuse.org/openSUSE:Build_Service_prjconf, which may need to be adjusted to state preferred dependencies for example. Before we apply project configurations to the official Osmocom OBS projects, we can test them in our own OBS project. Copy the relevant package first (adjust the username accordingly in all following examples):
101 1 osmith
102
<pre>
103 11 laforge
$ osc copypac osmocom:nightly osmo-gsm-manuals home:osmith42
104 1 osmith
</pre>
105
106
Visit the site in your browser:
107 10 osmith
* https://obs.osmocom.org/package/show/home:osmith42/osmo-gsm-manuals
108 1 osmith
109
Set up build targets:
110 10 osmith
* https://obs.osmocom.org/project/add_repository_from_default_list/home:osmith42
111 1 osmith
112
The package should get added to the queue already.
113
114
Open your project config next to the osmocom:nightly one:
115 10 osmith
* https://obs.osmocom.org/project/prjconf/home:osmith42
116 11 laforge
* https://obs.osmocom.org/project/prjconf/osmocom:nightly
117 1 osmith
118
First copy everything from the Osmocom project over to your own project. Then make changes to your config, until the builds are working as expected (dependency problems are resolved etc.). Whenever you change the config, OBS will immediately re-evaluate the build dependencies, no need to upload the source packages again.
119
120
When everything works as expected, copy the config changes you have made to the Osmocom project (nightly and latest).
121
122 12 laforge
Note that changing osmocom's project config did not seem to have any effect. It seems that we really must change both @osmocom:nightly@ and @osmocom:latest@ instead.
123 1 osmith
124
h2. Workflow for modifying packages
125
126
h3. (Optional) modify the debian dir
127
128
* clone the source git repository
129
* make changes to the debian dir
130
* commit your changes
131
* push to a "user/..." branch
132
133
h3. Build source packages and upload to your own OBS project
134
135
* clone osmo-ci.git
136 13 laforge
* open "osmo-nightly-packages.sh":https://gitea.osmocom.org/osmocom/osmo-ci/src/branch/master/scripts/osmocom-nightly-packages.sh
137 1 osmith
* if you intend to make changes to the script, do them and commit the changes
138
* change "PROJ":https://git.osmocom.org/osmo-ci/tree/scripts/osmocom-nightly-packages.sh?id=dc5fc51c1fa76e64db774ecb9e71fc25ad6c46cd#n10 to home:USERNAME
139
* if you made changes to the debian dir, insert your branch name after the related "checkout line":https://git.osmocom.org/osmo-ci/tree/scripts/osmocom-nightly-packages.sh?id=dc5fc51c1fa76e64db774ecb9e71fc25ad6c46cd#n172 (e.g. <code>checkout osmo-gsm-manuals osmith/some-random-change</code>)
140
* run osmocom-nightly-packages.sh
141
* check in your browser if all packages have been built by OBS as expected (iterate until you get everything right)
142
143
When everything works fine, contribute your patches with [[Gerrit]] as usually.
144
145
h2. Troubleshooting
146
147 20 osmith
h3. A script must run before building the source package (to download dependencies etc.)
148 1 osmith
149 23 osmith
If we have control over the git repository, we can add a <code>contrib/generate_build_dep.sh</code> script to it ("example":https://gitea.osmocom.org/osmith/osmo_dia2gsup/src/branch/master/contrib/generate_build_dep.sh). It will be executed by the OBS scripts when building source packages.
150 22 osmith
151 20 osmith
Otherwise add a <code>prepare_project_</code> function to <code>scripts/obs/lib/srcpkg.py</code> in <code>osmo-ci.git</code>. See the existing functions there for reference.
152 1 osmith
153 24 osmith
h3. Source tarball not found
154
155
If a build suddenly fails with an error like this:
156
<pre>
157
[   49s] error: File /home/abuild/rpmbuild/SOURCES/zeromq-4.3.4.tar.gz: No such file or directory
158
</pre>
159
160 25 osmith
Then it is probably linked to an upstream package from openSUSE OBS and needs to be adjusted. We have it set up like this to automatically get new versions if they are packaged upstream. However the downside is that oftentimes we need to adjust the spec file, which means that it can't automatically be updated. Therefore the new source tarball gets added (in the example zeromq-4.3.5.tar.gz), but the spec file still mentions the old version.
161 24 osmith
162
How to fix it:
163
* Follow the links on our OBS to the upstream project ("example":https://build.opensuse.org/package/show/openSUSE:Factory/zeromq)
164
* Look at the diff of the upgrade ("example":https://build.opensuse.org/request/show/1119932)
165 26 osmith
* Apply the changes to our spec files (usually in osmocom:latest, osmocom:nightly, osmocom:master)
166 24 osmith
167 1 osmith
h3. Package is not resolvable
168
169
<pre>
170
have choice for jadetex needed by docbook-utils: jadetex texlive-formats-extra
171
</pre>
172
173
You'll need to adjust the OBS project configuration (mind the testing workflow above):
174
<pre>
175
Prefer: texlive-htmlxml
176
</pre>
177
178 8 osmith
h3. Reproduce the nightly builds locally
179
180
<pre>
181
$ osc co
182
$ osc build
183
</pre>
184 1 osmith
185 9 osmith
h2. E-Mail Notifications of build failures
186
187
Build failure notifications are sent to the "gerrit-log mailing list":https://lists.osmocom.org/mailman/listinfo/gerrit-log
188
189 29 osmith
190
h2. Remove a package from a binary repository
191
192
When a package can't be built for e.g. debian 10 anymore, an old version of the package will still remain in the binary repository. A workaround is to delete the package and undelete it again:
193
194
<pre>
195
$ osc rdelete osmocom:nightly osmocom-bb
196
$ osc undelete osmocom:nightly osmocom-bb
197
</pre>
198
199 1 osmith
h2. See also
200
201
* [[Linux distributions]]: which distributions we support for how long
202 30 osmith
* [[Add a new distribution to OBS]]
203 1 osmith
* https://en.opensuse.org/Portal:Build_Service
204
* https://en.opensuse.org/openSUSE:Build_Service_prjconf
Add picture from clipboard (Maximum size: 48.8 MB)