From 30e50f45b1cf3609565924dc39b6880c01226118 Mon Sep 17 00:00:00 2001 From: Yue Tao Date: Wed, 2 Aug 2023 15:45:25 +0800 Subject: [PATCH] debrepack.py: support sud-directories in patches folder In order to maintain the kernel's patch set more easily, using sub-directories to separate the patches with different functionalities, like the Debian upstream behavior. https://salsa.debian.org/kernel-team/linux/-/tree/debian/5.10.179-3/debian/patches?ref_type=tags Test Plan: Pass: build kernel successfully with moving some patches to sub-directories Closes-Bug: 2029337 Signed-off-by: Yue Tao Change-Id: I81ac26206b5a26177c515986e30b2577ba096483 --- build-tools/stx/debrepack.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build-tools/stx/debrepack.py b/build-tools/stx/debrepack.py index 586f8e50..a6b8d6db 100755 --- a/build-tools/stx/debrepack.py +++ b/build-tools/stx/debrepack.py @@ -542,7 +542,14 @@ class Parser(): run_shell_cmd('patch -p1 < %s' % patch, self.logger) else: if format_type == "quilt": - run_shell_cmd('cp -r %s %s' % (patch, patches_folder), self.logger) + subdir = os.path.dirname(patch_file) + if subdir: + abspath = os.path.join(patches_folder, subdir) + if not os.path.isdir(abspath): + run_shell_cmd('mkdir -p %s' % abspath, self.logger) + else: + abspath = patches_folder + run_shell_cmd('cp -r %s %s' % (patch, abspath), self.logger) with open(series_file, 'a') as f: f.write(patch_file + "\n") f.close()