summaryrefslogtreecommitdiff
path: root/HACKING
blob: 6238f02dabb2765c4e807cafef84dc8bd57fc104 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Running the Tests
-----------------
The tests are run via

    make

To also run the component tests, you need to initialize the git submodules once
via:

    git submodule update --init --recursive

This will fetch the necessary binary data for the DEB and RPM component tests,
and the tests are from now on included within each regular test run.

Some tests reach out to the network. To run these in addition to all
other tests use:

    make all+net

You can run the tests in a `debian:sid` docker container by using

    packaging/run-in-docker

The python tests use `python-nose` so you can use all it's options. To run a
single test e.g.

   nosetests3 tests/component/deb/test_push.py:TestPush.test_push_failure

If you want to keep any temporary repos around for inspection use
`GBP_TESTS_NOCLEAN`:

   GBP_TESTS_NOCLEAN=1 nosetests3 tests/component/deb/test_push.py:TestPush.test_push_failure

Building the API Docs
---------------------
You can build the API docs using

    make apidocs


Contributing Patches
--------------------
Make sure the tests pass before sending in patch. You can either send it to the
mailing list or add it to a bug report against git-buildpackage on

    http://bugs.debian.org/src:git-buildpackage

If you fix a regression or add a new feature please make sure this is covered
by either a unittest (tests/*.py) or a component test that exercises one of the
scripts (tests/component/{deb,rpm}/*.py.

Layout
------

    gbp/scripts/*.py    - the actual gbp commands (buildpackage, dch, …)
    gbp/scripts/common/ - code shared between Debian and RPM commands
    gbp/deb/            - Debian package handling (control, dsc, …)
    gbp/rpm/            - RPM package handling (spec files, …)
    gbp/git/            - Git repository interaction
    tests/*.py          - unit tests
    tests/doctests      - doctests that also serve as examples
    tests/component/    - component tests that invoke actual commands

Interfaces
----------
A gbp command in gbp/scripts/<commmand>.py must provide these interfaces:

When one invokes `gbp <command>` gbp/scripts/<commmand>.py is imported by

    gbp/scripts/supercommand.py

which then invokes it's *main* function with all given command line arguments.
It is expected to return with the exit status that should be passed back to the
shell.

When one invokes `gbp config <command>` gbp/scripts/<commmand>.py is imported by

    gbp/scripts/config.py

which then invokes it's *build_parser* function with the command name as argument.
It is expected to return a GbpConfigParser with all config files parsed.