Patchwork [2/3] archiver.bbclass: emit patch series files for original src

login
register
mail settings
Submitter Robert Yang
Date March 24, 2014, 5:39 a.m.
Message ID <2a59c1ff1d02cc72a4e82420dd055516b1ac8faa.1395639299.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/69033/
State New
Headers show

Comments

Robert Yang - March 24, 2014, 5:39 a.m.
Emit patch series files for original src so that the user knows how to
apply the patch orderly.

[YOCTO #5113]

Signed-off-by: Christopher Larson <kergoth@gmail.com>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/archiver.bbclass | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 9aa9335..8d8e7c4 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -150,6 +150,19 @@  python do_ar_original() {
             tar = tarfile.open(tarname, 'w:gz')
             tar.add('.')
             tar.close()
+
+    # Emit patch series files for 'original'
+    bb.note('Writing patch series files...')
+    for patch in src_patches(d):
+        _, _, local, _, _, parm = bb.fetch.decodeurl(patch)
+        patchdir = parm.get('patchdir')
+        if patchdir:
+            series = os.path.join(ar_outdir, 'series.subdir.%s' % patchdir.replace('/', '_'))
+        else:
+            series = os.path.join(ar_outdir, 'series')
+
+        with open(series, 'a') as s:
+            s.write('%s -p%s\n' % (os.path.basename(local), parm['striplevel']))
 }
 
 python do_ar_patched() {