development.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. .. include:: global.rst.inc
  2. .. _development:
  3. Development
  4. ===========
  5. This chapter will get you started with |project_name|' development.
  6. |project_name| is written in Python (with a little bit of Cython and C for
  7. the performance critical parts).
  8. Building a development environment
  9. ----------------------------------
  10. First, just install borg into a virtual env as described before.
  11. To install some additional packages needed for running the tests, activate your
  12. virtual env and run::
  13. pip install -r requirements.d/development.txt
  14. Running the tests
  15. -----------------
  16. The tests are in the borg/testsuite package.
  17. To run all the tests, you need to have fakeroot installed. If you do not have
  18. fakeroot, you still will be able to run most tests, just leave away the
  19. `fakeroot -u` from the given command lines.
  20. To run the test suite use the following command::
  21. fakeroot -u tox # run all tests
  22. Some more advanced examples::
  23. # verify a changed tox.ini (run this after any change to tox.ini):
  24. fakeroot -u tox --recreate
  25. fakeroot -u tox -e py32 # run all tests, but only on python 3.2
  26. fakeroot -u tox borg.testsuite.locking # only run 1 test module
  27. fakeroot -u tox borg.testsuite.locking -- -k '"not Timer"' # exclude some tests
  28. fakeroot -u tox borg.testsuite -- -v # verbose py.test
  29. Important notes:
  30. - When using -- to give options to py.test, you MUST also give borg.testsuite[.module].
  31. Building the docs with Sphinx
  32. -----------------------------
  33. The documentation (in reStructuredText format, .rst) is in docs/.
  34. To build the html version of it, you need to have sphinx installed::
  35. pip3 install sphinx # important: this will install sphinx with Python 3
  36. Now run::
  37. cd docs/
  38. make html
  39. Then point a web browser at docs/_build/html/index.html.
  40. The website is updated automatically through Github web hooks on the
  41. main repository.
  42. Using Vagrant
  43. -------------
  44. We use Vagrant for the automated creation of testing environment and borgbackup
  45. standalone binaries for various platforms.
  46. For better security, there is no automatic sync in the VM to host direction.
  47. The plugin `vagrant-scp` is useful to copy stuff from the VMs to the host.
  48. Usage::
  49. To create and provision the VM:
  50. vagrant up OS
  51. To create an ssh session to the VM:
  52. vagrant ssh OS command
  53. To shut down the VM:
  54. vagrant halt OS
  55. To shut down and destroy the VM:
  56. vagrant destroy OS
  57. To copy files from the VM (in this case, the generated binary):
  58. vagrant scp OS:/vagrant/borg/borg/dist/borg .
  59. Creating standalone binaries
  60. ----------------------------
  61. Make sure you have everything built and installed (including llfuse and fuse).
  62. When using the Vagrant VMs, pyinstaller will already be installed.
  63. With virtual env activated::
  64. pip install pyinstaller>=3.0 # or git checkout master
  65. pyinstaller -F -n borg-PLATFORM --hidden-import=logging.config borg/__main__.py
  66. for file in dist/borg-*; do gpg --armor --detach-sign $file; done
  67. If you encounter issues, see also our `Vagrantfile` for details.
  68. .. note:: Standalone binaries built with pyinstaller are supposed to
  69. work on same OS, same architecture (x86 32bit, amd64 64bit)
  70. without external dependencies.
  71. Creating a new release
  72. ----------------------
  73. Checklist:
  74. - make sure all issues for this milestone are closed or moved to the
  75. next milestone
  76. - find and fix any low hanging fruit left on the issue tracker
  77. - run tox on all supported platforms via vagrant, check for test failures
  78. - check that Travis CI is also happy
  79. - update ``CHANGES.rst``, based on ``git log $PREVIOUS_RELEASE..``
  80. - check version number of upcoming release in ``CHANGES.rst``
  81. - verify that ``MANIFEST.in`` and ``setup.py`` are complete
  82. - tag the release::
  83. git tag -s -m "tagged/signed release X.Y.Z" X.Y.Z
  84. - build fresh docs and update the web site with them
  85. - create a release on PyPi::
  86. python setup.py register sdist upload --identity="Thomas Waldmann" --sign
  87. - close release milestone on Github
  88. - announce on::
  89. - `mailing list <mailto:borgbackup@librelist.org>`_
  90. - Twitter (follow @ThomasJWaldmann for these tweets)
  91. - `IRC channel <irc://irc.freenode.net/borgbackup>`_ (change ``/topic``
  92. - create a Github release, include:
  93. * standalone binaries (see above for how to create them)
  94. * a link to ``CHANGES.rst``