From 20d89cd34fa89ceaceab962bc15dac2c0c59d702 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 16 Aug 2015 12:39:06 +1200 Subject: [PATCH] Initial checkin --- .env | 5 ++++ .gitignore | 15 ++++++++++ README | 10 +++++++ osx-binaries | 66 ++++++++++++++++++++++++++++++++++++++++++++ release-checklist.md | 55 ++++++++++++++++++++++++++++++++++++ requirements.txt | 2 ++ test-release | 38 +++++++++++++++++++++++++ 7 files changed, 191 insertions(+) create mode 100644 .env create mode 100644 .gitignore create mode 100644 README create mode 100755 osx-binaries create mode 100644 release-checklist.md create mode 100644 requirements.txt create mode 100755 test-release diff --git a/.env b/.env new file mode 100644 index 000000000..97f38452b --- /dev/null +++ b/.env @@ -0,0 +1,5 @@ +DIR="${0%/*}" +if [ -z "$VIRTUAL_ENV" ] && [ -f "$DIR/../venv.mitmproxy/bin/activate" ]; then + echo "Activating mitmproxy virtualenv..." + source "$DIR/../venv.mitmproxy/bin/activate" +fi diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..5bb3661e1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.DS_Store +MANIFEST +/build +/dist +/tmp +/doc +/venv +/libmproxy/gui +/release/build +*.py[cdo] +*.swp +*.swo + +/venv +/release diff --git a/README b/README new file mode 100644 index 000000000..58e917f0f --- /dev/null +++ b/README @@ -0,0 +1,10 @@ + +General build and release utilities for the mitmproxy, netlib and pathod +projects. These tools assume a directory structure with all repositories at the +same level, for example: + + /src/ + ./mitmproxy + ./netlib + ./pathod + ./release diff --git a/osx-binaries b/osx-binaries new file mode 100755 index 000000000..3cfe0913b --- /dev/null +++ b/osx-binaries @@ -0,0 +1,66 @@ +#!/bin/sh + +# Quick and dangerous script for building OSX binaries. + +# At the moment, pyinstaller has no support for entry points, except for this +# hideous hack on the wiki: +# https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Setuptools-Entry-Point +# Once this is fixed, we can ditch the redundant command scripts. + +VENV=../venv.mitmproxy +PYINST_CMD="$VENV/bin/pyinstaller -F --clean" +TMPDIR=./tmp +CACHE="~/Library/Application Support/pyinstaller" + + +if [ ! -d $VENV ] +then + echo "Failed: set up a dev environment as described in the README" + echo "and run from the top-level mitmproxy directory." + exit +fi + +source $VENV/bin/activate + +if [ ! -f $VENV/bin/pyinstaller ] + then + echo "Installing pyinstaller..." + $VENV/bin/pip install \ + --force-reinstall \ + --upgrade \ + https://github.com/pyinstaller/pyinstaller/archive/develop.zip + $VENV/bin/pip install --upgrade macholib +fi + +# readline.so is actually a symlink to a Python file, which breaks PyInstaller +# (and readline itself). Why? Who knows. Re-address this when this stupidity +# ceases to be. +echo "Removing broken readline..." +rm -f $VENV/lib/python2.7/readline.so + + +echo "Clearing caches..." +rm -f dist/* +rm -rf $TMPDIR +rm -rf $CACHE + +$PYINST_CMD ./release/mitmdump.spec +echo "Running mitmdump..." +./dist/mitmdump --version || exit 1 + +$PYINST_CMD ./release/mitmproxy.spec +echo "Running mitmproxy..." +./dist/mitmproxy --version || exit 1 + +$PYINST_CMD ./release/mitmweb.spec +echo "Running mitmweb..." +./dist/mitmweb --version || exit 1 + +DST=osx-mitmproxy-`./dist/mitmdump --shortversion 2>&1` +mkdir -p $TMPDIR/$DST +cp ./dist/mitmproxy $TMPDIR/$DST +cp ./dist/mitmdump $TMPDIR/$DST +cshape ./doc-src $TMPDIR/$DST/doc + +cd $TMPDIR +tar -czvf $DST.tar.gz $DST diff --git a/release-checklist.md b/release-checklist.md new file mode 100644 index 000000000..e6d9ae1f4 --- /dev/null +++ b/release-checklist.md @@ -0,0 +1,55 @@ +# Release Checklist + +## Test + + - Create the source distributions, make sure the output is sensible: + `./release/build.py release` + All source distributions can be found in `./dist`. + + - Test the source distributions: + `./release/build.py test` + This creates a new virtualenv in `../venv.mitmproxy-release` and installs the distributions from `./dist` into it. + +## Release + + - Verify that repositories are in a clean state: + `./release/build.py git status` + + - Update the version number in `version.py` for all projects: + `./release/build.py set-version 0.13` + + - Ensure that the website style assets have been compiled for production, and synced to the docs. + + - Render the docs, update CONTRIBUTORS file: + `./release/build.py docs contributors` + + - Make version bump commit for all projects, tag and push it: + `./release/build.py git commit -am "bump version"` + `./release/build.py git tag v0.13` + `./release/build.py git push --tags` + + - Recreate the source distributions with updated version information: + `./release/build.py sdist` + + - Build the OSX binaries + - Follow instructions in osx-binaries + - Move to download dir: + `mv ./tmp/osx-mitmproxy-VERSION.tar.gz ~/mitmproxy/www.mitmproxy.org/src/download` + + - Move all source distributions from `./dist` to the server: + `mv ./dist/* ~/mitmproxy/www.mitmproxy.org/src/download` + + - Upload distributions in `./dist` to PyPI: + `./release/build.py upload` + You can test with [testpypi.python.org](https://testpypi.python.org/pypi) by passing `--repository test`. + ([more info](https://tom-christie.github.io/articles/pypi/)) + + - Now bump the version number to be ready for the next cycle: + + **TODO**: We just shipped 0.12 - do we bump to 0.12.1 or 0.13 now? + We should probably just leave it as-is and only bump once we actually do the next release. + + Also, we need a release policy. I propose the following: + - By default, every release is a new minor (`0.x`) release and it will be pushed for all three projects. + - Only if an emergency bugfix is needed, we push a new `0.x.y` bugfix release for a single project. + This matches with what we do in `setup.py`: `"netlib>=%s, <%s" % (version.MINORVERSION, version.NEXT_MINORVERSION)` \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..de1b90b2a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +click>=4.1 +twine>=1.5.0 diff --git a/test-release b/test-release new file mode 100755 index 000000000..8cbcea8c5 --- /dev/null +++ b/test-release @@ -0,0 +1,38 @@ +#!/bin/bash + +MITMPROXY_DIR=~/mitmproxy/mitmproxy +NETLIB_DIR=~/mitmproxy/netlib +PATHOD_DIR=~/mitmproxy/pathod +DST=/tmp/mitmproxy_release + +rm -rf $DST +mkdir -p $DST + +cd $NETLIB_DIR +echo "Creating netlib source distribution..." +python ./setup.py -q sdist --dist-dir $DST + +echo "Creating mitmproxy source distribution..." +cd $MITMPROXY_DIR +python ./setup.py -q sdist --dist-dir $DST + +echo "Creating pathod source distribution..." +cd $PATHOD_DIR +python ./setup.py -q sdist --dist-dir $DST + +echo "Creating virtualenv for test install..." +virtualenv -q $DST/venv + +cd $DST +echo "Installing netlib..." +./venv/bin/pip -q install --download-cache ~/.pipcache ./netlib* +echo "Installing pathod..." +./venv/bin/pip -q install --download-cache ~/.pipcache ./pathod* +echo "Installing mitmproxy..." +./venv/bin/pip -q install --download-cache ~/.pipcache ./mitmproxy* + +echo "Running binaries..." +./venv/bin/mitmproxy --version +./venv/bin/mitmdump --version +./venv/bin/pathod --version +./venv/bin/pathoc --version