mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
check_requirements.sh: improve output for cron usage
For running this script in a cron job we want to see just the interesting output since that will be sent as an email, so make the following changes: * Silence the normal output of virtualenv and pip * Add a -q option for the script to silence progress messages Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
736c1104ae
commit
58e501afc9
|
@ -14,27 +14,49 @@ fi
|
|||
|
||||
set -e
|
||||
|
||||
if [ "$1" = "-q" ] ; then
|
||||
quiet="1"
|
||||
elif [ "$1" = "" ] ; then
|
||||
quiet="0"
|
||||
else
|
||||
echo "Invalid option: $1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
vecho()
|
||||
{
|
||||
if [ "$quiet" = "0" ] ; then
|
||||
echo "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
tmpdir=`mktemp -d`
|
||||
virtualenv -p python3 $tmpdir
|
||||
vecho "Setting up virtual environment"
|
||||
virtualenv -q -p python3 $tmpdir
|
||||
. $tmpdir/bin/activate
|
||||
pip install -r requirements.txt
|
||||
pip install -q -r requirements.txt
|
||||
newreqs="requirements.txt.updated"
|
||||
echo "Creating $newreqs"
|
||||
vecho "Creating $newreqs"
|
||||
pip freeze > $newreqs
|
||||
newreqsdiff="requirements.txt.diff"
|
||||
echo "Creating $newreqsdiff"
|
||||
vecho "Creating $newreqsdiff"
|
||||
diff -udN requirements.txt $newreqs > $newreqsdiff || true
|
||||
outdated="outdated.txt"
|
||||
echo "Creating $outdated"
|
||||
vecho "Creating $outdated"
|
||||
pip list --outdated > $outdated
|
||||
pip install pipdeptree
|
||||
pip install -q pipdeptree
|
||||
deptree="deptree.txt"
|
||||
echo "Creating $deptree"
|
||||
vecho "Creating $deptree"
|
||||
pipdeptree > $deptree
|
||||
pip install safety
|
||||
pip install -q safety
|
||||
safety="safety_check.txt"
|
||||
echo "Running safety check (output also to $safety)"
|
||||
vecho "Running safety check (output also to $safety)"
|
||||
safety check | tee $safety
|
||||
echo
|
||||
echo "Outdated components:"
|
||||
echo
|
||||
cat $outdated
|
||||
deactivate
|
||||
rm -rf $tmpdir
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user