From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Cc: "Su, Bao Cheng (RC-CN DF FA R&D)" <baocheng.su@siemens.com>
Subject: [PATCH] patch: Add support for patches in sub-directories
Date: Mon, 29 Apr 2019 10:37:51 +0200 [thread overview]
Message-ID: <529c6ca1-0270-1323-07a2-7f0827329abb@siemens.com> (raw)
From: Jan Kiszka <jan.kiszka@siemens.com>
The patch class was assuming that the file is flat in the workdir after
unpack. That may not be true. Enhance the logic and add a test case to
hello-isar.
Reported-by: Su Bao Cheng <baocheng.su@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
.../hello-isar/files/{ => subdir}/0001-Add-some-help.patch | 0
meta-isar/recipes-app/hello-isar/hello-isar.bb | 2 +-
meta/classes/patch.bbclass | 9 +++++----
3 files changed, 6 insertions(+), 5 deletions(-)
rename meta-isar/recipes-app/hello-isar/files/{ => subdir}/0001-Add-some-help.patch (100%)
diff --git a/meta-isar/recipes-app/hello-isar/files/0001-Add-some-help.patch b/meta-isar/recipes-app/hello-isar/files/subdir/0001-Add-some-help.patch
similarity index 100%
rename from meta-isar/recipes-app/hello-isar/files/0001-Add-some-help.patch
rename to meta-isar/recipes-app/hello-isar/files/subdir/0001-Add-some-help.patch
diff --git a/meta-isar/recipes-app/hello-isar/hello-isar.bb b/meta-isar/recipes-app/hello-isar/hello-isar.bb
index 5806f9e..144a433 100644
--- a/meta-isar/recipes-app/hello-isar/hello-isar.bb
+++ b/meta-isar/recipes-app/hello-isar/hello-isar.bb
@@ -16,7 +16,7 @@ DEPENDS += "libhello"
SRC_URI = " \
git://github.com/ilbers/hello.git;protocol=https;destsuffix=${P} \
- file://0001-Add-some-help.patch \
+ file://subdir/0001-Add-some-help.patch \
file://yet-another-change.txt;apply=yes;striplevel=0"
SRCREV = "a18c14cc11ce6b003f3469e89223cffb4016861d"
diff --git a/meta/classes/patch.bbclass b/meta/classes/patch.bbclass
index bb203b7..2662702 100644
--- a/meta/classes/patch.bbclass
+++ b/meta/classes/patch.bbclass
@@ -40,8 +40,8 @@ python do_patch() {
if apply == "no":
continue
- basename = fetcher.ud[src_uri].basename or ""
- if not (basename.endswith(".patch") or apply == "yes"):
+ path = fetcher.ud[src_uri].path or ""
+ if not (path.endswith(".patch") or apply == "yes"):
continue
patchdir = fetcher.ud[src_uri].parm.get("patchdir") or src_dir
@@ -54,8 +54,9 @@ python do_patch() {
cmds = open(applied_patches_dir + ".patch-commands", "a")
- patch_file = applied_patches_dir + basename
- shutil.copyfile(workdir + basename, patch_file)
+ patch_file = applied_patches_dir + path
+ bb.utils.mkdirhier(os.path.dirname(patch_file))
+ shutil.copyfile(workdir + path, patch_file)
striplevel = fetcher.ud[src_uri].parm.get("striplevel") or "1"
--
2.16.4
next reply other threads:[~2019-04-29 8:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 8:37 Jan Kiszka [this message]
2019-05-14 12:42 ` Maxim Yu. Osipov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=529c6ca1-0270-1323-07a2-7f0827329abb@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=baocheng.su@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox