From 6875540909ca9079cc3158130fe711741366784e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dylan=20A=C3=AFssi?= <dylan.aissi@collabora.com>
Date: Mon, 2 Dec 2024 15:35:07 +0100
Subject: [PATCH] Make sure the returned value of an executed sh is still a
 RunningCommand object.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Debian has transitioned to python3.sh 2.x which now returns a true string
breaking our tools. See:
https://github.com/amoffat/sh/blob/develop/MIGRATION.md#return-value-now-a-true-string

Signed-off-by: Dylan Aïssi <dylan.aissi@collabora.com>
---
 tools/apertis-pkg-merge-updates                 |  2 ++
 tools/apertis-pkg-merge-upstream-to-downstreams |  8 +++++++-
 tools/apertis-pkg-pull-updates                  | 11 ++++++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/tools/apertis-pkg-merge-updates b/tools/apertis-pkg-merge-updates
index 93667b5..0158757 100755
--- a/tools/apertis-pkg-merge-updates
+++ b/tools/apertis-pkg-merge-updates
@@ -176,6 +176,7 @@ def main():
                 "merge",
                 "--ff-only",
                 rebase_tip,
+                _return_cmd=True,
                 _ok_code=[0, 128],
                 _out="/dev/stdout",
                 _err="/dev/stderr",
@@ -215,6 +216,7 @@ def main():
         args.upstream,
         ":!debian/changelog",
         ":!debian/apertis/*",
+        _return_cmd=True,
         _ok_code=[0, 1],
     )
     msg = [f"Sync from {args.upstream}."]
diff --git a/tools/apertis-pkg-merge-upstream-to-downstreams b/tools/apertis-pkg-merge-upstream-to-downstreams
index fdc31a0..fd363c4 100755
--- a/tools/apertis-pkg-merge-upstream-to-downstreams
+++ b/tools/apertis-pkg-merge-upstream-to-downstreams
@@ -91,6 +91,7 @@ def is_minor_change(upstream, downstream):
         downstream,
         ":!debian/changelog",
         ":!debian/apertis/*",
+        _return_cmd=True,
         _ok_code=[0, 1],
     )
     return o.exit_code == 0
@@ -356,6 +357,7 @@ def main():
                     "--is-ancestor",
                     upstream_branch,
                     downstream_branch,
+                    _return_cmd=True,
                     _ok_code=[0, 1],
                 ).exit_code
                 == 0
@@ -435,7 +437,11 @@ def main():
                 conflicts.append(conflict)
             else:
                 o = git(
-                    "diff", "--quiet", f"HEAD..{downstream_branch}", _ok_code=[0, 1]
+                    "diff",
+                    "--quiet",
+                    f"HEAD..{downstream_branch}",
+                    _return_cmd=True,
+                    _ok_code=[0, 1],
                 )
                 if o.exit_code == 0:
                     print(f"No merge required for {downstream_branch}, skipping ")
diff --git a/tools/apertis-pkg-pull-updates b/tools/apertis-pkg-pull-updates
index 3dbc341..9be3571 100755
--- a/tools/apertis-pkg-pull-updates
+++ b/tools/apertis-pkg-pull-updates
@@ -55,7 +55,15 @@ def parse_ref(ref: str) -> str:
 
 def is_ancestor(this: str, other: str):
     return (
-        git("merge-base", "--is-ancestor", this, other, _ok_code=[0, 1]).exit_code == 0
+        git(
+            "merge-base",
+            "--is-ancestor",
+            this,
+            other,
+            _return_cmd=True,
+            _ok_code=[0, 1],
+        ).exit_code
+        == 0
     )
 
 
@@ -433,6 +441,7 @@ def main():
                     "merge",
                     "--ff-only",
                     local_version_branch,
+                    _return_cmd=True,
                     _out="/dev/stdout",
                     _err="/dev/stderr",
                 )
-- 
GitLab