summaryrefslogtreecommitdiff
path: root/classes/base.bbclass
diff options
context:
space:
mode:
authornslu2-linux.adm@bkbits.net <nslu2-linux.adm@bkbits.net>2005-01-18 00:08:01 +0000
committernslu2-linux.adm@bkbits.net <nslu2-linux.adm@bkbits.net>2005-01-18 00:08:01 +0000
commit6e012296c2dc513ae301654b3d4d3eb826068c81 (patch)
tree785036b2cba7dac1aaa1f1b1e5462cd45a05f6af /classes/base.bbclass
parentf95ea756f4b4dabe70b9216901cf785380970e85 (diff)
Merge bk://oe-devel.bkbits.net/openembedded
into bkbits.net:/repos/n/nslu2-linux/openembedded 2005/01/17 18:08:00-06:00 ti.com!kergoth Merge oe-devel@oe-devel.bkbits.net:openembedded into odin.sc.ti.com:/home/kergoth/code/user/oe/openembedded 2005/01/17 18:07:46-06:00 ti.com!kergoth base_do_patch: Obey a 'PATCHCMD' variable for the actual patcher command. Execute it using bb.build.exec_func so that the patcher command execution is logged. 2005/01/15 20:07:00-06:00 ti.com!kergoth Merge oe-devel@oe-devel.bkbits.net:openembedded into odin.sc.ti.com:/home/kergoth/code/user/oe/openembedded 2005/01/15 20:06:41-06:00 ti.com!kergoth Adjust the dyn-ldconfig patch for uclibc cvs to apply against current cvs, and make it a uclibc configure option so it can be pushed upstream. Also update the i386 and i686 defconfigs for uclibc-cvs. BKrev: 41ec5361nnjCZWEmpkrD0oZ0-dBk8g
Diffstat (limited to 'classes/base.bbclass')
-rw-r--r--classes/base.bbclass54
1 files changed, 29 insertions, 25 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 608114cb22..47720464f9 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -405,40 +405,44 @@ addtask patch after do_unpack
do_patch[dirs] = "${WORKDIR}"
python base_do_patch() {
import re
+ import bb.fetch
+
+ src_uri = (bb.data.getVar('SRC_URI', d, 1) or '').split()
+ workdir = bb.data.getVar('WORKDIR', d, 1)
+ for url in src_uri:
- src_uri = bb.data.getVar('SRC_URI', d)
- if not src_uri:
- return
- src_uri = bb.data.expand(src_uri, d)
- for url in src_uri.split():
-# bb.note('url is %s' % url)
(type, host, path, user, pswd, parm) = bb.decodeurl(url)
if not "patch" in parm:
continue
- from bb.fetch import init, localpath
- init([url])
+
+ bb.fetch.init([url])
url = bb.encodeurl((type, host, path, user, pswd, []))
- local = '/' + localpath(url, d)
- # patch!
+ local = os.path.join('/', bb.fetch.localpath(url, d))
+
+ # did it need to be unpacked?
dots = local.split(".")
if dots[-1] in ['gz', 'bz2', 'Z']:
- efile = os.path.join(bb.data.getVar('WORKDIR', d),os.path.basename('.'.join(dots[0:-1])))
+ unpacked = os.path.join(bb.data.getVar('WORKDIR', d),os.path.basename('.'.join(dots[0:-1])))
else:
- efile = local
- efile = bb.data.expand(efile, d)
- patches_dir = bb.data.expand(bb.data.getVar('PATCHES_DIR', d), d)
- bb.mkdirhier(patches_dir + "/.patches")
- os.chdir(patches_dir)
- cmd = "PATH=\"%s\" patcher" % bb.data.getVar("PATH", d, 1)
+ unpacked = local
+ unpacked = bb.data.expand(unpacked, d)
+
if "pnum" in parm:
- cmd += " -p %s" % parm["pnum"]
- # Getting rid of // at the front helps the Cygwin-Users of OE
- if efile.startswith('//'):
- efile = efile[1:]
- cmd += " -R -n \"%s\" -i %s" % (os.path.basename(efile), efile)
- ret = os.system(cmd)
- if ret != 0:
- raise bb.build.FuncFailed("'patcher' execution failed")
+ pnum = parm["pnum"]
+ else:
+ pnum = "1"
+
+ dots = os.path.basename(unpacked).split(".")
+ if len(dots) > 1:
+ pname = ".".join(dots[:-1])
+ else:
+ pname = unpacked
+
+ os.chdir(workdir)
+ bb.note("Applying patch '%s'" % pname)
+ bb.data.setVar("do_patchcmd", bb.data.getVar("PATCHCMD", d, 1) % (pnum, pname, unpacked), d)
+ bb.data.setVarFlag("do_patchcmd", "func", 1, d)
+ bb.build.exec_func("do_patchcmd", d)
}