summaryrefslogtreecommitdiffstats
path: root/meta/classes/package_rpm.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r--meta/classes/package_rpm.bbclass1180
1 files changed, 590 insertions, 590 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 2a2991768b..b20df0f243 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -9,11 +9,11 @@ PKGWRITEDIRRPM = "${WORKDIR}/deploy-rpms"
9PKGWRITEDIRSRPM = "${DEPLOY_DIR}/sources/deploy-srpm" 9PKGWRITEDIRSRPM = "${DEPLOY_DIR}/sources/deploy-srpm"
10 10
11python package_rpm_fn () { 11python package_rpm_fn () {
12 d.setVar('PKGFN', d.getVar('PKG')) 12 d.setVar('PKGFN', d.getVar('PKG'))
13} 13}
14 14
15python package_rpm_install () { 15python package_rpm_install () {
16 bb.fatal("package_rpm_install not implemented!") 16 bb.fatal("package_rpm_install not implemented!")
17} 17}
18 18
19RPMCONF_TARGET_BASE = "${DEPLOY_DIR_RPM}/solvedb" 19RPMCONF_TARGET_BASE = "${DEPLOY_DIR_RPM}/solvedb"
@@ -547,601 +547,601 @@ EOF
547} 547}
548 548
549python write_specfile () { 549python write_specfile () {
550 import textwrap 550 import textwrap
551 import oe.packagedata 551 import oe.packagedata
552 552
553 # append information for logs and patches to %prep 553 # append information for logs and patches to %prep
554 def add_prep(d,spec_files_bottom): 554 def add_prep(d,spec_files_bottom):
555 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': 555 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
556 spec_files_bottom.append('%%prep -n %s' % d.getVar('PN', True) ) 556 spec_files_bottom.append('%%prep -n %s' % d.getVar('PN', True) )
557 spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"") 557 spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"")
558 spec_files_bottom.append('') 558 spec_files_bottom.append('')
559 559
560 # get the name of tarball for sources, patches and logs 560 # get the name of tarball for sources, patches and logs
561 def get_tarballs(d): 561 def get_tarballs(d):
562 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': 562 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
563 return get_package(d) 563 return get_package(d)
564 564
565 # append the name of tarball to key word 'SOURCE' in xxx.spec. 565 # append the name of tarball to key word 'SOURCE' in xxx.spec.
566 def tail_source(d,source_list=[],patch_list=None): 566 def tail_source(d,source_list=[],patch_list=None):
567 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': 567 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
568 source_number = 0 568 source_number = 0
569 patch_number = 0 569 patch_number = 0
570 for source in source_list: 570 for source in source_list:
571 spec_preamble_top.append('Source' + str(source_number) + ': %s' % source) 571 spec_preamble_top.append('Source' + str(source_number) + ': %s' % source)
572 source_number += 1 572 source_number += 1
573 if patch_list: 573 if patch_list:
574 for patch in patch_list: 574 for patch in patch_list:
575 print_deps(patch, "Patch" + str(patch_number), spec_preamble_top, d) 575 print_deps(patch, "Patch" + str(patch_number), spec_preamble_top, d)
576 patch_number += 1 576 patch_number += 1
577 # We need a simple way to remove the MLPREFIX from the package name, 577 # We need a simple way to remove the MLPREFIX from the package name,
578 # and dependency information... 578 # and dependency information...
579 def strip_multilib(name, d): 579 def strip_multilib(name, d):
580 multilibs = d.getVar('MULTILIBS', True) or "" 580 multilibs = d.getVar('MULTILIBS', True) or ""
581 for ext in multilibs.split(): 581 for ext in multilibs.split():
582 eext = ext.split(':') 582 eext = ext.split(':')
583 if len(eext) > 1 and eext[0] == 'multilib' and name and name.find(eext[1] + '-') >= 0: 583 if len(eext) > 1 and eext[0] == 'multilib' and name and name.find(eext[1] + '-') >= 0:
584 name = "".join(name.split(eext[1] + '-')) 584 name = "".join(name.split(eext[1] + '-'))
585 return name 585 return name
586 586
587# ml = d.getVar("MLPREFIX", True) 587# ml = d.getVar("MLPREFIX", True)
588# if ml and name and len(ml) != 0 and name.find(ml) == 0: 588# if ml and name and len(ml) != 0 and name.find(ml) == 0:
589# return ml.join(name.split(ml, 1)[1:]) 589# return ml.join(name.split(ml, 1)[1:])
590# return name 590# return name
591 591
592 # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release 592 # In RPM, dependencies are of the format: pkg <>= Epoch:Version-Release
593 # This format is similar to OE, however there are restrictions on the 593 # This format is similar to OE, however there are restrictions on the
594 # characters that can be in a field. In the Version field, "-" 594 # characters that can be in a field. In the Version field, "-"
595 # characters are not allowed. "-" is allowed in the Release field. 595 # characters are not allowed. "-" is allowed in the Release field.
596 # 596 #
597 # We translate the "-" in the version to a "+", by loading the PKGV 597 # We translate the "-" in the version to a "+", by loading the PKGV
598 # from the dependent recipe, replacing the - with a +, and then using 598 # from the dependent recipe, replacing the - with a +, and then using
599 # that value to do a replace inside of this recipe's dependencies. 599 # that value to do a replace inside of this recipe's dependencies.
600 # This preserves the "-" separator between the version and release, as 600 # This preserves the "-" separator between the version and release, as
601 # well as any "-" characters inside of the release field. 601 # well as any "-" characters inside of the release field.
602 # 602 #
603 # All of this has to happen BEFORE the mapping_rename_hook as 603 # All of this has to happen BEFORE the mapping_rename_hook as
604 # after renaming we cannot look up the dependencies in the packagedata 604 # after renaming we cannot look up the dependencies in the packagedata
605 # store. 605 # store.
606 def translate_vers(varname, d): 606 def translate_vers(varname, d):
607 depends = d.getVar(varname, True) 607 depends = d.getVar(varname, True)
608 if depends: 608 if depends:
609 depends_dict = bb.utils.explode_dep_versions(depends) 609 depends_dict = bb.utils.explode_dep_versions(depends)
610 newdeps_dict = {} 610 newdeps_dict = {}
611 for dep in depends_dict: 611 for dep in depends_dict:
612 ver = depends_dict[dep] 612 ver = depends_dict[dep]
613 if dep and ver: 613 if dep and ver:
614 if '-' in ver: 614 if '-' in ver:
615 subd = oe.packagedata.read_subpkgdata_dict(dep, d) 615 subd = oe.packagedata.read_subpkgdata_dict(dep, d)
616 if 'PKGV' in subd: 616 if 'PKGV' in subd:
617 pv = subd['PKGV'] 617 pv = subd['PKGV']
618 reppv = pv.replace('-', '+') 618 reppv = pv.replace('-', '+')
619 ver = ver.replace(pv, reppv) 619 ver = ver.replace(pv, reppv)
620 newdeps_dict[dep] = ver 620 newdeps_dict[dep] = ver
621 depends = bb.utils.join_deps(newdeps_dict) 621 depends = bb.utils.join_deps(newdeps_dict)
622 d.setVar(varname, depends.strip()) 622 d.setVar(varname, depends.strip())
623 623
624 # We need to change the style the dependency from BB to RPM 624 # We need to change the style the dependency from BB to RPM
625 # This needs to happen AFTER the mapping_rename_hook 625 # This needs to happen AFTER the mapping_rename_hook
626 def print_deps(variable, tag, array, d): 626 def print_deps(variable, tag, array, d):
627 depends = variable 627 depends = variable
628 if depends: 628 if depends:
629 depends_dict = bb.utils.explode_dep_versions(depends) 629 depends_dict = bb.utils.explode_dep_versions(depends)
630 for dep in depends_dict: 630 for dep in depends_dict:
631 ver = depends_dict[dep] 631 ver = depends_dict[dep]
632 if dep and ver: 632 if dep and ver:
633 ver = ver.replace('(', '') 633 ver = ver.replace('(', '')
634 ver = ver.replace(')', '') 634 ver = ver.replace(')', '')
635 array.append("%s: %s %s" % (tag, dep, ver)) 635 array.append("%s: %s %s" % (tag, dep, ver))
636 else: 636 else:
637 array.append("%s: %s" % (tag, dep)) 637 array.append("%s: %s" % (tag, dep))
638 638
639 def walk_files(walkpath, target, conffiles): 639 def walk_files(walkpath, target, conffiles):
640 import os 640 import os
641 for rootpath, dirs, files in os.walk(walkpath): 641 for rootpath, dirs, files in os.walk(walkpath):
642 path = rootpath.replace(walkpath, "") 642 path = rootpath.replace(walkpath, "")
643 for dir in dirs: 643 for dir in dirs:
644 # All packages own the directories their files are in... 644 # All packages own the directories their files are in...
645 target.append('%dir "' + path + '/' + dir + '"') 645 target.append('%dir "' + path + '/' + dir + '"')
646 for file in files: 646 for file in files:
647 if conffiles.count(path + '/' + file): 647 if conffiles.count(path + '/' + file):
648 target.append('%config "' + path + '/' + file + '"') 648 target.append('%config "' + path + '/' + file + '"')
649 else: 649 else:
650 target.append('"' + path + '/' + file + '"') 650 target.append('"' + path + '/' + file + '"')
651 651
652 # Prevent the prerm/postrm scripts from being run during an upgrade 652 # Prevent the prerm/postrm scripts from being run during an upgrade
653 def wrap_uninstall(scriptvar): 653 def wrap_uninstall(scriptvar):
654 scr = scriptvar.strip() 654 scr = scriptvar.strip()
655 if scr.startswith("#!"): 655 if scr.startswith("#!"):
656 pos = scr.find("\n") + 1 656 pos = scr.find("\n") + 1
657 else: 657 else:
658 pos = 0 658 pos = 0
659 scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi' 659 scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi'
660 return scr 660 return scr
661 661
662 packages = d.getVar('PACKAGES', True) 662 packages = d.getVar('PACKAGES', True)
663 if not packages or packages == '': 663 if not packages or packages == '':
664 bb.debug(1, "No packages; nothing to do") 664 bb.debug(1, "No packages; nothing to do")
665 return 665 return
666 666
667 pkgdest = d.getVar('PKGDEST', True) 667 pkgdest = d.getVar('PKGDEST', True)
668 if not pkgdest: 668 if not pkgdest:
669 bb.fatal("No PKGDEST") 669 bb.fatal("No PKGDEST")
670 return 670 return
671 671
672 outspecfile = d.getVar('OUTSPECFILE', True) 672 outspecfile = d.getVar('OUTSPECFILE', True)
673 if not outspecfile: 673 if not outspecfile:
674 bb.fatal("No OUTSPECFILE") 674 bb.fatal("No OUTSPECFILE")
675 return 675 return
676 676
677 # Construct the SPEC file... 677 # Construct the SPEC file...
678 srcname = strip_multilib(d.getVar('PN', True), d) 678 srcname = strip_multilib(d.getVar('PN', True), d)
679 srcsummary = (d.getVar('SUMMARY', True) or d.getVar('DESCRIPTION', True) or ".") 679 srcsummary = (d.getVar('SUMMARY', True) or d.getVar('DESCRIPTION', True) or ".")
680 srcversion = d.getVar('PKGV', True).replace('-', '+') 680 srcversion = d.getVar('PKGV', True).replace('-', '+')
681 srcrelease = d.getVar('PKGR', True) 681 srcrelease = d.getVar('PKGR', True)
682 srcepoch = (d.getVar('PKGE', True) or "") 682 srcepoch = (d.getVar('PKGE', True) or "")
683 srclicense = d.getVar('LICENSE', True) 683 srclicense = d.getVar('LICENSE', True)
684 srcsection = d.getVar('SECTION', True) 684 srcsection = d.getVar('SECTION', True)
685 srcmaintainer = d.getVar('MAINTAINER', True) 685 srcmaintainer = d.getVar('MAINTAINER', True)
686 srchomepage = d.getVar('HOMEPAGE', True) 686 srchomepage = d.getVar('HOMEPAGE', True)
687 srcdescription = d.getVar('DESCRIPTION', True) or "." 687 srcdescription = d.getVar('DESCRIPTION', True) or "."
688 688
689 srcdepends = strip_multilib(d.getVar('DEPENDS', True), d) 689 srcdepends = strip_multilib(d.getVar('DEPENDS', True), d)
690 srcrdepends = [] 690 srcrdepends = []
691 srcrrecommends = [] 691 srcrrecommends = []
692 srcrsuggests = [] 692 srcrsuggests = []
693 srcrprovides = [] 693 srcrprovides = []
694 srcrreplaces = [] 694 srcrreplaces = []
695 srcrconflicts = [] 695 srcrconflicts = []
696 srcrobsoletes = [] 696 srcrobsoletes = []
697 697
698 srcpreinst = [] 698 srcpreinst = []
699 srcpostinst = [] 699 srcpostinst = []
700 srcprerm = [] 700 srcprerm = []
701 srcpostrm = [] 701 srcpostrm = []
702 702
703 spec_preamble_top = [] 703 spec_preamble_top = []
704 spec_preamble_bottom = [] 704 spec_preamble_bottom = []
705 705
706 spec_scriptlets_top = [] 706 spec_scriptlets_top = []
707 spec_scriptlets_bottom = [] 707 spec_scriptlets_bottom = []
708 708
709 spec_files_top = [] 709 spec_files_top = []
710 spec_files_bottom = [] 710 spec_files_bottom = []
711 711
712 for pkg in packages.split(): 712 for pkg in packages.split():
713 localdata = bb.data.createCopy(d) 713 localdata = bb.data.createCopy(d)
714 714
715 root = "%s/%s" % (pkgdest, pkg) 715 root = "%s/%s" % (pkgdest, pkg)
716 716
717 lf = bb.utils.lockfile(root + ".lock") 717 lf = bb.utils.lockfile(root + ".lock")
718 718
719 localdata.setVar('ROOT', '') 719 localdata.setVar('ROOT', '')
720 localdata.setVar('ROOT_%s' % pkg, root) 720 localdata.setVar('ROOT_%s' % pkg, root)
721 pkgname = localdata.getVar('PKG_%s' % pkg, True) 721 pkgname = localdata.getVar('PKG_%s' % pkg, True)
722 if not pkgname: 722 if not pkgname:
723 pkgname = pkg 723 pkgname = pkg
724 localdata.setVar('PKG', pkgname) 724 localdata.setVar('PKG', pkgname)
725 725
726 localdata.setVar('OVERRIDES', pkg) 726 localdata.setVar('OVERRIDES', pkg)
727 727
728 bb.data.update_data(localdata) 728 bb.data.update_data(localdata)
729 729
730 conffiles = (localdata.getVar('CONFFILES', True) or "").split() 730 conffiles = (localdata.getVar('CONFFILES', True) or "").split()
731 731
732 splitname = strip_multilib(pkgname, d) 732 splitname = strip_multilib(pkgname, d)
733 733
734 splitsummary = (localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or ".") 734 splitsummary = (localdata.getVar('SUMMARY', True) or localdata.getVar('DESCRIPTION', True) or ".")
735 splitversion = (localdata.getVar('PKGV', True) or "").replace('-', '+') 735 splitversion = (localdata.getVar('PKGV', True) or "").replace('-', '+')
736 splitrelease = (localdata.getVar('PKGR', True) or "") 736 splitrelease = (localdata.getVar('PKGR', True) or "")
737 splitepoch = (localdata.getVar('PKGE', True) or "") 737 splitepoch = (localdata.getVar('PKGE', True) or "")
738 splitlicense = (localdata.getVar('LICENSE', True) or "") 738 splitlicense = (localdata.getVar('LICENSE', True) or "")
739 splitsection = (localdata.getVar('SECTION', True) or "") 739 splitsection = (localdata.getVar('SECTION', True) or "")
740 splitdescription = (localdata.getVar('DESCRIPTION', True) or ".") 740 splitdescription = (localdata.getVar('DESCRIPTION', True) or ".")
741 741
742 translate_vers('RDEPENDS', localdata) 742 translate_vers('RDEPENDS', localdata)
743 translate_vers('RRECOMMENDS', localdata) 743 translate_vers('RRECOMMENDS', localdata)
744 translate_vers('RSUGGESTS', localdata) 744 translate_vers('RSUGGESTS', localdata)
745 translate_vers('RPROVIDES', localdata) 745 translate_vers('RPROVIDES', localdata)
746 translate_vers('RREPLACES', localdata) 746 translate_vers('RREPLACES', localdata)
747 translate_vers('RCONFLICTS', localdata) 747 translate_vers('RCONFLICTS', localdata)
748 748
749 # Map the dependencies into their final form 749 # Map the dependencies into their final form
750 mapping_rename_hook(localdata) 750 mapping_rename_hook(localdata)
751 751
752 splitrdepends = strip_multilib(localdata.getVar('RDEPENDS', True), d) or "" 752 splitrdepends = strip_multilib(localdata.getVar('RDEPENDS', True), d) or ""
753 splitrrecommends = strip_multilib(localdata.getVar('RRECOMMENDS', True), d) or "" 753 splitrrecommends = strip_multilib(localdata.getVar('RRECOMMENDS', True), d) or ""
754 splitrsuggests = strip_multilib(localdata.getVar('RSUGGESTS', True), d) or "" 754 splitrsuggests = strip_multilib(localdata.getVar('RSUGGESTS', True), d) or ""
755 splitrprovides = strip_multilib(localdata.getVar('RPROVIDES', True), d) or "" 755 splitrprovides = strip_multilib(localdata.getVar('RPROVIDES', True), d) or ""
756 splitrreplaces = strip_multilib(localdata.getVar('RREPLACES', True), d) or "" 756 splitrreplaces = strip_multilib(localdata.getVar('RREPLACES', True), d) or ""
757 splitrconflicts = strip_multilib(localdata.getVar('RCONFLICTS', True), d) or "" 757 splitrconflicts = strip_multilib(localdata.getVar('RCONFLICTS', True), d) or ""
758 splitrobsoletes = [] 758 splitrobsoletes = []
759 759
760 # Gather special src/first package data 760 # Gather special src/first package data
761 if srcname == splitname: 761 if srcname == splitname:
762 srcrdepends = splitrdepends 762 srcrdepends = splitrdepends
763 srcrrecommends = splitrrecommends 763 srcrrecommends = splitrrecommends
764 srcrsuggests = splitrsuggests 764 srcrsuggests = splitrsuggests
765 srcrprovides = splitrprovides 765 srcrprovides = splitrprovides
766 srcrreplaces = splitrreplaces 766 srcrreplaces = splitrreplaces
767 srcrconflicts = splitrconflicts 767 srcrconflicts = splitrconflicts
768 768
769 srcpreinst = localdata.getVar('pkg_preinst', True) 769 srcpreinst = localdata.getVar('pkg_preinst', True)
770 srcpostinst = localdata.getVar('pkg_postinst', True) 770 srcpostinst = localdata.getVar('pkg_postinst', True)
771 srcprerm = localdata.getVar('pkg_prerm', True) 771 srcprerm = localdata.getVar('pkg_prerm', True)
772 srcpostrm = localdata.getVar('pkg_postrm', True) 772 srcpostrm = localdata.getVar('pkg_postrm', True)
773 773
774 file_list = [] 774 file_list = []
775 walk_files(root, file_list, conffiles) 775 walk_files(root, file_list, conffiles)
776 if not file_list and localdata.getVar('ALLOW_EMPTY') != "1": 776 if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
777 bb.note("Not creating empty RPM package for %s" % splitname) 777 bb.note("Not creating empty RPM package for %s" % splitname)
778 else: 778 else:
779 bb.note("Creating RPM package for %s" % splitname) 779 bb.note("Creating RPM package for %s" % splitname)
780 spec_files_top.append('%files') 780 spec_files_top.append('%files')
781 spec_files_top.append('%defattr(-,-,-,-)') 781 spec_files_top.append('%defattr(-,-,-,-)')
782 if file_list: 782 if file_list:
783 bb.note("Creating RPM package for %s" % splitname) 783 bb.note("Creating RPM package for %s" % splitname)
784 spec_files_top.extend(file_list) 784 spec_files_top.extend(file_list)
785 else: 785 else:
786 bb.note("Creating EMPTY RPM Package for %s" % splitname) 786 bb.note("Creating EMPTY RPM Package for %s" % splitname)
787 spec_files_top.append('') 787 spec_files_top.append('')
788 788
789 bb.utils.unlockfile(lf) 789 bb.utils.unlockfile(lf)
790 continue 790 continue
791 791
792 # Process subpackage data 792 # Process subpackage data
793 spec_preamble_bottom.append('%%package -n %s' % splitname) 793 spec_preamble_bottom.append('%%package -n %s' % splitname)
794 spec_preamble_bottom.append('Summary: %s' % splitsummary) 794 spec_preamble_bottom.append('Summary: %s' % splitsummary)
795 if srcversion != splitversion: 795 if srcversion != splitversion:
796 spec_preamble_bottom.append('Version: %s' % splitversion) 796 spec_preamble_bottom.append('Version: %s' % splitversion)
797 if srcrelease != splitrelease: 797 if srcrelease != splitrelease:
798 spec_preamble_bottom.append('Release: %s' % splitrelease) 798 spec_preamble_bottom.append('Release: %s' % splitrelease)
799 if srcepoch != splitepoch: 799 if srcepoch != splitepoch:
800 spec_preamble_bottom.append('Epoch: %s' % splitepoch) 800 spec_preamble_bottom.append('Epoch: %s' % splitepoch)
801 if srclicense != splitlicense: 801 if srclicense != splitlicense:
802 spec_preamble_bottom.append('License: %s' % splitlicense) 802 spec_preamble_bottom.append('License: %s' % splitlicense)
803 spec_preamble_bottom.append('Group: %s' % splitsection) 803 spec_preamble_bottom.append('Group: %s' % splitsection)
804 804
805 # Replaces == Obsoletes && Provides 805 # Replaces == Obsoletes && Provides
806 if splitrreplaces and splitrreplaces.strip() != "": 806 if splitrreplaces and splitrreplaces.strip() != "":
807 for dep in splitrreplaces.split(','): 807 for dep in splitrreplaces.split(','):
808 if splitrprovides: 808 if splitrprovides:
809 splitrprovides = splitrprovides + ", " + dep 809 splitrprovides = splitrprovides + ", " + dep
810 else: 810 else:
811 splitrprovides = dep 811 splitrprovides = dep
812 if splitrobsoletes: 812 if splitrobsoletes:
813 splitrobsoletes = splitrobsoletes + ", " + dep 813 splitrobsoletes = splitrobsoletes + ", " + dep
814 else: 814 else:
815 splitrobsoletes = dep 815 splitrobsoletes = dep
816 816
817 print_deps(splitrdepends, "Requires", spec_preamble_bottom, d) 817 print_deps(splitrdepends, "Requires", spec_preamble_bottom, d)
818 # Suggests in RPM are like recommends in OE-core! 818 # Suggests in RPM are like recommends in OE-core!
819 print_deps(splitrrecommends, "Suggests", spec_preamble_bottom, d) 819 print_deps(splitrrecommends, "Suggests", spec_preamble_bottom, d)
820 # While there is no analog for suggests... (So call them recommends for now) 820 # While there is no analog for suggests... (So call them recommends for now)
821 print_deps(splitrsuggests, "Recommends", spec_preamble_bottom, d) 821 print_deps(splitrsuggests, "Recommends", spec_preamble_bottom, d)
822 print_deps(splitrprovides, "Provides", spec_preamble_bottom, d) 822 print_deps(splitrprovides, "Provides", spec_preamble_bottom, d)
823 print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d) 823 print_deps(splitrobsoletes, "Obsoletes", spec_preamble_bottom, d)
824 824
825 # conflicts can not be in a provide! We will need to filter it. 825 # conflicts can not be in a provide! We will need to filter it.
826 if splitrconflicts: 826 if splitrconflicts:
827 depends_dict = bb.utils.explode_dep_versions(splitrconflicts) 827 depends_dict = bb.utils.explode_dep_versions(splitrconflicts)
828 newdeps_dict = {} 828 newdeps_dict = {}
829 for dep in depends_dict: 829 for dep in depends_dict:
830 if dep not in splitrprovides: 830 if dep not in splitrprovides:
831 newdeps_dict[dep] = depends_dict[dep] 831 newdeps_dict[dep] = depends_dict[dep]
832 if newdeps_dict: 832 if newdeps_dict:
833 splitrconflicts = bb.utils.join_deps(newdeps_dict) 833 splitrconflicts = bb.utils.join_deps(newdeps_dict)
834 else: 834 else:
835 splitrconflicts = "" 835 splitrconflicts = ""
836 836
837 print_deps(splitrconflicts, "Conflicts", spec_preamble_bottom, d) 837 print_deps(splitrconflicts, "Conflicts", spec_preamble_bottom, d)
838 838
839 spec_preamble_bottom.append('') 839 spec_preamble_bottom.append('')
840 840
841 spec_preamble_bottom.append('%%description -n %s' % splitname) 841 spec_preamble_bottom.append('%%description -n %s' % splitname)
842 dedent_text = textwrap.dedent(splitdescription).strip() 842 dedent_text = textwrap.dedent(splitdescription).strip()
843 spec_preamble_bottom.append('%s' % textwrap.fill(dedent_text, width=75)) 843 spec_preamble_bottom.append('%s' % textwrap.fill(dedent_text, width=75))
844 844
845 spec_preamble_bottom.append('') 845 spec_preamble_bottom.append('')
846 846
847 # Now process scriptlets 847 # Now process scriptlets
848 for script in ["preinst", "postinst", "prerm", "postrm"]: 848 for script in ["preinst", "postinst", "prerm", "postrm"]:
849 scriptvar = localdata.getVar('pkg_%s' % script, True) 849 scriptvar = localdata.getVar('pkg_%s' % script, True)
850 if not scriptvar: 850 if not scriptvar:
851 continue 851 continue
852 if script == 'preinst': 852 if script == 'preinst':
853 spec_scriptlets_bottom.append('%%pre -n %s' % splitname) 853 spec_scriptlets_bottom.append('%%pre -n %s' % splitname)
854 elif script == 'postinst': 854 elif script == 'postinst':
855 spec_scriptlets_bottom.append('%%post -n %s' % splitname) 855 spec_scriptlets_bottom.append('%%post -n %s' % splitname)
856 elif script == 'prerm': 856 elif script == 'prerm':
857 spec_scriptlets_bottom.append('%%preun -n %s' % splitname) 857 spec_scriptlets_bottom.append('%%preun -n %s' % splitname)
858 scriptvar = wrap_uninstall(scriptvar) 858 scriptvar = wrap_uninstall(scriptvar)
859 elif script == 'postrm': 859 elif script == 'postrm':
860 spec_scriptlets_bottom.append('%%postun -n %s' % splitname) 860 spec_scriptlets_bottom.append('%%postun -n %s' % splitname)
861 scriptvar = wrap_uninstall(scriptvar) 861 scriptvar = wrap_uninstall(scriptvar)
862 spec_scriptlets_bottom.append('# %s - %s' % (splitname, script)) 862 spec_scriptlets_bottom.append('# %s - %s' % (splitname, script))
863 spec_scriptlets_bottom.append(scriptvar) 863 spec_scriptlets_bottom.append(scriptvar)
864 spec_scriptlets_bottom.append('') 864 spec_scriptlets_bottom.append('')
865 865
866 # Now process files 866 # Now process files
867 file_list = [] 867 file_list = []
868 walk_files(root, file_list, conffiles) 868 walk_files(root, file_list, conffiles)
869 if not file_list and localdata.getVar('ALLOW_EMPTY') != "1": 869 if not file_list and localdata.getVar('ALLOW_EMPTY') != "1":
870 bb.note("Not creating empty RPM package for %s" % splitname) 870 bb.note("Not creating empty RPM package for %s" % splitname)
871 else: 871 else:
872 spec_files_bottom.append('%%files -n %s' % splitname) 872 spec_files_bottom.append('%%files -n %s' % splitname)
873 spec_files_bottom.append('%defattr(-,-,-,-)') 873 spec_files_bottom.append('%defattr(-,-,-,-)')
874 if file_list: 874 if file_list:
875 bb.note("Creating RPM package for %s" % splitname) 875 bb.note("Creating RPM package for %s" % splitname)
876 spec_files_bottom.extend(file_list) 876 spec_files_bottom.extend(file_list)
877 else: 877 else:
878 bb.note("Creating EMPTY RPM Package for %s" % splitname) 878 bb.note("Creating EMPTY RPM Package for %s" % splitname)
879 spec_files_bottom.append('') 879 spec_files_bottom.append('')
880 880
881 del localdata 881 del localdata
882 bb.utils.unlockfile(lf) 882 bb.utils.unlockfile(lf)
883
884 add_prep(d,spec_files_bottom)
885 spec_preamble_top.append('Summary: %s' % srcsummary)
886 spec_preamble_top.append('Name: %s' % srcname)
887 spec_preamble_top.append('Version: %s' % srcversion)
888 spec_preamble_top.append('Release: %s' % srcrelease)
889 if srcepoch and srcepoch.strip() != "":
890 spec_preamble_top.append('Epoch: %s' % srcepoch)
891 spec_preamble_top.append('License: %s' % srclicense)
892 spec_preamble_top.append('Group: %s' % srcsection)
893 spec_preamble_top.append('Packager: %s' % srcmaintainer)
894 spec_preamble_top.append('URL: %s' % srchomepage)
895 source_list = get_tarballs(d)
896 tail_source(d,source_list,None)
897
898 # Replaces == Obsoletes && Provides
899 if srcrreplaces and srcrreplaces.strip() != "":
900 for dep in srcrreplaces.split(','):
901 if srcrprovides:
902 srcrprovides = srcrprovides + ", " + dep
903 else:
904 srcrprovides = dep
905 if srcrobsoletes:
906 srcrobsoletes = srcrobsoletes + ", " + dep
907 else:
908 srcrobsoletes = dep
909
910 print_deps(srcdepends, "BuildRequires", spec_preamble_top, d)
911 print_deps(srcrdepends, "Requires", spec_preamble_top, d)
912 # Suggests in RPM are like recommends in OE-core!
913 print_deps(srcrrecommends, "Suggests", spec_preamble_top, d)
914 # While there is no analog for suggests... (So call them recommends for now)
915 print_deps(srcrsuggests, "Recommends", spec_preamble_top, d)
916 print_deps(srcrprovides, "Provides", spec_preamble_top, d)
917 print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d)
918 883
919 # conflicts can not be in a provide! We will need to filter it. 884 add_prep(d,spec_files_bottom)
920 if srcrconflicts: 885 spec_preamble_top.append('Summary: %s' % srcsummary)
921 depends_dict = bb.utils.explode_dep_versions(srcrconflicts) 886 spec_preamble_top.append('Name: %s' % srcname)
922 newdeps_dict = {} 887 spec_preamble_top.append('Version: %s' % srcversion)
923 for dep in depends_dict: 888 spec_preamble_top.append('Release: %s' % srcrelease)
924 if dep not in srcrprovides: 889 if srcepoch and srcepoch.strip() != "":
925 newdeps_dict[dep] = depends_dict[dep] 890 spec_preamble_top.append('Epoch: %s' % srcepoch)
926 if newdeps_dict: 891 spec_preamble_top.append('License: %s' % srclicense)
927 srcrconflicts = bb.utils.join_deps(newdeps_dict) 892 spec_preamble_top.append('Group: %s' % srcsection)
928 else: 893 spec_preamble_top.append('Packager: %s' % srcmaintainer)
929 srcrconflicts = "" 894 spec_preamble_top.append('URL: %s' % srchomepage)
930 895 source_list = get_tarballs(d)
931 print_deps(srcrconflicts, "Conflicts", spec_preamble_top, d) 896 tail_source(d,source_list,None)
932 897
933 spec_preamble_top.append('') 898 # Replaces == Obsoletes && Provides
934 899 if srcrreplaces and srcrreplaces.strip() != "":
935 spec_preamble_top.append('%description') 900 for dep in srcrreplaces.split(','):
936 dedent_text = textwrap.dedent(srcdescription).strip() 901 if srcrprovides:
937 spec_preamble_top.append('%s' % textwrap.fill(dedent_text, width=75)) 902 srcrprovides = srcrprovides + ", " + dep
938 903 else:
939 spec_preamble_top.append('') 904 srcrprovides = dep
940 905 if srcrobsoletes:
941 if srcpreinst: 906 srcrobsoletes = srcrobsoletes + ", " + dep
942 spec_scriptlets_top.append('%pre') 907 else:
943 spec_scriptlets_top.append('# %s - preinst' % srcname) 908 srcrobsoletes = dep
944 spec_scriptlets_top.append(srcpreinst) 909
945 spec_scriptlets_top.append('') 910 print_deps(srcdepends, "BuildRequires", spec_preamble_top, d)
946 if srcpostinst: 911 print_deps(srcrdepends, "Requires", spec_preamble_top, d)
947 spec_scriptlets_top.append('%post') 912 # Suggests in RPM are like recommends in OE-core!
948 spec_scriptlets_top.append('# %s - postinst' % srcname) 913 print_deps(srcrrecommends, "Suggests", spec_preamble_top, d)
949 spec_scriptlets_top.append(srcpostinst) 914 # While there is no analog for suggests... (So call them recommends for now)
950 spec_scriptlets_top.append('') 915 print_deps(srcrsuggests, "Recommends", spec_preamble_top, d)
951 if srcprerm: 916 print_deps(srcrprovides, "Provides", spec_preamble_top, d)
952 spec_scriptlets_top.append('%preun') 917 print_deps(srcrobsoletes, "Obsoletes", spec_preamble_top, d)
953 spec_scriptlets_top.append('# %s - prerm' % srcname) 918
954 scriptvar = wrap_uninstall(srcprerm) 919 # conflicts can not be in a provide! We will need to filter it.
955 spec_scriptlets_top.append(scriptvar) 920 if srcrconflicts:
956 spec_scriptlets_top.append('') 921 depends_dict = bb.utils.explode_dep_versions(srcrconflicts)
957 if srcpostrm: 922 newdeps_dict = {}
958 spec_scriptlets_top.append('%postun') 923 for dep in depends_dict:
959 spec_scriptlets_top.append('# %s - postrm' % srcname) 924 if dep not in srcrprovides:
960 scriptvar = wrap_uninstall(srcpostrm) 925 newdeps_dict[dep] = depends_dict[dep]
961 spec_scriptlets_top.append(scriptvar) 926 if newdeps_dict:
962 spec_scriptlets_top.append('') 927 srcrconflicts = bb.utils.join_deps(newdeps_dict)
963 928 else:
964 # Write the SPEC file 929 srcrconflicts = ""
965 try: 930
966 from __builtin__ import file 931 print_deps(srcrconflicts, "Conflicts", spec_preamble_top, d)
967 specfile = file(outspecfile, 'w') 932
968 except OSError: 933 spec_preamble_top.append('')
969 raise bb.build.FuncFailed("unable to open spec file for writing.") 934
970 935 spec_preamble_top.append('%description')
971 # RPMSPEC_PREAMBLE is a way to add arbitrary text to the top 936 dedent_text = textwrap.dedent(srcdescription).strip()
972 # of the generated spec file 937 spec_preamble_top.append('%s' % textwrap.fill(dedent_text, width=75))
973 external_preamble = d.getVar("RPMSPEC_PREAMBLE", True) 938
974 if external_preamble: 939 spec_preamble_top.append('')
975 specfile.write(external_preamble + "\n") 940
976 941 if srcpreinst:
977 for line in spec_preamble_top: 942 spec_scriptlets_top.append('%pre')
978 specfile.write(line + "\n") 943 spec_scriptlets_top.append('# %s - preinst' % srcname)
979 944 spec_scriptlets_top.append(srcpreinst)
980 for line in spec_preamble_bottom: 945 spec_scriptlets_top.append('')
981 specfile.write(line + "\n") 946 if srcpostinst:
982 947 spec_scriptlets_top.append('%post')
983 for line in spec_scriptlets_top: 948 spec_scriptlets_top.append('# %s - postinst' % srcname)
984 specfile.write(line + "\n") 949 spec_scriptlets_top.append(srcpostinst)
985 950 spec_scriptlets_top.append('')
986 for line in spec_scriptlets_bottom: 951 if srcprerm:
987 specfile.write(line + "\n") 952 spec_scriptlets_top.append('%preun')
988 953 spec_scriptlets_top.append('# %s - prerm' % srcname)
989 for line in spec_files_top: 954 scriptvar = wrap_uninstall(srcprerm)
990 specfile.write(line + "\n") 955 spec_scriptlets_top.append(scriptvar)
991 956 spec_scriptlets_top.append('')
992 for line in spec_files_bottom: 957 if srcpostrm:
993 specfile.write(line + "\n") 958 spec_scriptlets_top.append('%postun')
994 959 spec_scriptlets_top.append('# %s - postrm' % srcname)
995 specfile.close() 960 scriptvar = wrap_uninstall(srcpostrm)
961 spec_scriptlets_top.append(scriptvar)
962 spec_scriptlets_top.append('')
963
964 # Write the SPEC file
965 try:
966 from __builtin__ import file
967 specfile = file(outspecfile, 'w')
968 except OSError:
969 raise bb.build.FuncFailed("unable to open spec file for writing.")
970
971 # RPMSPEC_PREAMBLE is a way to add arbitrary text to the top
972 # of the generated spec file
973 external_preamble = d.getVar("RPMSPEC_PREAMBLE", True)
974 if external_preamble:
975 specfile.write(external_preamble + "\n")
976
977 for line in spec_preamble_top:
978 specfile.write(line + "\n")
979
980 for line in spec_preamble_bottom:
981 specfile.write(line + "\n")
982
983 for line in spec_scriptlets_top:
984 specfile.write(line + "\n")
985
986 for line in spec_scriptlets_bottom:
987 specfile.write(line + "\n")
988
989 for line in spec_files_top:
990 specfile.write(line + "\n")
991
992 for line in spec_files_bottom:
993 specfile.write(line + "\n")
994
995 specfile.close()
996} 996}
997 997
998python do_package_rpm () { 998python do_package_rpm () {
999 import os 999 import os
1000 1000
1001 def creat_srpm_dir(d): 1001 def creat_srpm_dir(d):
1002 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': 1002 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
1003 clean_licenses = get_licenses(d) 1003 clean_licenses = get_licenses(d)
1004 pkgwritesrpmdir = bb.data.expand('${PKGWRITEDIRSRPM}/${PACKAGE_ARCH_EXTEND}', d) 1004 pkgwritesrpmdir = bb.data.expand('${PKGWRITEDIRSRPM}/${PACKAGE_ARCH_EXTEND}', d)
1005 pkgwritesrpmdir = pkgwritesrpmdir + '/' + clean_licenses 1005 pkgwritesrpmdir = pkgwritesrpmdir + '/' + clean_licenses
1006 bb.mkdirhier(pkgwritesrpmdir) 1006 bb.mkdirhier(pkgwritesrpmdir)
1007 os.chmod(pkgwritesrpmdir, 0755) 1007 os.chmod(pkgwritesrpmdir, 0755)
1008 return pkgwritesrpmdir 1008 return pkgwritesrpmdir
1009 1009
1010 # We need a simple way to remove the MLPREFIX from the package name, 1010 # We need a simple way to remove the MLPREFIX from the package name,
1011 # and dependency information... 1011 # and dependency information...
1012 def strip_multilib(name, d): 1012 def strip_multilib(name, d):
1013 ml = d.getVar("MLPREFIX", True) 1013 ml = d.getVar("MLPREFIX", True)
1014 if ml and name and len(ml) != 0 and name.find(ml) >= 0: 1014 if ml and name and len(ml) != 0 and name.find(ml) >= 0:
1015 return "".join(name.split(ml)) 1015 return "".join(name.split(ml))
1016 return name 1016 return name
1017 1017
1018 workdir = d.getVar('WORKDIR', True) 1018 workdir = d.getVar('WORKDIR', True)
1019 outdir = d.getVar('DEPLOY_DIR_IPK', True) 1019 outdir = d.getVar('DEPLOY_DIR_IPK', True)
1020 tmpdir = d.getVar('TMPDIR', True) 1020 tmpdir = d.getVar('TMPDIR', True)
1021 pkgd = d.getVar('PKGD', True) 1021 pkgd = d.getVar('PKGD', True)
1022 pkgdest = d.getVar('PKGDEST', True) 1022 pkgdest = d.getVar('PKGDEST', True)
1023 if not workdir or not outdir or not pkgd or not tmpdir: 1023 if not workdir or not outdir or not pkgd or not tmpdir:
1024 bb.error("Variables incorrectly set, unable to package") 1024 bb.error("Variables incorrectly set, unable to package")
1025 return 1025 return
1026 1026
1027 packages = d.getVar('PACKAGES', True) 1027 packages = d.getVar('PACKAGES', True)
1028 if not packages or packages == '': 1028 if not packages or packages == '':
1029 bb.debug(1, "No packages; nothing to do") 1029 bb.debug(1, "No packages; nothing to do")
1030 return 1030 return
1031 1031
1032 # Construct the spec file... 1032 # Construct the spec file...
1033 srcname = strip_multilib(d.getVar('PN', True), d) 1033 srcname = strip_multilib(d.getVar('PN', True), d)
1034 outspecfile = workdir + "/" + srcname + ".spec" 1034 outspecfile = workdir + "/" + srcname + ".spec"
1035 d.setVar('OUTSPECFILE', outspecfile) 1035 d.setVar('OUTSPECFILE', outspecfile)
1036 bb.build.exec_func('write_specfile', d) 1036 bb.build.exec_func('write_specfile', d)
1037 1037
1038 # Construct per file dependencies file 1038 # Construct per file dependencies file
1039 def dump_filerdeps(varname, outfile, d): 1039 def dump_filerdeps(varname, outfile, d):
1040 outfile.write("#!/usr/bin/env python\n\n") 1040 outfile.write("#!/usr/bin/env python\n\n")
1041 outfile.write("# Dependency table\n") 1041 outfile.write("# Dependency table\n")
1042 outfile.write('deps = {\n') 1042 outfile.write('deps = {\n')
1043 for pkg in packages.split(): 1043 for pkg in packages.split():
1044 dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg 1044 dependsflist_key = 'FILE' + varname + 'FLIST' + "_" + pkg
1045 dependsflist = (d.getVar(dependsflist_key, True) or "") 1045 dependsflist = (d.getVar(dependsflist_key, True) or "")
1046 for dfile in dependsflist.split(): 1046 for dfile in dependsflist.split():
1047 key = "FILE" + varname + "_" + dfile + "_" + pkg 1047 key = "FILE" + varname + "_" + dfile + "_" + pkg
1048 depends_dict = bb.utils.explode_dep_versions(d.getVar(key, True) or "") 1048 depends_dict = bb.utils.explode_dep_versions(d.getVar(key, True) or "")
1049 file = dfile.replace("@underscore@", "_") 1049 file = dfile.replace("@underscore@", "_")
1050 file = file.replace("@closebrace@", "]") 1050 file = file.replace("@closebrace@", "]")
1051 file = file.replace("@openbrace@", "[") 1051 file = file.replace("@openbrace@", "[")
1052 file = file.replace("@tab@", "\t") 1052 file = file.replace("@tab@", "\t")
1053 file = file.replace("@space@", " ") 1053 file = file.replace("@space@", " ")
1054 file = file.replace("@at@", "@") 1054 file = file.replace("@at@", "@")
1055 outfile.write('"' + pkgd + file + '" : "') 1055 outfile.write('"' + pkgd + file + '" : "')
1056 for dep in depends_dict: 1056 for dep in depends_dict:
1057 ver = depends_dict[dep] 1057 ver = depends_dict[dep]
1058 if dep and ver: 1058 if dep and ver:
1059 ver = ver.replace("(","") 1059 ver = ver.replace("(","")
1060 ver = ver.replace(")","") 1060 ver = ver.replace(")","")
1061 outfile.write(dep + " " + ver + " ") 1061 outfile.write(dep + " " + ver + " ")
1062 else: 1062 else:
1063 outfile.write(dep + " ") 1063 outfile.write(dep + " ")
1064 outfile.write('",\n') 1064 outfile.write('",\n')
1065 outfile.write('}\n\n') 1065 outfile.write('}\n\n')
1066 outfile.write("import sys\n") 1066 outfile.write("import sys\n")
1067 outfile.write("while 1:\n") 1067 outfile.write("while 1:\n")
1068 outfile.write("\tline = sys.stdin.readline().strip()\n") 1068 outfile.write("\tline = sys.stdin.readline().strip()\n")
1069 outfile.write("\tif not line:\n") 1069 outfile.write("\tif not line:\n")
1070 outfile.write("\t\tsys.exit(0)\n") 1070 outfile.write("\t\tsys.exit(0)\n")
1071 outfile.write("\tif line in deps:\n") 1071 outfile.write("\tif line in deps:\n")
1072 outfile.write("\t\tprint(deps[line] + '\\n')\n") 1072 outfile.write("\t\tprint(deps[line] + '\\n')\n")
1073 1073
1074 # OE-core dependencies a.k.a. RPM requires 1074 # OE-core dependencies a.k.a. RPM requires
1075 outdepends = workdir + "/" + srcname + ".requires" 1075 outdepends = workdir + "/" + srcname + ".requires"
1076 1076
1077 try: 1077 try:
1078 from __builtin__ import file 1078 from __builtin__ import file
1079 dependsfile = file(outdepends, 'w') 1079 dependsfile = file(outdepends, 'w')
1080 except OSError: 1080 except OSError:
1081 raise bb.build.FuncFailed("unable to open spec file for writing.") 1081 raise bb.build.FuncFailed("unable to open spec file for writing.")
1082 1082
1083 dump_filerdeps('RDEPENDS', dependsfile, d) 1083 dump_filerdeps('RDEPENDS', dependsfile, d)
1084 1084
1085 dependsfile.close() 1085 dependsfile.close()
1086 os.chmod(outdepends, 0755) 1086 os.chmod(outdepends, 0755)
1087 1087
1088 # OE-core / RPM Provides 1088 # OE-core / RPM Provides
1089 outprovides = workdir + "/" + srcname + ".provides" 1089 outprovides = workdir + "/" + srcname + ".provides"
1090 1090
1091 try: 1091 try:
1092 from __builtin__ import file 1092 from __builtin__ import file
1093 providesfile = file(outprovides, 'w') 1093 providesfile = file(outprovides, 'w')
1094 except OSError: 1094 except OSError:
1095 raise bb.build.FuncFailed("unable to open spec file for writing.") 1095 raise bb.build.FuncFailed("unable to open spec file for writing.")
1096 1096
1097 dump_filerdeps('RPROVIDES', providesfile, d) 1097 dump_filerdeps('RPROVIDES', providesfile, d)
1098 1098
1099 providesfile.close() 1099 providesfile.close()
1100 os.chmod(outprovides, 0755) 1100 os.chmod(outprovides, 0755)
1101 1101
1102 # Setup the rpmbuild arguments... 1102 # Setup the rpmbuild arguments...
1103 rpmbuild = d.getVar('RPMBUILD', True) 1103 rpmbuild = d.getVar('RPMBUILD', True)
1104 targetsys = d.getVar('TARGET_SYS', True) 1104 targetsys = d.getVar('TARGET_SYS', True)
1105 targetvendor = d.getVar('TARGET_VENDOR', True) 1105 targetvendor = d.getVar('TARGET_VENDOR', True)
1106 package_arch = d.getVar('PACKAGE_ARCH', True) or "" 1106 package_arch = d.getVar('PACKAGE_ARCH', True) or ""
1107 if package_arch not in "all any noarch".split(): 1107 if package_arch not in "all any noarch".split():
1108 ml_prefix = (d.getVar('MLPREFIX', True) or "").replace("-", "_") 1108 ml_prefix = (d.getVar('MLPREFIX', True) or "").replace("-", "_")
1109 d.setVar('PACKAGE_ARCH_EXTEND', ml_prefix + package_arch) 1109 d.setVar('PACKAGE_ARCH_EXTEND', ml_prefix + package_arch)
1110 else: 1110 else:
1111 d.setVar('PACKAGE_ARCH_EXTEND', package_arch) 1111 d.setVar('PACKAGE_ARCH_EXTEND', package_arch)
1112 pkgwritedir = d.expand('${PKGWRITEDIRRPM}/${PACKAGE_ARCH_EXTEND}') 1112 pkgwritedir = d.expand('${PKGWRITEDIRRPM}/${PACKAGE_ARCH_EXTEND}')
1113 pkgarch = d.expand('${PACKAGE_ARCH_EXTEND}${TARGET_VENDOR}-${TARGET_OS}') 1113 pkgarch = d.expand('${PACKAGE_ARCH_EXTEND}${TARGET_VENDOR}-${TARGET_OS}')
1114 magicfile = d.expand('${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc') 1114 magicfile = d.expand('${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc')
1115 bb.mkdirhier(pkgwritedir) 1115 bb.mkdirhier(pkgwritedir)
1116 os.chmod(pkgwritedir, 0755) 1116 os.chmod(pkgwritedir, 0755)
1117 1117
1118 cmd = rpmbuild 1118 cmd = rpmbuild
1119 cmd = cmd + " --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd 1119 cmd = cmd + " --nodeps --short-circuit --target " + pkgarch + " --buildroot " + pkgd
1120 cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'" 1120 cmd = cmd + " --define '_topdir " + workdir + "' --define '_rpmdir " + pkgwritedir + "'"
1121 cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'" 1121 cmd = cmd + " --define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm'"
1122 cmd = cmd + " --define '_use_internal_dependency_generator 0'" 1122 cmd = cmd + " --define '_use_internal_dependency_generator 0'"
1123 cmd = cmd + " --define '__find_requires " + outdepends + "'" 1123 cmd = cmd + " --define '__find_requires " + outdepends + "'"
1124 cmd = cmd + " --define '__find_provides " + outprovides + "'" 1124 cmd = cmd + " --define '__find_provides " + outprovides + "'"
1125 cmd = cmd + " --define '_unpackaged_files_terminate_build 0'" 1125 cmd = cmd + " --define '_unpackaged_files_terminate_build 0'"
1126 cmd = cmd + " --define 'debug_package %{nil}'" 1126 cmd = cmd + " --define 'debug_package %{nil}'"
1127 cmd = cmd + " --define '_rpmfc_magic_path " + magicfile + "'" 1127 cmd = cmd + " --define '_rpmfc_magic_path " + magicfile + "'"
1128 cmd = cmd + " --define '_tmppath " + workdir + "'" 1128 cmd = cmd + " --define '_tmppath " + workdir + "'"
1129 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': 1129 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
1130 cmdsrpm = cmd + " --define '_sourcedir " + workdir + "' --define '_srcrpmdir " + creat_srpm_dir(d) + "'" 1130 cmdsrpm = cmd + " --define '_sourcedir " + workdir + "' --define '_srcrpmdir " + creat_srpm_dir(d) + "'"
1131 cmdsrpm = 'fakeroot ' + cmdsrpm + " -bs " + outspecfile 1131 cmdsrpm = 'fakeroot ' + cmdsrpm + " -bs " + outspecfile
1132 cmd = cmd + " -bb " + outspecfile 1132 cmd = cmd + " -bb " + outspecfile
1133 1133
1134 # Build the source rpm package ! 1134 # Build the source rpm package !
1135 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM': 1135 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) and d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() == 'SRPM':
1136 d.setVar('SBUILDSPEC', cmdsrpm + "\n") 1136 d.setVar('SBUILDSPEC', cmdsrpm + "\n")
1137 d.setVarFlag('SBUILDSPEC', 'func', '1') 1137 d.setVarFlag('SBUILDSPEC', 'func', '1')
1138 bb.build.exec_func('SBUILDSPEC', d) 1138 bb.build.exec_func('SBUILDSPEC', d)
1139 1139
1140 1140
1141 # Build the rpm package! 1141 # Build the rpm package!
1142 d.setVar('BUILDSPEC', cmd + "\n") 1142 d.setVar('BUILDSPEC', cmd + "\n")
1143 d.setVarFlag('BUILDSPEC', 'func', '1') 1143 d.setVarFlag('BUILDSPEC', 'func', '1')
1144 bb.build.exec_func('BUILDSPEC', d) 1144 bb.build.exec_func('BUILDSPEC', d)
1145} 1145}
1146 1146
1147python () { 1147python () {
@@ -1161,13 +1161,13 @@ do_package_write_rpm[sstate-outputdirs] = "${DEPLOY_DIR_RPM}"
1161do_package_write_rpm[sstate-lockfile-shared] += "${DEPLOY_DIR_RPM}/rpm.lock" 1161do_package_write_rpm[sstate-lockfile-shared] += "${DEPLOY_DIR_RPM}/rpm.lock"
1162 1162
1163python do_package_write_rpm_setscene () { 1163python do_package_write_rpm_setscene () {
1164 sstate_setscene(d) 1164 sstate_setscene(d)
1165} 1165}
1166addtask do_package_write_rpm_setscene 1166addtask do_package_write_rpm_setscene
1167 1167
1168python do_package_write_rpm () { 1168python do_package_write_rpm () {
1169 bb.build.exec_func("read_subpackage_metadata", d) 1169 bb.build.exec_func("read_subpackage_metadata", d)
1170 bb.build.exec_func("do_package_rpm", d) 1170 bb.build.exec_func("do_package_rpm", d)
1171} 1171}
1172 1172
1173do_package_write_rpm[dirs] = "${PKGWRITEDIRRPM}" 1173do_package_write_rpm[dirs] = "${PKGWRITEDIRRPM}"