diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-04-04 16:58:18 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2014-04-04 16:58:18 -0300 |
commit | 81715dc47d77934c4f67d2527a56c28f58f0345d (patch) | |
tree | 6e66940af735e089803c5ce05ad1ce1df16c9d1e /pkg/scripts | |
parent | 496036f15cf257d16b6594770812da64a249280c (diff) | |
parent | eb4cdab9c6b8ff66bb4667cc6195d2c366122540 (diff) |
Merge branch 'release-0.5.0'
Diffstat (limited to 'pkg/scripts')
-rwxr-xr-x | pkg/scripts/bootstrap_develop.sh | 27 | ||||
-rwxr-xr-x | pkg/scripts/check_code.sh | 33 | ||||
-rwxr-xr-x | pkg/scripts/monitor_resource.zsh | 26 | ||||
-rwxr-xr-x | pkg/scripts/stats.sh | 34 |
4 files changed, 106 insertions, 14 deletions
diff --git a/pkg/scripts/bootstrap_develop.sh b/pkg/scripts/bootstrap_develop.sh index 07063a81..7027a908 100755 --- a/pkg/scripts/bootstrap_develop.sh +++ b/pkg/scripts/bootstrap_develop.sh @@ -17,6 +17,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. ###################################################################### set -e # Exit immediately if a command exits with a non-zero status. + REPOSITORIES="bitmask_client leap_pycommon soledad keymanager leap_mail" PACKAGES="leap_pycommon keymanager soledad/common soledad/client soledad/server leap_mail bitmask_client" REPOS_ROOT=`pwd` # Root path for all the needed repositories @@ -40,20 +41,16 @@ clone_repos() { if [[ "$1" == "ro" ]]; then # read-only remotes: - git clone https://leap.se/git/bitmask_client - git clone https://leap.se/git/leap_pycommon - git clone https://leap.se/git/soledad - git clone https://leap.se/git/keymanager - git clone https://leap.se/git/leap_mail + src="https://leap.se/git" else # read-write remotes: - git clone ssh://gitolite@leap.se/bitmask_client - git clone ssh://gitolite@leap.se/leap_pycommon - git clone ssh://gitolite@leap.se/soledad - git clone ssh://gitolite@leap.se/keymanager - git clone ssh://gitolite@leap.se/leap_mail + src="ssh://gitolite@leap.se" fi + for repo in $REPOSITORIES; do + [ ! -d $repo ] && git clone $src/$repo + done + set +x echo "${cc_green}Status: $status done!${cc_normal}" } @@ -115,7 +112,7 @@ setup_develop() { # do a setup develop in every package for package in $PACKAGES; do cd $REPOS_ROOT/$package - python setup.py develop + python setup.py develop --always-unzip done # hack to solve gnupg version problem @@ -163,10 +160,12 @@ update() { } run() { + shift # remove 'run' from arg list + passthrough_args=$@ echo "${cc_green}Status: running client...${cc_normal}" source bitmask.venv/bin/activate set -x - python bitmask_client/src/leap/bitmask/app.py -d $* + python bitmask_client/src/leap/bitmask/app.py -d $passthrough_args set +x } @@ -175,7 +174,7 @@ help() { echo "Bootstraps the environment to start developing the bitmask client" echo "with all the needed repositories and dependencies." echo - echo "Usage: $0 {init | update | help}" + echo "Usage: $0 {init | update | run | help}" echo echo " init : Initialize repositories, create virtualenv and \`python setup.py develop\` all." echo " You can use \`init ro\` in order to use the https remotes if you don't have rw access." @@ -193,7 +192,7 @@ case "$1" in update ;; run) - run + run "$@" ;; *) help diff --git a/pkg/scripts/check_code.sh b/pkg/scripts/check_code.sh new file mode 100755 index 00000000..7bbd91f6 --- /dev/null +++ b/pkg/scripts/check_code.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Escape code +esc=`echo -en "\033"` + +# Set colors +cc_green="${esc}[0;32m" +cc_red="${esc}[0;31m" +cc_normal=`echo -en "${esc}[m\017"` + + +[[ -z "$1" ]] && WHERE='src/leap/bitmask' || WHERE=$1 + +PEP8="pep8 --ignore=E202,W602 --exclude=*_rc.py,ui_*,_version.py $WHERE" +echo "${cc_green}$PEP8${cc_normal}" +$PEP8 + +echo +FLAKE8="flake8 --ignore=E202,W602 --exclude=*_rc.py,ui_*,_version.py $WHERE" +echo "${cc_green}$FLAKE8${cc_normal}" +$FLAKE8 + +echo +echo "${cc_green}Looking for 'print's, no prints in code, use logging/twisted.log.${cc_normal}" +echo `git grep -n "print " | wc -l` 'coincidences.' + +echo +echo "${cc_green}Grepping for 'pdb' code left behind.${cc_normal}" +git grep -n "pdb" + +echo +echo "${cc_green}Grepping for 'XXX|TODO|FIXME|NOTE|HACK'.${cc_normal}" +echo `git grep -E "XXX|TODO|FIXME|NOTE|HACK" | wc -l` 'coincidences.' diff --git a/pkg/scripts/monitor_resource.zsh b/pkg/scripts/monitor_resource.zsh new file mode 100755 index 00000000..ac468e34 --- /dev/null +++ b/pkg/scripts/monitor_resource.zsh @@ -0,0 +1,26 @@ +#!/bin/zsh +if (( ! $# )); then + echo "Usage: $0:t <PID> <minutes to monitor>" >&2 + return 1; +fi + +OUT="$1-usage.data" +GRAPH="bitmask-resources.png" +MAX=150 +let "ticks=$2*60/3" +echo "cpu mem" >> $OUT +for i in {1..$ticks}; do; + cpu=$(ps -p $1 -o pcpu | grep -v %) + mem=$(ps wuh -p $1 | awk '{print $4}') + echo "$cpu $mem" >> $OUT; + sleep 3; + echo $i / $ticks; +done; + +gnuplot -e "set term dumb; \ +set key outside; set yrange [0:$MAX]; \ +plot for [col=1:2] '$OUT' using 0:col title columnheader s c" + +gnuplot -e "set term png; set output '$GRAPH'; \ +set key outside; set yrange [0:$MAX]; \ +plot for [col=1:2] '$OUT' using 0:col with lines title columnheader" diff --git a/pkg/scripts/stats.sh b/pkg/scripts/stats.sh new file mode 100755 index 00000000..2b7a8b18 --- /dev/null +++ b/pkg/scripts/stats.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +REPOSITORIES="bitmask_client leap_pycommon soledad keymanager leap_mail" + +CHANGED=0 +INSERTIONS=0 +DELETIONS=0 +MERGES_TOTAL=0 + +echo "Changes summary between closest annotated tag to HEAD" +echo "=====================================================" +echo + +for repo in $REPOSITORIES; do + cd $repo + echo "Stats for: $repo" + # the 'describe' command gives the closest annotated tag + STATS=$(git diff --shortstat `git describe --abbrev=0`..HEAD) + MERGES=$(git log --merges `git describe --abbrev=0`..HEAD | wc -l) + echo "Stats:$STATS" + echo "Merges: $MERGES" + VALUES=(`echo $STATS | awk '{ print $1, $4, $6 }'`) # use array to store values + CHANGED=$(echo $CHANGED + ${VALUES[0]} | bc) + INSERTIONS=$(echo $INSERTIONS + ${VALUES[1]} | bc) + DELETIONS=$(echo $DELETIONS + ${VALUES[2]} | bc) + MERGES_TOTAL=$(echo $MERGES_TOTAL + $MERGES | bc) + echo "----------------------------------------------------------------------" + cd .. +done + +echo +echo "TOTAL" +echo "Stats: $CHANGED files changed, $INSERTIONS insertions(+), $DELETIONS deletions(-)" +echo "Merges: $MERGES_TOTAL" |