From 2bb48366937bf0d5191be954ea21c671c3722d04 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 18 Dec 2013 18:08:34 -0300 Subject: Avoids permanent break of resolv.conf. The resolv.conf file gets updated by resolvconf, maintaining it as a symlink allows the system to reset it during boot time. That is useful when the app has a hard crash that gives no chance to roll back our changes. [Closes #4633] --- pkg/linux/resolv-update | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkg') diff --git a/pkg/linux/resolv-update b/pkg/linux/resolv-update index 601d3bd2..c308b788 100755 --- a/pkg/linux/resolv-update +++ b/pkg/linux/resolv-update @@ -70,7 +70,7 @@ SETVAR R="${R}nameserver $NS " done - mv /etc/resolv.conf /etc/resolv.conf.bak + cp /etc/resolv.conf /etc/resolv.conf.bak echo "$comment $custom_head $R @@ -79,8 +79,8 @@ $custom_tail" > /etc/resolv.conf function down() { if [ -f /etc/resolv.conf.bak ] ; then - unlink /etc/resolv.conf - mv /etc/resolv.conf.bak /etc/resolv.conf + cat /etc/resolv.conf.bak > /etc/resolv.conf + rm /etc/resolv.conf.bak fi } -- cgit v1.2.3 From 40fc60e69841a2f9d0a4ba0f02a54ee06a60b56f Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 13 Jan 2014 12:16:34 -0300 Subject: Install all dependencies unzipped. Otherwise scrypt gets installed as an egg resulting in an error trying to import it. [Closes #4948] --- pkg/scripts/bootstrap_develop.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/scripts/bootstrap_develop.sh b/pkg/scripts/bootstrap_develop.sh index 07063a81..225bc303 100755 --- a/pkg/scripts/bootstrap_develop.sh +++ b/pkg/scripts/bootstrap_develop.sh @@ -115,7 +115,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 -- cgit v1.2.3 From bcfdeb7aea4cb263a47502abd04f47ab59210b1c Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 14 Jan 2014 14:14:45 -0800 Subject: bootstrap script -- make run passthrough args work, allow init to be re-run. --- pkg/scripts/bootstrap_develop.sh | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'pkg') diff --git a/pkg/scripts/bootstrap_develop.sh b/pkg/scripts/bootstrap_develop.sh index 225bc303..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 . ###################################################################### 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}" } @@ -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 -- cgit v1.2.3 From 06c8d6f98768f173854585e3c9b36c4fa6bfe753 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 5 Mar 2014 15:28:08 -0400 Subject: script to graph cpu/mem usage. Related: #5259 Use as: RESOURCE_TIME=5 make resource_graph where RESOURCE_TIME are the minutes to run for. --- pkg/scripts/monitor_resource.zsh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 pkg/scripts/monitor_resource.zsh (limited to 'pkg') 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 " >&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" -- cgit v1.2.3 From 2f46572ef137bb20c04f443a36361569b4b9e120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Fri, 7 Mar 2014 18:02:58 -0300 Subject: Remove qtreactor dependency --- pkg/requirements.pip | 1 - 1 file changed, 1 deletion(-) (limited to 'pkg') diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 04cd33de..c8f6b101 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -13,7 +13,6 @@ python-dateutil psutil ipaddr twisted -qt4reactor python-daemon # this should not be needed for Windows. keyring zope.proxy -- cgit v1.2.3 From 23d77edd4c748e9758b48b5297f8b3c899c5c156 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Mon, 17 Mar 2014 14:27:29 -0300 Subject: Pin psutil version to avoid conflicts with gnupg. gnupg 1.2.5 requires psutil==1.2.1 --- pkg/requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/requirements.pip b/pkg/requirements.pip index c8f6b101..850ccf44 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -10,7 +10,7 @@ requests>=1.1.0 srp>=1.0.2 pyopenssl python-dateutil -psutil +psutil==1.2.1 ipaddr twisted python-daemon # this should not be needed for Windows. -- cgit v1.2.3 From 114857f4d31697ee58e0b1417013412fd6132efa Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 21 Mar 2014 17:23:45 -0300 Subject: Add script to quickly verify some code rules. --- pkg/scripts/check_code.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 pkg/scripts/check_code.sh (limited to 'pkg') 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.' -- cgit v1.2.3 From 63d2c8e247fadcb9c7f8f0e8a189c6dc490e7442 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 4 Apr 2014 10:12:05 -0300 Subject: Add script to sum changes status. --- pkg/scripts/stats.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 pkg/scripts/stats.sh (limited to 'pkg') 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" -- cgit v1.2.3 From b40cc1c561f1f9375295ac31f857446e056cba07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Fri, 4 Apr 2014 16:50:49 -0300 Subject: Update requirements --- pkg/requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/requirements.pip b/pkg/requirements.pip index 850ccf44..be4ea858 100644 --- a/pkg/requirements.pip +++ b/pkg/requirements.pip @@ -20,7 +20,7 @@ zope.proxy leap.common>=0.3.4 leap.soledad.client>=0.4.2 leap.keymanager>=0.3.6 -leap.mail>=0.3.7 +leap.mail>=0.3.9 # Remove this when u1db fixes its dependency on oauth oauth -- cgit v1.2.3