This is an old revision of the document!
This is a blueprint on how to make the source-tree of NAV a bit less complex, and how to make it easier to develop in an local matter (no more “sudo make install”)
Out current source code tree is heavily influenced by the fact that NAV started out by using a number of different programming languages. This made the installation dependent on numerous Makefiles for handling each subsytem to their needs.
This is how it looks today:
|-- subsystem | |-- alertengine | | |-- Makefile.in | | |-- README | | |-- alertengine.conf | | |-- alertengine.in | | |-- alertengine.py | | `-- nav | |-- alertprofiles | | |-- Makefile.in | | |-- alertprofiles.tool | | |-- config | | |-- htaccess | | |-- images | | |-- media | | |-- nav | | `-- templates | |-- arnold | | |-- ArnoldTemplate.tmpl | | |-- Makefile.in | | |-- arnold.py | | |-- arnold.tool | | |-- arnoldhandler.py | | |-- autoenable.py | | |-- config | | |-- images | | |-- lib | | |-- start_arnold.py | | `-- t1000.py | |-- dbTools | | |-- Makefile.in | | |-- README | | |-- dump.py | | `-- navclean.py ...
There are several issues with this design. As we converge to use more and more python,
we also try to collect all common modules in the
lib-python-subsystem. This is great and all
for keeping code-duplication down. However, since we do all import from the
nav-module (which is they everything is installed),
we cant reach this code from other subsystem without installing our changes system wide. This also imposes the same problems on
testing as the modules in question needs to be installed globally unless we have our tests in the same module as the code itself
and only do local imports.
The new layout is based upon how most django based projects are organized.
../nav |-- bin | |-- system1.py | `-- system2.py |-- conf | |-- nav.conf | |-- system1.conf | `-- system2.conf |-- doc | |-- INSTALL | |-- LICENSE | `-- README |-- other | `-- java_app1 |-- source | `-- nav | |-- __init__.py | |-- system1 | | `-- __init__.py | |-- system2 | | `-- __init__.py | |-- system3 | | `-- __init__.py | `-- system4 | | `-- __init__.py |-- sql | |-- nav-3.5.sql | |-- nav-3.6.sql | `-- trunk.sql |-- templates | |-- system1 | |-- system2 | |-- system3 | `-- system4 `-- tests |-- system1 |-- system2 |-- system3 `-- system4
bindirectory holds all deamons and similar “binaries” that should be installed into an executable path
confdirectory holds all configuration files. All deamons should accept a
-ccommandline argument for specifying configfiles
docdirectory holds our documentation
otherdirectory holds all system that are not coded in python
sqldirectory holds our sql-files
templatesdirectory holds all templates organized into the system they belong to
testsdirectory holds our tests organized by the system they are testing.
This allows us to easily reach all other systems in nav without touching the system-wide installed files. Tests can be neatly organized and run on the development code by supplying the PYTHONPATH to our source code.
This change does require quite some work though. All Makefiles must be changed, and systems dependand on relative paths to their configfile must be updated. I do think it will be worth the job in the long run though.