neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/29110 )
Change subject: readme, and sanitize feed name ......................................................................
readme, and sanitize feed name
In a README, explain how to use these scripts to test a private branch.
The README suggests using a private branch as feed. I am not sure whether a forward slash is allowed in a feed name, but I know that the feed name is put in a sed 's/../../' command, hence sanitize feed name.
Change-Id: I4d1303e0c04e827200b48a9fe4aea3680c9c9f84 --- A scripts/obs/README M scripts/obs/lib/config.py M scripts/obs/lib/srcpkg.py 3 files changed, 121 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/10/29110/1
diff --git a/scripts/obs/README b/scripts/obs/README new file mode 100644 index 0000000..995344a --- /dev/null +++ b/scripts/obs/README @@ -0,0 +1,115 @@ +Submitting source packages to Osmocom's OBS build server +======================================================== + +Dependencies: + + apt-get install dh-python meson osc rebar3 + +Usage Example +============= + +I want to test changes to the packaging of osmo-hnbgw. +They are committed on a private branch osmo-hnbgw.git:neels/gtpmap. +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 and then edit it: + + $ osc list home:nhofmeyr:test + Username: nhofmeyr + Password: ************ + Select credentials manager: 4 + Server returned an error: HTTP Error 401: Unauthorized + +Now edit ~/.config/osc/oscrc and set the API URL to obs.osmocom.org: +Replace "api.opensuse.org" with "obs.osmocom.org" in two places: + + sed -i 's/api.opensuse.org/obs.osmocom.org/' ~/.config/osc/oscrc + +Now the 'osc list' command should no longer fail: + + $ osc list home:nhofmeyr:test + libosmo-pfcp + +Publish patches in private branch +--------------------------------- + +Push my private branch to Osmocom's git upstream -- not submit for review, just +push a private branch. + +Why is that? The obs scripts here modify the git tree, so it is better to build +the source packages on a separate git clone. + + cd ~/osmo-dev/src/osmo-hnbgw + git push --set-upstream origin neels/gtpmap + +Clone source tree into the cache +-------------------------------- + + cd ~/osmo-dev/src/osmo-ci/scripts/obs/ + ./build_srcpkg.py osmo-hnbgw + +Now there is a git clone in ./_cache/osmo-hnbgw/ + +Checkout my branch +------------------ + +#if 0 + git -C _cache/osmo-hnbgw checkout neels/gtpmap +#else +One step of update_obs_project.py is to checkout the right branch. +In order to checkout my branch, I add my branch as a feed to +./lib/config.py: + + ... + feeds = [ + "2022q1", + "2022q2", + "latest", + "nightly", + "neels/gtpmap", + ] + ... + +Now I can tell update_obs_project.py to build my branch using the -f option (see +below). +#endif + +Build and upload source package to OBS +-------------------------------------- + + ./update_obs_project.py -f neels/gtpmap home:nhofmeyr:test osmo-hnbgw + +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 aarch64 unresolvable + neels_test2 armv7l broken + neels_test2 i586 broken + neels_test2 x86_64 unresolvable + neels_test aarch64 unresolvable + neels_test armv7l unresolvable + neels_test i586 unresolvable + neels_test x86_64 failed + +Or point my web browser at +https://obs.osmocom.org/project/show/home:nhofmeyr:test diff --git a/scripts/obs/lib/config.py b/scripts/obs/lib/config.py index 997fff2..517fe48 100644 --- a/scripts/obs/lib/config.py +++ b/scripts/obs/lib/config.py @@ -32,6 +32,7 @@ "2022q2", "latest", "nightly", + "neels/gtpmap", ]
# Osmocom projects: generated source packages will depend on a meta package, diff --git a/scripts/obs/lib/srcpkg.py b/scripts/obs/lib/srcpkg.py index 468a240..3fce993 100644 --- a/scripts/obs/lib/srcpkg.py +++ b/scripts/obs/lib/srcpkg.py @@ -132,6 +132,11 @@
if project in lib.config.projects_osmocom: metapkg = f"osmocom-{feed}" + + # replace special chars with '_' in the feed name, + # e.g. from a user's private git branch 'johndoe/wip' + metapkg = [c for c in metapkg if c.isalnum() else '_'] + lib.debian.control_add_depend(project, metapkg, conflict_version) if has_rpm_spec: lib.rpm_spec.add_depend(project, metapkg, conflict_version)