summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_rpm.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-09 15:00:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-10 11:51:19 +0000
commitc8dee9b92dfd545852ecac8dc2adfc95ac02e957 (patch)
tree5f1b86954646a0f3bb914407994388a6a4346769 /meta/classes/package_rpm.bbclass
parent5d3860f4a8abb8e95442b04f8b84a333af362fcd (diff)
downloadpoky-c8dee9b92dfd545852ecac8dc2adfc95ac02e957.tar.gz
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata: sed \ -e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \ -e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -i `grep -ril bb.data *` (From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r--meta/classes/package_rpm.bbclass136
1 files changed, 68 insertions, 68 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index f804a0fc17..2c5545c11d 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -8,7 +8,7 @@ RPMBUILD="rpmbuild"
8PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms" 8PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms"
9 9
10python package_rpm_fn () { 10python package_rpm_fn () {
11 bb.data.setVar('PKGFN', bb.data.getVar('PKG',d), d) 11 bb.data.setVar('PKGFN', d.getVar('PKG'), d)
12} 12}
13 13
14python package_rpm_install () { 14python package_rpm_install () {
@@ -406,7 +406,7 @@ python write_specfile () {
406 name = "".join(name.split(eext[1] + '-')) 406 name = "".join(name.split(eext[1] + '-'))
407 return name 407 return name
408 408
409# ml = bb.data.getVar("MLPREFIX", d, True) 409# ml = d.getVar("MLPREFIX", True)
410# if ml and name and len(ml) != 0 and name.find(ml) == 0: 410# if ml and name and len(ml) != 0 and name.find(ml) == 0:
411# return ml.join(name.split(ml, 1)[1:]) 411# return ml.join(name.split(ml, 1)[1:])
412# return name 412# return name
@@ -426,7 +426,7 @@ python write_specfile () {
426 # after renaming we cannot look up the dependencies in the packagedata 426 # after renaming we cannot look up the dependencies in the packagedata
427 # store. 427 # store.
428 def translate_vers(varname, d): 428 def translate_vers(varname, d):
429 depends = bb.data.getVar(varname, d, True) 429 depends = d.getVar(varname, True)
430 if depends: 430 if depends:
431 depends_dict = bb.utils.explode_dep_versions(depends) 431 depends_dict = bb.utils.explode_dep_versions(depends)
432 newdeps_dict = {} 432 newdeps_dict = {}
@@ -481,34 +481,34 @@ python write_specfile () {
481 scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi' 481 scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi'
482 return scr 482 return scr
483 483
484 packages = bb.data.getVar('PACKAGES', d, True) 484 packages = d.getVar('PACKAGES', True)
485 if not packages or packages == '': 485 if not packages or packages == '':
486 bb.debug(1, "No packages; nothing to do") 486 bb.debug(1, "No packages; nothing to do")
487 return 487 return
488 488
489 pkgdest = bb.data.getVar('PKGDEST', d, True) 489 pkgdest = d.getVar('PKGDEST', True)
490 if not pkgdest: 490 if not pkgdest:
491 bb.fatal("No PKGDEST") 491 bb.fatal("No PKGDEST")
492 return 492 return
493 493
494 outspecfile = bb.data.getVar('OUTSPECFILE', d, True) 494 outspecfile = d.getVar('OUTSPECFILE', True)
495 if not outspecfile: 495 if not outspecfile:
496 bb.fatal("No OUTSPECFILE") 496 bb.fatal("No OUTSPECFILE")
497 return 497 return
498 498
499 # Construct the SPEC file... 499 # Construct the SPEC file...
500 srcname = strip_multilib(bb.data.getVar('PN', d, True), d) 500 srcname = strip_multilib(d.getVar('PN', True), d)
501 srcsummary = (bb.data.getVar('SUMMARY', d, True) or bb.data.getVar('DESCRIPTION', d, True) or ".") 501 srcsummary = (d.getVar('SUMMARY', True) or d.getVar('DESCRIPTION', True) or ".")
502 srcversion = bb.data.getVar('PKGV', d, True).replace('-', '+') 502 srcversion = d.getVar('PKGV', True).replace('-', '+')
503 srcrelease = bb.data.getVar('PKGR', d, True) 503 srcrelease = d.getVar('PKGR', True)
504 srcepoch = (bb.data.getVar('PKGE', d, True) or "") 504 srcepoch = (d.getVar('PKGE', True) or "")
505 srclicense = bb.data.getVar('LICENSE', d, True) 505 srclicense = d.getVar('LICENSE', True)
506 srcsection = bb.data.getVar('SECTION', d, True) 506 srcsection = d.getVar('SECTION', True)
507 srcmaintainer = bb.data.getVar('MAINTAINER', d, True) 507 srcmaintainer = d.getVar('MAINTAINER', True)
508 srchomepage = bb.data.getVar('HOMEPAGE', d, True) 508 srchomepage = d.getVar('HOMEPAGE', True)
509 srcdescription = bb.data.getVar('DESCRIPTION', d, True) or "." 509 srcdescription = d.getVar('DESCRIPTION', True) or "."
510 510
511 srcdepends = strip_multilib(bb.data.getVar('DEPENDS', d, True), d) 511 srcdepends = strip_multilib(d.getVar('DEPENDS', True), d)
512 srcrdepends = [] 512 srcrdepends = []
513 srcrrecommends = [] 513 srcrrecommends = []
514 srcrsuggests = [] 514 srcrsuggests = []
@@ -538,28 +538,28 @@ python write_specfile () {
538 538
539 lf = bb.utils.lockfile(root + ".lock") 539 lf = bb.utils.lockfile(root + ".lock")
540 540
541 bb.data.setVar('ROOT', '', localdata) 541 localdata.setVar('ROOT', '')
542 bb.data.setVar('ROOT_%s' % pkg, root, localdata) 542 localdata.setVar('ROOT_%s' % pkg, root)
543 pkgname = bb.data.getVar('PKG_%s' % pkg, localdata, 1) 543 pkgname = localdata.getVar('PKG_%s' % pkg, 1)
544 if not pkgname: 544 if not pkgname:
545 pkgname = pkg 545 pkgname = pkg
546 bb.data.setVar('PKG', pkgname, localdata) 546 localdata.setVar('PKG', pkgname)
547 547
548 bb.data.setVar('OVERRIDES', pkg, localdata) 548 localdata.setVar('OVERRIDES', pkg)
549 549
550 bb.data.update_data(localdata) 550 bb.data.update_data(localdata)
551 551
552 conffiles = (bb.data.getVar('CONFFILES', localdata, True) or "").split() 552 conffiles = (localdata.getVar('CONFFILES', True) or "").split()
553 553
554 splitname = strip_multilib(pkgname, d) 554 splitname = strip_multilib(pkgname, d)
555 555
556 splitsummary = (bb.data.getVar('SUMMARY', localdata, True) or bb.data.getVar('DESCRIPTION', localdata, True) or ".") 556 splitsummary = (localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or ".")
557 splitversion = (bb.data.getVar('PKGV', localdata, True) or "").replace('-', '+') 557 splitversion = (localdata.getVar('PKGV', True) or "").replace('-', '+')
558 splitrelease = (bb.data.getVar('PKGR', localdata, True) or "") 558 splitrelease = (localdata.getVar('PKGR', True) or "")
559 splitepoch = (bb.data.getVar('PKGE', localdata, True) or "") 559 splitepoch = (localdata.getVar('PKGE', True) or "")
560 splitlicense = (bb.data.getVar('LICENSE', localdata, True) or "") 560 splitlicense = (localdata.getVar('LICENSE', True) or "")
561 splitsection = (bb.data.getVar('SECTION', localdata, True) or "") 561 splitsection = (localdata.getVar('SECTION', True) or "")
562 splitdescription = (bb.data.getVar('DESCRIPTION', localdata, True) or ".") 562 splitdescription = (localdata.getVar('DESCRIPTION', True) or ".")
563 563
564 translate_vers('RDEPENDS', localdata) 564 translate_vers('RDEPENDS', localdata)
565 translate_vers('RRECOMMENDS', localdata) 565 translate_vers('RRECOMMENDS', localdata)
@@ -571,12 +571,12 @@ python write_specfile () {
571 # Map the dependencies into their final form 571 # Map the dependencies into their final form
572 bb.build.exec_func("mapping_rename_hook", localdata) 572 bb.build.exec_func("mapping_rename_hook", localdata)
573 573
574 splitrdepends = strip_multilib(bb.data.getVar('RDEPENDS', localdata, True), d) or "" 574 splitrdepends = strip_multilib(localdata.getVar('RDEPENDS', True), d) or ""
575 splitrrecommends = strip_multilib(bb.data.getVar('RRECOMMENDS', localdata, True), d) or "" 575 splitrrecommends = strip_multilib(localdata.getVar('RRECOMMENDS', True), d) or ""
576 splitrsuggests = strip_multilib(bb.data.getVar('RSUGGESTS', localdata, True), d) or "" 576 splitrsuggests = strip_multilib(localdata.getVar('RSUGGESTS', True), d) or ""
577 splitrprovides = strip_multilib(bb.data.getVar('RPROVIDES', localdata, True), d) or "" 577 splitrprovides = strip_multilib(localdata.getVar('RPROVIDES', True), d) or ""
578 splitrreplaces = strip_multilib(bb.data.getVar('RREPLACES', localdata, True), d) or "" 578 splitrreplaces = strip_multilib(localdata.getVar('RREPLACES', True), d) or ""
579 splitrconflicts = strip_multilib(bb.data.getVar('RCONFLICTS', localdata, True), d) or "" 579 splitrconflicts = strip_multilib(localdata.getVar('RCONFLICTS', True), d) or ""
580 splitrobsoletes = [] 580 splitrobsoletes = []
581 581
582 # For now we need to manually supplement RPROVIDES with any update-alternatives links 582 # For now we need to manually supplement RPROVIDES with any update-alternatives links
@@ -592,14 +592,14 @@ python write_specfile () {
592 srcrreplaces = splitrreplaces 592 srcrreplaces = splitrreplaces
593 srcrconflicts = splitrconflicts 593 srcrconflicts = splitrconflicts
594 594
595 srcpreinst = bb.data.getVar('pkg_preinst', localdata, True) 595 srcpreinst = localdata.getVar('pkg_preinst', True)
596 srcpostinst = bb.data.getVar('pkg_postinst', localdata, True) 596 srcpostinst = localdata.getVar('pkg_postinst', True)
597 srcprerm = bb.data.getVar('pkg_prerm', localdata, True) 597 srcprerm = localdata.getVar('pkg_prerm', True)
598 srcpostrm = bb.data.getVar('pkg_postrm', localdata, True) 598 srcpostrm = localdata.getVar('pkg_postrm', True)
599 599
600 file_list = [] 600 file_list = []
601 walk_files(root, file_list, conffiles) 601 walk_files(root, file_list, conffiles)
602 if not file_list and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": 602 if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
603 bb.note("Not creating empty RPM package for %s" % splitname) 603 bb.note("Not creating empty RPM package for %s" % splitname)
604 else: 604 else:
605 bb.note("Creating RPM package for %s" % splitname) 605 bb.note("Creating RPM package for %s" % splitname)
@@ -672,7 +672,7 @@ python write_specfile () {
672 672
673 # Now process scriptlets 673 # Now process scriptlets
674 for script in ["preinst", "postinst", "prerm", "postrm"]: 674 for script in ["preinst", "postinst", "prerm", "postrm"]:
675 scriptvar = bb.data.getVar('pkg_%s' % script, localdata, True) 675 scriptvar = localdata.getVar('pkg_%s' % script, True)
676 if not scriptvar: 676 if not scriptvar:
677 continue 677 continue
678 if script == 'preinst': 678 if script == 'preinst':
@@ -691,7 +691,7 @@ python write_specfile () {
691 # Now process files 691 # Now process files
692 file_list = [] 692 file_list = []
693 walk_files(root, file_list, conffiles) 693 walk_files(root, file_list, conffiles)
694 if not file_list and bb.data.getVar('ALLOW_EMPTY', localdata) != "1": 694 if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
695 bb.note("Not creating empty RPM package for %s" % splitname) 695 bb.note("Not creating empty RPM package for %s" % splitname)
696 else: 696 else:
697 spec_files_bottom.append('%%files -n %s' % splitname) 697 spec_files_bottom.append('%%files -n %s' % splitname)
@@ -813,29 +813,29 @@ python do_package_rpm () {
813 # We need a simple way to remove the MLPREFIX from the package name, 813 # We need a simple way to remove the MLPREFIX from the package name,
814 # and dependency information... 814 # and dependency information...
815 def strip_multilib(name, d): 815 def strip_multilib(name, d):
816 ml = bb.data.getVar("MLPREFIX", d, True) 816 ml = d.getVar("MLPREFIX", True)
817 if ml and name and len(ml) != 0 and name.find(ml) >= 0: 817 if ml and name and len(ml) != 0 and name.find(ml) >= 0:
818 return "".join(name.split(ml)) 818 return "".join(name.split(ml))
819 return name 819 return name
820 820
821 workdir = bb.data.getVar('WORKDIR', d, True) 821 workdir = d.getVar('WORKDIR', True)
822 outdir = bb.data.getVar('DEPLOY_DIR_IPK', d, True) 822 outdir = d.getVar('DEPLOY_DIR_IPK', True)
823 tmpdir = bb.data.getVar('TMPDIR', d, True) 823 tmpdir = d.getVar('TMPDIR', True)
824 pkgd = bb.data.getVar('PKGD', d, True) 824 pkgd = d.getVar('PKGD', True)
825 pkgdest = bb.data.getVar('PKGDEST', d, True) 825 pkgdest = d.getVar('PKGDEST', True)
826 if not workdir or not outdir or not pkgd or not tmpdir: 826 if not workdir or not outdir or not pkgd or not tmpdir:
827 bb.error("Variables incorrectly set, unable to package") 827 bb.error("Variables incorrectly set, unable to package")
828 return 828 return
829 829
830 packages = bb.data.getVar('PACKAGES', d, True) 830 packages = d.getVar('PACKAGES', True)
831 if not packages or packages == '': 831 if not packages or packages == '':
832 bb.debug(1, "No packages; nothing to do") 832 bb.debug(1, "No packages; nothing to do")
833 return 833 return
834 834
835 # Construct the spec file... 835 # Construct the spec file...
836 srcname = strip_multilib(bb.data.getVar('PN', d, True), d) 836 srcname = strip_multilib(d.getVar('PN', True), d)
837 outspecfile = workdir + "/" + srcname + ".spec" 837 outspecfile = workdir + "/" + srcname + ".spec"
838 bb.data.setVar('OUTSPECFILE', outspecfile, d) 838 d.setVar('OUTSPECFILE', outspecfile)
839 bb.build.exec_func('write_specfile', d) 839 bb.build.exec_func('write_specfile', d)
840 840
841 # Construct per file dependencies file 841 # Construct per file dependencies file
@@ -844,10 +844,10 @@ python do_package_rpm () {
844 outfile.write("\n# Dependency table\n") 844 outfile.write("\n# Dependency table\n")
845 for pkg in packages.split(): 845 for pkg in packages.split():
846 dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg 846 dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg
847 dependsflist = (bb.data.getVar(dependsflist_key, d, True) or "") 847 dependsflist = (d.getVar(dependsflist_key, True) or "")
848 for dfile in dependsflist.split(): 848 for dfile in dependsflist.split():
849 key = "FILE" + varname + "_" + dfile + "_" + pkg 849 key = "FILE" + varname + "_" + dfile + "_" + pkg
850 depends_dict = bb.utils.explode_dep_versions(bb.data.getVar(key, d, True) or "") 850 depends_dict = bb.utils.explode_dep_versions(d.getVar(key, True) or "")
851 file = dfile.replace("@underscore@", "_") 851 file = dfile.replace("@underscore@", "_")
852 file = file.replace("@closebrace@", "]") 852 file = file.replace("@closebrace@", "]")
853 file = file.replace("@openbrace@", "[") 853 file = file.replace("@openbrace@", "[")
@@ -899,15 +899,15 @@ python do_package_rpm () {
899 os.chmod(outprovides, 0755) 899 os.chmod(outprovides, 0755)
900 900
901 # Setup the rpmbuild arguments... 901 # Setup the rpmbuild arguments...
902 rpmbuild = bb.data.getVar('RPMBUILD', d, True) 902 rpmbuild = d.getVar('RPMBUILD', True)
903 targetsys = bb.data.getVar('TARGET_SYS', d, True) 903 targetsys = d.getVar('TARGET_SYS', True)
904 targetvendor = bb.data.getVar('TARGET_VENDOR', d, True) 904 targetvendor = d.getVar('TARGET_VENDOR', True)
905 package_arch = bb.data.getVar('PACKAGE_ARCH', d, True) or "" 905 package_arch = d.getVar('PACKAGE_ARCH', True) or ""
906 if package_arch not in "all any noarch".split(): 906 if package_arch not in "all any noarch".split():
907 ml_prefix = (bb.data.getVar('MLPREFIX', d, True) or "").replace("-", "_") 907 ml_prefix = (d.getVar('MLPREFIX', True) or "").replace("-", "_")
908 bb.data.setVar('PACKAGE_ARCH_EXTEND', ml_prefix + package_arch, d) 908 d.setVar('PACKAGE_ARCH_EXTEND', ml_prefix + package_arch)
909 else: 909 else:
910 bb.data.setVar('PACKAGE_ARCH_EXTEND', package_arch, d) 910 d.setVar('PACKAGE_ARCH_EXTEND', package_arch)
911 pkgwritedir = bb.data.expand('${PKGWRITEDIRRPM}/${PACKAGE_ARCH_EXTEND}', d) 911 pkgwritedir = bb.data.expand('${PKGWRITEDIRRPM}/${PACKAGE_ARCH_EXTEND}', d)
912 pkgarch = bb.data.expand('${PACKAGE_ARCH_EXTEND}${TARGET_VENDOR}-${TARGET_OS}', d) 912 pkgarch = bb.data.expand('${PACKAGE_ARCH_EXTEND}${TARGET_VENDOR}-${TARGET_OS}', d)
913 magicfile = bb.data.expand('${STAGING_DIR_NATIVE}/usr/share/misc/magic.mgc', d) 913 magicfile = bb.data.expand('${STAGING_DIR_NATIVE}/usr/share/misc/magic.mgc', d)
@@ -927,19 +927,19 @@ python do_package_rpm () {
927 cmd = cmd + " -bb " + outspecfile 927 cmd = cmd + " -bb " + outspecfile
928 928
929 # Build the rpm package! 929 # Build the rpm package!
930 bb.data.setVar('BUILDSPEC', cmd + "\n", d) 930 d.setVar('BUILDSPEC', cmd + "\n")
931 bb.data.setVarFlag('BUILDSPEC', 'func', '1', d) 931 d.setVarFlag('BUILDSPEC', 'func', '1')
932 bb.build.exec_func('BUILDSPEC', d) 932 bb.build.exec_func('BUILDSPEC', d)
933} 933}
934 934
935python () { 935python () {
936 if bb.data.getVar('PACKAGES', d, True) != '': 936 if d.getVar('PACKAGES', True) != '':
937 deps = (bb.data.getVarFlag('do_package_write_rpm', 'depends', d) or "").split() 937 deps = (d.getVarFlag('do_package_write_rpm', 'depends') or "").split()
938 deps.append('rpm-native:do_populate_sysroot') 938 deps.append('rpm-native:do_populate_sysroot')
939 deps.append('virtual/fakeroot-native:do_populate_sysroot') 939 deps.append('virtual/fakeroot-native:do_populate_sysroot')
940 bb.data.setVarFlag('do_package_write_rpm', 'depends', " ".join(deps), d) 940 bb.data.setVarFlag('do_package_write_rpm', 'depends', " ".join(deps), d)
941 bb.data.setVarFlag('do_package_write_rpm', 'fakeroot', 1, d) 941 d.setVarFlag('do_package_write_rpm', 'fakeroot', 1)
942 bb.data.setVarFlag('do_package_write_rpm_setscene', 'fakeroot', 1, d) 942 d.setVarFlag('do_package_write_rpm_setscene', 'fakeroot', 1)
943} 943}
944 944
945SSTATETASKS += "do_package_write_rpm" 945SSTATETASKS += "do_package_write_rpm"