Contribute
~~~~~~~~~~

This section explains the various ways users can participate in the
development of Monkeysign, or get support when they find problems.

.. _schedule:

Support schedule
================

First, to know a bit more about the version you are using, understand
that we adhere to `Semantic Versioning <http://semver.org/>`__, which is:

    Given a version number MAJOR.MINOR.PATCH, increment the:

    -  MAJOR version when you make incompatible API changes,
    -  MINOR version when you add functionality in a
       backwards-compatible manner, and
    -  PATCH version when you make backwards-compatible bug fixes.

    Additional labels for pre-release and build metadata are available
    as extensions to the MAJOR.MINOR.PATCH format.

The 2.0.x branch is featured in Debian Jessie and Ubuntu Xenial and is
therefore be maintained for security fixes for the lifetime of those
releases or of any other distribution that picks it up.

Most development and major bug fixes are done directly in the 2.x branch
and published as part of minor releases, which in turn become supported
branches.

Major, API-changing development will happen on the 3.x branch.

Those
`milestones <https://0xacab.org/monkeysphere/monkeysign/milestones>`__
are collaboratively tracked on `0xACAB <https://0xacab.org/monkeysphere/monkeysign/>`_.

Branches status
---------------

Each branch may be in one of those states:

* Development: the development branch is where most of the new
  features are implemented. Consequently, new features and changes may
  inadvertently break things.
* Supported: The branch is supported, but no further development will
  be made on the branch. Only critical issues and security fixes are
  performed.
* Deprecated: users are strongly encouraged to upgrde to later
  versions. No further updates perform except for critical
  security issues.
* Abandoned: the branch is completely abandoned. No further updates
  will ever be performed on the branch, security or otherwise.

====== =========== ====================================================================
Branch Status      Notes
====== =========== ====================================================================
0.x    Abandoned   explicitely unsupported.
1.x    Deprecated  supported until the release of Debian jessie, now only in Debian LTS
2.0.x  Supported   supported until the end of the Debian jessie
2.1.x  Deprecated  short lived support branch, superseded by 2.2.x
2.2.x  Supported   supported until the end of the Debian stretch
2.x    Development new releases performed here, schedule to be clarified
====== =========== ====================================================================

See also :doc:`history` for more information on past releases.

Documentation
=============

We love documentation!

We maintain the documentation in the Git repository, in `RST`_
format. Documentation can be `edited directly on the website`_ and
built locally with `Sphinx`_ with::

  cd doc ; make html

The Sphinx project has a `good tutorial`_ on RST online. Documentation
is `automatically generated on RTD.io`_.
  
.. _RST: https://en.wikipedia.org/wiki/ReStructuredText
.. _edited directly on the website: https://0xacab.org/monkeysphere/monkeysign/tree/HEAD
.. _Sphinx: http://www.sphinx-doc.org/
.. _good tutorial: http://www.sphinx-doc.org/en/stable/rest.html
.. _automatically generated on RTD.io: https://monkeysign.readthedocs.io/

Translation
===========

Monkeysign is translated using the standard `Gettext
<https://en.wikipedia.org/wiki/Gettetx>`_ translation
system. Translation files are located in the source tree, in the
``po/`` subdirectory and can be edited using `standard translation
tools
<https://www.gnu.org/software/gettext/manual/html_node/Editing.html#Editing>`_
or even a regular text editor. A new translation for your locale can
be created with the ``msginit`` command, see the `gettext manual
<https://www.gnu.org/software/gettext/manual/>`_ for more information
about how to use gettext directly.

You can also use the `Weblate web interface
<https://hosted.weblate.org/projects/monkeysphere/monkeysign/>`_ to
translate Monkeysign directly in your browser, without having to
install any special software. New translations from Weblate need to be
updated in our source tree by hand, so do let us know if you make a
new translation, by filing an issue in our `online issue tracker`_.

.. _online issue tracker: https://0xacab.org/monkeysphere/monkeysign/issues

.. note:: We have chosen `Weblate <http://weblate.org/>`_ instead of
          other solutions because it integrates well with our
          git-based workflow: translations on the site are stored as
          commits in the git repository, and the server is just
          another remote that we can merge directly. It also merges
          our changes automatically and so requires minimal work on
          our part. We have also considered tools like `Transifex
          <https://en.wikipedia.org/wiki/Transifex>`_ (proprietary)
          and `Pootle <https://en.wikipedia.org/wiki/Pootle>`_ (no
          public instance, requires us to run our own).

.. tip:: We encourage our users and developers to `support Weblate's
         development <https://weblate.org/en/donate/>`_. Thank you to
         Weblate's people for hosting our project for free!.

Bug reports
===========

We want you to report bugs you find in Monkeysign. It's an important
part of contributing to a project, and all bug reports will be read and
replied to politely and professionally. See the :doc:`support` section
for more information about troubleshooting and bug reporting.

Bug triage
----------

Bug triage is a very useful contribution as well. You can review the
`issues on 0xACAB <https://0xacab.org/monkeysphere/monkeysign/issues>`__
or in the `Debian BTS for Monkeysign <http://bugs.debian.org/monkeysign>`_. What needs to be done
is, for every issue:

-  try to reproduce the bug, if it is not reproducible, tag it with
   ``unreproducible``
-  if information is missing, tag it with ``moreinfo``
-  if a patch is provided, tag it with ``patch`` and test it
-  if the patch is incomplete, tag it with ``help`` (this is often the
   case when unit tests are missing)
-  if the patch is not working, remove the ``patch`` tag
-  if the patch gets merged into the git repository, tag it with
   ``pending``
-  if the feature request is not within the scope of the project or
   should be refused for other reasons, use the ``wontfix`` tag and
   close the bug (with the ``close`` command or by CC'ing
   ``NNNN-done@bugs.debian.org``)
-  feature requests should have a ``wishlist`` severity

Those directives apply mostly to the Debian BTS, but some tags are also
useful in the 0xACAB site. See also the more `complete directives on how
to use the Debian BTS <https://www.debian.org/Bugs/Developer>`__.

Patches
=======

Patches can be submitted through `merge
requests <https://0xacab.org/monkeysphere/monkeysign/merge_requests>`__
on the `Gitlab site <https://0xacab.org/monkeysphere/monkeysign/>`__.

If you prefer old school, offline email systems, you can also use the
Debian BTS, as described above, or send patches to the mailing list for
discussion.

Unit tests
==========

Unit tests should be ran before sending patches. They can be ran with
``monkeysign --test`` (starting from Monkeysign 2.1.4, previously it
was ``./test.py`` and only from the source tree).

The tests expect a unicode locale, so if you do not have that configured
already, do set one like this:

::

    export LANG=C.UTF-8
    monkeysign --test

It is possible that some keys used in the tests expire. The built-in
keys do not have specific expiry dates, but some keys are provided to
test some corner cases and *those* keys may have new expiration dates.

To renew the keys, try:

::

    mkdir ~/.gpg-tmp
    chmod 700 ~/.gpg-tmp
    gpg --homedir ~/.gpg-tmp --import 7B75921E.asc
    gpg --homedir ~/.gpg-tmp --refresh-keys 8DC901CE64146C048AD50FBB792152527B75921E
    gpg --homedir ~/.gpg-tmp --export-options export-minimal --armor --export 8DC901CE64146C048AD50FBB792152527B75921E > 7B75921E.asc

It is also possible the key is just expired and there is no replacement.
In this case the solution is to try and find a similar test case and
replace the key, or simply disable that test.

Debian packaging
================

The Debian package requires backports of ``dh-python`` to operate
properly, otherwise you will get errors like :bts:`839687`::

  LookupError: setuptools-scm was unable to detect version for '/tmp/buildd-...'.

A workaround is to hardcode the version with::

  SETUPTOOLS_SCM_PRETEND_VERSION=x.y.z

Release process
===============

1. make sure tests pass::

     ./scripts/monkeysign --test

2. create release notes with::

     git-dch
     dch -D unstable

3. commit the results::

     git commit -m"prepare new release" -a

4. create a signed and annotated tag::

     git tag -s x.y.z

5. build and test Debian package::

     git-buildpackage
     dpkg -i ../monkeysign_*.deb
     monkeysign --version
     monkeysign --test
     monkeyscan

6. build and test Python "wheel"::

     dpkg --remove monkeysign
     python setup.py bdist_wheel
     pip install dist/*.whl
     monkeysign --version
     monkeysign --test
     monkeyscan
     pip uninstall monkeysign

7. push commits and tags to the git repository::

     git push
     git push --tags

8. publish Python "wheel" on PyPI::

     twine upload dist/*

9. upload Debian package::

     dput ../monkeysign*.changes

10. add announcement on website, IRC channel and mailing list:
    monkeysphere@lists.riseup.net

11. on 0xACAB: close the current `milestone`_, create the next one and
    edit the `release notes on the tag`_

.. _milestone: https://0xacab.org/monkeysphere/monkeysign/milestones
.. _release notes on the tag: https://0xacab.org/monkeysphere/monkeysign/tags
