]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/classes/package.bbclass
1171de54e3f2843a52442a6ee4375d78e0bc88f1
[familiar-h63xx-build.git] / org.handhelds.familiar / classes / package.bbclass
1 def legitimize_package_name(s):
2         return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
3
4 def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None):
5         import os, os.path, bb
6
7         dvar = bb.data.getVar('D', d, 1)
8         if not dvar:
9                 bb.error("D not defined")
10                 return
11
12         packages = bb.data.getVar('PACKAGES', d, 1).split()
13         if not packages:
14                 # nothing to do
15                 return
16
17         if postinst:
18                 postinst = '#!/bin/sh\n' + postinst + '\n'
19         if postrm:
20                 postrm = '#!/bin/sh\n' + postrm + '\n'
21         if not recursive:
22                 objs = os.listdir(dvar + root)
23         else:
24                 objs = []
25                 for walkroot, dirs, files in os.walk(dvar + root):
26                         for file in files:
27                                 relpath = os.path.join(walkroot, file).replace(dvar + root + '/', '', 1)
28                                 if relpath:
29                                         objs.append(relpath)
30
31         if extra_depends == None:
32                 extra_depends = bb.data.getVar('PKG_' + packages[0], d, 1) or packages[0]
33
34         for o in objs:
35                 import re, stat
36                 if match_path:
37                         m = re.match(file_regex, o)
38                 else:
39                         m = re.match(file_regex, os.path.basename(o))
40                 
41                 if not m:
42                         continue
43                 f = os.path.join(dvar + root, o)
44                 mode = os.lstat(f).st_mode
45                 if not (stat.S_ISREG(mode) or (allow_dirs and stat.S_ISDIR(mode))):
46                         continue
47                 on = legitimize_package_name(m.group(1))
48                 pkg = output_pattern % on
49                 if not pkg in packages:
50                         if prepend:
51                                 packages = [pkg] + packages
52                         else:
53                                 packages.append(pkg)
54                         the_files = [os.path.join(root, o)]
55                         if aux_files_pattern:
56                                 if type(aux_files_pattern) is list:
57                                         for fp in aux_files_pattern:
58                                                 the_files.append(fp % on)       
59                                 else:
60                                         the_files.append(aux_files_pattern % on)
61                         if aux_files_pattern_verbatim:
62                                 if type(aux_files_pattern_verbatim) is list:
63                                         for fp in aux_files_pattern_verbatim:
64                                                 the_files.append(fp % m.group(1))       
65                                 else:
66                                         the_files.append(aux_files_pattern_verbatim % m.group(1))
67                         bb.data.setVar('FILES_' + pkg, " ".join(the_files), d)
68                         if extra_depends != '':
69                                 the_depends = bb.data.getVar('RDEPENDS_' + pkg, d, 1)
70                                 if the_depends:
71                                         the_depends = '%s %s' % (the_depends, extra_depends)
72                                 else:
73                                         the_depends = extra_depends
74                                 bb.data.setVar('RDEPENDS_' + pkg, the_depends, d)
75                         bb.data.setVar('DESCRIPTION_' + pkg, description % on, d)
76                         if postinst:
77                                 bb.data.setVar('pkg_postinst_' + pkg, postinst, d)
78                         if postrm:
79                                 bb.data.setVar('pkg_postrm_' + pkg, postrm, d)
80                 else:
81                         oldfiles = bb.data.getVar('FILES_' + pkg, d, 1)
82                         if not oldfiles:
83                                 bb.fatal("Package '%s' exists but has no files" % pkg)
84                         bb.data.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o), d)
85                 if callable(hook):
86                         hook(f, pkg, file_regex, output_pattern, m.group(1))
87
88         bb.data.setVar('PACKAGES', ' '.join(packages), d)
89
90 # Function to strip a single file, called from RUNSTRIP below
91 # A working 'file' (one which works on the target architecture)
92 # is necessary for this stuff to work.
93 #FIXME: this should be "" when any errors are gone!
94 IGNORE_STRIP_ERRORS ?= "1"
95
96 runstrip() {
97         local ro st
98         st=0
99         if {    file "$1" || {
100                         oewarn "file $1: failed (forced strip)" >&2
101                         echo 'not stripped'
102                 }
103            } | grep -q 'not stripped'
104         then
105                 oenote "${STRIP} $1"
106                 ro=
107                 test -w "$1" || {
108                         ro=1
109                         chmod +w "$1"
110                 }
111                 '${STRIP}' "$1"
112                 st=$?
113                 test -n "$ro" && chmod -w "$1"
114                 if test $st -ne 0
115                 then
116                         oewarn "runstrip: ${STRIP} $1: strip failed" >&2
117                         if [ x${IGNORE_STRIP_ERRORS} == x1 ]
118                         then
119                                 #FIXME: remove this, it's for error detection
120                                 if file "$1" 2>/dev/null >&2
121                                 then
122                                         (oefatal "${STRIP} $1: command failed" >/dev/tty)
123                                 else
124                                         (oefatal "file $1: command failed" >/dev/tty)
125                                 fi
126                                 st=0
127                         fi
128                 fi
129         else
130                 oenote "runstrip: skip $1"
131         fi
132         return $st
133 }
134
135 python populate_packages () {
136         import glob, stat, errno, re
137
138         workdir = bb.data.getVar('WORKDIR', d, 1)
139         if not workdir:
140                 bb.error("WORKDIR not defined, unable to package")
141                 return
142
143         import os # path manipulations
144         outdir = bb.data.getVar('DEPLOY_DIR', d, 1)
145         if not outdir:
146                 bb.error("DEPLOY_DIR not defined, unable to package")
147                 return
148         bb.mkdirhier(outdir)
149
150         dvar = bb.data.getVar('D', d, 1)
151         if not dvar:
152                 bb.error("D not defined, unable to package")
153                 return
154         bb.mkdirhier(dvar)
155
156         packages = bb.data.getVar('PACKAGES', d, 1)
157         if not packages:
158                 bb.debug(1, "PACKAGES not defined, nothing to package")
159                 return
160
161         pn = bb.data.getVar('PN', d, 1)
162         if not pn:
163                 bb.error("PN not defined")
164                 return
165
166         os.chdir(dvar)
167
168         def isexec(path):
169                 try:
170                         s = os.stat(path)
171                 except (os.error, AttributeError):
172                         return 0
173                 return (s[stat.ST_MODE] & stat.S_IEXEC)
174
175         for pkg in packages.split():
176                 localdata = bb.data.createCopy(d)
177                 root = os.path.join(workdir, "install", pkg)
178
179                 os.system('rm -rf %s' % root)
180
181                 bb.data.setVar('ROOT', '', localdata)
182                 bb.data.setVar('ROOT_%s' % pkg, root, localdata)
183                 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1)
184                 if not pkgname:
185                         pkgname = pkg
186                 bb.data.setVar('PKG', pkgname, localdata)
187
188                 overrides = bb.data.getVar('OVERRIDES', localdata, 1)
189                 if not overrides:
190                         raise bb.build.FuncFailed('OVERRIDES not defined')
191                 bb.data.setVar('OVERRIDES', overrides+':'+pkg, localdata)
192
193                 bb.data.update_data(localdata)
194
195                 root = bb.data.getVar('ROOT', localdata, 1)
196                 bb.mkdirhier(root)
197                 filesvar = bb.data.getVar('FILES', localdata, 1) or ""
198                 files = filesvar.split()
199                 stripfunc = ""
200                 for file in files:
201                         if os.path.isabs(file):
202                                 file = '.' + file
203                         if not os.path.islink(file):
204                                 if os.path.isdir(file):
205                                         newfiles =  [ os.path.join(file,x) for x in os.listdir(file) ]
206                                         if newfiles:
207                                                 files += newfiles
208                                                 continue
209                         globbed = glob.glob(file)
210                         if globbed:
211                                 if [ file ] != globbed:
212                                         files += globbed
213                                         continue
214                         if (not os.path.islink(file)) and (not os.path.exists(file)):
215                                 continue
216                         fpath = os.path.join(root,file)
217                         dpath = os.path.dirname(fpath)
218                         bb.mkdirhier(dpath)
219                         if (bb.data.getVar('INHIBIT_PACKAGE_STRIP', d, 1) != '1') and not os.path.islink(file) and isexec(file):
220                                 stripfunc += "\trunstrip %s || st=1\n" % fpath
221                         ret = bb.movefile(file,fpath)
222                         if ret is None or ret == 0:
223                                 raise bb.build.FuncFailed("File population failed")
224                 if not stripfunc == "":
225                         from bb import build
226                         # strip
227                         bb.data.setVar('RUNSTRIP', '\tlocal st\n\tst=0\n%s\treturn $st' % stripfunc, localdata)
228                         bb.data.setVarFlag('RUNSTRIP', 'func', 1, localdata)
229                         bb.build.exec_func('RUNSTRIP', localdata)
230                 del localdata
231         os.chdir(workdir)
232
233         unshipped = []
234         for root, dirs, files in os.walk(dvar):
235                 for f in files:
236                         path = os.path.join(root[len(dvar):], f)
237                         unshipped.append(path)
238
239         if unshipped != []:
240                 bb.note("the following files were installed but not shipped in any package:")
241                 for f in unshipped:
242                         bb.note("  " + f)
243
244         bb.build.exec_func("package_name_hook", d)
245
246         for pkg in packages.split():
247                 if bb.data.getVar('PKG_%s' % pkg, d, 1) is None:
248                         bb.data.setVar('PKG_%s' % pkg, pkg, d)
249
250         dangling_links = {}
251         pkg_files = {}
252         for pkg in packages.split():
253                 dangling_links[pkg] = []
254                 pkg_files[pkg] = []
255                 inst_root = os.path.join(workdir, "install", pkg)
256                 for root, dirs, files in os.walk(inst_root):
257                         for f in files:
258                                 path = os.path.join(root, f)
259                                 rpath = path[len(inst_root):]
260                                 pkg_files[pkg].append(rpath)
261                                 try:
262                                         s = os.stat(path)
263                                 except OSError, (err, strerror):
264                                         if err != errno.ENOENT:
265                                                 raise
266                                         target = os.readlink(path)
267                                         if target[0] != '/':
268                                                 target = os.path.join(root[len(inst_root):], target)
269                                         dangling_links[pkg].append(os.path.normpath(target))
270
271         for pkg in packages.split():
272                 rdepends = explode_deps(bb.data.getVar('RDEPENDS_' + pkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "")
273                 for l in dangling_links[pkg]:
274                         found = False
275                         bb.debug(1, "%s contains dangling link %s" % (pkg, l))
276                         for p in packages.split():
277                                 for f in pkg_files[p]:
278                                         if f == l:
279                                                 found = True
280                                                 bb.debug(1, "target found in %s" % p)
281                                                 if p == pkg:
282                                                         break
283                                                 dp = bb.data.getVar('PKG_' + p, d, 1) or p
284                                                 if not dp in rdepends:
285                                                         rdepends.append(dp)
286                                                 break
287                         if found == False:
288                                 bb.note("%s contains dangling symlink to %s" % (pkg, l))
289                 bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
290
291         def write_if_exists(f, pkg, var):
292                 def encode(str):
293                         import codecs
294                         c = codecs.getencoder("string_escape")
295                         return c(str)[0]
296
297                 val = bb.data.getVar('%s_%s' % (var, pkg), d, 1)
298                 if val:
299                         f.write('%s_%s: %s\n' % (var, pkg, encode(val)))
300
301         data_file = os.path.join(workdir, "install", pn + ".package")
302         f = open(data_file, 'w')
303         f.write("PACKAGES: %s\n" % packages)
304         for pkg in packages.split():
305                 write_if_exists(f, pkg, 'DESCRIPTION')
306                 write_if_exists(f, pkg, 'RDEPENDS')
307                 write_if_exists(f, pkg, 'RPROVIDES')
308                 write_if_exists(f, pkg, 'PKG')
309                 write_if_exists(f, pkg, 'ALLOW_EMPTY')
310                 write_if_exists(f, pkg, 'FILES')
311                 write_if_exists(f, pkg, 'pkg_postinst')
312                 write_if_exists(f, pkg, 'pkg_postrm')
313                 write_if_exists(f, pkg, 'pkg_preinst')
314                 write_if_exists(f, pkg, 'pkg_prerm')
315         f.close()
316         bb.build.exec_func("read_subpackage_metadata", d)
317 }
318
319 ldconfig_postinst_fragment() {
320 if [ x"$D" = "x" ]; then
321         ldconfig
322 fi
323 }
324
325 python package_do_shlibs() {
326         import os, re, os.path
327
328         exclude_shlibs = bb.data.getVar('EXCLUDE_FROM_SHLIBS', d, 0)
329         if exclude_shlibs:
330                 bb.note("not generating shlibs")
331                 return
332                 
333         lib_re = re.compile("^lib.*\.so")
334         libdir_re = re.compile(".*/lib$")
335
336         packages = bb.data.getVar('PACKAGES', d, 1)
337         if not packages:
338                 bb.debug(1, "no packages to build; not calculating shlibs")
339                 return
340
341         workdir = bb.data.getVar('WORKDIR', d, 1)
342         if not workdir:
343                 bb.error("WORKDIR not defined")
344                 return
345
346         staging = bb.data.getVar('STAGING_DIR', d, 1)
347         if not staging:
348                 bb.error("STAGING_DIR not defined")
349                 return
350
351         ver = bb.data.getVar('PV', d, 1)
352         if not ver:
353                 bb.error("PV not defined")
354                 return
355
356         target_sys = bb.data.getVar('TARGET_SYS', d, 1)
357         if not target_sys:
358                 bb.error("TARGET_SYS not defined")
359                 return
360
361         shlibs_dir = os.path.join(staging, target_sys, "shlibs")
362         old_shlibs_dir = os.path.join(staging, "shlibs")
363         bb.mkdirhier(shlibs_dir)
364
365         needed = {}
366         for pkg in packages.split():
367                 needs_ldconfig = False
368                 bb.debug(2, "calculating shlib provides for %s" % pkg)
369
370                 pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1)
371                 if not pkgname:
372                         pkgname = pkg
373
374                 needed[pkg] = []
375                 sonames = list()
376                 top = os.path.join(workdir, "install", pkg)
377                 for root, dirs, files in os.walk(top):
378                         for file in files:
379                                 soname = None
380                                 path = os.path.join(root, file)
381                                 if os.access(path, os.X_OK) or lib_re.match(file):
382                                         cmd = (bb.data.getVar('BUILD_PREFIX', d, 1) or "") + "objdump -p " + path + " 2>/dev/null"
383                                         fd = os.popen(cmd)
384                                         lines = fd.readlines()
385                                         fd.close()
386                                         for l in lines:
387                                                 m = re.match("\s+NEEDED\s+([^\s]*)", l)
388                                                 if m:
389                                                         needed[pkg].append(m.group(1))
390                                                 m = re.match("\s+SONAME\s+([^\s]*)", l)
391                                                 if m and not m.group(1) in sonames:
392                                                         sonames.append(m.group(1))
393                                                 if m and libdir_re.match(root):
394                                                         needs_ldconfig = True
395                 shlibs_file = os.path.join(shlibs_dir, pkgname + ".list")
396                 if os.path.exists(shlibs_file):
397                         os.remove(shlibs_file)
398                 shver_file = os.path.join(shlibs_dir, pkgname + ".ver")
399                 if os.path.exists(shver_file):
400                         os.remove(shver_file)
401                 if len(sonames):
402                         fd = open(shlibs_file, 'w')
403                         for s in sonames:
404                                 fd.write(s + '\n')
405                         fd.close()
406                         fd = open(shver_file, 'w')
407                         fd.write(ver + '\n')
408                         fd.close()
409                 if needs_ldconfig:
410                         bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
411                         postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1)
412                         if not postinst:
413                                 postinst = '#!/bin/sh\n'
414                         postinst += bb.data.getVar('ldconfig_postinst_fragment', d, 1)
415                         bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
416
417         shlib_provider = {}
418         list_re = re.compile('^(.*)\.list$')
419         for dir in [old_shlibs_dir, shlibs_dir]: 
420                 if not os.path.exists(dir):
421                         continue
422                 for file in os.listdir(dir):
423                         m = list_re.match(file)
424                         if m:
425                                 dep_pkg = m.group(1)
426                                 fd = open(os.path.join(dir, file))
427                                 lines = fd.readlines()
428                                 fd.close()
429                                 ver_file = os.path.join(dir, dep_pkg + '.ver')
430                                 lib_ver = None
431                                 if os.path.exists(ver_file):
432                                         fd = open(ver_file)
433                                         lib_ver = fd.readline().rstrip()
434                                         fd.close()
435                                 for l in lines:
436                                         shlib_provider[l.rstrip()] = (dep_pkg, lib_ver)
437
438
439         for pkg in packages.split():
440                 bb.debug(2, "calculating shlib requirements for %s" % pkg)
441
442                 p_pkg = bb.data.getVar("PKG_%s" % pkg, d, 1) or pkg
443
444                 deps = list()
445                 for n in needed[pkg]:
446                         if n in shlib_provider.keys():
447                                 (dep_pkg, ver_needed) = shlib_provider[n]
448
449                                 if dep_pkg == p_pkg:
450                                         continue
451
452                                 if ver_needed:
453                                         dep = "%s (>= %s)" % (dep_pkg, ver_needed)
454                                 else:
455                                         dep = dep_pkg
456                                 if not dep in deps:
457                                         deps.append(dep)
458                         else:
459                                 bb.note("Couldn't find shared library provider for %s" % n)
460
461
462                 deps_file = os.path.join(workdir, "install", pkg + ".shlibdeps")
463                 if os.path.exists(deps_file):
464                         os.remove(deps_file)
465                 if len(deps):
466                         fd = open(deps_file, 'w')
467                         for dep in deps:
468                                 fd.write(dep + '\n')
469                         fd.close()
470 }
471
472 python package_do_pkgconfig () {
473         import re, os
474
475         packages = bb.data.getVar('PACKAGES', d, 1)
476         if not packages:
477                 bb.debug(1, "no packages to build; not calculating pkgconfig dependencies")
478                 return
479
480         workdir = bb.data.getVar('WORKDIR', d, 1)
481         if not workdir:
482                 bb.error("WORKDIR not defined")
483                 return
484
485         staging = bb.data.getVar('STAGING_DIR', d, 1)
486         if not staging:
487                 bb.error("STAGING_DIR not defined")
488                 return
489
490         target_sys = bb.data.getVar('TARGET_SYS', d, 1)
491         if not target_sys:
492                 bb.error("TARGET_SYS not defined")
493                 return
494
495         shlibs_dir = os.path.join(staging, target_sys, "shlibs")
496         old_shlibs_dir = os.path.join(staging, "shlibs")
497         bb.mkdirhier(shlibs_dir)
498
499         pc_re = re.compile('(.*)\.pc$')
500         var_re = re.compile('(.*)=(.*)')
501         field_re = re.compile('(.*): (.*)')
502
503         pkgconfig_provided = {}
504         pkgconfig_needed = {}
505         for pkg in packages.split():
506                 pkgconfig_provided[pkg] = []
507                 pkgconfig_needed[pkg] = []
508                 top = os.path.join(workdir, "install", pkg)
509                 for root, dirs, files in os.walk(top):
510                         for file in files:
511                                 m = pc_re.match(file)
512                                 if m:
513                                         pd = bb.data.init()
514                                         name = m.group(1)
515                                         pkgconfig_provided[pkg].append(name)
516                                         path = os.path.join(root, file)
517                                         if not os.access(path, os.R_OK):
518                                                 continue
519                                         f = open(path, 'r')
520                                         lines = f.readlines()
521                                         f.close()
522                                         for l in lines:
523                                                 m = var_re.match(l)
524                                                 if m:
525                                                         name = m.group(1)
526                                                         val = m.group(2)
527                                                         bb.data.setVar(name, bb.data.expand(val, pd), pd)
528                                                         continue
529                                                 m = field_re.match(l)
530                                                 if m:
531                                                         hdr = m.group(1)
532                                                         exp = bb.data.expand(m.group(2), pd)
533                                                         if hdr == 'Requires':
534                                                                 pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
535
536         for pkg in packages.split():
537                 ppkg = bb.data.getVar("PKG_" + pkg, d, 1) or pkg
538                 pkgs_file = os.path.join(shlibs_dir, ppkg + ".pclist")
539                 if os.path.exists(pkgs_file):
540                         os.remove(pkgs_file)
541                 if pkgconfig_provided[pkg] != []:
542                         f = open(pkgs_file, 'w')
543                         for p in pkgconfig_provided[pkg]:
544                                 f.write('%s\n' % p)
545                         f.close()
546
547         for dir in [old_shlibs_dir, shlibs_dir]:
548                 if not os.path.exists(dir):
549                         continue
550                 for file in os.listdir(dir):
551                         m = re.match('^(.*)\.pclist$', file)
552                         if m:
553                                 pkg = m.group(1)
554                                 fd = open(os.path.join(dir, file))
555                                 lines = fd.readlines()
556                                 fd.close()
557                                 pkgconfig_provided[pkg] = []
558                                 for l in lines:
559                                         pkgconfig_provided[pkg].append(l.rstrip())
560
561         for pkg in packages.split():
562                 deps = []
563                 for n in pkgconfig_needed[pkg]:
564                         found = False
565                         for k in pkgconfig_provided.keys():
566                                 if n in pkgconfig_provided[k]:
567                                         if k != pkg and not (k in deps):
568                                                 deps.append(k)
569                                         found = True
570                         if found == False:
571                                 bb.note("couldn't find pkgconfig module '%s' in any package" % n)
572                 deps_file = os.path.join(workdir, "install", pkg + ".pcdeps")
573                 if os.path.exists(deps_file):
574                         os.remove(deps_file)
575                 if len(deps):
576                         fd = open(deps_file, 'w')
577                         for dep in deps:
578                                 fd.write(dep + '\n')
579                         fd.close()
580 }
581
582 python package_do_split_locales() {
583         import os
584
585         if (bb.data.getVar('PACKAGE_NO_LOCALE', d, 1) == '1'):
586                 bb.debug(1, "package requested not splitting locales")
587                 return
588
589         packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
590         if not packages:
591                 bb.debug(1, "no packages to build; not splitting locales")
592                 return
593
594         datadir = bb.data.getVar('datadir', d, 1)
595         if not datadir:
596                 bb.note("datadir not defined")
597                 return
598
599         dvar = bb.data.getVar('D', d, 1)
600         if not dvar:
601                 bb.error("D not defined")
602                 return
603
604         pn = bb.data.getVar('PN', d, 1)
605         if not pn:
606                 bb.error("PN not defined")
607                 return
608
609         if pn + '-locale' in packages:
610                 packages.remove(pn + '-locale')
611
612         localedir = os.path.join(dvar + datadir, 'locale')
613
614         if not os.path.isdir(localedir):
615                 bb.debug(1, "No locale files in this package")
616                 return
617
618         locales = os.listdir(localedir)
619
620         mainpkg = packages[0]
621
622         for l in locales:
623                 ln = legitimize_package_name(l)
624                 pkg = pn + '-locale-' + ln
625                 packages.append(pkg)
626                 bb.data.setVar('FILES_' + pkg, os.path.join(datadir, 'locale', l), d)
627                 bb.data.setVar('RDEPENDS_' + pkg, '${PKG_%s} virtual-locale-%s' % (mainpkg, ln), d)
628                 bb.data.setVar('RPROVIDES_' + pkg, '%s-locale %s-translation' % (pn, ln), d)
629                 bb.data.setVar('DESCRIPTION_' + pkg, '%s translation for %s' % (l, pn), d)
630
631         bb.data.setVar('PACKAGES', ' '.join(packages), d)
632
633         rdep = (bb.data.getVar('RDEPENDS_%s' % mainpkg, d, 1) or bb.data.getVar('RDEPENDS', d, 1) or "").split()
634         rdep.append('%s-locale*' % pn)
635         bb.data.setVar('RDEPENDS_%s' % mainpkg, ' '.join(rdep), d)
636 }
637
638 PACKAGEFUNCS = "do_install package_do_split_locales \
639                 populate_packages package_do_shlibs \
640                 package_do_pkgconfig read_shlibdeps"
641 python package_do_package () {
642         for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split():
643                 bb.build.exec_func(f, d)
644 }
645
646 do_package[dirs] = "${D}"
647 populate_packages[dirs] = "${D}"
648 EXPORT_FUNCTIONS do_package do_shlibs do_split_locales
649 addtask package before do_build after do_populate_staging