Skip to contentSkip to conversation

Bring in and use patchdir

PATCH Applied Tom Rini 2 participants 4 messages Apr 1, 2011 – Apr 4, 2011

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

cover Bring in and use patchdir

The following series brings in the 'patchdir' parameter from openembedded so that we can say that a patch needs to be applied in a subdir. This allows us to re-write the db change for how we apply the arm patch to be just ';subdir=..' and in meta-oe and other layers will help a number of other patches be cleanly applied.

Pull URL: git://git.openembedded.org/openembedded-core-contrib
Branch: trini/use-patchdir-for-nonstd-paths
Browse: http://git.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=trini/use-patchdir-for-nonstd-paths

Thanks,
Tom Rini <[email protected]>
---

Tom Rini (2):
patch.bbclass: allow importing patches into other dirs
db: Switch to patchdir rather than applying in do_configure

 meta/classes/patch.bbclass           |   19 ++++++++++++++++---
 meta/recipes-support/db/db_5.1.19.bb |    6 +-----
 2 files changed, 17 insertions(+), 8 deletions(-)
author
#1 lore raw

PATCH 1/2 patch.bbclass: allow importing patches into other dirs

This is taken from openembedded.master:
commit 9d0d70da60ca8ef278916f442125d41161846f38

Author: Chris Larson <[email protected]>
Date:   Mon Aug 23 13:03:55 2010 -0400

patch: allow importing patches into other dirs

Use the 'patchdir' flag. If relative, it's assumed to be relative to ${S}. It creates a patchset class per patch directory, so for quilt this results i multiple .pc/patches directories to manage each of the patchsets.

---
 meta/classes/patch.bbclass |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
meta/classes/patch.bbclass +16 -3
index 80fd45f..7622163 100644
@@ -31,10 +31,8 @@ python patch_do_patch() {
 
 	path = os.getenv('PATH')
 	os.putenv('PATH', bb.data.getVar('PATH', d, 1))
-	patchset = cls(s, d)
-	patchset.Clean()
 
-	resolver = rcls(patchset)
+	classes = {}
 
 	workdir = bb.data.getVar('WORKDIR', d, 1)
 	for url in src_uri:
@@ -117,6 +115,21 @@ python patch_do_patch() {
 				bb.note("Patch '%s' doesn't apply to revision" % pname)
 				continue
 
+		if "patchdir" in parm:
+			patchdir = parm["patchdir"]
+			if not os.path.isabs(patchdir):
+				patchdir = os.path.join(s, patchdir)
+		else:
+			patchdir = s
+
+		if not patchdir in classes:
+			patchset = cls(patchdir, d)
+			resolver = rcls(patchset)
+			classes[patchdir] = (patchset, resolver)
+			patchset.Clean()
+		else:
+			patchset, resolver = classes[patchdir]
+
 		bb.note("Applying patch '%s' (%s)" % (pname, oe.path.format_display(local, d)))
 		try:
 			patchset.Import({"file":local, "remote":url, "strippath": striplevel}, True)
Signature · 1 line
1.7.0.4
author
#2 lore raw

PATCH 2/2 db: Switch to patchdir rather than applying in do_configure

In reply to Tom Rini
---
 meta/recipes-support/db/db_5.1.19.bb |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
meta/recipes-support/db/db_5.1.19.bb +1 -5
index 94ce180..7b7c4dd 100644
@@ -17,7 +17,7 @@ CONFLICTS = "db3"
 PR = "r2"
 
 SRC_URI = "http://download.oracle.com/berkeley-db/db-${PV}.tar.gz"
-SRC_URI += "file://arm-thumb-mutex_db5.patch;apply=no"
+SRC_URI += "file://arm-thumb-mutex_db5.patch;patchdir=.."
 
 SRC_URI[md5sum] = "76fcbfeebfcd09ba0b4d96bfdf8d884d"
 SRC_URI[sha256sum] = "0194d4ca9266ba1a1c0bfbc233b18bfd05f63163453c81ebcdfdc7112d5ac850"
@@ -79,10 +79,6 @@ do_configure() {
 	oe_runconf
 }
 
-do_patch_append() {
-	os.system("cd ${S}/.. ; patch -p1 -i ${WORKDIR}/arm-thumb-mutex_db5.patch")
-}
-
 do_install_append() {
 	mkdir -p ${D}/${includedir}/db51
 	#mv ${D}/${includedir}/db_185.h ${D}/${includedir}/db51/.
Signature · 1 line
1.7.0.4
#3 lore raw
In reply to Tom Rini
Quoted 10 lines · Tom Rini

The following series brings in the 'patchdir' parameter from openembedded so that we can say that a patch needs to be applied in a subdir. This allows us to re-write the db change for how we apply the arm patch to be just ';subdir=..' and in meta-oe and other layers will help a number of other patches be cleanly applied.

Pull URL: git://git.openembedded.org/openembedded-core-contrib
Branch: trini/use-patchdir-for-nonstd-paths
Browse: http://git.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=trini/use-patchdir-for-nonstd-paths

Quoted 8 lines

Thanks,
Tom Rini <[email protected]>
---

Tom Rini (2):
patch.bbclass: allow importing patches into other dirs
db: Switch to patchdir rather than applying in do_configure

Merged to master, thanks!

Richard