2015-08-06 10:59:51 +00:00
|
|
|
.. include:: global.rst.inc
|
|
|
|
.. _development:
|
|
|
|
|
|
|
|
Development
|
|
|
|
===========
|
|
|
|
|
|
|
|
This chapter will get you started with |project_name|' development.
|
|
|
|
|
|
|
|
|project_name| is written in Python (with a little bit of Cython and C for
|
|
|
|
the performance critical parts).
|
|
|
|
|
|
|
|
|
|
|
|
Building a development environment
|
|
|
|
----------------------------------
|
|
|
|
|
|
|
|
First, just install borg into a virtual env as described before.
|
|
|
|
|
|
|
|
To install some additional packages needed for running the tests, activate your
|
|
|
|
virtual env and run::
|
|
|
|
|
|
|
|
pip install -r requirements.d/development.txt
|
|
|
|
|
|
|
|
|
|
|
|
Running the tests
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
The tests are in the borg/testsuite package.
|
|
|
|
|
2015-08-20 21:39:40 +00:00
|
|
|
To run all the tests, you need to have fakeroot installed. If you do not have
|
|
|
|
fakeroot, you still will be able to run most tests, just leave away the
|
|
|
|
`fakeroot -u` from the given command lines.
|
2015-08-06 10:59:51 +00:00
|
|
|
|
|
|
|
To run the test suite use the following command::
|
|
|
|
|
|
|
|
fakeroot -u tox # run all tests
|
|
|
|
|
|
|
|
Some more advanced examples::
|
|
|
|
|
|
|
|
# verify a changed tox.ini (run this after any change to tox.ini):
|
|
|
|
fakeroot -u tox --recreate
|
|
|
|
|
|
|
|
fakeroot -u tox -e py32 # run all tests, but only on python 3.2
|
|
|
|
|
|
|
|
fakeroot -u tox borg.testsuite.locking # only run 1 test module
|
|
|
|
|
|
|
|
fakeroot -u tox borg.testsuite.locking -- -k '"not Timer"' # exclude some tests
|
|
|
|
|
|
|
|
fakeroot -u tox borg.testsuite -- -v # verbose py.test
|
|
|
|
|
|
|
|
Important notes:
|
|
|
|
|
|
|
|
- When using -- to give options to py.test, you MUST also give borg.testsuite[.module].
|
|
|
|
|
2015-09-19 19:35:02 +00:00
|
|
|
|
2015-08-06 10:59:51 +00:00
|
|
|
Building the docs with Sphinx
|
|
|
|
-----------------------------
|
|
|
|
|
|
|
|
The documentation (in reStructuredText format, .rst) is in docs/.
|
|
|
|
|
|
|
|
To build the html version of it, you need to have sphinx installed::
|
|
|
|
|
2015-09-30 15:38:51 +00:00
|
|
|
pip3 install sphinx # important: this will install sphinx with Python 3
|
2015-08-06 10:59:51 +00:00
|
|
|
|
|
|
|
Now run::
|
|
|
|
|
|
|
|
cd docs/
|
|
|
|
make html
|
|
|
|
|
|
|
|
Then point a web browser at docs/_build/html/index.html.
|
2015-09-19 19:35:02 +00:00
|
|
|
|
2015-09-30 15:38:51 +00:00
|
|
|
Using Vagrant
|
|
|
|
-------------
|
|
|
|
|
|
|
|
We use Vagrant for the automated creation of testing environment and borgbackup
|
|
|
|
standalone binaries for various platforms.
|
|
|
|
|
|
|
|
For better security, there is no automatic sync in the VM to host direction.
|
|
|
|
The plugin `vagrant-scp` is useful to copy stuff from the VMs to the host.
|
|
|
|
|
|
|
|
Usage::
|
|
|
|
|
|
|
|
To create and provision the VM:
|
|
|
|
vagrant up OS
|
|
|
|
To create an ssh session to the VM:
|
|
|
|
vagrant ssh OS command
|
|
|
|
To shut down the VM:
|
|
|
|
vagrant halt OS
|
|
|
|
To shut down and destroy the VM:
|
|
|
|
vagrant destroy OS
|
|
|
|
To copy files from the VM (in this case, the generated binary):
|
|
|
|
vagrant scp OS:/vagrant/borg/borg/dist/borg .
|
|
|
|
|
2015-09-19 19:35:02 +00:00
|
|
|
|
|
|
|
Creating a new release
|
|
|
|
----------------------
|
|
|
|
|
2015-10-07 13:53:19 +00:00
|
|
|
Checklist:
|
2015-09-19 19:35:02 +00:00
|
|
|
|
2015-10-07 14:01:12 +00:00
|
|
|
- make sure all issues for this milestone are closed or move to the
|
|
|
|
next milestone
|
2015-10-07 14:08:00 +00:00
|
|
|
- find and fix any low hanging fruit left on the issue tracker
|
2015-10-07 13:37:59 +00:00
|
|
|
- run tox on all supported platforms via vagrant, check for test failures
|
|
|
|
- check that Travis CI is also happy
|
|
|
|
- update ``CHANGES.rst``, based on ``git log $PREVIOUS_RELEASE..``
|
|
|
|
- check version number of upcoming release in ``CHANGES.rst``
|
|
|
|
- verify that ``MANIFEST.in`` and ``setup.py`` are complete
|
2015-09-19 19:35:02 +00:00
|
|
|
- tag the release::
|
|
|
|
|
2015-10-07 13:53:19 +00:00
|
|
|
git tag -s -m "tagged release" 0.26.0
|
2015-09-19 19:35:02 +00:00
|
|
|
|
2015-10-07 13:37:59 +00:00
|
|
|
- update usage include files::
|
|
|
|
|
2015-10-07 13:53:19 +00:00
|
|
|
cd docs ; make html
|
2015-10-07 13:37:59 +00:00
|
|
|
|
2015-10-07 13:28:41 +00:00
|
|
|
- update website with the html (XXX: how?)
|
2015-10-07 14:12:56 +00:00
|
|
|
- create a release on PyPi::
|
2015-09-19 19:35:02 +00:00
|
|
|
|
|
|
|
python setup.py register sdist upload --identity="Thomas Waldmann" --sign
|
|
|
|
|
2015-10-07 14:12:56 +00:00
|
|
|
- close release milestone on Github
|
|
|
|
- announce on::
|
2015-09-19 19:35:02 +00:00
|
|
|
|
2015-10-07 13:53:19 +00:00
|
|
|
- `mailing list <mailto:borgbackup@librelist.org>`_
|
2015-10-07 13:59:30 +00:00
|
|
|
- Twitter (your personnal account, if you have one)
|
2015-10-07 13:53:19 +00:00
|
|
|
- `IRC channel <irc://irc.freenode.net/borgbackup>`_ (change ``/topic``
|
2015-09-19 19:35:02 +00:00
|
|
|
|
2015-10-07 14:16:07 +00:00
|
|
|
- create a Github release, include:
|
|
|
|
* standalone binaries (see below for how to create them)
|
|
|
|
* a link to ``CHANGES.rst``
|
2015-09-21 19:48:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
Creating standalone binaries
|
|
|
|
----------------------------
|
|
|
|
|
2015-09-30 15:38:51 +00:00
|
|
|
Make sure you have everything built and installed (including llfuse and fuse).
|
|
|
|
|
2015-09-21 19:48:46 +00:00
|
|
|
With virtual env activated::
|
|
|
|
|
2015-10-07 01:42:08 +00:00
|
|
|
pip install pyinstaller>=3.0 # or git checkout master
|
2015-09-30 15:38:51 +00:00
|
|
|
pyinstaller -F -n borg-PLATFORM --hidden-import=logging.config borg/__main__.py
|
2015-10-07 13:37:59 +00:00
|
|
|
gpg --armor --detach-sign dist/borg-*
|
2015-09-21 19:48:46 +00:00
|
|
|
|
2015-09-30 15:38:51 +00:00
|
|
|
If you encounter issues, see also our `Vagrantfile` for details.
|
2015-09-21 19:48:46 +00:00
|
|
|
|
2015-10-07 13:37:59 +00:00
|
|
|
.. note:: Standalone binaries built with pyinstaller are supposed to
|
|
|
|
work on same OS, same architecture (x86 32bit, amd64 64bit)
|
|
|
|
without external dependencies.
|