summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-05 14:16:59 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-19 20:06:25 +0100
commit29ca8936493b2044c6926becca0ffcf3747b2528 (patch)
tree043b4b06a4a93c0c7a6bf1e76e7c546fd8c9a8a8 /meta/classes/package.bbclass
parentc28973c16047f6668edaeba1bef6d81c4a353c78 (diff)
downloadpoky-29ca8936493b2044c6926becca0ffcf3747b2528.tar.gz
package.bbclass: Implement packaged-staging2
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass71
1 files changed, 31 insertions, 40 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 9787a81fda..05456ce4c7 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -466,6 +466,8 @@ python populate_packages () {
466} 466}
467populate_packages[dirs] = "${D}" 467populate_packages[dirs] = "${D}"
468 468
469PKGDESTWORK = "${WORKDIR}/pkgdata"
470
469python emit_pkgdata() { 471python emit_pkgdata() {
470 from glob import glob 472 from glob import glob
471 473
@@ -486,17 +488,14 @@ python emit_pkgdata() {
486 488
487 packages = bb.data.getVar('PACKAGES', d, True) 489 packages = bb.data.getVar('PACKAGES', d, True)
488 pkgdest = bb.data.getVar('PKGDEST', d, 1) 490 pkgdest = bb.data.getVar('PKGDEST', d, 1)
489 pkgdatadir = bb.data.getVar('PKGDATA_DIR', d, True) 491 pkgdatadir = bb.data.getVar('PKGDESTWORK', d, True)
490 492
491 pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) 493 lf = bb.utils.lockfile(bb.data.expand("${PACKAGELOCK}", d))
492 if pstageactive == "1":
493 lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
494 494
495 data_file = pkgdatadir + bb.data.expand("/${PN}" , d) 495 data_file = pkgdatadir + bb.data.expand("/${PN}" , d)
496 f = open(data_file, 'w') 496 f = open(data_file, 'w')
497 f.write("PACKAGES: %s\n" % packages) 497 f.write("PACKAGES: %s\n" % packages)
498 f.close() 498 f.close()
499 package_stagefile(data_file, d)
500 499
501 workdir = bb.data.getVar('WORKDIR', d, True) 500 workdir = bb.data.getVar('WORKDIR', d, True)
502 501
@@ -522,9 +521,6 @@ python emit_pkgdata() {
522 write_if_exists(sf, pkg, 'pkg_prerm') 521 write_if_exists(sf, pkg, 'pkg_prerm')
523 sf.close() 522 sf.close()
524 523
525 package_stagefile(subdata_file, d)
526 #if pkgdatadir2:
527 # bb.copyfile(subdata_file, pkgdatadir2 + "/runtime/%s" % pkg)
528 524
529 allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True) 525 allow_empty = bb.data.getVar('ALLOW_EMPTY_%s' % pkg, d, True)
530 if not allow_empty: 526 if not allow_empty:
@@ -535,11 +531,10 @@ python emit_pkgdata() {
535 if g or allow_empty == "1": 531 if g or allow_empty == "1":
536 packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg 532 packagedfile = pkgdatadir + '/runtime/%s.packaged' % pkg
537 file(packagedfile, 'w').close() 533 file(packagedfile, 'w').close()
538 package_stagefile(packagedfile, d) 534
539 if pstageactive == "1": 535 bb.utils.unlockfile(lf)
540 bb.utils.unlockfile(lf)
541} 536}
542emit_pkgdata[dirs] = "${PKGDATA_DIR}/runtime" 537emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime"
543 538
544ldconfig_postinst_fragment() { 539ldconfig_postinst_fragment() {
545if [ x"$D" = "x" ]; then 540if [ x"$D" = "x" ]; then
@@ -548,6 +543,7 @@ fi
548} 543}
549 544
550SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs" 545SHLIBSDIR = "${STAGING_DIR_HOST}/shlibs"
546SHLIBSWORKDIR = "${WORKDIR}/shlibs"
551 547
552python package_do_shlibs() { 548python package_do_shlibs() {
553 import re 549 import re
@@ -573,11 +569,9 @@ python package_do_shlibs() {
573 pkgdest = bb.data.getVar('PKGDEST', d, True) 569 pkgdest = bb.data.getVar('PKGDEST', d, True)
574 570
575 shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) 571 shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True)
576 bb.mkdirhier(shlibs_dir) 572 shlibswork_dir = bb.data.getVar('SHLIBSWORKDIR', d, True)
577 573
578 pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) 574 lf = bb.utils.lockfile(bb.data.expand("${PACKAGELOCK}", d))
579 if pstageactive == "1":
580 lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
581 575
582 def linux_so(root, path, file): 576 def linux_so(root, path, file):
583 cmd = bb.data.getVar('OBJDUMP', d, True) + " -p " + os.path.join(root, file) + " 2>/dev/null" 577 cmd = bb.data.getVar('OBJDUMP', d, True) + " -p " + os.path.join(root, file) + " 2>/dev/null"
@@ -676,22 +670,16 @@ python package_do_shlibs() {
676 darwin_so(root, dirs, file) 670 darwin_so(root, dirs, file)
677 elif os.access(path, os.X_OK) or lib_re.match(file): 671 elif os.access(path, os.X_OK) or lib_re.match(file):
678 linux_so(root, dirs, file) 672 linux_so(root, dirs, file)
679 shlibs_file = os.path.join(shlibs_dir, pkg + ".list") 673 shlibs_file = os.path.join(shlibswork_dir, pkg + ".list")
680 if os.path.exists(shlibs_file): 674 shver_file = os.path.join(shlibswork_dir, pkg + ".ver")
681 os.remove(shlibs_file)
682 shver_file = os.path.join(shlibs_dir, pkg + ".ver")
683 if os.path.exists(shver_file):
684 os.remove(shver_file)
685 if len(sonames): 675 if len(sonames):
686 fd = open(shlibs_file, 'w') 676 fd = open(shlibs_file, 'w')
687 for s in sonames: 677 for s in sonames:
688 fd.write(s + '\n') 678 fd.write(s + '\n')
689 fd.close() 679 fd.close()
690 package_stagefile(shlibs_file, d)
691 fd = open(shver_file, 'w') 680 fd = open(shver_file, 'w')
692 fd.write(ver + '\n') 681 fd.write(ver + '\n')
693 fd.close() 682 fd.close()
694 package_stagefile(shver_file, d)
695 if needs_ldconfig: 683 if needs_ldconfig:
696 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg) 684 bb.debug(1, 'adding ldconfig call to postinst for %s' % pkg)
697 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, True) or bb.data.getVar('pkg_postinst', d, True) 685 postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, True) or bb.data.getVar('pkg_postinst', d, True)
@@ -700,8 +688,7 @@ python package_do_shlibs() {
700 postinst += bb.data.getVar('ldconfig_postinst_fragment', d, True) 688 postinst += bb.data.getVar('ldconfig_postinst_fragment', d, True)
701 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) 689 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
702 690
703 if pstageactive == "1": 691 bb.utils.unlockfile(lf)
704 bb.utils.unlockfile(lf)
705 692
706 shlib_provider = {} 693 shlib_provider = {}
707 list_re = re.compile('^(.*)\.list$') 694 list_re = re.compile('^(.*)\.list$')
@@ -773,7 +760,7 @@ python package_do_pkgconfig () {
773 pkgdest = bb.data.getVar('PKGDEST', d, True) 760 pkgdest = bb.data.getVar('PKGDEST', d, True)
774 761
775 shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True) 762 shlibs_dir = bb.data.getVar('SHLIBSDIR', d, True)
776 bb.mkdirhier(shlibs_dir) 763 shlibswork_dir = bb.data.getVar('SHLIBSWORKDIR', d, True)
777 764
778 pc_re = re.compile('(.*)\.pc$') 765 pc_re = re.compile('(.*)\.pc$')
779 var_re = re.compile('(.*)=(.*)') 766 var_re = re.compile('(.*)=(.*)')
@@ -812,20 +799,15 @@ python package_do_pkgconfig () {
812 if hdr == 'Requires': 799 if hdr == 'Requires':
813 pkgconfig_needed[pkg] += exp.replace(',', ' ').split() 800 pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
814 801
815 pstageactive = bb.data.getVar('PSTAGING_ACTIVE', d, True) 802 lf = bb.utils.lockfile(bb.data.expand("${PACKAGELOCK}", d))
816 if pstageactive == "1":
817 lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
818 803
819 for pkg in packages.split(): 804 for pkg in packages.split():
820 pkgs_file = os.path.join(shlibs_dir, pkg + ".pclist") 805 pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist")
821 if os.path.exists(pkgs_file):
822 os.remove(pkgs_file)
823 if pkgconfig_provided[pkg] != []: 806 if pkgconfig_provided[pkg] != []:
824 f = open(pkgs_file, 'w') 807 f = open(pkgs_file, 'w')
825 for p in pkgconfig_provided[pkg]: 808 for p in pkgconfig_provided[pkg]:
826 f.write('%s\n' % p) 809 f.write('%s\n' % p)
827 f.close() 810 f.close()
828 package_stagefile(pkgs_file, d)
829 811
830 for dir in [shlibs_dir]: 812 for dir in [shlibs_dir]:
831 if not os.path.exists(dir): 813 if not os.path.exists(dir):
@@ -853,17 +835,13 @@ python package_do_pkgconfig () {
853 if found == False: 835 if found == False:
854 bb.note("couldn't find pkgconfig module '%s' in any package" % n) 836 bb.note("couldn't find pkgconfig module '%s' in any package" % n)
855 deps_file = os.path.join(pkgdest, pkg + ".pcdeps") 837 deps_file = os.path.join(pkgdest, pkg + ".pcdeps")
856 if os.path.exists(deps_file):
857 os.remove(deps_file)
858 if len(deps): 838 if len(deps):
859 fd = open(deps_file, 'w') 839 fd = open(deps_file, 'w')
860 for dep in deps: 840 for dep in deps:
861 fd.write(dep + '\n') 841 fd.write(dep + '\n')
862 fd.close() 842 fd.close()
863 package_stagefile(deps_file, d)
864 843
865 if pstageactive == "1": 844 bb.utils.unlockfile(lf)
866 bb.utils.unlockfile(lf)
867} 845}
868 846
869python read_shlibdeps () { 847python read_shlibdeps () {
@@ -1023,9 +1001,22 @@ python package_do_package () {
1023 for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split(): 1001 for f in (bb.data.getVar('PACKAGEFUNCS', d, True) or '').split():
1024 bb.build.exec_func(f, d) 1002 bb.build.exec_func(f, d)
1025} 1003}
1026do_package[dirs] = "${D}" 1004do_package[dirs] = "${SHLIBSWORKDIR} ${PKGDESTWORK} ${D}"
1027addtask package before do_build after do_install 1005addtask package before do_build after do_install
1028 1006
1007PACKAGELOCK = "${STAGING_DIR}/package-output.lock"
1008SSTATETASKS += "do_package"
1009do_package[sstate-name] = "package"
1010do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST}"
1011do_package[sstate-inputdirs] = "${PKGDESTWORK} ${SHLIBSWORKDIR}"
1012do_package[sstate-outputdirs] = "${PKGDATA_DIR} ${SHLIBSDIR}"
1013do_package[sstate-lockfile] = "${PACKAGELOCK}"
1014
1015python do_package_setscene () {
1016 sstate_setscene(d)
1017}
1018addtask do_package_setscene
1019
1029# Dummy task to mark when all packaging is complete 1020# Dummy task to mark when all packaging is complete
1030do_package_write () { 1021do_package_write () {
1031 : 1022 :