scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate
PATCH 1/1 scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate
* 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
--- scripts/sstate-sysroot-cruft.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.sh
scripts/sstate-sysroot-cruft.sh new file +27 -0
@@ -0,0 +1,27 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked by sstate manifest +# Update BASE + +BASE="/OE/oe-core" + +OUTPUT=${BASE}/sysroot.cruft.`date "+%s"` +WHITELIST="\/var\/pseudo\/*[^\/]*$ \/shlibs$ \.pyc$" + +mkdir ${OUTPUT} +find ${BASE}/tmp-eglibc/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 -u > ${OUTPUT}/sstate-control.master.list # -u because some directories are listed for more recipes +find ${BASE}/tmp-eglibc/sysroots/ | \ + sort > ${OUTPUT}/sstate-control.sysroot.list + +diff ${OUTPUT}/sstate-control.master.list ${OUTPUT}/sstate-control.sysroot.list > ${OUTPUT}/sstate-control.diff.all + +cp ${OUTPUT}/sstate-control.diff.all ${OUTPUT}/sstate-control.diff +for item in ${WHITELIST}; do + sed -i "/${item}/d" ${OUTPUT}/sstate-control.diff; +done + +echo "Following files are installed in sysroot, but not tracked by sstate" +cat ${OUTPUT}/sstate-control.diff
Signature · 1 line
1.7.12.4
PATCH v2 1/1 scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate
* 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
---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
added duplicates but not shown
scripts/sstate-sysroot-cruft.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.sh
scripts/sstate-sysroot-cruft.sh new file +34 -0
@@ -0,0 +1,34 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked by sstate manifest +# Update BASE + +BASE="/OE/oe-core" +TMPDIR="${BASE}/tmp-eglibc" + +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; +done + +# 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
Signature · 1 line
1.7.12.4
PATCH v3 1/1 scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate
* 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
---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
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
scripts/sstate-sysroot-cruft.sh new file +34 -0
@@ -0,0 +1,34 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked by sstate manifest +# Update BASE + +BASE="/OE/oe-core" +TMPDIR="${BASE}/tmp-eglibc" + +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; +done + +# 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
Signature · 1 line
1.7.12.4
PATCH v4 1/1 scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate
* it's not very universal, but works with default oe-core setup and shows basic HOW-TO. It can be improved later.
---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
added duplicates but not shown
V3: use also populate-sysroot.MACHINE, manifest name for populate-sysroot
was changed in febeaf3d1b8917b660c7279b008d8b03337568e9
V4: dropped eglibc-initial work around, it was fixed in oe-core
scripts/sstate-sysroot-cruft.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.sh
scripts/sstate-sysroot-cruft.sh new file +34 -0
@@ -0,0 +1,34 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked by sstate manifest +# Update BASE + +BASE="/OE/oe-core" +TMPDIR="${BASE}/tmp-eglibc" + +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#/$##g; s#///*#/#g' | \ + # work around for 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; +done + +# 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
Signature · 1 line
1.8.0
Quoted 31 lines · Martin Jansa
* it's not very universal, but works with default oe-core setup and shows basic HOW-TO. It can be improved later.
Signed-off-by Martin Jansa <[email protected]>---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
added duplicates but not shownV3: use also populate-sysroot.MACHINE, manifest name for populate-sysroot
was changed in febeaf3d1b8917b660c7279b008d8b03337568e9V4: dropped eglibc-initial work around, it was fixed in oe-core
scripts/sstate-sysroot-cruft.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.shscripts/sstate-sysroot-cruft.sh new file +3
-0@@ -0,0 +1,34 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked by sstatemanifest
scripts/sstate-sysroot-cruft.sh line 6
Quoted 3 lines
scripts/sstate-sysroot-cruft.sh new file +3
-0+# Update BASE + +BASE="/OE/oe-core"
This seems interesting, but I have a few comments/concerns.
1) don't hardcode BASE, figure out the path relative to the script's location, e.g. BASE="$(cd $(dirname $(dirname $0)) && pwd)"
2) output files shouldn't go into oe-core directly, as oe-core isn't guaranteed to be writable, and it's more common to expect output from a script like this to go relative to the current directory, or a temp directory
3) extract TMPDIR from bitbake -e, rather than hardcoding that, as that breaks for any distros or users which separate their tmpdirs by distro, or set TCLIBCAPPEND = ""
Signature · 1 line
Christopher Larson
Quoted 39 lines · Chris Larson
Quoted 31 lines · Martin Jansa
* it's not very universal, but works with default oe-core setup and shows basic HOW-TO. It can be improved later.
Signed-off-by Martin Jansa <[email protected]>---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
added duplicates but not shownV3: use also populate-sysroot.MACHINE, manifest name for populate-sysroot
was changed in febeaf3d1b8917b660c7279b008d8b03337568e9V4: dropped eglibc-initial work around, it was fixed in oe-core
scripts/sstate-sysroot-cruft.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.shscripts/sstate-sysroot-cruft.sh new file +3
-0@@ -0,0 +1,34 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked by sstatemanifest
scripts/sstate-sysroot-cruft.sh line 6
Quoted 3 lines
scripts/sstate-sysroot-cruft.sh new file +3
-0+# Update BASE + +BASE="/OE/oe-core"This seems interesting, but I have a few comments/concerns.
Quoted 9 lines
1) don't hardcode BASE, figure out the path relative to the script's location, e.g. BASE="$(cd $(dirname $(dirname $0)) && pwd)"
2) output files shouldn't go into oe-core directly, as oe-core isn't guaranteed to be writable, and it's more common to expect output from a script like this to go relative to the current directory, or a temp directory
3) extract TMPDIR from bitbake -e, rather than hardcoding that, as that breaks for any distros or users which separate their tmpdirs by distro, or set TCLIBCAPPEND = ""
Ah in this case BASE is not directory with oe-core layer but one above.
I didn't want to use bitbake -e, so that this script can be executed when some other bitbake process is running.
As said it's not really universal (I wrote it just to confirm something and then shared it to find if someone else finds it also usefull to improve it).
What about moving output to TMPDIR and setting TMPDIR by parameter?
Cheers,
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Quoted 52 lines · Martin Jansa
Quoted 6 lines · Chris Larson
Quoted 3 lines · On Thu, Nov 15, 2012 at 12:30 AM, Martin Jansa <[email protected] wrote:
* it's not very universal, but works with default oe-core setup and shows basic HOW-TO. It can be improved later.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Martin Jansa <[email protected]>---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
added duplicates but not shownV3: use also populate-sysroot.MACHINE, manifest name for
populate-sysroot
Quoted 5 lines
Quoted 5 lines
was changed in febeaf3d1b8917b660c7279b008d8b03337568e9V4: dropped eglibc-initial work around, it was fixed in oe-core
scripts/sstate-sysroot-cruft.sh | 34++++++++++++++++++++++++++++++++++
Quoted 13 lines
scripts/sstate-sysroot-cruft.sh line 3
Quoted 13 lines
1 file changed, 34 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.shscripts/sstate-sysroot-cruft.sh new file +3
-0@@ -0,0 +1,34 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked bysstate
Quoted 8 lines
scripts/sstate-sysroot-cruft.sh line 6
Quoted 5 lines
manifest
scripts/sstate-sysroot-cruft.sh new file +3
-0+# Update BASE + +BASE="/OE/oe-core"This seems interesting, but I have a few comments/concerns.
Quoted 8 lines
1) don't hardcode BASE, figure out the path relative to the script's location, e.g. BASE="$(cd $(dirname $(dirname $0)) && pwd)"
2) output files shouldn't go into oe-core directly, as oe-core isn't guaranteed to be writable, and it's more common to expect output from a script like this to go relative to the current directory, or a temp directory
3) extract TMPDIR from bitbake -e, rather than hardcoding that, as that breaks for any distros or users which separate their tmpdirs by distro,
Quoted 5 lines
or
Quoted 1 line
set TCLIBCAPPEND = ""
Ah in this case BASE is not directory with oe-core layer but one above.
Still trivial to determine relative to the script's location. Adding an extra call to dirname, or an extra '/..' isn't particularly tough.
I didn't want to use bitbake -e, so that this script can be executed
Quoted 2 lines
when some other bitbake process is running.
I don't see having to hardcode assumptions about the environment as a net win, personally. At least make them arguments, or add an argument to optionally use bitbake -e, or let it take vars from the environment.
As said it's not really universal (I wrote it just to confirm something
Quoted 3 lines
and then shared it to find if someone else finds it also usefull to improve it).
If it can't be used in a wide variety of circumstances, I'd argue against its inclusion in oe-core until such time that it's ready. The subject of this thread didn't include "RFC' ;)
Signature · 1 line
Christopher Larson
Quoted 54 lines · Chris Larson
Quoted 52 lines · Martin Jansa
Quoted 6 lines · Chris Larson
Quoted 3 lines · On Thu, Nov 15, 2012 at 12:30 AM, Martin Jansa <[email protected] wrote:
* it's not very universal, but works with default oe-core setup and shows basic HOW-TO. It can be improved later.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Martin Jansa <[email protected]>---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
added duplicates but not shownV3: use also populate-sysroot.MACHINE, manifest name for
populate-sysroot
Quoted 5 lines
Quoted 5 lines
was changed in febeaf3d1b8917b660c7279b008d8b03337568e9V4: dropped eglibc-initial work around, it was fixed in oe-core
scripts/sstate-sysroot-cruft.sh | 34++++++++++++++++++++++++++++++++++
Quoted 13 lines
scripts/sstate-sysroot-cruft.sh line 3
Quoted 13 lines
1 file changed, 34 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.shscripts/sstate-sysroot-cruft.sh new file +3
-0@@ -0,0 +1,34 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked bysstate
Quoted 16 lines
scripts/sstate-sysroot-cruft.sh line 6
Quoted 5 lines
manifest
scripts/sstate-sysroot-cruft.sh new file +3
-0+# Update BASE + +BASE="/OE/oe-core"This seems interesting, but I have a few comments/concerns.
1) don't hardcode BASE, figure out the path relative to the script's location, e.g. BASE="$(cd $(dirname $(dirname $0)) && pwd)"
2) output files shouldn't go into oe-core directly, as oe-core isn't guaranteed to be writable, and it's more common to expect output from a script like this to go relative to the current directory, or a temp directory
3) extract TMPDIR from bitbake -e, rather than hardcoding that, as that breaks for any distros or users which separate their tmpdirs by distro,
Quoted 8 lines
Quoted 5 lines
or
Quoted 1 line
set TCLIBCAPPEND = ""
Ah in this case BASE is not directory with oe-core layer but one above.
Still trivial to determine relative to the script's location. Adding an extra call to dirname, or an extra '/..' isn't particularly tough.
Yes, but making another assumption that TMPDIR is on same level as oe-core checkout it.
Quoted 7 lines
I didn't want to use bitbake -e, so that this script can be executed
Quoted 2 lines
when some other bitbake process is running.
I don't see having to hardcode assumptions about the environment as a net win, personally. At least make them arguments, or add an argument to optionally use bitbake -e, or let it take vars from the environment.
v5 is using argument or env variable (like sstate-cache-management.sh)
Quoted 8 lines
As said it's not really universal (I wrote it just to confirm something
Quoted 3 lines
and then shared it to find if someone else finds it also usefull to improve it).
If it can't be used in a wide variety of circumstances, I'd argue against its inclusion in oe-core until such time that it's ready. The subject of this thread didn't include "RFC' ;)
I was using it in wide variety of circumstances just by updating 1 variable in script, but I agree that argument + shell history can make it easier.
Cheers,
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
Quoted 2 lines · On Thursday 15 November 2012 17:19:07 Martin Jansa wrote:
I didn't want to use bitbake -e, so that this script can be executed when some other bitbake process is running.
You really should not be trying to touch anything under TMPDIR let alone sstate files while bitbake is actually running against that same directory. I'm not sure why you would want to though...
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Quoted 7 lines · Paul Eggleton
Quoted 2 lines · On Thursday 15 November 2012 17:19:07 Martin Jansa wrote:
I didn't want to use bitbake -e, so that this script can be executed when some other bitbake process is running.
You really should not be trying to touch anything under TMPDIR let alone sstate files while bitbake is actually running against that same directory. I'm not sure why you would want to though...
While running builds for 8 MACHINEs in for loop I find it usefull to test one sysroot (from 1st MACHINE already built) while keeping build for remaining machines running for rest of night and sometimes following days..
At least that was my use-case when I wrote this script..
Yes I could have execute build only for 1st machine, wait till it's finished, then run script wait till it's finished and then start for loop for remainig 7, but that does not allow me to fall asleep while it's still building 1st :) or I have to plan it in advance and build with much longer one-liner.
Cheers,
Signature · 1 line
Martin 'JaMa' Jansa jabber: [email protected]
PATCH v5 1/1 scripts/sstate-sysroot-cruft.sh: add simple script to find files in sysroots not tracked by sstate
In reply to Martin Jansa---
V2: added .pyo to WHITELIST
shorter filenames
TMPDIR
added duplicates but not shown
V3: use also populate-sysroot.MACHINE, manifest name for populate-sysroot
was changed in febeaf3d1b8917b660c7279b008d8b03337568e9
V4: dropped eglibc-initial work around, it was fixed in oe-core
V5: set tmpdir from param or env variable and show usage
scripts/sstate-sysroot-cruft.sh | 78 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 scripts/sstate-sysroot-cruft.sh
scripts/sstate-sysroot-cruft.sh new file +78 -0
@@ -0,0 +1,78 @@ +#!/bin/sh + +# Used to find files installed in sysroot which are not tracked by sstate manifest + +# Global vars +tmpdir= + +usage () { + cat << EOF +Welcome to sysroot cruft finding utility. +$0 <OPTION> + +Options: + -h, --help + Display this help and exit. + + --tmpdir=<tmpdir> + Specify tmpdir, will use the environment variable TMPDIR if it is not specified. + Something like /OE/oe-core/tmp-eglibc (no / at the end). +EOF +} + +# Print error information and exit. +echo_error () { + echo "ERROR: $1" >&2 + exit 1 +} + +while [ -n "$1" ]; do + case $1 in + --tmpdir=*) + tmpdir=`echo $1 | sed -e 's#^--tmpdir=##' | xargs readlink -e` + [ -d "$tmpdir" ] || echo_error "Invalid argument to --tmpdir" + shift + ;; + --help|-h) + usage + exit 0 + ;; + *) + echo "Invalid arguments $*" + echo_error "Try '$0 -h' for more information." + ;; + esac +done + +# sstate cache directory, use environment variable TMPDIR +# if it was not specified, otherwise, error. +[ -n "$tmpdir" ] || tmpdir=$TMPDIR +[ -n "$tmpdir" ] || echo_error "No tmpdir found!" +[ -d "$tmpdir" ] || echo_error "Invalid tmpdir \"$tmpdir\"" + +OUTPUT=${tmpdir}/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#/$##g; s#///*#/#g' | \ + # work around for 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; +done + +# 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
Signature · 1 line
1.8.0