Statistics
| Branch: | Tag: | Revision:

root / doc / devnotes.rst @ d4fcd298

History | View | Annotate | Download (4.1 kB)

1 832aef24 Michael Hanselmann
Developer notes
2 832aef24 Michael Hanselmann
===============
3 832aef24 Michael Hanselmann
4 b2fc7ea1 Michael Hanselmann
Build dependencies
5 b2fc7ea1 Michael Hanselmann
------------------
6 b2fc7ea1 Michael Hanselmann
7 77a180f6 Iustin Pop
Most dependencies from :doc:`install-quick`, plus (for Python):
8 cbf3d64b Michael Hanselmann
9 c27ba1cc Michael Hanselmann
- `GNU make <http://www.gnu.org/software/make/>`_
10 c27ba1cc Michael Hanselmann
- `GNU tar <http://www.gnu.org/software/tar/>`_
11 c27ba1cc Michael Hanselmann
- `Gzip <http://www.gnu.org/software/gzip/>`_
12 18e2b6e4 Iustin Pop
- `pandoc <http://johnmacfarlane.net/pandoc/>`_
13 c27ba1cc Michael Hanselmann
- `python-sphinx <http://sphinx.pocoo.org/>`_
14 c27ba1cc Michael Hanselmann
  (tested with version 0.6.1)
15 c27ba1cc Michael Hanselmann
- `graphviz <http://www.graphviz.org/>`_
16 1de45c78 Guido Trotter
- the `en_US.UTF-8` locale must be enabled on the system
17 77a180f6 Iustin Pop
- `pylint <http://www.logilab.org/857>`_ and its associated
18 77a180f6 Iustin Pop
  dependencies
19 08366664 Michael Hanselmann
- `pep8 <https://github.com/jcrocholl/pep8/>`_
20 77a180f6 Iustin Pop
21 77a180f6 Iustin Pop
Note that for pylint, at the current moment the following versions
22 77a180f6 Iustin Pop
need to be used::
23 77a180f6 Iustin Pop
24 77a180f6 Iustin Pop
    $ pylint --version
25 77a180f6 Iustin Pop
    pylint 0.21.1,
26 77a180f6 Iustin Pop
    astng 0.20.1, common 0.50.3
27 b2fc7ea1 Michael Hanselmann
28 27e336af Michael Hanselmann
To generate unittest coverage reports (``make coverage``), `coverage
29 27e336af Michael Hanselmann
<http://pypi.python.org/pypi/coverage>`_ needs to be installed.
30 27e336af Michael Hanselmann
31 77a180f6 Iustin Pop
For Haskell development, again all things from the quick install
32 77a180f6 Iustin Pop
document, plus:
33 77a180f6 Iustin Pop
34 77a180f6 Iustin Pop
- `haddock <http://www.haskell.org/haddock/>`_, documentation
35 77a180f6 Iustin Pop
  generator (equivalent to epydoc for Python)
36 77a180f6 Iustin Pop
- `HsColour <http://hackage.haskell.org/package/hscolour>`_, again
37 77a180f6 Iustin Pop
  used for documentation (it's source-code pretty-printing)
38 77a180f6 Iustin Pop
- `hlint <http://community.haskell.org/~ndm/hlint/>`_, a source code
39 3603605a Iustin Pop
  linter (equivalent to pylint for Python), recommended version 1.8 or
40 3603605a Iustin Pop
  above (tested with 1.8.15)
41 77a180f6 Iustin Pop
- the `QuickCheck <http://hackage.haskell.org/package/QuickCheck>`_
42 8e4f6d56 Iustin Pop
  library, version 2.x
43 fd0bc853 Iustin Pop
- ``hpc``, which comes with the compiler, so you should already have
44 fd0bc853 Iustin Pop
  it
45 fd0bc853 Iustin Pop
46 fd0bc853 Iustin Pop
Under Debian, these can be installed (on top of the required ones from
47 fd0bc853 Iustin Pop
the quick install document) via::
48 fd0bc853 Iustin Pop
49 ee041788 Iustin Pop
  apt-get install libghc-quickcheck2-dev hscolour hlint
50 77a180f6 Iustin Pop
51 b2fc7ea1 Michael Hanselmann
52 832aef24 Michael Hanselmann
Configuring for development
53 832aef24 Michael Hanselmann
---------------------------
54 832aef24 Michael Hanselmann
55 c27ba1cc Michael Hanselmann
.. highlight:: sh
56 c27ba1cc Michael Hanselmann
57 d17e74b4 Iustin Pop
Run the following command (only use ``PYTHON=...`` if you need to use a
58 d17e74b4 Iustin Pop
different python version)::
59 d17e74b4 Iustin Pop
60 62947ebb Michael Hanselmann
  ./autogen.sh && \
61 b3a8bebf Michael Hanselmann
  ./configure --prefix=/usr/local --sysconfdir=/etc --localstatedir=/var
62 558fd122 Michael Hanselmann
63 ef958f2a Iustin Pop
Haskell development notes
64 ef958f2a Iustin Pop
-------------------------
65 ef958f2a Iustin Pop
66 ef958f2a Iustin Pop
There are a few things which can help writing or debugging the Haskell
67 ef958f2a Iustin Pop
code.
68 ef958f2a Iustin Pop
69 ef958f2a Iustin Pop
You can run the Haskell linter :command:`hlint` via::
70 ef958f2a Iustin Pop
71 ef958f2a Iustin Pop
  make hlint
72 ef958f2a Iustin Pop
73 3603605a Iustin Pop
This is not enabled by default (as the htools component is
74 3603605a Iustin Pop
optional). The above command will generate both output on the terminal
75 3603605a Iustin Pop
and, if any warnings are found, also an HTML report at
76 ef958f2a Iustin Pop
``doc/hs-lint.html``.
77 ef958f2a Iustin Pop
78 ef958f2a Iustin Pop
When writing or debugging TemplateHaskell code, it's useful to see
79 ef958f2a Iustin Pop
what the splices are converted to. This can be done via::
80 ef958f2a Iustin Pop
81 ef958f2a Iustin Pop
  make HEXTRA="-ddump-splices"
82 ef958f2a Iustin Pop
83 ef958f2a Iustin Pop
Due to the way TemplateHaskell works, it's not straightforward to
84 c7ec3025 Iustin Pop
build profiling code. The recommended way is to run ``make hs-prof``,
85 c7ec3025 Iustin Pop
or alternatively the manual sequence is::
86 ef958f2a Iustin Pop
87 ef958f2a Iustin Pop
  make clean
88 ef958f2a Iustin Pop
  make htools/htools HEXTRA="-osuf .o"
89 ef958f2a Iustin Pop
  rm htools/htools
90 ef958f2a Iustin Pop
  make htools/htools HEXTRA="-osuf .prof_o -prof -auto-all"
91 ef958f2a Iustin Pop
92 ef958f2a Iustin Pop
This will build the binary twice, per the TemplateHaskell
93 ef958f2a Iustin Pop
documentation, the second one with profiling enabled.
94 ef958f2a Iustin Pop
95 94338f0a Michael Hanselmann
96 94338f0a Michael Hanselmann
Packaging notes
97 94338f0a Michael Hanselmann
===============
98 94338f0a Michael Hanselmann
99 94338f0a Michael Hanselmann
Ganeti is mostly developped and tested on `Debian
100 94338f0a Michael Hanselmann
<http://www.debian.org/>`_-based distributions, while still keeping
101 94338f0a Michael Hanselmann
adoptability to other Linux distributions in mind.
102 94338f0a Michael Hanselmann
103 94338f0a Michael Hanselmann
The ``doc/examples/`` directory contains a number of potentially useful
104 94338f0a Michael Hanselmann
scripts and configuration files. Some of them might need adjustment
105 94338f0a Michael Hanselmann
before use.
106 94338f0a Michael Hanselmann
107 94338f0a Michael Hanselmann
``daemon-util``
108 94338f0a Michael Hanselmann
---------------
109 94338f0a Michael Hanselmann
110 94338f0a Michael Hanselmann
This script, in the source code as ``daemons/daemon-util.in``, is used
111 94338f0a Michael Hanselmann
to start/stop Ganeti and do a few other things related to system
112 77a180f6 Iustin Pop
daemons. It is recommended to use ``daemon-util`` also from the system's
113 94338f0a Michael Hanselmann
init scripts. That way the code starting and stopping daemons is shared
114 94338f0a Michael Hanselmann
and future changes have to be made in only one place.
115 94338f0a Michael Hanselmann
116 94338f0a Michael Hanselmann
``daemon-util`` reads extra arguments from variables (``*_ARGS``) in
117 94338f0a Michael Hanselmann
``/etc/default/ganeti``. When modifying ``daemon-util``, keep in mind to
118 94338f0a Michael Hanselmann
not remove support for the ``EXTRA_*_ARGS`` variables for starting
119 94338f0a Michael Hanselmann
daemons. Some parts of Ganeti use them to pass additional arguments when
120 94338f0a Michael Hanselmann
starting a daemon.
121 94338f0a Michael Hanselmann
122 94338f0a Michael Hanselmann
The ``reload_ssh_keys`` function can be adjusted to use another command
123 94338f0a Michael Hanselmann
for reloading the OpenSSH daemon's host keys.
124 94338f0a Michael Hanselmann
125 558fd122 Michael Hanselmann
.. vim: set textwidth=72 :