2015-07-02 13:15:27 +00:00
|
|
|
=====================
|
|
|
|
Contributing to Pungi
|
|
|
|
=====================
|
|
|
|
|
|
|
|
|
2015-11-26 08:47:37 +00:00
|
|
|
Set up development environment
|
|
|
|
==============================
|
|
|
|
|
2017-03-01 09:10:10 +00:00
|
|
|
In order to work on *Pungi*, you should install recent version of *Fedora*.
|
2015-11-26 08:47:37 +00:00
|
|
|
|
2020-08-10 09:15:44 +00:00
|
|
|
Python2
|
|
|
|
-------
|
|
|
|
|
|
|
|
Fedora 29 is recommended because some packages are not available in newer Fedora release, e.g. python2-libcomps.
|
|
|
|
|
|
|
|
Install required packages ::
|
|
|
|
|
|
|
|
$ sudo dnf install -y krb5-devel gcc make libcurl-devel python2-devel python2-createrepo_c kobo-rpmlib yum python2-libcomps python2-libselinx
|
|
|
|
|
|
|
|
Python3
|
|
|
|
-------
|
|
|
|
|
|
|
|
Install required packages ::
|
|
|
|
|
|
|
|
$ sudo dnf install -y krb5-devel gcc make libcurl-devel python3-devel python3-createrepo_c python3-libcomps
|
2015-11-26 08:47:37 +00:00
|
|
|
|
2015-07-02 13:15:27 +00:00
|
|
|
Developing
|
|
|
|
==========
|
|
|
|
|
|
|
|
Currently the development workflow for Pungi is on master branch:
|
|
|
|
|
|
|
|
- Make your own fork at https://pagure.io/pungi
|
|
|
|
- Clone your fork locally (replacing $USERNAME with your own)::
|
|
|
|
|
|
|
|
git clone git@pagure.io:forks/$USERNAME/pungi.git
|
|
|
|
|
|
|
|
- cd into your local clone and add the remote upstream for rebasing::
|
|
|
|
|
|
|
|
cd pungi
|
|
|
|
git remote add upstream git@pagure.io:pungi.git
|
|
|
|
|
2015-11-26 08:47:37 +00:00
|
|
|
.. note::
|
|
|
|
This workflow assumes that you never ``git commit`` directly to the master
|
|
|
|
branch of your fork. This will make more sense when we cover rebasing
|
|
|
|
below.
|
2015-07-02 13:15:27 +00:00
|
|
|
|
|
|
|
- create a topic branch based on master::
|
|
|
|
|
|
|
|
git branch my_topic_branch master
|
|
|
|
git checkout my_topic_branch
|
|
|
|
|
|
|
|
|
|
|
|
- Make edits, changes, add new features, etc. and then make sure to pull
|
|
|
|
from upstream master and rebase before submitting a pull request::
|
|
|
|
|
|
|
|
# lets just say you edited setup.py for sake of argument
|
|
|
|
git checkout my_topic_branch
|
|
|
|
|
|
|
|
# make changes to setup.py
|
2020-02-07 09:00:39 +00:00
|
|
|
black setup.py
|
|
|
|
tox
|
2015-07-02 13:15:27 +00:00
|
|
|
git add setup.py
|
2015-11-26 08:47:37 +00:00
|
|
|
git commit -s -m "added awesome feature to setup.py"
|
2015-07-02 13:15:27 +00:00
|
|
|
|
|
|
|
# now we rebase
|
|
|
|
git checkout master
|
2015-09-09 07:57:24 +00:00
|
|
|
git pull --rebase upstream master
|
2015-07-02 13:15:27 +00:00
|
|
|
git push origin master
|
|
|
|
git push origin --tags
|
|
|
|
git checkout my_topic_branch
|
|
|
|
git rebase master
|
|
|
|
|
|
|
|
# resolve merge conflicts if any as a result of your development in
|
|
|
|
# your topic branch
|
|
|
|
git push origin my_topic_branch
|
|
|
|
|
2015-11-26 08:47:37 +00:00
|
|
|
.. note::
|
2020-02-07 09:00:39 +00:00
|
|
|
In order to for your commit to be merged:
|
|
|
|
|
|
|
|
- you must sign-off on it. Use ``-s`` option when running ``git commit``.
|
|
|
|
|
2020-08-10 09:15:44 +00:00
|
|
|
- The code must be well formatted via ``black`` and pass ``flake8`` checking. Run ``tox -e black,flake8`` to do the check.
|
2015-11-26 08:47:37 +00:00
|
|
|
|
2015-07-02 13:15:27 +00:00
|
|
|
- Create pull request in the pagure.io web UI
|
|
|
|
|
|
|
|
- For convenience, here is a bash shell function that can be placed in your
|
2015-11-26 08:47:37 +00:00
|
|
|
~/.bashrc and called such as ``pullupstream pungi-4-devel`` that will
|
2015-07-02 13:15:27 +00:00
|
|
|
automate a large portion of the rebase steps from above::
|
|
|
|
|
|
|
|
pullupstream () {
|
|
|
|
if [[ -z "$1" ]]; then
|
|
|
|
printf "Error: must specify a branch name (e.g. - master, devel)\n"
|
|
|
|
else
|
|
|
|
pullup_startbranch=$(git describe --contains --all HEAD)
|
|
|
|
git checkout $1
|
2015-09-09 07:57:24 +00:00
|
|
|
git pull --rebase upstream master
|
2015-07-02 13:15:27 +00:00
|
|
|
git push origin $1
|
|
|
|
git push origin --tags
|
|
|
|
git checkout ${pullup_startbranch}
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Testing
|
|
|
|
=======
|
|
|
|
|
2016-02-23 12:03:11 +00:00
|
|
|
You must write unit tests for any new code (except for trivial changes). Any
|
|
|
|
code without sufficient test coverage may not be merged.
|
2015-11-26 08:47:37 +00:00
|
|
|
|
2020-08-10 09:15:44 +00:00
|
|
|
To run all existing tests, suggested method is to use *tox*. ::
|
|
|
|
|
|
|
|
$ sudo dnf install python3-tox -y
|
2015-11-26 08:47:37 +00:00
|
|
|
|
2020-08-10 09:15:44 +00:00
|
|
|
$ tox -e py3
|
|
|
|
$ tox -e py27
|
|
|
|
|
|
|
|
Alternatively you could create a vitualenv, install deps and run tests
|
|
|
|
manually if you don't want to use tox. ::
|
|
|
|
|
|
|
|
$ sudo dnf install python3-virtualenvwrapper -y
|
|
|
|
$ mkvirtualenv --system-site-packages py3
|
|
|
|
$ workon py3
|
|
|
|
$ pip install -r requirements.txt -r test-requirements.txt
|
2016-02-23 12:03:11 +00:00
|
|
|
$ make test
|
2015-11-26 08:47:37 +00:00
|
|
|
|
2020-08-10 09:15:44 +00:00
|
|
|
# or with coverage
|
|
|
|
$ make test-coverage
|
|
|
|
|
|
|
|
If you need to run specified tests, *pytest* is recommended. ::
|
|
|
|
|
|
|
|
# Activate virtualenv first
|
|
|
|
|
|
|
|
# Run tests
|
|
|
|
$ pytest tests/test_config.py
|
|
|
|
$ pytest tests/test_config.py -k test_pkgset_mismatch_repos
|
2015-11-26 08:47:37 +00:00
|
|
|
|
|
|
|
In the ``tests/`` directory there is a shell script ``test_compose.sh`` that
|
|
|
|
you can use to try and create a miniature compose on dummy data. The actual
|
2016-02-23 12:03:11 +00:00
|
|
|
data will be created by running ``make test-data`` in project root. ::
|
|
|
|
|
2020-08-10 09:15:44 +00:00
|
|
|
$ sudo dnf -y install rpm-build createrepo_c isomd5sum genisoimage syslinux
|
|
|
|
|
|
|
|
# Activate virtualenv (the one created by tox could be used)
|
|
|
|
$ source .tox/py3/bin/activate
|
|
|
|
|
2019-12-06 02:54:11 +00:00
|
|
|
$ python setup.py develop
|
2016-02-23 12:03:11 +00:00
|
|
|
$ make test-data
|
2017-10-25 08:18:03 +00:00
|
|
|
$ make test-compose
|
2015-11-26 08:47:37 +00:00
|
|
|
|
|
|
|
This testing compose does not actually use all phases that are available, and
|
|
|
|
there is no checking that the result is correct. It only tells you whether it
|
|
|
|
crashed or not.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
Even when it finishes successfully, it may print errors about
|
|
|
|
``repoclosure`` on *Server-Gluster.x86_64* in *test* phase. This is not a
|
|
|
|
bug.
|
2015-07-02 13:15:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
Documenting
|
|
|
|
===========
|
|
|
|
|
|
|
|
You must write documentation for any new features and functional changes.
|
|
|
|
Any code without sufficient documentation may not be merged.
|
2015-11-26 08:47:37 +00:00
|
|
|
|
|
|
|
To generate the documentation, run ``make doc`` in project root.
|