classes/buildhistory: sort list fields in package info
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Tue, 7 Feb 2012 15:01:43 +0000 (15:01 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 8 Feb 2012 10:57:09 +0000 (10:57 +0000)
Sort DEPENDS, RDEPENDS, and RRECOMMENDS in package info files so that
any changes in order (which are not important) are smoothed out in the
change history.

Fixes [YOCTO #1961]

(From OE-Core rev: 06b740d4ca077fb4c89ee6d1065fabb02da45ec6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/buildhistory.bbclass

index 3964247..1b6b249 100644 (file)
@@ -126,6 +126,17 @@ python buildhistory_emit_pkghistory() {
        def squashspaces(string):
                return re.sub("\s+", " ", string)
 
+       def sortpkglist(string):
+               pkgiter = re.finditer(r'[a-zA-Z0-9.-]+( \([><=]+ [^ )]+\))?', string, 0)
+               pkglist = [p.group(0) for p in pkgiter]
+               pkglist.sort()
+               return ' '.join(pkglist)
+
+       def sortlist(string):
+               items = string.split(' ')
+               items.sort()
+               return ' '.join(items)
+
        pn = d.getVar('PN', True)
        pe = d.getVar('PE', True) or "0"
        pv = d.getVar('PV', True)
@@ -136,7 +147,7 @@ python buildhistory_emit_pkghistory() {
        rcpinfo.pe = pe
        rcpinfo.pv = pv
        rcpinfo.pr = pr
-       rcpinfo.depends = squashspaces(d.getVar('DEPENDS', True) or "")
+       rcpinfo.depends = sortlist(squashspaces(d.getVar('DEPENDS', True) or ""))
        rcpinfo.packages = packages
        write_recipehistory(rcpinfo, d)
        write_latestlink(None, pe, pv, pr, d)
@@ -164,8 +175,8 @@ python buildhistory_emit_pkghistory() {
                pkginfo.pe = pe
                pkginfo.pv = pv
                pkginfo.pr = pr
-               pkginfo.rdepends = squashspaces(getpkgvar(pkg, 'RDEPENDS') or "")
-               pkginfo.rrecommends = squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or "")
+               pkginfo.rdepends = sortpkglist(squashspaces(getpkgvar(pkg, 'RDEPENDS') or ""))
+               pkginfo.rrecommends = sortpkglist(squashspaces(getpkgvar(pkg, 'RRECOMMENDS') or ""))
                pkginfo.files = squashspaces(getpkgvar(pkg, 'FILES') or "")
 
                # Gather information about packaged files