osmo-ci/scripts/obs
Oliver Smith f0cff7161b OBS: add gapk, osmocom-bb
Related: OS#6409
Depends: osmocom-bb I3713201233e13fca5ea4e0b8c4df913c787965f5
Depends: gapk I8e9d42fc332c5d426b9074c6bc58bc6efe037fea
Change-Id: Ifd84479f97fe17de35a5f409c8fabadd3bf5c272
2024-03-19 13:00:31 +01:00
..
data OBS: srcpkg Dockerfile: add lsb-release, quilt 2023-12-21 13:23:11 +01:00
lib OBS: add gapk, osmocom-bb 2024-03-19 13:00:31 +01:00
README OBS: add sync_obs_projects.py 2023-09-08 09:06:57 +00:00
build_binpkg.py obs: build_binpkg: no network during build 2023-10-06 14:05:51 +02:00
build_srcpkg.py OBS: exit() -> sys.exit() 2023-09-08 11:09:39 +02:00
check_builders.sh obs: check_builders: at least 10, fail on error 2022-11-04 15:08:00 +00:00
check_new_distros.py OBS: add jenkins job to check for new distros 2023-12-06 06:10:46 +00:00
sync_obs_projects.py OBS: exit() -> sys.exit() 2023-09-08 11:09:39 +02:00
update_obs_project.py OBS: exit() -> sys.exit() 2023-09-08 11:09:39 +02:00
update_obs_wireshark.sh scripts: wireshark: remove laforge/doc-fixes 2023-09-13 14:38:04 +02:00

README

Overview
========
This directory contains the following scripts, related to building Osmocom
projects in OBS (Open Build Service) and building binary packages. Here is an
overview of the scripts, run them with -h to get a more detailed description.

* build_srcpkg.py: build one source package for an Osmocom project
* update_obs_project.py: generate source packages and upload them to OBS
* build_binpkg.py: build rpm/deb packages for one Osmocom project
* sync_obs_projects.py: sync projects from another instance (OS#6165)

Docker
------
The above scripts have a -d parameter, that allows running them inside docker.
This is how we run it in jenkins to avoid installing dependencies on the host.

Note that when building binary packages, libosmocore socket tests and possibly
others will fail unless docker has ipv6 configured:
https://osmocom.org/issues/4700#note-3

Usage Example: Submitting source packages to Osmocom's OBS build server
=======================================================================

I want to test changes to the packaging of osmo-hnbgw.
They are committed on a private branch osmo-hnbgw.git:neels/pkg.
I want to test this in my OBS "Home Project" called home:nhofmeyr:test.

Here are the steps of what I do:


OBS home project
----------------

Sign up / sign in to obs.osmocom.org and create the "test" project under the
"Home Project" link (right next to the "Logout" link on the OBS web interface),
so that https://obs.osmocom.org/project/show/home:nhofmeyr:test exists.

Make sure I can list the project using the 'osc' tool.
That requires an osc config file. Easiest is to let osc create one:

 $ osc -A https://obs.osmocom.org list home:nhofmeyr:test
 Username: nhofmeyr
 Password: ************
 Select credentials manager: 4

Verify that it worked:

 $ osc list home:nhofmeyr:test
 libosmo-pfcp
 osmo-hnbgw

FYI, the config file (oscrc) will look like this:

 [general]
 apiurl = https://obs.osmocom.org

 [https://obs.osmocom.org]
 user=nhofmeyr
 pass=***********
 credentials_mgr_class=osc.credentials.PlaintextConfigFileCredentialsManager


Publish patches in private branch
---------------------------------

(Optional: bypassing gerrit.osmocom.org explained in next section below.)

Push my private branch to Osmocom's git repository at gerrit.osmocom.org -- not
submit for review, just push a private branch.

Why is that? The obs scripts here potentially maim a git tree, so it uses a
separate git clone, which is cloned from gerrit.osmocom.org. When my private
branch is pushed there, I can trivially use it.

 cd ~/osmo-dev/src/osmo-hnbgw
 git push --set-upstream origin neels/pkg


Optional: fetch from local git repos
------------------------------------

Instead of using gerrit.osmocom.org, I can change the config of a locally
cached repository, so that the branch is fetched from my local working copy.
That is useful if I want to avoid pushing my branch upstream.

Create initial git clone in _cache/:

 cd ~/osmo-dev/src/osmo-ci/scripts/obs/
 ./build_srcpkg.py osmo-hnbgw

Set the 'origin' of the './_cache/osmo-hnbgw' git clone to my local working
copy in '~/osmo-dev/src/osmo-hnbgw':

 git -C _cache/osmo-hnbgw remote set-url origin '~/osmo-dev/src/osmo-hnbgw'

After this, no need to push to Osmocom's git, i just commit patches on my local
branch in my git clone in '~/osmo-dev/src/osmo-hnbgw'. The obs script will
fetch my local branch, known as 'origin/neels/pkg' in its cached git tree.

Verify:

 $ git -C _cache/osmo-hnbgw remote -v
 origin  ~/osmo-dev/src/osmo-hnbgw (fetch)
 origin  ~/osmo-dev/src/osmo-hnbgw (push)


Build and upload source package to OBS
--------------------------------------

 cd ~/osmo-dev/src/osmo-ci/scripts/obs/
 ./update_obs_project.py -b neels/pkg home:nhofmeyr:test osmo-hnbgw

The -b option chooses a custom branch to build.


See results
-----------

I can now see my hnbgw package listed:

 $ osc list home:nhofmeyr:test
 libosmo-pfcp
 osmo-hnbgw

I could query things via the osc tool:

 $ osc results home:nhofmeyr:test osmo-hnbgw
 neels_test2          x86_64     unresolvable
 neels_test           x86_64     failed

Or point my web browser at
https://obs.osmocom.org/project/show/home:nhofmeyr:test


Repeat
------

The dev cycle of rebuilding a change is:

* Commit changes on private branch (and push to Osmocom's git server if necessary),
* Re-run './update_obs_project.py -g -b origin/...' as above.