osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/29597 )
Change subject: obs: run_in_docker_and_exit: remove args param
......................................................................
obs: run_in_docker_and_exit: remove args param
No need to pass args here. It was only used for args.verbose, and that
isn't necessary since we don't need to restore the verbose mode.
Related: OS#2385
Change-Id: I620cdef46e18f4c66644f14003caf2183c89686f
---
M scripts/obs/build_srcpkg.py
M scripts/obs/lib/docker.py
M scripts/obs/update_obs_project.py
3 files changed, 5 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/97/29597/1
diff --git a/scripts/obs/build_srcpkg.py b/scripts/obs/build_srcpkg.py
index 262ead8..61d8d64 100755
--- a/scripts/obs/build_srcpkg.py
+++ b/scripts/obs/build_srcpkg.py
@@ -31,7 +31,7 @@
lib.set_cmds_verbose(args.verbose)
if args.docker:
- lib.docker.run_in_docker_and_exit(__file__, args)
+ lib.docker.run_in_docker_and_exit(__file__)
if not args.ignore_req:
lib.check_required_programs()
diff --git a/scripts/obs/lib/docker.py b/scripts/obs/lib/docker.py
index b4ec157..629f239 100644
--- a/scripts/obs/lib/docker.py
+++ b/scripts/obs/lib/docker.py
@@ -28,7 +28,7 @@
exit(1)
-def run_in_docker_and_exit(script_path, args, add_oscrc=False):
+def run_in_docker_and_exit(script_path, add_oscrc=False):
if "INSIDE_DOCKER" in os.environ:
return
@@ -41,10 +41,10 @@
oscrc = get_oscrc()
# Build the docker image. Unless it is up-to-date, this will take a few
- # minutes or so, therefore print the output.
+ # minutes or so, therefore print the output. No need to restore
+ # set_cmds_verbose, as we use subprocess.run() below and exit afterwards.
lib.set_cmds_verbose(True)
build_image()
- lib.set_cmds_verbose(args.verbose)
cmd = ["docker", "run",
"--rm",
diff --git a/scripts/obs/update_obs_project.py b/scripts/obs/update_obs_project.py
index 9bd46ff..58e5888 100755
--- a/scripts/obs/update_obs_project.py
+++ b/scripts/obs/update_obs_project.py
@@ -202,7 +202,7 @@
lib.set_cmds_verbose(args.verbose)
if args.docker:
- lib.docker.run_in_docker_and_exit(__file__, args, True)
+ lib.docker.run_in_docker_and_exit(__file__, True)
lib.osc.check_proj(proj)
lib.osc.check_oscrc()
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/29597
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I620cdef46e18f4c66644f14003caf2183c89686f
Gerrit-Change-Number: 29597
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/29596 )
Change subject: obs: run_in_docker_and_exit: --rm on extra line
......................................................................
obs: run_in_docker_and_exit: --rm on extra line
Put it on an extra line like the other arguments to prevent it from
getting overlooked.
Related: OS#2385
Change-Id: Ie7dea2734e7c47766dfe64b7091bc4f5f72d53a5
---
M scripts/obs/lib/docker.py
1 file changed, 2 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/96/29596/1
diff --git a/scripts/obs/lib/docker.py b/scripts/obs/lib/docker.py
index a5dbcd9..b4ec157 100644
--- a/scripts/obs/lib/docker.py
+++ b/scripts/obs/lib/docker.py
@@ -47,9 +47,10 @@
lib.set_cmds_verbose(args.verbose)
cmd = ["docker", "run",
+ "--rm",
"-e", "INSIDE_DOCKER=1",
"-e", "PYTHONUNBUFFERED=1",
- "--rm", "-v", f"{lib.config.path_top}:/obs"]
+ "-v", f"{lib.config.path_top}:/obs"]
if oscrc:
cmd += ["-v", f"{oscrc}:/home/user/.oscrc"]
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/29596
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ie7dea2734e7c47766dfe64b7091bc4f5f72d53a5
Gerrit-Change-Number: 29596
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/29593 )
Change subject: obs: build_srcpkg_if_needed: switch if branches
......................................................................
obs: build_srcpkg_if_needed: switch if branches
Make it slightly easier to read, before extending the latest branch with
master too in a follow-up patch.
Related: OS#2385
Change-Id: I4f1d4e250eb4d8163f1ded29106a44deb0d0feff
---
M scripts/obs/update_obs_project.py
1 file changed, 5 insertions(+), 3 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/93/29593/1
diff --git a/scripts/obs/update_obs_project.py b/scripts/obs/update_obs_project.py
index aa33984..168193d 100755
--- a/scripts/obs/update_obs_project.py
+++ b/scripts/obs/update_obs_project.py
@@ -66,9 +66,9 @@
fetch, is_meta_pkg, skip_up_to_date):
global srcpkgs_skipped
- if feed != "latest":
- print(f"{package}: building source package (feed is {feed})")
- else:
+ if feed == "latest":
+ """ Check if we can skip this package by comparing the OBS version with
+ the git remote. """
if is_meta_pkg:
latest_version = conflict_version if conflict_version else "1.0.0"
else:
@@ -95,6 +95,8 @@
else:
print(f"{package}: building source package (outdated:"
f" {latest_version} <=> {obs_version} in OBS)")
+ else:
+ print(f"{package}: building source package (feed is {feed})")
build_srcpkg(feed, branch, package, conflict_version, fetch, is_meta_pkg)
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/29593
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I4f1d4e250eb4d8163f1ded29106a44deb0d0feff
Gerrit-Change-Number: 29593
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/29594 )
Change subject: obs: update_obs_project: add master feed
......................................................................
obs: update_obs_project: add master feed
Add a new master feed, where packages are updated as soon as patches get
merged to master. Upload a commit_$COMMIT.txt file for each package in
this feed and use it to determine if the package needs to be updated or
not.
In most packages the commit is already part of the version in the dsc
file, e.g. "libosmocore_1.7.0.38.c3b90.dsc", but that's harder to parse
and is more likely to have a hash collision (just 5 characters).
Related: OS#2385
Change-Id: I3b0b4f4876b8c1eeb61f20d903a6f2cac6e99638
---
M scripts/obs/lib/__init__.py
M scripts/obs/lib/config.py
M scripts/obs/lib/git.py
M scripts/obs/lib/osc.py
M scripts/obs/lib/srcpkg.py
M scripts/obs/update_obs_project.py
6 files changed, 58 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/94/29594/1
diff --git a/scripts/obs/lib/__init__.py b/scripts/obs/lib/__init__.py
index f94c0a8..8f52dba 100644
--- a/scripts/obs/lib/__init__.py
+++ b/scripts/obs/lib/__init__.py
@@ -17,7 +17,7 @@
parser.add_argument("-f", "--feed",
help="package feed (default: nightly). The feed"
" determines the git revision to be built:"
- " 'nightly' builds 'origin/master',"
+ " 'nightly' and 'master' build 'origin/master',"
" 'latest' builds the last signed tag,"
" other feeds build their respective branch.",
metavar="FEED", default="nightly",
diff --git a/scripts/obs/lib/config.py b/scripts/obs/lib/config.py
index c9df74a..79a7849 100644
--- a/scripts/obs/lib/config.py
+++ b/scripts/obs/lib/config.py
@@ -32,6 +32,7 @@
"2022q1",
"2022q2",
"latest",
+ "master",
"nightly",
]
diff --git a/scripts/obs/lib/git.py b/scripts/obs/lib/git.py
index aab0533..8faf5b2 100644
--- a/scripts/obs/lib/git.py
+++ b/scripts/obs/lib/git.py
@@ -76,6 +76,28 @@
checkout(project, f"origin/{branch}")
+def get_head(project):
+ repo_path = get_repo_path(project)
+ ret = lib.run_cmd(["git", "rev-parse", "HEAD"], cwd=repo_path)
+ return ret.output.rstrip()
+
+
+def get_head_remote(project, branch):
+ if not branch:
+ branch = get_default_branch(project)
+ repo_url = get_repo_url(project)
+
+ print(f"{project}: getting head from git remote for {branch}")
+ ls_remote = lib.run_cmd(["git", "ls-remote", repo_url, branch])
+
+ ret = ls_remote.output.split("\t")[0]
+ if not ret:
+ lib.exit_error_cmd(ls_remote, f"failed to find head commit for"
+ "{project} in output")
+
+ return ret
+
+
def get_latest_tag(project):
pattern_str = get_latest_tag_pattern(project)
pattern = re.compile(pattern_str)
diff --git a/scripts/obs/lib/osc.py b/scripts/obs/lib/osc.py
index 51e2f5f..df5c34c 100644
--- a/scripts/obs/lib/osc.py
+++ b/scripts/obs/lib/osc.py
@@ -62,7 +62,7 @@
return ret.output.rstrip().split("\n")
-def get_package_version(proj, package):
+def get_package_version(proj, package, feed):
print(f"{package}: getting OBS version")
ret = run_osc(["list", proj, os.path.basename(package)])
@@ -70,15 +70,21 @@
if ret.output == '\n':
return "0"
- # Extract the version from the dsc filename
+ # Extract the version from the file list
for line in ret.output.split('\n'):
line = line.rstrip()
- if line.endswith(".dsc"):
- return line.split("_")[-1][:-4]
+ if feed == "master" and package != "osmocom-master":
+ # Use commit_*.txt
+ if line.startswith("commit_") and line.endswith(".txt"):
+ return line.split("_")[1].split(".")[0]
+ else:
+ # Use *.dsc
+ if line.endswith(".dsc"):
+ return line.split("_")[-1][:-4]
lib.exit_error_cmd(ret, "failed to find package version on OBS by"
- " extracting the version from the .dsc filename")
+ " extracting the version from the file list")
def create_package(proj, package):
diff --git a/scripts/obs/lib/srcpkg.py b/scripts/obs/lib/srcpkg.py
index 159f4ed..1711f70 100644
--- a/scripts/obs/lib/srcpkg.py
+++ b/scripts/obs/lib/srcpkg.py
@@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright 2022 sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
import os
+import pathlib
import lib.config
import lib.debian
import lib.rpm_spec
@@ -13,7 +14,7 @@
lib.git.checkout(project, f"origin/{branch}")
elif feed == "latest":
lib.git.checkout_latest_tag(project)
- elif feed == "nightly":
+ elif feed in ["master", "nightly"]:
lib.git.checkout_default_branch(project)
else: # 2022q1 etc
lib.git.checkout(project, f"origin/{feed}")
@@ -117,6 +118,18 @@
f.write(f"{version}\n")
+def write_commit_txt(project):
+ """ Write the current git commit to commit_$commit.txt file, so it gets
+ uploaded to OBS along with the rest of the source package. This allows
+ figuring out if the source package is still up-to-date or not for the
+ master feed. """
+ output_path = lib.get_output_path(project)
+ commit = lib.git.get_head(project)
+
+ print(f"{project}: adding commit_{commit}.txt")
+ pathlib.Path(f"{output_path}/commit_{commit}.txt").touch()
+
+
def build(project, feed, branch, conflict_version, fetch, gerrit_id=0):
lib.git.clone(project, fetch)
lib.git.clean(project)
@@ -155,5 +168,8 @@
lib.rpm_spec.generate(project, version, epoch)
lib.rpm_spec.copy_to_output(project)
+ if feed == "master":
+ write_commit_txt(project)
+
lib.remove_cache_extra_files()
return version_epoch
diff --git a/scripts/obs/update_obs_project.py b/scripts/obs/update_obs_project.py
index 168193d..9bd46ff 100755
--- a/scripts/obs/update_obs_project.py
+++ b/scripts/obs/update_obs_project.py
@@ -66,13 +66,16 @@
fetch, is_meta_pkg, skip_up_to_date):
global srcpkgs_skipped
- if feed == "latest":
+ if feed in ["master", "latest"]:
""" Check if we can skip this package by comparing the OBS version with
the git remote. """
if is_meta_pkg:
latest_version = conflict_version if conflict_version else "1.0.0"
else:
- latest_version = lib.git.get_latest_tag_remote(package)
+ if feed == "master":
+ latest_version = lib.git.get_head_remote(package, branch)
+ else:
+ latest_version = lib.git.get_latest_tag_remote(package)
if latest_version is None:
print(f"{package}: skipping (no git tag found)")
@@ -82,7 +85,7 @@
if os.path.basename(package) not in pkgs_remote:
print(f"{package}: building source package (not in OBS)")
else:
- obs_version = lib.osc.get_package_version(proj, package)
+ obs_version = lib.osc.get_package_version(proj, package, feed)
if is_up_to_date(obs_version, latest_version):
if skip_up_to_date:
print(f"{package}: skipping ({obs_version} is up-to-date)")
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/29594
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I3b0b4f4876b8c1eeb61f20d903a6f2cac6e99638
Gerrit-Change-Number: 29594
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange
osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ci/+/29595 )
Change subject: jobs/osmocom-obs: add job for master feed
......................................................................
jobs/osmocom-obs: add job for master feed
Add one new job for building source packages and sending them to
obs.osmocom.org. Trigger it from all master-* jobs.
I've also considered adding one job per existing master job that would
only update one package at a time (master-libosmocore-obs,
master-osmo-bsc-obs, ...). With some additional development effort it
should be possible, and it would make each individual master OBS job
faster. But given that with the current implementation it only takes
20s to 30s for *all* packages if there are no changes, as it compares
git remote HEAD with the version currently on OBS before starting to
clone repositories and building the source packages (similar to
Osmocom_OBS_latest_obs.osmocom.org), it didn't seem worth optimizing.
Set concurrent to false as the triggers from master-builds will likely
cause it to run multiple times in parallel otherwise.
Related: https://jenkins.osmocom.org/jenkins/view/OBS/job/Osmocom_OBS_master_obs.osm…
Related: https://obs.osmocom.org/project/show/osmocom:master
Related: OS#2385
Change-Id: I53a494f13f81ae837f2d362c54e1bdf13f121db3
---
M jobs/master-builds.yml
M jobs/osmocom-obs.yml
M scripts/obs/lib/git.py
3 files changed, 11 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/95/29595/1
diff --git a/jobs/master-builds.yml b/jobs/master-builds.yml
index 7fc306f..e7b4c61 100644
--- a/jobs/master-builds.yml
+++ b/jobs/master-builds.yml
@@ -491,6 +491,8 @@
resolve-relative-paths: true
- trigger:
project: '{obj:trigger}'
+ - trigger:
+ project: 'Osmocom_OBS_master_obs.osmocom.org'
- email:
recipients: '{obj:email}'
send-to-individuals: true
diff --git a/jobs/osmocom-obs.yml b/jobs/osmocom-obs.yml
index ff2a18a..0036493 100644
--- a/jobs/osmocom-obs.yml
+++ b/jobs/osmocom-obs.yml
@@ -4,6 +4,8 @@
jobs:
- Osmocom_OBS_{type}_{server}
type:
+ - master:
+ conflict_version: ""
- nightly:
# For nightly we don't provide ABI compatibility, make sure packages
# from different build dates are not mixed by accident
@@ -15,10 +17,16 @@
proj: "network:osmocom"
- obs.osmocom.org:
proj: "osmocom"
+ # Pushing to build.opensuse.org is legacy, will be disabled soon (OS#5557).
+ # Don't push the new master repository there.
+ exclude:
+ - type: master
+ server: build.opensuse.org
- job-template:
name: 'Osmocom_OBS_{type}_{server}'
project-type: freestyle
+ concurrent: false
defaults: global
description: |
See <a href="https://osmocom.org/projects/cellular-infrastructure/wiki/Binary_Packages">Wiki: binary packages</a>
diff --git a/scripts/obs/lib/git.py b/scripts/obs/lib/git.py
index 8faf5b2..8081a54 100644
--- a/scripts/obs/lib/git.py
+++ b/scripts/obs/lib/git.py
@@ -88,7 +88,7 @@
repo_url = get_repo_url(project)
print(f"{project}: getting head from git remote for {branch}")
- ls_remote = lib.run_cmd(["git", "ls-remote", repo_url, branch])
+ ls_remote = lib.run_cmd(["git", "ls-remote", repo_url, f"heads/{branch}"])
ret = ls_remote.output.split("\t")[0]
if not ret:
--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/29595
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: I53a494f13f81ae837f2d362c54e1bdf13f121db3
Gerrit-Change-Number: 29595
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Gerrit-MessageType: newchange
Attention is currently required from: dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29591 )
Change subject: msgb: dont return a length when msgb->lXh is NULL
......................................................................
Patch Set 1:
(1 comment)
Patchset:
PS1:
one could actually argue that we should OSMO_ASSERT in this case, as using msgb_lXlen() on a msgb without lXh pointer set is almost certainly a programming error.
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29591
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1795c559f190713ebbabfbabf3453ab77da46a49
Gerrit-Change-Number: 29591
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 04 Oct 2022 12:53:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: dexter.
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/29591 )
Change subject: msgb: dont return a length when msgb->lXh is NULL
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/29591
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I1795c559f190713ebbabfbabf3453ab77da46a49
Gerrit-Change-Number: 29591
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Attention: dexter <pmaier(a)sysmocom.de>
Gerrit-Comment-Date: Tue, 04 Oct 2022 12:52:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment