From 120ebae6c6b064d9e368df052ccc4e5693a1a85a Mon Sep 17 00:00:00 2001
From: Andrej Shadura <andrew.shadura@collabora.co.uk>
Date: Tue, 2 Feb 2021 19:33:24 +0100
Subject: [PATCH] When run on -security or -updates, act on the main distro
 branch

Strip off the suffix since all branches related to the upstream
Debian release need to be taken into account when pulling updates.

Without this, when the script runs on e.g. buster-security branch,
it would completely ignore the existence of any other buster branches,
leading to incorrectly applied updates.

Apertis: T7681

Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
---
 .../overlay/usr/bin/apertis-pkg-pull-updates                 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/package-source-builder/overlay/usr/bin/apertis-pkg-pull-updates b/package-source-builder/overlay/usr/bin/apertis-pkg-pull-updates
index 2ea3536..4c47139 100755
--- a/package-source-builder/overlay/usr/bin/apertis-pkg-pull-updates
+++ b/package-source-builder/overlay/usr/bin/apertis-pkg-pull-updates
@@ -228,7 +228,10 @@ def main():
   parser.add_argument('--mirror', dest='mirror', type=str, required=True, help='the upstream mirror (e.g. http://deb.debian.org/debian)')
   args = parser.parse_args()
   package_name = args.package
-  upstream_suite = args.upstream
+  # buster-security → buster,
+  # buster-updates  → buster,
+  # buster          → buster
+  upstream_suite = args.upstream.split('-')[0]
   mirror = args.mirror
 
   package_name = args.package or get_package_name()
-- 
GitLab