[PATCHv3] scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate

Submitted by Martin Jansa on Oct. 24, 2012, 11:15 a.m.


Message ID 1351077301-7744-1-git-send-email-Martin.Jansa@gmail.com
State Superseded, archived
Headers show

Commit Message

Martin Jansa Oct. 24, 2012, 11:15 a.m.
* it's not very universal, but works with default oe-core setup and
  shows basic HOW-TO. It can be improved later.

* eglibc-initial should be fixed, but for now better to add that
  work around then to show a lot of false positives

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
 V2: added .pyo to WHITELIST                                                                                            
     shorter filenames                                                                                        
     added duplicates but not shown                                                                                                   

 V3: use also populate-sysroot.MACHINE, manifest name for populate-sysroot 
     was changed in febeaf3d1b8917b660c7279b008d8b03337568e9

 scripts/sstate-sysroot-cruft.sh | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100755 scripts/sstate-sysroot-cruft.sh

Patch hide | download patch | download mbox

diff --git a/scripts/sstate-sysroot-cruft.sh b/scripts/sstate-sysroot-cruft.sh
new file mode 100755
index 0000000..b68de42
--- /dev/null
+++ b/scripts/sstate-sysroot-cruft.sh
@@ -0,0 +1,34 @@ 
+# Used to find files installed in sysroot which are not tracked by sstate manifest
+# Update BASE
+OUTPUT=${BASE}/sysroot.cruft.`date "+%s"`
+WHITELIST="\/var\/pseudo\/*[^\/]*$ \/shlibs$ \.pyc$ \.pyo$"
+mkdir ${OUTPUT}
+find ${TMPDIR}/sstate-control -name \*.populate-sysroot\* -o -name \*.package\* | xargs cat | grep sysroots | \
+  sed 's#tcbootstrapusr#tcbootstrap/usr#g; s#/$##g; s#///*#/#g' | \
+  # work around for missing / in manifest for eglibc-initial, paths ending with / for directories and multiplied // (e.g. paths to native sysroot)
+  sort > ${OUTPUT}/master.list.all
+sort -u ${OUTPUT}/master.list.all > ${OUTPUT}/master.list # -u because some directories are listed for more recipes
+find ${TMPDIR}/sysroots/ | \
+  sort > ${OUTPUT}/sysroot.list
+diff ${OUTPUT}/master.list.all ${OUTPUT}/master.list > ${OUTPUT}/duplicates
+diff ${OUTPUT}/master.list ${OUTPUT}/sysroot.list > ${OUTPUT}/diff.all
+cp ${OUTPUT}/diff.all ${OUTPUT}/diff
+for item in ${WHITELIST}; do 
+  sed -i "/${item}/d" ${OUTPUT}/diff;
+# too many false positives for directories
+# echo "Following files are installed in sysroot at least twice"
+# cat ${OUTPUT}/duplicates
+echo "Following files are installed in sysroot, but not tracked by sstate"
+cat ${OUTPUT}/diff