package.bbclass: Make package output files more deterministic

Submitted by Jacob Kroon on Jan. 10, 2019, 10:45 p.m. | Patch ID: 157733

Details

Message ID 20190110224516.11775-1-jacob.kroon@gmail.com
State Accepted
Commit c99cb0bbb78089d1d15c4c8563a71db0df1cb0da
Headers show

Commit Message

Jacob Kroon Jan. 10, 2019, 10:45 p.m.
Observing depsig.do_package for packages inbetween rebuilds indicated
that the following variables/files content was changing order randomly.
Make them deterministic by sorting the output:

 RDEPENDS_<pkg>
 RRECOMMENDS_<pkg>
 FILERDEPENDSFLIST_<pkg>

 packages-split/<pkg>.shlibdeps

The following variable was not observed to change, but it is
assumed that the same situation can occur, so do the same
sorting for consistency:

 FILERPROVIDESFLIST_<pkg>

Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
---
 meta/classes/package.bbclass | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 322c4ec77f..9585835279 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1561,12 +1561,12 @@  python package_do_filedeps() {
         if pkg not in requires_files:
             requires_files[pkg] = []
 
-        for file in provides:
+        for file in sorted(provides):
             provides_files[pkg].append(file)
             key = "FILERPROVIDES_" + file + "_" + pkg
             d.appendVar(key, " " + " ".join(provides[file]))
 
-        for file in requires:
+        for file in sorted(requires):
             requires_files[pkg].append(file)
             key = "FILERDEPENDS_" + file + "_" + pkg
             d.appendVar(key, " " + " ".join(requires[file]))
@@ -1867,7 +1867,7 @@  python package_do_shlibs() {
             os.remove(deps_file)
         if len(deps):
             fd = open(deps_file, 'w')
-            for dep in deps:
+            for dep in sorted(deps):
                 fd.write(dep + '\n')
             fd.close()
 }
@@ -1988,7 +1988,7 @@  python read_shlibdeps () {
     packages = d.getVar('PACKAGES').split()
     for pkg in packages:
         rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg) or "")
-        for dep in pkglibdeps[pkg]:
+        for dep in sorted(pkglibdeps[pkg]):
             # Add the dep if it's not already there, or if no comparison is set
             if dep not in rdepends:
                 rdepends[dep] = []
@@ -2021,7 +2021,7 @@  python package_depchains() {
         #bb.note('depends for %s is %s' % (base, depends))
         rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS_' + pkg) or "")
 
-        for depend in depends:
+        for depend in sorted(depends):
             if depend.find('-native') != -1 or depend.find('-cross') != -1 or depend.startswith('virtual/'):
                 #bb.note("Skipping %s" % depend)
                 continue
@@ -2042,7 +2042,7 @@  python package_depchains() {
         #bb.note('rdepends for %s is %s' % (base, rdepends))
         rreclist = bb.utils.explode_dep_versions2(d.getVar('RRECOMMENDS_' + pkg) or "")
 
-        for depend in rdepends:
+        for depend in sorted(rdepends):
             if depend.find('virtual-locale-') != -1:
                 #bb.note("Skipping %s" % depend)
                 continue