mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00

Add a script that creates a virtualenv and does the following: 1) Tests pip install -r requirements.txt 2) Runs pip freeze and diffs the output to requirements.txt (to check if any dependencies have been missed when it was last updated) 3) Runs pip list --outdated and writes the output to a file so you can see which packages might need updating (of course some may not be able to be updated easily e.g. if an API change has been made) 4) Installs safety and runs "safety check" to check if there are any known vulnerabilities Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
40 lines
909 B
Bash
40 lines
909 B
Bash
#!/bin/sh
|
|
|
|
# Script to be used on a regular basis to prevent requirements.txt
|
|
# from going stale
|
|
#
|
|
# Copyright (C) 2018 Intel Corporation
|
|
#
|
|
# Licensed under the MIT license, see COPYING.MIT for details
|
|
|
|
if [ ! -f requirements.txt ] ; then
|
|
echo "No requirements.txt file, please run this in the right directory"
|
|
exit 1
|
|
fi
|
|
|
|
set -e
|
|
|
|
tmpdir=`mktemp -d`
|
|
virtualenv -p python3 $tmpdir
|
|
. $tmpdir/bin/activate
|
|
pip install -r requirements.txt
|
|
newreqs="requirements.txt.updated"
|
|
echo "Creating $newreqs"
|
|
pip freeze > $newreqs
|
|
newreqsdiff="requirements.txt.diff"
|
|
echo "Creating $newreqsdiff"
|
|
diff -udN requirements.txt $newreqs > $newreqsdiff || true
|
|
outdated="outdated.txt"
|
|
echo "Creating $outdated"
|
|
pip list --outdated > $outdated
|
|
pip install pipdeptree
|
|
deptree="deptree.txt"
|
|
echo "Creating $deptree"
|
|
pipdeptree > $deptree
|
|
pip install safety
|
|
echo "Running safety check"
|
|
safety check
|
|
deactivate
|
|
rm -rf $tmpdir
|
|
|