install: move chown code from Makefile to setup.py

The idea is to concentrate all distro related code in setup.py to make support
for distributions easier.
Move restorestate and savestate implementation to setup.py
Rework the glob() mechanism.

Unfortunately this does not work anymore if we configure some files. The
problem is that these globs are evaluated when setup() is called but the
files are generated when then configure task is run.

So on the first run the configured files where not found and because of
that not installed.
Implement a configuration build step.

It makes it possible to specify files on setup() that should have @@value@@
variables substituted ob build. The files will be copied to build/<path>
when doing that and have to be installed from there. Dependencies are checked
against setup.py and the original file.

        configure_values = {
            'webroot': webroot,
        },
        configure_files = [
            "config/settings",
            "config/cobbler.conf"
        ],
Replace the webroot in configuration files.

This gets rid of one opensuse patch.
Configure cobblerd, cobbler_web.conf and cobblerd.service

Since cobblerd no longer is guaranteed to be installed into /usr/bin .
Do not use wildcards for config/*

Some have to be taken from build/config/ now. And i think some of those
still taken from config/ should not be installed twice

  - cobbler_web.conf
  - cobbler.conf
  - ...
Create a build_man command that builds the man pages only if necessary.

build_man:    docs/*.pod -> builds/docs/*.gz
install       builds/doc/*.1.gz -> /usr/share/man/man1

IDEA: Take .X.gz and install into manX
Fix the build target.

I always tested with install so i failed to notice build is broken.
Now its fixed. (TYPO)
If no root is specified it makes no sense to unroot those directories.
Allow use of no kickstart for systems

Before, if a system had an empty string as kickstart then it would
inherit the one from its profile. It is not desirable if we don't want to use
a kickstart at all, as is the case of attended installations.

Signed-off-by: Alan Evangelista <alanoe@linux.vnet.ibm.com>
Signed-off-by: Andrea Bucci <andreavb@linux.vnet.ibm.com>
Signed-off-by: Eduardo Bacchi Kienetz <ebacchi@linux.vnet.ibm.com>
Signed-off-by: Plinio Freire <pleirie@linux.vnet.ibm.com>
Merge pull request #668 from jansenm/mjansen/makefile-cleanup

Mjansen/makefile cleanup
Copy the mode (permissions) for configured files.

This makes the executables executable again.
Remove hardcoded /usr/share/cobbler path

Determine the directories to add to sys.path with the inspect module (they
are relative to the current file)
Support for virtualenv out of the box

If cobbler is installed using a virtualenv python it will use (and setup)
this python for its scripts and wsgi processes automatically.

The directory directives are needed on opensuse since it still uses apache 2.2.
Add some logging in cobblerd

cobblerd failed to start and the backtrace is nowhere to be found (here?).
At least log the message so its possible to fix the problem.
Strip the distribution names

On my system platform.linux_distribution() returns "opensuse " for some reason.
Play safe.
Improve regen_ss_file()

 - use python stdlib instead of os.system()
 - always change the owner of the file. Not only on creation.

The os.system() call failed for me because it tried with user apache that does not exist here.
With this code you can see the problem.
Merge pull request #669 from natoze/support_no_system_kickstart

Allow use of no kickstart for systems