diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-10-02 11:37:07 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-10-02 11:40:53 +0100 |
commit | 5fdbda6922327d963d4fe1c597fed8f0dfd20ed1 (patch) | |
tree | 98e3a58efeaead2fa76110b571cfda3f63414277 /meta/classes/package_rpm.bbclass | |
parent | 0bfb2094e3eadc85358a354d12b211ff69612a61 (diff) | |
download | poky-5fdbda6922327d963d4fe1c597fed8f0dfd20ed1.tar.gz |
classes: Update to use corrected bb.utils.explode_dep_versions2 API
The bb.utils.explode_dep_versions function has issues where dependency information
can be lost. The API doesn't support maintaining the correct information so this
changes to use a new function which correctly handles the data.
This patch also fixes various points in the code to ensure that we do not have any
duplicates in things that use explode_dep_versions.
A new sanity test to test the contents of the R* variables is also added.
[Some changes from Mark Hatle <mark.hatle@windriver.com>]
(From OE-Core rev: 16a892431d0c0d03f8b561b92909cf2f11af4918)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_rpm.bbclass')
-rw-r--r-- | meta/classes/package_rpm.bbclass | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index 49055f2f51..c491775976 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass | |||
@@ -608,6 +608,13 @@ python write_specfile () { | |||
608 | name = "".join(name.split(eext[1] + '-')) | 608 | name = "".join(name.split(eext[1] + '-')) |
609 | return name | 609 | return name |
610 | 610 | ||
611 | def strip_multilib_deps(deps, d): | ||
612 | depends = bb.utils.explode_dep_versions2(deps or "") | ||
613 | newdeps = {} | ||
614 | for dep in depends: | ||
615 | newdeps[strip_multilib(dep, d)] = depends[dep] | ||
616 | return bb.utils.join_deps(newdeps) | ||
617 | |||
611 | # ml = d.getVar("MLPREFIX", True) | 618 | # ml = d.getVar("MLPREFIX", True) |
612 | # if ml and name and len(ml) != 0 and name.find(ml) == 0: | 619 | # if ml and name and len(ml) != 0 and name.find(ml) == 0: |
613 | # return ml.join(name.split(ml, 1)[1:]) | 620 | # return ml.join(name.split(ml, 1)[1:]) |
@@ -630,18 +637,20 @@ python write_specfile () { | |||
630 | def translate_vers(varname, d): | 637 | def translate_vers(varname, d): |
631 | depends = d.getVar(varname, True) | 638 | depends = d.getVar(varname, True) |
632 | if depends: | 639 | if depends: |
633 | depends_dict = bb.utils.explode_dep_versions(depends) | 640 | depends_dict = bb.utils.explode_dep_versions2(depends) |
634 | newdeps_dict = {} | 641 | newdeps_dict = {} |
635 | for dep in depends_dict: | 642 | for dep in depends_dict: |
636 | ver = depends_dict[dep] | 643 | verlist = [] |
637 | if dep and ver: | 644 | for ver in depends_dict[dep]: |
638 | if '-' in ver: | 645 | if '-' in ver: |
639 | subd = oe.packagedata.read_subpkgdata_dict(dep, d) | 646 | subd = oe.packagedata.read_subpkgdata_dict(dep, d) |
640 | if 'PKGV' in subd: | 647 | if 'PKGV' in subd: |
641 | pv = subd['PKGV'] | 648 | pv = subd['PKGV'] |
642 | reppv = pv.replace('-', '+') | 649 | reppv = pv.replace('-', '+') |
643 | ver = ver.replace(pv, reppv) | 650 | verlist.append(ver.replace(pv, reppv)) |
644 | newdeps_dict[dep] = ver | 651 | else: |
652 | verlist.append(ver) | ||
653 | newdeps_dict[dep] = verlist | ||
645 | depends = bb.utils.join_deps(newdeps_dict) | 654 | depends = bb.utils.join_deps(newdeps_dict) |
646 | d.setVar(varname, depends.strip()) | 655 | d.setVar(varname, depends.strip()) |
647 | 656 | ||
@@ -650,14 +659,13 @@ python write_specfile () { | |||
650 | def print_deps(variable, tag, array, d): | 659 | def print_deps(variable, tag, array, d): |
651 | depends = variable | 660 | depends = variable |
652 | if depends: | 661 | if depends: |
653 | depends_dict = bb.utils.explode_dep_versions(depends) | 662 | depends_dict = bb.utils.explode_dep_versions2(depends) |
654 | for dep in depends_dict: | 663 | for dep in depends_dict: |
655 | ver = depends_dict[dep] | 664 | for ver in depends_dict[dep]: |
656 | if dep and ver: | ||
657 | ver = ver.replace('(', '') | 665 | ver = ver.replace('(', '') |
658 | ver = ver.replace(')', '') | 666 | ver = ver.replace(')', '') |
659 | array.append("%s: %s %s" % (tag, dep, ver)) | 667 | array.append("%s: %s %s" % (tag, dep, ver)) |
660 | else: | 668 | if not len(depends_dict[dep]): |
661 | array.append("%s: %s" % (tag, dep)) | 669 | array.append("%s: %s" % (tag, dep)) |
662 | 670 | ||
663 | def walk_files(walkpath, target, conffiles): | 671 | def walk_files(walkpath, target, conffiles): |
@@ -709,7 +717,7 @@ python write_specfile () { | |||
709 | srchomepage = d.getVar('HOMEPAGE', True) | 717 | srchomepage = d.getVar('HOMEPAGE', True) |
710 | srcdescription = d.getVar('DESCRIPTION', True) or "." | 718 | srcdescription = d.getVar('DESCRIPTION', True) or "." |
711 | 719 | ||
712 | srcdepends = strip_multilib(d.getVar('DEPENDS', True), d) | 720 | srcdepends = strip_multilib_deps(d.getVar('DEPENDS', True), d) |
713 | srcrdepends = [] | 721 | srcrdepends = [] |
714 | srcrrecommends = [] | 722 | srcrrecommends = [] |
715 | srcrsuggests = [] | 723 | srcrsuggests = [] |
@@ -772,12 +780,12 @@ python write_specfile () { | |||
772 | # Map the dependencies into their final form | 780 | # Map the dependencies into their final form |
773 | mapping_rename_hook(localdata) | 781 | mapping_rename_hook(localdata) |
774 | 782 | ||
775 | splitrdepends = strip_multilib(localdata.getVar('RDEPENDS', True), d) or "" | 783 | splitrdepends = strip_multilib_deps(localdata.getVar('RDEPENDS', True), d) |
776 | splitrrecommends = strip_multilib(localdata.getVar('RRECOMMENDS', True), d) or "" | 784 | splitrrecommends = strip_multilib_deps(localdata.getVar('RRECOMMENDS', True), d) |
777 | splitrsuggests = strip_multilib(localdata.getVar('RSUGGESTS', True), d) or "" | 785 | splitrsuggests = strip_multilib_deps(localdata.getVar('RSUGGESTS', True), d) |
778 | splitrprovides = strip_multilib(localdata.getVar('RPROVIDES', True), d) or "" | 786 | splitrprovides = strip_multilib_deps(localdata.getVar('RPROVIDES', True), d) |
779 | splitrreplaces = strip_multilib(localdata.getVar('RREPLACES', True), d) or "" | 787 | splitrreplaces = strip_multilib_deps(localdata.getVar('RREPLACES', True), d) |
780 | splitrconflicts = strip_multilib(localdata.getVar('RCONFLICTS', True), d) or "" | 788 | splitrconflicts = strip_multilib_deps(localdata.getVar('RCONFLICTS', True), d) |
781 | splitrobsoletes = [] | 789 | splitrobsoletes = [] |
782 | 790 | ||
783 | # Gather special src/first package data | 791 | # Gather special src/first package data |
@@ -826,16 +834,16 @@ python write_specfile () { | |||
826 | spec_preamble_bottom.append('Group: %s' % splitsection) | 834 | spec_preamble_bottom.append('Group: %s' % splitsection) |
827 | 835 | ||
828 | # Replaces == Obsoletes && Provides | 836 | # Replaces == Obsoletes && Provides |
829 | if splitrreplaces and splitrreplaces.strip() != "": | 837 | robsoletes = bb.utils.explode_dep_versions2(splitrobsoletes or "") |
830 | for dep in splitrreplaces.split(','): | 838 | rprovides = bb.utils.explode_dep_versions2(splitrprovides or "") |
831 | if splitrprovides: | 839 | rreplaces = bb.utils.explode_dep_versions2(splitrreplaces or "") |
832 | splitrprovides = splitrprovides + ", " + dep | 840 | for dep in rreplaces: |
833 | else: | 841 | if not dep in robsoletes: |
834 | splitrprovides = dep | 842 | robsoletes[dep] = rreplaces[dep] |
835 | if splitrobsoletes: | 843 | if not dep in rprovides: |
836 | splitrobsoletes = splitrobsoletes + ", " + dep | 844 | rprovides[dep] = rreplaces[dep] |
837 | else: | 845 | splitrobsoletes = bb.utils.join_deps(robsoletes, commasep=False) |
838 | splitrobsoletes = dep | 846 | splitrprovides = bb.utils.join_deps(rprovides, commasep=False) |
839 | 847 | ||
840 | print_deps(splitrdepends, "Requires", spec_preamble_bottom, d) | 848 | print_deps(splitrdepends, "Requires", spec_preamble_bottom, d) |
841 | # Suggests in RPM are like recommends in OE-core! | 849 | # Suggests in RPM are like recommends in OE-core! |
@@ -847,7 +855,7 @@ python write_specfile () { | |||
847 | 855 | ||
848 | # conflicts can not be in a provide! We will need to filter it. | 856 | # conflicts can not be in a provide! We will need to filter it. |
849 | if splitrconflicts: | 857 | if splitrconflicts: |
850 | depends_dict = bb.utils.explode_dep_versions(splitrconflicts) | 858 | depends_dict = bb.utils.explode_dep_versions2(splitrconflicts) |
851 | newdeps_dict = {} | 859 | newdeps_dict = {} |
852 | for dep in depends_dict: | 860 | for dep in depends_dict: |
853 | if dep not in splitrprovides: | 861 | if dep not in splitrprovides: |
@@ -918,16 +926,16 @@ python write_specfile () { | |||
918 | tail_source(d) | 926 | tail_source(d) |
919 | 927 | ||
920 | # Replaces == Obsoletes && Provides | 928 | # Replaces == Obsoletes && Provides |
921 | if srcrreplaces and srcrreplaces.strip() != "": | 929 | robsoletes = bb.utils.explode_dep_versions2(srcrobsoletes or "") |
922 | for dep in srcrreplaces.split(','): | 930 | rprovides = bb.utils.explode_dep_versions2(srcrprovides or "") |
923 | if srcrprovides: | 931 | rreplaces = bb.utils.explode_dep_versions2(srcrreplaces or "") |
924 | srcrprovides = srcrprovides + ", " + dep | 932 | for dep in rreplaces: |
925 | else: | 933 | if not dep in robsoletes: |
926 | srcrprovides = dep | 934 | robsoletes[dep] = rreplaces[dep] |
927 | if srcrobsoletes: | 935 | if not dep in rprovides: |
928 | srcrobsoletes = srcrobsoletes + ", " + dep | 936 | rprovides[dep] = rreplaces[dep] |
929 | else: | 937 | srcrobsoletes = bb.utils.join_deps(robsoletes, commasep=False) |
930 | srcrobsoletes = dep | 938 | srcrprovides = bb.utils.join_deps(rprovides, commasep=False) |
931 | 939 | ||
932 | print_deps(srcdepends, "BuildRequires", spec_preamble_top, d) | 940 | print_deps(srcdepends, "BuildRequires", spec_preamble_top, d) |
933 | print_deps(srcrdepends, "Requires", spec_preamble_top, d) | 941 | print_deps(srcrdepends, "Requires", spec_preamble_top, d) |
@@ -940,7 +948,7 @@ python write_specfile () { | |||
940 | 948 | ||
941 | # conflicts can not be in a provide! We will need to filter it. | 949 | # conflicts can not be in a provide! We will need to filter it. |
942 | if srcrconflicts: | 950 | if srcrconflicts: |
943 | depends_dict = bb.utils.explode_dep_versions(srcrconflicts) | 951 | depends_dict = bb.utils.explode_dep_versions2(srcrconflicts) |
944 | newdeps_dict = {} | 952 | newdeps_dict = {} |
945 | for dep in depends_dict: | 953 | for dep in depends_dict: |
946 | if dep not in srcrprovides: | 954 | if dep not in srcrprovides: |