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 <yue.tao@windriver.com>
Change-Id: I81ac26206b5a26177c515986e30b2577ba096483
This commit is contained in:
Yue Tao 2023-08-02 15:45:25 +08:00
parent b70f3b1410
commit 30e50f45b1

View File

@ -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()