From 1d7e51aad9e3cd649d0921b533669fa24cbd7ab2 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 7 Oct 2014 13:47:39 -0300 Subject: Bump version of dep on soledad.common. --- server/pkg/requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index be5d156b..28717664 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -9,7 +9,7 @@ PyOpenSSL<0.14 twisted>=12.0.0 # leap deps -- bump me! -leap.soledad.common>=0.3.0 +leap.soledad.common>=0.6.0 # # Things yet to fix: -- cgit v1.2.3 From 17682563bd30e780cf7d620624a856376d257e83 Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 26 Nov 2014 20:20:52 -0200 Subject: Enforce TLSv1 in soledad server (#6437). --- server/pkg/soledad | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/soledad b/server/pkg/soledad index 841233d1..62b7c5f8 100644 --- a/server/pkg/soledad +++ b/server/pkg/soledad @@ -19,6 +19,7 @@ CERT_PATH=/etc/leap/soledad-server.pem PRIVKEY_PATH=/etc/leap/soledad-server.key TWISTD_PATH=/usr/bin/twistd HOME=/var/lib/soledad/ +SSL_METHOD=TLSv1_METHOD [ -r /etc/default/soledad ] && . /etc/default/soledad @@ -35,7 +36,7 @@ case "$1" in --logfile=$LOGFILE \ web \ --wsgi=$OBJ \ - --port=ssl:$HTTPS_PORT:privateKey=$PRIVKEY_PATH:certKey=$CERT_PATH + --port=ssl:${HTTPS_PORT}:privateKey=${PRIVKEY_PATH}:certKey=${CERT_PATH}:sslmethod=${SSL_METHOD} echo "." ;; -- cgit v1.2.3 From 93bd3fb17670c0c8db5b50028ba2b3ce811dcf5d Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 26 Nov 2014 20:23:33 -0200 Subject: Run daemon as user soledad (#6436). --- server/pkg/soledad | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/soledad b/server/pkg/soledad index 62b7c5f8..7f48e2c8 100644 --- a/server/pkg/soledad +++ b/server/pkg/soledad @@ -20,6 +20,8 @@ PRIVKEY_PATH=/etc/leap/soledad-server.key TWISTD_PATH=/usr/bin/twistd HOME=/var/lib/soledad/ SSL_METHOD=TLSv1_METHOD +USER=soledad +GROUP=soledad [ -r /etc/default/soledad ] && . /etc/default/soledad @@ -31,7 +33,9 @@ test -r /etc/leap/ || exit 0 case "$1" in start) echo -n "Starting soledad: twistd" - start-stop-daemon --start --quiet --exec $TWISTD_PATH -- \ + start-stop-daemon --start --quiet \ + --user=$USER --group=$GROUP \ + --exec $TWISTD_PATH -- \ --pidfile=$PIDFILE \ --logfile=$LOGFILE \ web \ -- cgit v1.2.3 From 2414b23ecdb8cfc8b8a5852243c22b6fbb89536f Mon Sep 17 00:00:00 2001 From: drebs Date: Fri, 28 Nov 2014 09:39:41 -0200 Subject: Enclose server initscript variables in curly brackets. --- server/pkg/soledad | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'server/pkg') diff --git a/server/pkg/soledad b/server/pkg/soledad index 7f48e2c8..bf24dac2 100644 --- a/server/pkg/soledad +++ b/server/pkg/soledad @@ -30,16 +30,16 @@ test -r /etc/leap/ || exit 0 . /lib/lsb/init-functions -case "$1" in +case "${1}" in start) echo -n "Starting soledad: twistd" start-stop-daemon --start --quiet \ - --user=$USER --group=$GROUP \ - --exec $TWISTD_PATH -- \ - --pidfile=$PIDFILE \ - --logfile=$LOGFILE \ + --user=${USER} --group=${GROUP} \ + --exec ${TWISTD_PATH} -- \ + --pidfile=${PIDFILE} \ + --logfile=${LOGFILE} \ web \ - --wsgi=$OBJ \ + --wsgi=${OBJ} \ --port=ssl:${HTTPS_PORT}:privateKey=${PRIVKEY_PATH}:certKey=${CERT_PATH}:sslmethod=${SSL_METHOD} echo "." ;; @@ -47,21 +47,21 @@ case "$1" in stop) echo -n "Stopping soledad: twistd" start-stop-daemon --stop --quiet \ - --pidfile $PIDFILE + --pidfile ${PIDFILE} echo "." ;; restart) - $0 stop - $0 start + ${0} stop + ${0} start ;; force-reload) - $0 restart + ${0} restart ;; status) - status_of_proc -p $PIDFILE $TWISTD_PATH soledad && exit 0 || exit $? + status_of_proc -p ${PIDFILE} ${TWISTD_PATH} soledad && exit 0 || exit ${?} ;; *) -- cgit v1.2.3 From 31eeafd715f407c61d8de4e6555241a1de33fba1 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 3 Dec 2014 00:22:18 +0100 Subject: Use SSL negotiation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although the API can be misleading, PROTOCOL_SSLv23 selects the highest protocol version that both the client and server support. Despite the name, this option can select “TLS” protocols as well as “SSL”. In this way, we can use TLSv1.2 (PROTOCOL_TLSv1 will *only* give us TLS v1.0) In the client side, we try to disable SSLv2 and SSLv3 options explicitely. The python version in wheezy does not offer PROTOCOL_TLSv1_2 nor OP_NO_SSLv2 or OP_NO_SSLv3 (It's new in 2.7.9) --- server/pkg/soledad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/soledad b/server/pkg/soledad index bf24dac2..ccb3e9b0 100644 --- a/server/pkg/soledad +++ b/server/pkg/soledad @@ -19,7 +19,7 @@ CERT_PATH=/etc/leap/soledad-server.pem PRIVKEY_PATH=/etc/leap/soledad-server.key TWISTD_PATH=/usr/bin/twistd HOME=/var/lib/soledad/ -SSL_METHOD=TLSv1_METHOD +SSL_METHOD=SSLv23_METHOD USER=soledad GROUP=soledad -- cgit v1.2.3 From e909a218efb0ad31f413c47c90303f44f6906158 Mon Sep 17 00:00:00 2001 From: drebs Date: Tue, 16 Dec 2014 14:47:21 -0200 Subject: Fix server initscript location (#6557). --- server/pkg/soledad | 73 ----------------------------------------------- server/pkg/soledad-server | 73 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 73 deletions(-) delete mode 100644 server/pkg/soledad create mode 100644 server/pkg/soledad-server (limited to 'server/pkg') diff --git a/server/pkg/soledad b/server/pkg/soledad deleted file mode 100644 index ccb3e9b0..00000000 --- a/server/pkg/soledad +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: soledad -# Required-Start: $network $named $remote_fs $syslog $time -# Required-Stop: $network $named $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start soledad daemon at boot time -# Description: Synchronization of locally encrypted data among devices -### END INIT INFO - -PATH=/sbin:/bin:/usr/sbin:/usr/bin -PIDFILE=/var/run/soledad.pid -RUNDIR=/var/lib/soledad/ -OBJ=leap.soledad.server.application -LOGFILE=/var/log/soledad.log -HTTPS_PORT=2424 -CERT_PATH=/etc/leap/soledad-server.pem -PRIVKEY_PATH=/etc/leap/soledad-server.key -TWISTD_PATH=/usr/bin/twistd -HOME=/var/lib/soledad/ -SSL_METHOD=SSLv23_METHOD -USER=soledad -GROUP=soledad - -[ -r /etc/default/soledad ] && . /etc/default/soledad - -test -r /etc/leap/ || exit 0 - -. /lib/lsb/init-functions - - -case "${1}" in - start) - echo -n "Starting soledad: twistd" - start-stop-daemon --start --quiet \ - --user=${USER} --group=${GROUP} \ - --exec ${TWISTD_PATH} -- \ - --pidfile=${PIDFILE} \ - --logfile=${LOGFILE} \ - web \ - --wsgi=${OBJ} \ - --port=ssl:${HTTPS_PORT}:privateKey=${PRIVKEY_PATH}:certKey=${CERT_PATH}:sslmethod=${SSL_METHOD} - echo "." - ;; - - stop) - echo -n "Stopping soledad: twistd" - start-stop-daemon --stop --quiet \ - --pidfile ${PIDFILE} - echo "." - ;; - - restart) - ${0} stop - ${0} start - ;; - - force-reload) - ${0} restart - ;; - - status) - status_of_proc -p ${PIDFILE} ${TWISTD_PATH} soledad && exit 0 || exit ${?} - ;; - - *) - echo "Usage: /etc/init.d/soledad {start|stop|restart|force-reload|status}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/server/pkg/soledad-server b/server/pkg/soledad-server new file mode 100644 index 00000000..ccb3e9b0 --- /dev/null +++ b/server/pkg/soledad-server @@ -0,0 +1,73 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: soledad +# Required-Start: $network $named $remote_fs $syslog $time +# Required-Stop: $network $named $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start soledad daemon at boot time +# Description: Synchronization of locally encrypted data among devices +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin +PIDFILE=/var/run/soledad.pid +RUNDIR=/var/lib/soledad/ +OBJ=leap.soledad.server.application +LOGFILE=/var/log/soledad.log +HTTPS_PORT=2424 +CERT_PATH=/etc/leap/soledad-server.pem +PRIVKEY_PATH=/etc/leap/soledad-server.key +TWISTD_PATH=/usr/bin/twistd +HOME=/var/lib/soledad/ +SSL_METHOD=SSLv23_METHOD +USER=soledad +GROUP=soledad + +[ -r /etc/default/soledad ] && . /etc/default/soledad + +test -r /etc/leap/ || exit 0 + +. /lib/lsb/init-functions + + +case "${1}" in + start) + echo -n "Starting soledad: twistd" + start-stop-daemon --start --quiet \ + --user=${USER} --group=${GROUP} \ + --exec ${TWISTD_PATH} -- \ + --pidfile=${PIDFILE} \ + --logfile=${LOGFILE} \ + web \ + --wsgi=${OBJ} \ + --port=ssl:${HTTPS_PORT}:privateKey=${PRIVKEY_PATH}:certKey=${CERT_PATH}:sslmethod=${SSL_METHOD} + echo "." + ;; + + stop) + echo -n "Stopping soledad: twistd" + start-stop-daemon --stop --quiet \ + --pidfile ${PIDFILE} + echo "." + ;; + + restart) + ${0} stop + ${0} start + ;; + + force-reload) + ${0} restart + ;; + + status) + status_of_proc -p ${PIDFILE} ${TWISTD_PATH} soledad && exit 0 || exit ${?} + ;; + + *) + echo "Usage: /etc/init.d/soledad {start|stop|restart|force-reload|status}" >&2 + exit 1 + ;; +esac + +exit 0 -- cgit v1.2.3 From 61a56f2ee301212d96c2d95a21d524bc06b3a677 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 9 Mar 2015 15:22:17 -0300 Subject: Fix soledad initscript uid and gid. --- server/pkg/soledad-server | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/soledad-server b/server/pkg/soledad-server index ccb3e9b0..811ad55b 100644 --- a/server/pkg/soledad-server +++ b/server/pkg/soledad-server @@ -34,8 +34,8 @@ case "${1}" in start) echo -n "Starting soledad: twistd" start-stop-daemon --start --quiet \ - --user=${USER} --group=${GROUP} \ --exec ${TWISTD_PATH} -- \ + --uid=${USER} --gid=${GROUP} \ --pidfile=${PIDFILE} \ --logfile=${LOGFILE} \ web \ -- cgit v1.2.3 From 4b78cf9da0874501fa123a02b53d7650e8dfcdf1 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 19 Mar 2015 09:54:38 -0300 Subject: [fix] add/fix dependency on twisted Add dependency on twisted for Soledad Client. Also remove minimum twisted version for Soledad Server because debian stable currently distributes 12.0.0 and pypi currently distributes 15.0.0. Closes: #6797 --- server/pkg/requirements.pip | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'server/pkg') diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index 28717664..89ec52e7 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -4,9 +4,7 @@ simplejson u1db routes PyOpenSSL<0.14 - -# TODO: maybe we just want twisted-web? -twisted>=12.0.0 +twisted # leap deps -- bump me! leap.soledad.common>=0.6.0 -- cgit v1.2.3 From 74dec41c1d99ae8d4a4a79a7cb0d5c3c9f40cbae Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 19 Mar 2015 10:57:54 -0300 Subject: [fix] add explicit dependency on leap.common In the past, we wanted dependency on leap.common to be optional, but now because of the explicit use of the config path prefix and signaling, we want to enforce dependency on leap.common. --- server/pkg/requirements.pip | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'server/pkg') diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index 89ec52e7..c65ee4f5 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -9,12 +9,7 @@ twisted # leap deps -- bump me! leap.soledad.common>=0.6.0 -# -# Things yet to fix: -# - -# oauth is not strictly needed by us, but we need it -# until u1db adds it to its release as a dep. - +# XXX -- fix me! +# oauth is not strictly needed by us, but we need it until u1db adds it to its +# release as a dep. oauth - -- cgit v1.2.3 From 340b0dcfbc0a819738a28f9c803fdbf848754897 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 14 May 2015 11:52:20 -0300 Subject: [pkg] bump version of server dependency on common soledad-common versions before 0.6.5 do not contain the fix for #6833 and thus will not work with most recent server. That is why we have to bump this soledad-server dependency on soledad.common. --- server/pkg/requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index c65ee4f5..df6ad95d 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -7,7 +7,7 @@ PyOpenSSL<0.14 twisted # leap deps -- bump me! -leap.soledad.common>=0.6.0 +leap.soledad.common>=0.6.5 # XXX -- fix me! # oauth is not strictly needed by us, but we need it until u1db adds it to its -- cgit v1.2.3 From 1137bf9f4a6264b3525679da474112a04b111aca Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 28 May 2015 10:12:59 -0300 Subject: [pkg] remove PyOpenSSL version pinning Once upon a time we needed to pin the PyOpenSSL version to avoid unneeded crypto deps (see https://leap.se/code/issues/5368#note-5). Since then, jessie was released and PyOpenSSL 0.14 is now shipped with it. We have removed that pinning from the debian package, and it is not needed here. --- server/pkg/requirements.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index df6ad95d..43088222 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -3,7 +3,7 @@ couchdb simplejson u1db routes -PyOpenSSL<0.14 +PyOpenSSL twisted # leap deps -- bump me! -- cgit v1.2.3 From 82c8989ddbcc57befca806495b7040efd0cb0d4e Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Wed, 22 Jul 2015 12:36:41 -0400 Subject: [pkg] separate leap requirements this is part of a process to make the setup of the development mode less troublesome. from now on, setting up a virtualenv in pure development mode will be as easy as telling pip to just install the external dependencies:: pip install -r pkg/requirements.pip and traversing all the leap repos for the needed leap dependencies doing:: python setup.py develop - Related: #7288 --- server/pkg/requirements-leap.pip | 1 + server/pkg/requirements.pip | 3 --- server/pkg/utils.py | 29 +++++++++++++++++++++++------ 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 server/pkg/requirements-leap.pip (limited to 'server/pkg') diff --git a/server/pkg/requirements-leap.pip b/server/pkg/requirements-leap.pip new file mode 100644 index 00000000..aaad340c --- /dev/null +++ b/server/pkg/requirements-leap.pip @@ -0,0 +1 @@ +leap.soledad.common>=0.6.5 diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index 43088222..53f7db57 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -6,9 +6,6 @@ routes PyOpenSSL twisted -# leap deps -- bump me! -leap.soledad.common>=0.6.5 - # XXX -- fix me! # oauth is not strictly needed by us, but we need it until u1db adds it to its # release as a dep. diff --git a/server/pkg/utils.py b/server/pkg/utils.py index deace14b..d1680102 100644 --- a/server/pkg/utils.py +++ b/server/pkg/utils.py @@ -14,20 +14,34 @@ # # You should have received a copy of the GNU General Public License # along with this program. If not, see . - """ Utils to help in the setup process """ - import os import re import sys +def is_develop_mode(): + """ + Returns True if we're calling the setup script using the argument for + setuptools development mode. + + This avoids messing up with dependency pinning and order, the + responsibility of installing the leap dependencies is left to the + developer. + """ + args = sys.argv + devflags = "setup.py", "develop" + if (args[0], args[1]) == devflags: + return True + return False + + def get_reqs_from_files(reqfiles): """ Returns the contents of the top requirement file listed as a - string list with the lines + string list with the lines. @param reqfiles: requirement files to parse @type reqfiles: list of str @@ -43,6 +57,9 @@ def parse_requirements(reqfiles=['requirements.txt', """ Parses the requirement files provided. + The passed reqfiles list is a list of possible locations to try, the + function will return the contents of the first path found. + Checks the value of LEAP_VENV_SKIP_PYSIDE to see if it should return PySide as a dep or not. Don't set, or set to 0 if you want to install it through pip. @@ -58,9 +75,9 @@ def parse_requirements(reqfiles=['requirements.txt', if re.match(r'\s*-e\s+', line): pass # do not try to do anything with externals on vcs - #requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', - #line)) - # http://foo.bar/baz/foobar/zipball/master#egg=foobar + # requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', + # line)) + # http://foo.bar/baz/foobar/zipball/master#egg=foobar elif re.match(r'\s*https?:', line): requirements.append(re.sub(r'\s*https?:.*#egg=(.*)$', r'\1', line)) -- cgit v1.2.3 From fa42397e13c5d7a70ceb961153d39e10a0d4c8f9 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Mon, 27 Jul 2015 22:17:47 -0400 Subject: [pkg] add script to install base requirements - update pip - install base reqs, with insecure flags for dirspec and u1db --- server/pkg/pip_install_requirements.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100755 server/pkg/pip_install_requirements.sh (limited to 'server/pkg') diff --git a/server/pkg/pip_install_requirements.sh b/server/pkg/pip_install_requirements.sh new file mode 100755 index 00000000..71adebc7 --- /dev/null +++ b/server/pkg/pip_install_requirements.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Update pip and install LEAP base requirements. +# For convenience, u1db and dirspec are allowed with insecure flags enabled. +# Use at your own risk. +pip install -U pip +pip install --allow-external u1db --allow-unverified u1db --allow-external dirspec --allow-unverified dirspec -r pkg/requirements.pip -- cgit v1.2.3 From 52c2f7258416fcd54e9aeb50656830b55d653630 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Wed, 29 Jul 2015 14:11:48 -0300 Subject: [feat] Added requirements-latest pip file With this, you can setup soledad for using locally and running the tests with the latest head in a simpler way --- server/pkg/requirements-latest.pip | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 server/pkg/requirements-latest.pip (limited to 'server/pkg') diff --git a/server/pkg/requirements-latest.pip b/server/pkg/requirements-latest.pip new file mode 100644 index 00000000..0edfbca0 --- /dev/null +++ b/server/pkg/requirements-latest.pip @@ -0,0 +1,8 @@ +--index-url https://pypi.python.org/simple/ + +--allow-external u1db --allow-unverified u1db +--allow-external dirspec --allow-unverified dirspec + +-e 'git+https://github.com/pixelated-project/leap_pycommon.git#egg=leap.common' +-e '../common' +-e . -- cgit v1.2.3 From c8fcfb452392af6b54e36a4bd0788f7b412fdc5c Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 29 Jul 2015 16:21:33 -0300 Subject: [bug] specify develop branch when using -e requirements-latest.pip will try to clone and install. Since it is meant to be latest, I added a small change to specify the branch 'develop'. --- server/pkg/requirements-latest.pip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/requirements-latest.pip b/server/pkg/requirements-latest.pip index 0edfbca0..a629aa57 100644 --- a/server/pkg/requirements-latest.pip +++ b/server/pkg/requirements-latest.pip @@ -3,6 +3,6 @@ --allow-external u1db --allow-unverified u1db --allow-external dirspec --allow-unverified dirspec --e 'git+https://github.com/pixelated-project/leap_pycommon.git#egg=leap.common' +-e 'git+https://github.com/pixelated-project/leap_pycommon.git@develop#egg=leap.common' -e '../common' -e . -- cgit v1.2.3 From 0d8455007283fba00fa1747a30974de12fbe251c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Fri, 31 Jul 2015 08:57:57 +0200 Subject: [feat] use wheels to install dependencies generate_wheels uses $WHEELHOUSE to generate and store the wheels for requirements.pip and requirements-testing.pip (if it exists). pip_install_requirements.sh installs requirements.pip from them if possible (if not, then it fetches them from pypi) or, if passed the --testing flag, it installs requirements-testing.pip. Related: #7327 --- server/pkg/generate_wheels.sh | 13 +++++++ server/pkg/pip_install_requirements.sh | 71 ++++++++++++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 4 deletions(-) create mode 100755 server/pkg/generate_wheels.sh (limited to 'server/pkg') diff --git a/server/pkg/generate_wheels.sh b/server/pkg/generate_wheels.sh new file mode 100755 index 00000000..e29c327e --- /dev/null +++ b/server/pkg/generate_wheels.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# Generate wheels for dependencies +# Use at your own risk. + +if [ "$WHEELHOUSE" = "" ]; then + WHEELHOUSE=$HOME/wheelhouse +fi + +pip wheel --wheel-dir $WHEELHOUSE pip +pip wheel --wheel-dir $WHEELHOUSE --allow-external u1db --allow-unverified u1db --allow-external dirspec --allow-unverified dirspec -r pkg/requirements.pip +if [ -f pkg/requirements-testing.pip ]; then + pip wheel --wheel-dir $WHEELHOUSE -r pkg/requirements-testing.pip +fi diff --git a/server/pkg/pip_install_requirements.sh b/server/pkg/pip_install_requirements.sh index 71adebc7..c9dc3198 100755 --- a/server/pkg/pip_install_requirements.sh +++ b/server/pkg/pip_install_requirements.sh @@ -1,6 +1,69 @@ #!/bin/sh -# Update pip and install LEAP base requirements. -# For convenience, u1db and dirspec are allowed with insecure flags enabled. +# Update pip and install LEAP base/testing requirements. +# For convenience, $insecure_packages are allowed with insecure flags enabled. # Use at your own risk. -pip install -U pip -pip install --allow-external u1db --allow-unverified u1db --allow-external dirspec --allow-unverified dirspec -r pkg/requirements.pip +# See $usage for help + +insecure_packages="u1db dirspec" + +return_wheelhouse() { + if [ "$WHEELHOUSE" = "" ]; then + WHEELHOUSE=$HOME/wheelhouse + fi + + if [ ! -d "$WHEELHOUSE" ]; then + mkdir $WHEELHOUSE + fi + + echo "$WHEELHOUSE" +} + +show_help() { + usage="Usage: $0 [--testing]\n --testing\tInstall dependencies from requirements-testing.pip\n +\t\tOtherwise, it will install requirements.pip" + echo $usage + + exit 1 +} + +process_arguments() { + testing=false + while [ "$#" -gt 0 ]; do + # From http://stackoverflow.com/a/31443098 + case "$1" in + --help) show_help;; + --testing) testing=true; shift 1;; + + -h) show_help;; + -*) echo "unknown option: $1" >&2; exit 1;; + esac + done +} + +return_insecure_flags() { + for insecure_package in $insecure_packages; do + flags="$flags --allow-external $insecure_package --allow-unverified $insecure_package" + done + + echo $flags +} + +return_packages() { + if $testing ; then + packages="-r pkg/requirements-testing.pip" + else + packages="-r pkg/requirements.pip" + fi + + echo $packages +} + +process_arguments $@ +wheelhouse=`return_wheelhouse` +install_options="-U --find-links=$wheelhouse" +insecure_flags=`return_insecure_flags` +packages=`return_packages` + +pip install -U wheel +pip install $install_options pip +pip install $install_options $insecure_flags $packages -- cgit v1.2.3 From cb92f58a141f410739ae6460b7eb8aaf2daa3c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Parm=C3=A9nides=20GV?= Date: Thu, 6 Aug 2015 08:45:42 +0200 Subject: [feat] WHEELHOUSE can be a url + --use-leap-wheels --use-leap-wheels sets --trusted-host (remove it when we have a proper cert) and WHEELHOUSE to https://ftp.lizard.leap.se Until we get ftp.lizard cname, use lizard as the wheels server. - Related: #7339 --- server/pkg/pip_install_requirements.sh | 51 ++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 18 deletions(-) (limited to 'server/pkg') diff --git a/server/pkg/pip_install_requirements.sh b/server/pkg/pip_install_requirements.sh index c9dc3198..d0479365 100755 --- a/server/pkg/pip_install_requirements.sh +++ b/server/pkg/pip_install_requirements.sh @@ -1,27 +1,17 @@ -#!/bin/sh +#!/bin/bash # Update pip and install LEAP base/testing requirements. # For convenience, $insecure_packages are allowed with insecure flags enabled. # Use at your own risk. # See $usage for help insecure_packages="u1db dirspec" - -return_wheelhouse() { - if [ "$WHEELHOUSE" = "" ]; then - WHEELHOUSE=$HOME/wheelhouse - fi - - if [ ! -d "$WHEELHOUSE" ]; then - mkdir $WHEELHOUSE - fi - - echo "$WHEELHOUSE" -} +leap_wheelhouse=https://lizard.leap.se/wheels show_help() { - usage="Usage: $0 [--testing]\n --testing\tInstall dependencies from requirements-testing.pip\n -\t\tOtherwise, it will install requirements.pip" - echo $usage + usage="Usage: $0 [--testing] [--use-leap-wheels]\n --testing\t\tInstall dependencies from requirements-testing.pip\n +\t\t\tOtherwise, it will install requirements.pip\n +--use-leap-wheels\tUse wheels from leap.se" + echo -e $usage exit 1 } @@ -33,6 +23,7 @@ process_arguments() { case "$1" in --help) show_help;; --testing) testing=true; shift 1;; + --use-leap-wheels) use_leap_wheels=true; shift 1;; -h) show_help;; -*) echo "unknown option: $1" >&2; exit 1;; @@ -40,6 +31,31 @@ process_arguments() { done } +return_wheelhouse() { + if $use_leap_wheels ; then + WHEELHOUSE=$leap_wheelhouse + elif [ "$WHEELHOUSE" = "" ]; then + WHEELHOUSE=$HOME/wheelhouse + fi + + # Tested with bash and zsh + if [[ $WHEELHOUSE != http* && ! -d "$WHEELHOUSE" ]]; then + mkdir $WHEELHOUSE + fi + + echo "$WHEELHOUSE" +} + +return_install_options() { + wheelhouse=`return_wheelhouse` + install_options="-U --find-links=$wheelhouse" + if $use_leap_wheels ; then + install_options="$install_options --trusted-host lizard.leap.se" + fi + + echo $install_options +} + return_insecure_flags() { for insecure_package in $insecure_packages; do flags="$flags --allow-external $insecure_package --allow-unverified $insecure_package" @@ -59,8 +75,7 @@ return_packages() { } process_arguments $@ -wheelhouse=`return_wheelhouse` -install_options="-U --find-links=$wheelhouse" +install_options=`return_install_options` insecure_flags=`return_insecure_flags` packages=`return_packages` -- cgit v1.2.3 From 66b58d3222e86916431f5c9cd534619537de5359 Mon Sep 17 00:00:00 2001 From: drebs Date: Mon, 24 Aug 2015 14:38:46 -0300 Subject: [refactor] remove simplejson dep on server --- server/pkg/requirements.pip | 1 - 1 file changed, 1 deletion(-) (limited to 'server/pkg') diff --git a/server/pkg/requirements.pip b/server/pkg/requirements.pip index 53f7db57..d75678b2 100644 --- a/server/pkg/requirements.pip +++ b/server/pkg/requirements.pip @@ -1,6 +1,5 @@ configparser couchdb -simplejson u1db routes PyOpenSSL -- cgit v1.2.3