66136074c797f86d017a263e0fe0928a46dfcd2d
[vuplus_openembedded] / classes / base.oeclass
1 PATCHES_DIR="${S}"
2
3 def base_dep_prepend(d):
4         import oe;
5         #
6         # Ideally this will check a flag so we will operate properly in
7         # the case where host == build == target, for now we don't work in
8         # that case though.
9         #
10         deps = ""
11         if not oe.data.getVar('INHIBIT_DEFAULT_DEPS', d):
12                 deps += "patcher-native"
13                 if (oe.data.getVar('HOST_SYS', d, 1) !=
14                     oe.data.getVar('BUILD_SYS', d, 1)):
15                         deps += " virtual/${TARGET_PREFIX}gcc virtual/libc "
16         return deps
17
18 def base_read_file(filename):
19         import oe
20         try:
21                 f = file( filename, "r" )
22         except IOError, reason:
23                 raise oe.build.FuncFailed("can't read from file '%s' (%s)", (filename,reason))
24         else:
25                 return f.read().strip()
26         return None
27
28 DEPENDS_prepend="${@base_dep_prepend(d)} "
29
30 def base_set_filespath(path, d):
31         import os, oe
32         filespath = []
33         for p in path:
34                 overrides = oe.data.getVar("OVERRIDES", d, 1) or ""
35                 overrides = overrides + ":"
36                 for o in overrides.split(":"):
37                         filespath.append(os.path.join(p, o))
38         oe.data.setVar("FILESPATH", ":".join(filespath), d)
39
40 FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}"
41
42 def oe_filter(f, str, d):
43         from re import match
44         return " ".join(filter(lambda x: match(f, x, 0), str.split()))
45
46 def oe_filter_out(f, str, d):
47         from re import match
48         return " ".join(filter(lambda x: not match(f, x, 0), str.split()))
49
50 die() {
51         oefatal "$*"
52 }
53
54 oenote() {
55         echo "NOTE:" "$*"
56 }
57
58 oewarn() {
59         echo "WARNING:" "$*"
60 }
61
62 oefatal() {
63         echo "FATAL:" "$*"
64         exit 1
65 }
66
67 oedebug() {
68         test $# -ge 2 || {
69                 echo "Usage: oedebug level \"message\""
70                 exit 1
71         }
72
73         test ${OEDEBUG:-0} -ge $1 && {
74                 shift
75                 echo "DEBUG:" $*
76         }
77 }
78
79 oe_runmake() {
80         if [ x"$MAKE" = x ]; then MAKE=make; fi
81         oenote ${MAKE} ${EXTRA_OEMAKE} "$@"
82         ${MAKE} ${EXTRA_OEMAKE} "$@" || die "oemake failed"
83 }
84
85 oe_soinstall() {
86         # Purpose: Install shared library file and
87         #          create the necessary links
88         # Example:
89         #
90         # oe_
91         #
92         #oenote installing shared library $1 to $2
93         #
94         libname=`basename $1`
95         install -m 755 $1 $2/$libname
96         sonamelink=`${HOST_PREFIX}readelf -d $1 |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
97         solink=`echo $libname | sed -e 's/\.so\..*/.so/'`
98         ln -sf $libname $2/$sonamelink
99         ln -sf $libname $2/$solink
100 }
101
102 oe_libinstall() {
103         # Purpose: Install a library, in all its forms
104         # Example
105         #
106         # oe_libinstall libltdl ${STAGING_LIBDIR}/
107         # oe_libinstall -C src/libblah libblah ${D}/${libdir}/
108         dir=""
109         libtool=""
110         silent=""
111         require_static=""
112         require_shared=""
113         while [ "$#" -gt 0 ]; do
114                 case "$1" in
115                 -C)
116                         shift
117                         dir="$1"
118                         ;;
119                 -s)
120                         silent=1
121                         ;;
122                 -a)
123                         require_static=1
124                         ;;
125                 -so)
126                         require_shared=1
127                         ;;
128                 -*)
129                         oefatal "oe_libinstall: unknown option: $1"
130                         ;;
131                 *)
132                         break;
133                         ;;
134                 esac
135                 shift
136         done
137
138         libname="$1"
139         shift
140         destpath="$1"
141         if [ -z "$destpath" ]; then
142                 oefatal "oe_libinstall: no destination path specified"
143         fi
144
145         __runcmd () {
146                 if [ -z "$silent" ]; then
147                         echo >&2 "oe_libinstall: $*"
148                 fi
149                 $*
150         }
151
152         if [ -z "$dir" ]; then
153                 dir=`pwd`
154         fi
155         if [ -d "$dir/.libs" ]; then
156                 dir=$dir/.libs
157         fi
158         olddir=`pwd`
159         __runcmd cd $dir
160
161         lafile=$libname.la
162         if [ -f "$lafile" ]; then
163                 # libtool archive
164                 eval `cat $lafile|grep "^library_names="`
165                 libtool=1
166         else
167                 library_names="$libname.so* $libname.dll.a"
168         fi
169
170         __runcmd install -d $destpath/
171         dota=$libname.a
172         if [ -f "$dota" -o -n "$require_static" ]; then
173                 __runcmd install -m 0644 $dota $destpath/
174         fi
175         dotlai=$libname.lai
176         if [ -f "$dotlai" -o -n "$libtool" ]; then
177                 __runcmd install -m 0644 $dotlai $destpath/$libname.la
178         fi
179
180         for name in $library_names; do
181                 files=`eval echo $name`
182                 for f in $files; do
183                         if [ ! -e "$f" ]; then
184                                 if [ -n "$libtool" ]; then
185                                         oefatal "oe_libinstall: $dir/$f not found."
186                                 fi
187                         elif [ -L "$f" ]; then
188                                 __runcmd cp -P "$f" $destpath/
189                         elif [ ! -L "$f" ]; then
190                                 libfile="$f"
191                                 __runcmd install -m 0755 $libfile $destpath/
192                         fi
193                 done
194         done
195
196         if [ -z "$libfile" ]; then
197                 if  [ -n "$require_shared" ]; then
198                         oefatal "oe_libinstall: unable to locate shared library"
199                 fi
200         elif [ -z "$libtool" ]; then
201                 # special case hack for non-libtool .so.#.#.# links
202                 baselibfile=`basename "$libfile"`
203                 if (echo $baselibfile | grep -qE '^lib.*\.so\.[0-9.]*$'); then
204                         sonamelink=`${HOST_PREFIX}readelf -d $libfile |grep 'Library soname:' |sed -e 's/.*\[\(.*\)\].*/\1/'`
205                         solink=`echo $baselibfile | sed -e 's/\.so\..*/.so/'`
206                         if [ -n "$sonamelink" -a x"$baselibfile" != x"$sonamelink" ]; then
207                                 __runcmd ln -sf $baselibfile $destpath/$sonamelink
208                         fi
209                         __runcmd ln -sf $baselibfile $destpath/$solink
210                 fi
211         fi
212
213         __runcmd cd "$olddir"
214 }
215
216 oe_machinstall() {
217         # Purpose: Install machine dependent files, if available
218         #          If not available, check if there is a default
219         #          If no default, just touch the destination
220         # Example:
221         #                $1  $2   $3         $4
222         # oe_machinstall -m 0644 fstab ${D}/etc/fstab
223         #
224         # TODO: Check argument number?
225         #
226         filename=`basename $3`
227         dirname=`dirname $3`
228
229         for o in `echo ${OVERRIDES} | tr ':' ' '`; do
230                 if [ -e $dirname/$o/$filename ]; then
231                         oenote $dirname/$o/$filename present, installing to $4
232                         install $1 $2 $dirname/$o/$filename $4
233                         return
234                 fi
235         done
236 #       oenote overrides specific file NOT present, trying default=$3...
237         if [ -e $3 ]; then
238                 oenote $3 present, installing to $4
239                 install $1 $2 $3 $4
240         else
241                 oenote $3 NOT present, touching empty $4
242                 touch $4
243         fi
244 }
245
246 addtask showdata
247 do_showdata[nostamp] = "1"
248 python do_showdata() {
249         import sys
250         # emit variables and shell functions
251         oe.data.emit_env(sys.__stdout__, d, True)
252         # emit the metadata which isnt valid shell
253         for e in d.keys():
254             if oe.data.getVarFlag(e, 'python', d):
255                 sys.__stdout__.write("\npython %s () {\n%s}\n" % (e, oe.data.getVar(e, d, 1)))
256 }
257
258 addtask listtasks
259 do_listtasks[nostamp] = "1"
260 python do_listtasks() {
261         import sys
262         # emit variables and shell functions
263         #oe.data.emit_env(sys.__stdout__, d)
264         # emit the metadata which isnt valid shell
265         for e in d.keys():
266                 if oe.data.getVarFlag(e, 'task', d):
267                         sys.__stdout__.write("%s\n" % e)
268 }
269
270 addtask clean
271 do_clean[dirs] = "${TOPDIR}"
272 do_clean[nostamp] = "1"
273 python base_do_clean() {
274         """clear the build and temp directories"""
275         dir = oe.data.expand("${WORKDIR}", d)
276         if dir == '//': raise oe.build.FuncFailed("wrong DATADIR")
277         oe.note("removing " + dir)
278         os.system('rm -rf ' + dir)
279
280         dir = "%s.*" % oe.data.expand(oe.data.getVar('STAMP', d), d)
281         oe.note("removing " + dir)
282         os.system('rm -f '+ dir)
283 }
284
285 addtask mrproper
286 do_mrproper[dirs] = "${TOPDIR}"
287 do_mrproper[nostamp] = "1"
288 python base_do_mrproper() {
289         """clear downloaded sources, build and temp directories"""
290         dir = oe.data.expand("${DL_DIR}", d)
291         if dir == '/': oe.build.FuncFailed("wrong DATADIR")
292         oe.debug(2, "removing " + dir)
293         os.system('rm -rf ' + dir)
294         oe.build.exec_task('do_clean', d)
295 }
296
297 addtask fetch
298 do_fetch[dirs] = "${DL_DIR}"
299 do_fetch[nostamp] = "1"
300 python base_do_fetch() {
301         import sys, copy
302
303         localdata = copy.deepcopy(d)
304         oe.data.update_data(localdata)
305
306         src_uri = oe.data.getVar('SRC_URI', localdata, 1)
307         if not src_uri:
308                 return 1
309
310         try:
311                 oe.fetch.init(src_uri.split())
312         except oe.fetch.NoMethodError:
313                 (type, value, traceback) = sys.exc_info()
314                 raise oe.build.FuncFailed("No method: %s" % value)
315
316         try:
317                 oe.fetch.go(localdata)
318         except oe.fetch.MissingParameterError:
319                 (type, value, traceback) = sys.exc_info()
320                 raise oe.build.FuncFailed("Missing parameters: %s" % value)
321         except oe.fetch.FetchError:
322                 (type, value, traceback) = sys.exc_info()
323                 raise oe.build.FuncFailed("Fetch failed: %s" % value)
324 }
325
326 def oe_unpack_file(file, data, url = None):
327         import oe, os
328         if not url:
329                 url = "file://%s" % file
330         dots = file.split(".")
331         if dots[-1] in ['gz', 'bz2', 'Z']:
332                 efile = os.path.join(oe.data.getVar('WORKDIR', data, 1),os.path.basename('.'.join(dots[0:-1])))
333         else:
334                 efile = file
335         cmd = None
336         if file.endswith('.tar'):
337                 cmd = 'tar x --no-same-owner -f %s' % file
338         elif file.endswith('.tgz') or file.endswith('.tar.gz'):
339                 cmd = 'tar xz --no-same-owner -f %s' % file
340         elif file.endswith('.tbz') or file.endswith('.tar.bz2'):
341                 cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file
342         elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'):
343                 cmd = 'gzip -dc %s > %s' % (file, efile)
344         elif file.endswith('.bz2'):
345                 cmd = 'bzip2 -dc %s > %s' % (file, efile)
346         elif file.endswith('.zip'):
347                 cmd = 'unzip -q %s' % file
348         elif os.path.isdir(file):
349                 filesdir = os.path.realpath(oe.data.getVar("FILESDIR", data, 1))
350                 destdir = "."
351                 if file[0:len(filesdir)] == filesdir:
352                         destdir = file[len(filesdir):file.rfind('/')]
353                         destdir = destdir.strip('/')
354                         if len(destdir) < 1:
355                                 destdir = "."
356                         elif not os.access("%s/%s" % (os.getcwd(), destdir), os.F_OK):
357                                 os.makedirs("%s/%s" % (os.getcwd(), destdir))
358                 cmd = 'cp -a %s %s/%s/' % (file, os.getcwd(), destdir)
359         else:
360                 (type, host, path, user, pswd, parm) = oe.decodeurl(url)
361                 if not 'patch' in parm:
362                         destdir = oe.decodeurl(url)[1] or "."
363                         oe.mkdirhier("%s/%s" % (os.getcwd(), destdir))
364                         cmd = 'cp %s %s/%s/' % (file, os.getcwd(), destdir)
365         if not cmd:
366                 return True
367         cmd = "PATH=\"%s\" %s" % (oe.data.getVar('PATH', data, 1), cmd)
368         oe.note("Unpacking %s to %s/" % (file, os.getcwd()))
369         ret = os.system(cmd)
370         return ret == 0
371
372 addtask unpack after do_fetch
373 do_unpack[dirs] = "${WORKDIR}"
374 python base_do_unpack() {
375         import re, copy, os
376
377         localdata = copy.deepcopy(d)
378         oe.data.update_data(localdata)
379
380         src_uri = oe.data.getVar('SRC_URI', localdata)
381         if not src_uri:
382                 return
383         src_uri = oe.data.expand(src_uri, localdata)
384         for url in src_uri.split():
385                 try:
386                         local = oe.data.expand(oe.fetch.localpath(url, localdata), localdata)
387                 except oe.MalformedUrl, e:
388                         raise FuncFailed('Unable to generate local path for malformed uri: %s' % e)
389                 # dont need any parameters for extraction, strip them off
390                 local = re.sub(';.*$', '', local)
391                 local = os.path.realpath(local)
392                 ret = oe_unpack_file(local, localdata, url)
393                 if not ret:
394                         raise oe.build.FuncFailed()
395 }
396
397 addtask patch after do_unpack
398 do_patch[dirs] = "${WORKDIR}"
399 python base_do_patch() {
400         import re
401
402         src_uri = oe.data.getVar('SRC_URI', d)
403         if not src_uri:
404                 return
405         src_uri = oe.data.expand(src_uri, d)
406         for url in src_uri.split():
407 #               oe.note('url is %s' % url)
408                 (type, host, path, user, pswd, parm) = oe.decodeurl(url)
409                 if not "patch" in parm:
410                         continue
411                 from oe.fetch import init, localpath
412                 init([url])
413                 url = oe.encodeurl((type, host, path, user, pswd, []))
414                 local = '/' + localpath(url, d)
415                 # patch!
416                 dots = local.split(".")
417                 if dots[-1] in ['gz', 'bz2', 'Z']:
418                         efile = os.path.join(oe.data.getVar('WORKDIR', d),os.path.basename('.'.join(dots[0:-1])))
419                 else:
420                         efile = local
421                 efile = oe.data.expand(efile, d)
422                 patches_dir = oe.data.expand(oe.data.getVar('PATCHES_DIR', d), d)
423                 oe.mkdirhier(patches_dir + "/.patches")
424                 os.chdir(patches_dir)
425                 cmd = "PATH=\"%s\" patcher" % oe.data.getVar("PATH", d, 1)
426                 if "pnum" in parm:
427                         cmd += " -p %s" % parm["pnum"]
428                 # Getting rid of // at the front helps the Cygwin-Users of OE
429                 if efile.startswith('//'):
430                         efile = efile[1:]
431                 cmd += " -R -n \"%s\" -i %s" % (os.path.basename(efile), efile)
432                 ret = os.system(cmd)
433                 if ret != 0:
434                         raise oe.build.FuncFailed("'patcher' execution failed")
435 }
436
437
438 addhandler base_eventhandler
439 python base_eventhandler() {
440         from oe import note, error, data
441         from oe.event import Handled, NotHandled, getName
442         import os
443
444         name = getName(e)
445         if name in ["PkgSucceeded"]:
446                 note("package %s: build completed" % e.pkg)
447         if name in ["PkgStarted"]:
448                 note("package %s: build %s" % (e.pkg, name[3:].lower()))
449         elif name in ["PkgFailed"]:
450                 error("package %s: build %s" % (e.pkg, name[3:].lower()))
451         elif name in ["TaskStarted"]:
452                 note("package %s: task %s %s" % (data.expand(data.getVar("PF", e.data), e.data), e.task, name[4:].lower()))
453         elif name in ["TaskSucceeded"]:
454                 note("package %s: task %s completed" % (data.expand(data.getVar("PF", e.data), e.data), e.task))
455         elif name in ["TaskFailed"]:
456                 error("package %s: task %s %s" % (data.expand(data.getVar("PF", e.data), e.data), e.task, name[4:].lower()))
457         elif name in ["UnsatisfiedDep"]:
458                 note("package %s: dependency %s %s" % (e.pkg, e.dep, name[:-3].lower()))
459         elif name in ["BuildStarted", "BuildCompleted"]:
460                 note("build %s %s" % (e.name, name[5:].lower()))
461         return NotHandled
462 }
463
464 addtask configure after do_unpack do_patch
465 do_configure[dirs] = "${S} ${B}"
466
467 base_do_configure() {
468         :
469 }
470
471 addtask compile after do_configure
472 do_compile[dirs] = "${S} ${B}"
473 base_do_compile() {
474         if [ -e Makefile -o -e makefile ]; then
475                 oe_runmake || die "make failed"
476         else
477                 oenote "nothing to compile"
478         fi
479 }
480
481
482 addtask stage after do_compile
483 base_do_stage () {
484         :
485 }
486
487 do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${TARGET_SYS}/lib \
488                              ${STAGING_DIR}/${TARGET_SYS}/include \
489                              ${STAGING_DIR}/${BUILD_SYS}/bin ${STAGING_DIR}/${BUILD_SYS}/lib \
490                              ${STAGING_DIR}/${BUILD_SYS}/include \
491                              ${STAGING_DATADIR} \
492                              ${S} ${B}"
493
494 addtask populate_staging after do_compile
495
496 #python do_populate_staging () {
497 #       if not oe.data.getVar('manifest', d):
498 #               oe.build.exec_func('do_emit_manifest', d)
499 #       if oe.data.getVar('do_stage', d):
500 #               oe.build.exec_func('do_stage', d)
501 #       else:
502 #               oe.build.exec_func('manifest_do_populate_staging', d)
503 #}
504
505 python do_populate_staging () {
506         if oe.data.getVar('manifest_do_populate_staging', d):
507                 oe.build.exec_func('manifest_do_populate_staging', d)
508         else:
509                 oe.build.exec_func('do_stage', d)
510 }
511
512 #addtask install
513 addtask install after do_compile
514 do_install[dirs] = "${S} ${B}"
515
516 base_do_install() {
517         :
518 }
519
520 #addtask populate_pkgs after do_compile
521 #python do_populate_pkgs () {
522 #       if not oe.data.getVar('manifest', d):
523 #               oe.build.exec_func('do_emit_manifest', d)
524 #       oe.build.exec_func('manifest_do_populate_pkgs', d)
525 #       oe.build.exec_func('package_do_shlibs', d)
526 #}
527
528 base_do_package() {
529         :
530 }
531
532 addtask build after do_populate_staging
533 do_build = ""
534 do_build[nostamp] = "1"
535 do_build[func] = "1"
536
537 # Functions that update metadata based on files outputted
538 # during the build process.
539
540 SHLIBS = ""
541 RDEPENDS_prepend = " ${SHLIBS}"
542
543 python read_manifest () {
544         import sys
545         mfn = oe.data.getVar("MANIFEST", d, 1)
546         if os.access(mfn, os.R_OK):
547                 # we have a manifest, so emit do_stage and do_populate_pkgs,
548                 # and stuff some additional bits of data into the metadata store
549                 mfile = file(mfn, "r")
550                 manifest = oe.manifest.parse(mfile, d)
551                 if not manifest:
552                         return
553
554                 oe.data.setVar('manifest', manifest, d)
555 }
556
557 python parse_manifest () {
558                 manifest = oe.data.getVar("manifest", d)
559                 if not manifest:
560                         return
561                 for func in ("do_populate_staging", "do_populate_pkgs"):
562                         value = oe.manifest.emit(func, manifest, d)
563                         if value:
564                                 oe.data.setVar("manifest_" + func, value, d)
565                                 oe.data.delVarFlag("manifest_" + func, "python", d)
566                                 oe.data.delVarFlag("manifest_" + func, "fakeroot", d)
567                                 oe.data.setVarFlag("manifest_" + func, "func", 1, d)
568                 packages = []
569                 for l in manifest:
570                         if "pkg" in l and l["pkg"] is not None:
571                                 packages.append(l["pkg"])
572                 oe.data.setVar("PACKAGES", " ".join(packages), d)
573 }
574
575 def explode_deps(s):
576         r = []
577         l = s.split()
578         flag = False
579         for i in l:
580                 if i[0] == '(':
581                         flag = True
582                         j = []
583                 if flag:
584                         j.append(i)
585                         if i.endswith(')'):
586                                 flag = False
587                                 r[-1] += ' ' + ' '.join(j)
588                 else:
589                         r.append(i)
590         return r
591
592 python read_shlibdeps () {
593         packages = (oe.data.getVar('PACKAGES', d, 1) or "").split()
594         for pkg in packages:
595                 rdepends = explode_deps(oe.data.getVar('RDEPENDS_' + pkg, d, 0) or oe.data.getVar('RDEPENDS', d, 0) or "")
596                 shlibsfile = oe.data.expand("${WORKDIR}/install/" + pkg + ".shlibdeps", d)
597                 if os.access(shlibsfile, os.R_OK):
598                         fd = file(shlibsfile)
599                         lines = fd.readlines()
600                         fd.close()
601                         for l in lines:
602                                 rdepends.append(l.rstrip())
603                 pcfile = oe.data.expand("${WORKDIR}/install/" + pkg + ".pcdeps", d)
604                 if os.access(pcfile, os.R_OK):
605                         fd = file(pcfile)
606                         lines = fd.readlines()
607                         fd.close()
608                         for l in lines:
609                                 rdepends.append(l.rstrip())
610                 oe.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
611 }
612
613 python read_subpackage_metadata () {
614         import re
615
616         def decode(str):
617                 import codecs
618                 c = codecs.getdecoder("string_escape")
619                 return c(str)[0]
620
621         data_file = oe.data.expand("${WORKDIR}/install/${PN}.package", d)
622         if os.access(data_file, os.R_OK):
623                 f = file(data_file, 'r')
624                 lines = f.readlines()
625                 f.close()
626                 r = re.compile("([^:]+):\s*(.*)")
627                 for l in lines:
628                         m = r.match(l)
629                         if m:
630                                 oe.data.setVar(m.group(1), decode(m.group(2)), d)
631 }
632
633 python __anonymous () {
634         import exceptions
635         need_host = oe.data.getVar('COMPATIBLE_HOST', d, 1)
636         if need_host:
637                 import re
638                 this_host = oe.data.getVar('HOST_SYS', d, 1)
639                 if not re.match(need_host, this_host):
640                         raise oe.parse.SkipPackage("incompatible with host %s" % this_host)
641         
642         pn = oe.data.getVar('PN', d, 1)
643         cvsdate = oe.data.getVar('CVSDATE_%s' % pn, d, 1)
644         if cvsdate != None:
645                 oe.data.setVar('CVSDATE', cvsdate, d)
646
647         try:
648                 oe.build.exec_func('read_manifest', d)
649                 oe.build.exec_func('parse_manifest', d)
650                 oe.build.exec_func('read_shlibdeps', d)
651                 oe.build.exec_func('read_subpackage_metadata', d)
652         except exceptions.KeyboardInterrupt:
653                 raise
654         except Exception, e:
655                 oe.error("anonymous function: %s" % e)
656                 pass
657 }
658
659 python () {
660         import oe, os
661         mach_arch = oe.data.getVar('MACHINE_ARCH', d, 1)
662         old_arch = oe.data.getVar('PACKAGE_ARCH', d, 1)
663         if (old_arch == mach_arch):
664                 # Nothing to do
665                 return
666         paths = []
667         for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]:
668                 paths.append(oe.data.expand(os.path.join(p, mach_arch), d))
669         for s in oe.data.getVar('SRC_URI', d, 1).split():
670                 local = oe.data.expand(oe.fetch.localpath(s, d), d)
671                 for mp in paths:
672                         if local.startswith(mp):
673 #                               oe.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch))
674                                 oe.data.setVar('PACKAGE_ARCH', mach_arch, d)
675                                 return
676 }
677
678
679 addtask emit_manifest
680 python do_emit_manifest () {
681 #       FIXME: emit a manifest here
682 #       1) adjust PATH to hit the wrapper scripts
683         wrappers = oe.which(oe.data.getVar("OEPATH", d, 1), 'build/install', 0)
684         path = (oe.data.getVar('PATH', d, 1) or '').split(':')
685         path.insert(0, os.path.dirname(wrappers))
686         oe.data.setVar('PATH', ':'.join(path), d)
687 #       2) exec_func("do_install", d)
688         oe.build.exec_func('do_install', d)
689 #       3) read in data collected by the wrappers
690         oe.build.exec_func('read_manifest', d)
691 #       4) mangle the manifest we just generated, get paths back into
692 #          our variable form
693 #       5) write it back out
694 #       6) re-parse it to ensure the generated functions are proper
695         oe.build.exec_func('parse_manifest', d)
696 }
697
698 EXPORT_FUNCTIONS do_clean do_mrproper do_fetch do_unpack do_configure do_compile do_install do_package do_patch do_populate_pkgs do_stage
699
700 MIRRORS[func] = "0"
701 MIRRORS () {
702 ${DEBIAN_MIRROR}/main   http://snapshot.debian.net/archive/pool
703 ${DEBIAN_MIRROR}        ftp://ftp.de.debian.org/debian/pool
704 ${DEBIAN_MIRROR}        ftp://ftp.au.debian.org/debian/pool
705 ${DEBIAN_MIRROR}        ftp://ftp.cl.debian.org/debian/pool
706 ${DEBIAN_MIRROR}        ftp://ftp.hr.debian.org/debian/pool
707 ${DEBIAN_MIRROR}        ftp://ftp.fi.debian.org/debian/pool
708 ${DEBIAN_MIRROR}        ftp://ftp.hk.debian.org/debian/pool
709 ${DEBIAN_MIRROR}        ftp://ftp.hu.debian.org/debian/pool
710 ${DEBIAN_MIRROR}        ftp://ftp.ie.debian.org/debian/pool
711 ${DEBIAN_MIRROR}        ftp://ftp.it.debian.org/debian/pool
712 ${DEBIAN_MIRROR}        ftp://ftp.jp.debian.org/debian/pool
713 ${DEBIAN_MIRROR}        ftp://ftp.no.debian.org/debian/pool
714 ${DEBIAN_MIRROR}        ftp://ftp.pl.debian.org/debian/pool
715 ${DEBIAN_MIRROR}        ftp://ftp.ro.debian.org/debian/pool
716 ${DEBIAN_MIRROR}        ftp://ftp.si.debian.org/debian/pool
717 ${DEBIAN_MIRROR}        ftp://ftp.es.debian.org/debian/pool
718 ${DEBIAN_MIRROR}        ftp://ftp.se.debian.org/debian/pool
719 ${DEBIAN_MIRROR}        ftp://ftp.tr.debian.org/debian/pool
720 ${GNU_MIRROR}   ftp://mirrors.kernel.org/gnu
721 ${GNU_MIRROR}   ftp://ftp.matrix.com.br/pub/gnu
722 ${GNU_MIRROR}   ftp://ftp.cs.ubc.ca/mirror2/gnu
723 ${GNU_MIRROR}   ftp://sunsite.ust.hk/pub/gnu
724 ${GNU_MIRROR}   ftp://ftp.ayamura.org/pub/gnu
725 ftp://ftp.kernel.org/pub        http://www.kernel.org/pub
726 ftp://ftp.kernel.org/pub        ftp://ftp.us.kernel.org/pub
727 ftp://ftp.kernel.org/pub        ftp://ftp.uk.kernel.org/pub
728 ftp://ftp.kernel.org/pub        ftp://ftp.hk.kernel.org/pub
729 ftp://ftp.kernel.org/pub        ftp://ftp.au.kernel.org/pub
730 ftp://ftp.kernel.org/pub        ftp://ftp.jp.kernel.org/pub
731 ftp://.*/.*/    http://treke.net/oe/source/
732 http://.*/.*/   http://treke.net/oe/source/
733 }
734