Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/install requirements #1

Merged
merged 45 commits into from
May 4, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
309d1b8
Fix missing "#egg=scapy" specification in requirements.txt.
isislovecruft Apr 19, 2013
1eb5b25
Update install documentation.
isislovecruft Apr 19, 2013
42c8bdf
Add python2.7-dev to the commands for installing dependencies.
isislovecruft Apr 19, 2013
62711b5
Fix typo in README.md installation commands.
isislovecruft Apr 19, 2013
a3c9707
Force usage of newer pip even if a distro version is installed.
isislovecruft Apr 19, 2013
75d3ea7
Force pip to upgrade virtualenv if it was already installed.
isislovecruft Apr 19, 2013
764b4ae
Remove outdated .gitmodules file.
isislovecruft Apr 19, 2013
82c5050
Remove ooni-probe specific (and outdated) documentation from HACKING …
isislovecruft Apr 19, 2013
48172b9
Remove unused txtorcon import statement from /oonib/oonibackend.py.
isislovecruft Apr 19, 2013
c93088a
Remove unused modules from requirements.txt.
isislovecruft Apr 19, 2013
aabb0d0
Specify minimum version of txtorcon in requirements.txt.
isislovecruft Apr 19, 2013
140e801
Fuck you, pip.
isislovecruft Apr 19, 2013
2e62b04
Force pip to forget whatever builtin PI it thought it thought it shou…
isislovecruft Apr 19, 2013
972cd19
Remove git, twisted-names, and cyclone from the dependencies list in …
isislovecruft Apr 19, 2013
ad572b1
Add transaction and TwistedNames to requirements.txt.
isislovecruft Apr 19, 2013
8280a4a
Add .travis.yml file.
isislovecruft Apr 19, 2013
12d6970
Apparently, travis-lint doesn't find missing quotes. And TravisCI has…
isislovecruft Apr 19, 2013
35a786c
And that should be a lowercase "i".
isislovecruft Apr 19, 2013
19d00c2
Install tor keyring in .travis.yml and use deb.tpo for Tor install.
isislovecruft Apr 19, 2013
4af3f84
Removing faulting setup.py code.
isislovecruft Apr 19, 2013
06611c7
Testing pip1.3.1 without explicit https per-package PI URIs.
isislovecruft Apr 20, 2013
d6fcb5c
Presuming missing file 'oonib.conf' to be 'ooniprobe.conf.example'.
isislovecruft Apr 20, 2013
fd3ffa8
Copy oonib.conf.example, not ooniprobe.conf.example.
isislovecruft Apr 20, 2013
58d6b47
Remove CI tests for python3.x, add openssl to requirements.
isislovecruft Apr 20, 2013
b87b8f2
Add pyOpenSSL dependency back into requirements.txt.
isislovecruft Apr 20, 2013
9dbedbe
Add openssl self-signed cert generation commands to .travis.yml.
isislovecruft Apr 20, 2013
5808bfd
Update TravisCI config with unattended SSL cert generation commands.
isislovecruft Apr 21, 2013
059cb07
Add missing OpenSSL cert generation parameter to .travis.yml.
isislovecruft Apr 21, 2013
74cee6a
Don't override the pip PI URI for TravisCI; use alternate ".requireme…
isislovecruft Apr 21, 2013
66aa12e
Fix the "got non-string for process arg" errors resulting from blank …
isislovecruft Apr 21, 2013
6bfbf1d
Add logfile as a config option and fix several bugs in the log.py.
isislovecruft Apr 21, 2013
e77aad6
Add file headers and cleanup module docstring in oonib/runner.py.
isislovecruft Apr 21, 2013
568d05b
Cleanup log/print statements and docstrings in oonib/runner.py.
isislovecruft Apr 21, 2013
ad74b06
Create a tempdir at the top of the repo directory for tor_datadir if …
isislovecruft Apr 21, 2013
be1d323
Use the socks_port option from oonib.conf when starting Tor.
isislovecruft Apr 21, 2013
5a45d4a
Don't pass the tor_binary option to txtorcon if not set.
isislovecruft Apr 21, 2013
851e91b
Update the .gitignore.
isislovecruft Apr 21, 2013
99d86cf
Add script for killing the TravisCI spawned oonib after thirty seconds.
isislovecruft Apr 21, 2013
093ebaa
Grab oonib's pid from the .pid file for the CI test process killer.
isislovecruft Apr 21, 2013
0fe8088
Only import txtorcon classes which are in use.
isislovecruft Apr 21, 2013
0a99413
Fix the "directory not empty" error when removing the tmp tor_datadir.
isislovecruft Apr 21, 2013
7b9bed9
Everything exits 0, and then Travis exits with 1. #FML.
isislovecruft Apr 21, 2013
aae5648
Only kill it if we didn't already killitwithfire().
isislovecruft Apr 21, 2013
d676445
Updated the README with better instructions. [ci skip]
isislovecruft Apr 21, 2013
75c95e5
Testing the ooni-backend continuous integration buildbot notifications.
isislovecruft Apr 21, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,64 @@
*.pyc
# Emacs temp files:
*~
*.*~
\#*\#
.\#*

# Python binary and object files:
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject]

# PyCharm directory:
.idea/*

# config.tor_datadir directory:
tmp/*

# openssl certificates, keys, signing requests:
*.crt
*.csr
*.key

# logs and private files:
*.log
*.private

# from "python setup.py install --record installed-files.txt":
installed-files.txt

# client config:
oonib.conf
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

25 changes: 25 additions & 0 deletions .requirements.travis
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## we do not want to override the PI URI for TravisCI:
#-i https://pypi.python.org/packages
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines which are commented out are because I discovered that pip-1.3.0 does not actually use SSL all of the time like it claims it does. What it does do is go to https://pypi.python.org/simple/ and select the package name, and then crawl all the links from the package's page, HTTPS or otherwise. So, for PyYAML, it would do go to https://pypi.python.org/simple/PyYAML/ where it sees:

PyYAML-3.10.win32-py3.0.exe
PyYAML-3.10.tar.gz
PyYAML-3.10.zip
3.08 home_page
3.08 download_url
3.09 home_page
3.09 download_url
3.05 home_page
3.05 download_url
3.06 home_page
3.06 download_url
3.04 home_page
3.04 download_url
3.03 home_page
3.03 download_url
3.01 home_page

Instead, if we force pip to use https://pypi.python.org/packages/source/ as its package index, it will use SSL, all the time. However, we cannot simply use pip's options pip --no-index --index-url https://pypi.python.org/packages/source to do this, because then it tries to get everything from there, making it break on Windows and making it break when the packages source is elsewhere (like on the homepage of whatever project). Not to mention that specifying urls like this is subject to change without notice, and so we would have to deal with this shit breaking nonstop.

Therefore, these links are commented out. They might be useful, and they took me a while to find and confirm that they work, so I left them in. But we should just use pip-1.3.0 the normal way, and wait patiently while they slowly upgrade all their links to use SSL, which it appears they are doing.

https://pypi.python.org/packages/2.7/T/Twisted/

PyYAML>=3.10
#https://pypi.python.org/packages/source/P/PyYAML/PyYAML-3.10.tar.gz#md5=74c94a383886519e9e7b3dd1ee540247#egg=PyYAML
Twisted>=12.2.0
#https://pypi.python.org/packages/source/T/Twisted/Twisted-13.0.0.tar.bz2#md5=68afff4e1efd3757d934e39f70c99f57#egg=Twisted
cyclone>=1.1
#https://pypi.python.org/packages/source/c/cyclone/cyclone-1.1.tar.gz#md5=477c5ef9cf8902e37105fe450c4d8c5d#egg=cyclone
ipaddr>=2.1.10
#https://ipaddr-py.googlecode.com/files/ipaddr-2.1.10.tar.gz#sha1=c608450b077b19773d4f1b5f1ef88b26f6650ce0#egg=ipaddr
pygeoip>=0.2.6
#https://pypi.python.org/packages/source/p/pygeoip/pygeoip-0.2.6.zip#md5=b3ac1bfcd535782bc59af78e722cf5c1#egg=pygeoip
# Originally fetched from the hg repo on secdev.org:
# https://hg.secdev.org/scapy/archive/tip.zip#egg=scapy
# This is a Tor Project mirror with valid SSL/TLS certs that is stable and fast:
https://people.torproject.org/~ioerror/src/mirrors/ooniprobe/scapy-02-25-2013-tip.zip#egg=scapy
transaction>=1.4.1
#https://pypi.python.org/packages/source/t/transaction/transaction-1.4.1.zip#md5=8db2680bc0f999219861a67b8f335a88#egg=transaction
storm>=0.19
#https://pypi.python.org/packages/source/s/storm/storm-0.19.tar.gz#md5=61d1ee4cd2a08639ab917e43fa2c9265#egg=storm
txtorcon>=0.7
pyOpenSSL>=0.13
zope.component>=4.0.0
zope.event>=4.0.0
zope.interface>=4.0.1
35 changes: 35 additions & 0 deletions .travis.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash
##############################################################################
#
# .travis.test.sh
# -------------------
# Run $2 for $1 seconds and then kill the process.
#
# :authors: Isis Agora Lovecruft, 0x2cdb8b35
# :date: 21 April 2013
# :version: 0.0.1
##############################################################################

set -vx --

function killitwithfire () {
trap - ALRM
kill -ALRM $prog 2>/dev/null
kill -9 $! 2>/dev/null && exit 0
}

function waitforit () {
trap "killitwithfire" ALRM
sleep $1& wait
kill -ALRM $$
}

waitforit $1& prog=$! ; shift ;
trap "killitwithfire" ALRM INT
"$@"& wait $!
RET=$?
if [[ "$(ps -ef | awk -v pid=$prog '$2==pid{print}{}')" != "" ]]; then
kill -ALRM $prog
wait $prog
fi
exit $RET
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
language: python
notifications:
irc:
channels:
- "irc.oftc.net#tor-bots"
- "irc.oftc.net#ooni"
on_success: always
on_failure: always
email:
recipients:
- isis@torproject.org
- aagbsn@torproject.org
- ioerror@torproject.org
- hellais@torproject.org
on_success: change
on_failure: always
before_install:
- echo "deb http://deb.torproject.org/torproject.org wheezy main" | sudo tee -a /etc/apt/sources.list
- gpg --keyserver keys.gnupg.net --recv 886DDD89
- gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
- sudo apt-get update
- sudo apt-get install deb.torproject.org-keyring tor tor-geoipdb build-essential python-dev python-setuptools openssl
python:
#- "3.3"
- "2.7"
- "2.6"
install:
- pip install -r .requirements.travis --use-mirrors
- python setup.py install
# command to run tests, e.g. python setup.py test
script:
- cp oonib.conf.example oonib.conf
- openssl genrsa -des3 -passout pass:oonib -out private.key 4096
- openssl req -batch -passin pass:oonib -new -key private.key -out server.csr
- cp private.key private.key.org
- openssl rsa -passin pass:oonib -in private.key.org -out private.key
- openssl x509 -req -days 365 -in server.csr -signkey private.key -out certificate.crt
- test -f "private.key.org" && rm -f private.key.org
- test -f "server.csr" && rm -f server.csr
- chmod +x .travis.test.sh && ./.travis.test.sh 30 ./bin/oonib
- echo "Build successful."
96 changes: 0 additions & 96 deletions HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -36,109 +36,15 @@ Code Structure
- HACKING
The document you are currently reading.

- inputs/
Contains input files for tests.

- oonib/
Contains the OONI probe backend to be run on the ooni-net

- ooni/
Contains the main ooni probe comand line client

- ooni/config.py
Parts of the code related to parsing OONI
configuration files and making them accessible
to other components of the software.

- ooni/inputunit.py
In here we have functions related to the creation of input
units. Input units are how the inputs to be fed to tests are
split up into.

- ooni/nettest.py
In here is the NetTest API definition. This is how people
interested in writing ooniprobe tests will be specifying
them.

- ooni/nodes.py
Mostly broken code for the remote dispatching of tests.

- ooni/oonicli.py
In here we take care of running ooniprobe from the command
line interface

- ooni/reporter.py
In here goes the logic for the creation of ooniprobe
reports.

- ooni/runner.py
Handles running ooni.nettests as well as
ooni.plugoo.tests.OONITests.

- ooni/otime.py
Generation of timestamps, time conversions and all the rest

- ooni/kit/
In here go utilities that can be used by tests.

- ooni/lib/
XXX this directory is to be removed.

- ooni/utils/
In here go internal utilities that are useful to ooniprobe

- ooni/utils/geodata.py
In here go functions related to the understanding of
geographical information of the probe

- ooni/utils/hacks.py
When some software has issues and we need to fix it in a
hackish way, we put it in here. This one day will be empty.

- ooni/utils/log.py
log realted functions.

- ooni/utils/net.py
utilities for networking related operations

- ooni/utils/onion.py
Utilities for working with Tor.
XXX this code should be removed and merged into txtorcon.

- ooni/utils/txscapy.py
Tools for making scapy work well with twisted.

- ooniprobe.conf
The main OONI-probe configuration file. This can be used
to configure your OONI CLI, tell it where it should report
to, where the asset files are located, what should be used
for control, etc.

Test related conventions
------------------------

These are the conventions for tests that are written in ooniprobe. That is what
goes inside of nettests/.

Naming
......

All methods that are relevant to the test should be all lower case separated by
underscore.

All variables that are specific to your test should be all lower case separated
by underscore.

Simplicity
..........

Tests written in ooniprobe should be as short as possible and should contain as
little code not related to the measurement as possible. It should be possible
from reading the test to understand what it does without clutter.

Everything that is not related directly to the test should go inside of the
test template of which the test you are writing is a subclass of.


Style guide
-----------
Expand Down Expand Up @@ -288,5 +194,3 @@ methods. Even better if you write them also for non-public methods.
Place docstrings under the def.

For a better overview on how to write docstrings consult: PEP-257


Loading