tools/perf: pmu-events: Fix reproducibility
Forwarded: https://lore.kernel.org/lkml/
20190825131329.naqzd5kwg7mw5d3f@decadent.org.uk/T/#u
jevents.c uses nftw() to enumerate files and outputs the corresponding
C structs in the order they are found. This makes it sensitive to
directory ordering, so that the perf executable is not reproducible.
To avoid this, store all the files and directories found and then sort
them by their (relative) path. (This maintains the parent-first
ordering that nftw() promises.) Then apply the existing callbacks to
them in the sorted order.
Don't both storing the stat buffers as we don't need them.
References: https://tests.reproducible-builds.org/debian/dbdtxt/bullseye/i386/linux_4.19.37-6.diffoscope.txt.gz
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name tools-perf-pmu-events-fix-reproducibility.patch