OE Package
[bitbake.git] / bin / classes / base.oeclass
1 PATCHES_DIR="${S}"
2
3 python base_do_patch () {
4         if not env.has_key('SRC_URI'):
5                 raise Exception("SRC_URI not defined")
6         for url in getenv('SRC_URI').split():
7 #               print "url: %s" % url
8                 (type, host, path, user, pswd, parm) = decodeurl(expand(url))
9                 if not parm.has_key("patch"):
10                         continue
11                 oe.fetch.init([url])
12                 local = oe.fetch.localpath(url)
13                 # patch!
14                 dots = local.split(".")
15                 if dots[-2] in ['tar']:
16                         continue
17                 efile = os.path.join(getenv('WORKDIR'),os.path.basename(re.sub(r"\.%s$" % dots[-1],"",local)))
18                 os.chdir(getenv('PATCHES_DIR'))
19                 cmd = "patcher"
20                 if parm.has_key("pnum"):
21                         cmd += " -p %s" % parm["pnum"]
22                 cmd += " -i %s" % efile
23                 ret = os.system(cmd)
24                 if ret != 0:
25                         raise Exception("Patch execution failed")
26         mkstamp('do_patch')
27                 
28 }
29
30 base_do_unpack() {
31         if test -z "${A}"; then oenote "nothing to extract"; fi
32         unpack "${A}" || die "unpack failure"
33 }
34
35
36 base_do_compile() {
37         if [ -x ./configure ] ; then
38                 oeconf 
39                 oemake || die "oemake failed"
40         else
41                 oenote "nothing to compile"
42         fi
43 }
44
45
46 base_do_stage() {
47         oenote "nothing to install into stage area"
48 }
49
50
51 base_do_install() {
52         oenote "nothing to install"
53 }
54
55 base_do_package() {
56         oenote "nothing to package"
57 }
58
59 EXPORT_FUNCTIONS do_unpack do_compile do_stage do_install do_package do_patch
60
61 addtask patch after do_unpack before do_compile