From 26c740ba0d2e8b0323a7bc1f5fb34c495aecfe80 Mon Sep 17 00:00:00 2001
From: Walter Lozano <walter.lozano@collabora.com>
Date: Mon, 17 Mar 2025 13:32:23 -0300
Subject: [PATCH 1/5] rebase-pkg: Use default rulez

To make things tidy use the default rulez when forking packages for testing
a rebase.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
 rebase-scripts/rebase-pkg | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rebase-scripts/rebase-pkg b/rebase-scripts/rebase-pkg
index f43a15c..a1108bf 100755
--- a/rebase-scripts/rebase-pkg
+++ b/rebase-scripts/rebase-pkg
@@ -75,8 +75,9 @@ then
     # 2. Apply rulez.yaml
 
     # Make sure to use the latest rulez for rebase
+    # For testing this file should be changed
     wget -O rebase-rulez.yaml \
-        ${GITLAB}/infrastructure/apertis-infrastructure/-/raw/wip/daissi/rulez-testing-rebase/gitlab-rulez/rulez.yaml
+        ${GITLAB}/infrastructure/apertis-infrastructure/-/raw/main/gitlab-rulez/rulez.yaml
 
     gitlab-rulez apply ./rebase-rulez.yaml --filter ${FORK_NAMESPACE}/${PKG}
 else
-- 
GitLab


From 2a5a91a1c3ebb65071e6d121bf91362960475463 Mon Sep 17 00:00:00 2001
From: Walter Lozano <walter.lozano@collabora.com>
Date: Mon, 17 Mar 2025 13:34:00 -0300
Subject: [PATCH 2/5] rebase-from-germinate: Allow script to run from different
 locations

Improve the script to be able to run from different locations, to make
other workflows more straightforward.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
 rebase-scripts/rebase-from-germinate | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rebase-scripts/rebase-from-germinate b/rebase-scripts/rebase-from-germinate
index 0fe7516..6ce2ae3 100755
--- a/rebase-scripts/rebase-from-germinate
+++ b/rebase-scripts/rebase-from-germinate
@@ -11,6 +11,9 @@
 # -l : Germinate list of packages to import (i.e. report/target-keep.txt)
 # -t : Private GitLab token used for the REST API
 
+SCRIPT_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
+CUR_DIR=`pwd`
+
 set -eu
 
 ARGS=
@@ -34,7 +37,7 @@ echo "Processing the germinate list ${LIST}..."
 
 while read p; do
     echo "... processing the source package '$p'"
-    ./rebase-pkg -p ${p} ${ARGS}
+    $SCRIPT_DIR/rebase-pkg -p ${p} ${ARGS}
 done <${LIST}
 
 echo "The germinate list ${LIST} have been processed!"
-- 
GitLab


From 5770f870196067e6211b08a5a2f779d632e1bac4 Mon Sep 17 00:00:00 2001
From: Walter Lozano <walter.lozano@collabora.com>
Date: Mon, 17 Mar 2025 13:37:23 -0300
Subject: [PATCH 3/5] Rename rebase-from-germinate

Since the script is not really tight to germinate, rename it to show that.
In general, germinate specific scripts should be located in the germinate
repo.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
 rebase-scripts/{rebase-from-germinate => rebase-pkg-list} | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 rename rebase-scripts/{rebase-from-germinate => rebase-pkg-list} (81%)

diff --git a/rebase-scripts/rebase-from-germinate b/rebase-scripts/rebase-pkg-list
similarity index 81%
rename from rebase-scripts/rebase-from-germinate
rename to rebase-scripts/rebase-pkg-list
index 6ce2ae3..7a22668 100755
--- a/rebase-scripts/rebase-from-germinate
+++ b/rebase-scripts/rebase-pkg-list
@@ -8,7 +8,7 @@
 # file, you can obtain one at http://mozilla.org/MPL/2.0/.
 #
 # Arguments
-# -l : Germinate list of packages to import (i.e. report/target-keep.txt)
+# -l : List of packages to import (i.e. report/target-keep.txt)
 # -t : Private GitLab token used for the REST API
 
 SCRIPT_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
@@ -33,11 +33,11 @@ done
 
 test "$REBASE" = "1" && ARGS="-r"
 
-echo "Processing the germinate list ${LIST}..."
+echo "Processing package list ${LIST}..."
 
 while read p; do
     echo "... processing the source package '$p'"
     $SCRIPT_DIR/rebase-pkg -p ${p} ${ARGS}
 done <${LIST}
 
-echo "The germinate list ${LIST} have been processed!"
+echo "The package list ${LIST} have been processed!"
-- 
GitLab


From 8e0f881508ce803ab778d6a5c7233380c69a0ee6 Mon Sep 17 00:00:00 2001
From: Walter Lozano <walter.lozano@collabora.com>
Date: Tue, 18 Mar 2025 11:08:01 -0300
Subject: [PATCH 4/5] rebase-scripts: Fix comments

Fix comments on several rebase-scripts to help users to understand their
usage.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
 rebase-scripts/rebase-pkg      | 2 +-
 rebase-scripts/rebase-pkg-list | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rebase-scripts/rebase-pkg b/rebase-scripts/rebase-pkg
index a1108bf..ea1b0f0 100755
--- a/rebase-scripts/rebase-pkg
+++ b/rebase-scripts/rebase-pkg
@@ -19,7 +19,7 @@
 #
 # Arguments
 # -p : Package to fork
-# -t : Private GitLab token used for the REST API
+# -r : Execute a rebase rather than a fork
 
 set -eu
 
diff --git a/rebase-scripts/rebase-pkg-list b/rebase-scripts/rebase-pkg-list
index 7a22668..2f7334e 100755
--- a/rebase-scripts/rebase-pkg-list
+++ b/rebase-scripts/rebase-pkg-list
@@ -9,7 +9,7 @@
 #
 # Arguments
 # -l : List of packages to import (i.e. report/target-keep.txt)
-# -t : Private GitLab token used for the REST API
+# -r : Execute a rebase rather than a fork
 
 SCRIPT_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
 CUR_DIR=`pwd`
-- 
GitLab


From 1948c73bfc8687ce76925c94fe30d7e70f966eb1 Mon Sep 17 00:00:00 2001
From: Walter Lozano <walter.lozano@collabora.com>
Date: Mon, 17 Mar 2025 15:52:03 -0300
Subject: [PATCH 5/5] import-pkg-list: Add new script to import list of
 packages

During the rebase it is quite common to import a big list of packages to
satisfy dependencies flagged by germinate/obs. To make this process
smoother add a script to process a list of packages to call
import-debian-package tool.

Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
---
 rebase-scripts/import-pkg-list | 81 ++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100755 rebase-scripts/import-pkg-list

diff --git a/rebase-scripts/import-pkg-list b/rebase-scripts/import-pkg-list
new file mode 100755
index 0000000..15343f6
--- /dev/null
+++ b/rebase-scripts/import-pkg-list
@@ -0,0 +1,81 @@
+#!/bin/sh
+#
+# Copyright © 2024 Collabora Ltd.
+#
+# SPDX-License-Identifier: MPL-2.0
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, you can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# Arguments
+# -a : Apertis/downstream release
+# -c : Apertis component to import to
+# -d : Debian/upstream release
+# -l : List of packages to import (i.e. report/target-keep.txt)
+# -p : Push changes to gitlab
+# -r : Reason to import
+
+SCRIPT_DIR=$( cd -- "$( dirname -- "$0" )" &> /dev/null && pwd )
+CUR_DIR=`pwd`
+
+set -eu
+
+COMPONENT=
+REASON="Imported to resolve dependencies flagged by germinate/obs"
+ARGS=
+PUSH_REMOTE=0
+DEBIAN_RELEASE=trixie
+APERTIS_RELEASE=apertis/v2026dev2
+
+while getopts 'a:c:d:l:pr:' opt
+do
+    case "$opt" in
+        a)
+            APERTIS_RELEASE=$OPTARG
+            ;;
+        c)
+            COMPONENT=$OPTARG
+            ;;
+        d)
+            DEBIAN_RELEASE=$OPTARG
+            ;;
+        l)
+            LIST=$OPTARG
+            ;;
+        p)
+            PUSH_REMOTE=1
+            ;;
+        r)
+            REASON=$OPTARG
+            ;;
+        *)
+            echo Invalid argument
+            ;;
+    esac
+done
+
+test "$PUSH_REMOTE" = "1" && ARGS="--push-remote"
+
+if ! command -v import-debian-package ; then
+    echo Command import-debian-package not found, please add it to the PATH
+    exit
+fi
+
+if [ -z "$COMPONENT" ]; then
+    echo Component not set aborting!
+    exit
+fi
+
+echo "Processing package list ${LIST}..."
+
+while read p; do
+    echo "... processing the source package '$p'"
+    import-debian-package --upstream ${DEBIAN_RELEASE} \
+        --downstream ${APERTIS_RELEASE} \
+        --component ${COMPONENT} \
+        --reason "${REASON}" \
+        ${ARGS} \
+        --package ${p}
+done <${LIST}
+
+echo "The package list ${LIST} have been processed!"
-- 
GitLab