[poky] [PATCH] [RFH] rpm: catch up with fetcher2

Koen Kooi koen at dominion.thruhere.net
Mon Feb 7 06:27:27 PST 2011


I tried to change this to mimic the base.bbclass changes as much as possible, but I can't get it to work. Can someone with more RPM and fetcher2 experience have a look please?

Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>
---
 meta/recipes-devtools/rpm/rpm_5.4.0.bb |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/meta/recipes-devtools/rpm/rpm_5.4.0.bb b/meta/recipes-devtools/rpm/rpm_5.4.0.bb
index e158b80..6c1ce81 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.0.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.0.bb
@@ -333,7 +333,7 @@ python base_do_unpack_append() {
 	import subprocess
 
 	for url in src_uri:
-		local = bb.fetch2.localpath(url)
+		local = bb.fetch2.localpath(url, d)
 		if local is None:
 			continue
 		local = os.path.realpath(local)
@@ -347,21 +347,23 @@ python base_do_unpack_append() {
 			newdir = ("%s/%s" % (old_cwd, 'srpm-unpack'))
 			bb.mkdirhier(newdir)
 			os.chdir(newdir)
-			ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True)
+			ret = subprocess.call(cmd, shell=True)
 			os.chdir(old_cwd)
 			if ret != 0:
 				raise bb.build.FuncFailed('Unpack command failed: %s (%s)' % (cmd, ret))
 
-	srpm_uri = bb.data.getVar('SRPM_UNPACK', localdata, True)
-	if not srpm_uri:
+	srpm_uri = bb.data.getVar('SRPM_UNPACK', localdata, True).split()
+	if len(srpm_uri) == 0:
 		return
 
-	# Note, not really URI's!  Just a list of files
-	for url in srpm_uri.split():
-		local = os.path.join(bb.data.getVar('WORKDIR', localdata, 1), "srpm-unpack/" + url)
-		ret = oe_unpack_file(local, localdata, 'file://' + url)
-		if not ret:
-			raise bb.build.FuncFailed("oe_unpack_file failed with return value %s" % ret)
+	rootdir = bb.data.getVar('WORKDIR', localdata, True)
+	srpm_file_uri = [ "file://srpm-unpack/" + uri for uri in srpm_uri]; 
+
+	try:
+		fetcher = bb.fetch2.Fetch(srpm_file_uri, localdata)
+		fetcher.unpack(rootdir)
+	except bb.fetch2.BBFetchException, e:
+		raise bb.build.FuncFailed(e)
 }
 
 do_configure() {
-- 
1.6.6.1




More information about the poky mailing list