From 20c19aca5be73456a81bfc3f33a103f4fb26b9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 27 May 2024 14:31:35 +0200 Subject: [PATCH] gitea: fix status update for pull requests --- flake.lock | 6 +-- ...status-in-the-base-repository-of-a-p.patch | 40 +++++++++++++++++++ nix/buildbot-gitea.nix | 6 +-- 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 nix/0001-reporter-create-status-in-the-base-repository-of-a-p.patch diff --git a/flake.lock b/flake.lock index 0ec92be..f4fe350 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1716660083, - "narHash": "sha256-QO7cdjtDhx72KEw6m0NOtuE5FS4asaRExZ65uFR/q8g=", + "lastModified": 1716792620, + "narHash": "sha256-wQmXzee/veETYJv93TkRYsAQkEdt2QYCJeJil5SrJfg=", "owner": "Nixos", "repo": "nixpkgs", - "rev": "6de51d98ec2ae46730f11845e221aab9d2470a8a", + "rev": "7d7cf1590c05d799745bf456f2b95b798f48d3bb", "type": "github" }, "original": { diff --git a/nix/0001-reporter-create-status-in-the-base-repository-of-a-p.patch b/nix/0001-reporter-create-status-in-the-base-repository-of-a-p.patch new file mode 100644 index 0000000..7dbc453 --- /dev/null +++ b/nix/0001-reporter-create-status-in-the-base-repository-of-a-p.patch @@ -0,0 +1,40 @@ +From 6c287ad5735882f71ffa07722f7205eb3bf85269 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= +Date: Mon, 27 May 2024 14:20:41 +0200 +Subject: [PATCH] reporter: create status in the base repository of a pull + requests +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Buildbot might not have access to the build status of the fork +and for pull request we want the information in the pull request +window rather than the commit on the fork. + +Signed-off-by: Jörg Thalheim +--- + buildbot_gitea/reporter.py | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/buildbot_gitea/reporter.py b/buildbot_gitea/reporter.py +index 85d0a39..27347f2 100644 +--- a/buildbot_gitea/reporter.py ++++ b/buildbot_gitea/reporter.py +@@ -164,12 +164,10 @@ def _send_impl(self, reports): + if sha is None: + # No special revision for this, so ignore it + continue +- # If this is a pull request, send the status to the head repository + if 'pr_id' in props: +- repository_name = props['head_reponame'] +- repository_owner = props['head_owner'] + sha = props['head_sha'] +- elif 'repository_name' in props: ++ ++ if 'repository_name' in props: + repository_name = props['repository_name'] + else: + match = re.match(self.ssh_url_match, sourcestamp['repository']) +-- +2.44.1 + diff --git a/nix/buildbot-gitea.nix b/nix/buildbot-gitea.nix index acaf92d..e07526d 100644 --- a/nix/buildbot-gitea.nix +++ b/nix/buildbot-gitea.nix @@ -10,16 +10,14 @@ buildPythonPackage (lib.fix (self: { pname = "buildbot-gitea"; version = "1.8.0"; - nativeBuildInputs = [ - - ]; - propagatedBuildInputs = [ pip buildbot requests ]; + patches = [ ./0001-reporter-create-status-in-the-base-repository-of-a-p.patch ]; + src = fetchPypi { inherit (self) pname version; hash = "sha256-zYcILPp42QuQyfEIzmYKV9vWf47sBAQI8FOKJlZ60yA=";