From patchwork Tue Feb 7 16:25:00 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] classes/buildhistory: sort list fields in package info Date: Tue, 07 Feb 2012 16:25:00 -0000 From: Paul Eggleton X-Patchwork-Id: 20889 Message-Id: To: openembedded-core@lists.openembedded.org Sort DEPENDS, PACKAGES, 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] Signed-off-by: Paul Eggleton --- meta/classes/buildhistory.bbclass | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 3964247..26d1a91 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -126,17 +126,28 @@ python buildhistory_emit_pkghistory() { def squashspaces(string): return re.sub("\s+", " ", string) + def sortpkglist(string): + pkgiter = re.finditer(r'[a-zA-Z0-9.-]+( \([><=]+ [^ )]+\))?', pkgs, 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) pr = d.getVar('PR', True) - packages = squashspaces(d.getVar('PACKAGES', True)) + packages = sortlist(squashspaces(d.getVar('PACKAGES', True))) rcpinfo = RecipeInfo(pn) 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