ZoneMinder/ZoneMinder — pull request #605 by manupap1 (2014-11-29 01:38:11+00:00)
Title: New debian folder for jessie release

Tested on a clean installation of debian jessie.

I removed the dependency to packages which are not available in this release.

The patching system has been switched to quilt (dpatch is deprecated and this introduces a lintian warning).

Systemd is supported.
The service file and the tmp file are installed by the debhelper commands.
I tried to remove the old init script but this add a lintian error (maybe lintian does not yet fully compatible with systemd).

I replaced some standard commands by debhelper ones in debian/rules.
This fix a bug when the package is removed:
```
$ sudo apt-get remove zoneminder --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
zoneminder*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 9,132 kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 157490 files and directories currently installed.)
Removing zoneminder ...
Stopping ZoneMinder: success

Purging configuration files for zoneminder ...
Database "zm" dropped
dpkg: warning: while removing zoneminder, directory '/home/manupap1/src/zm/master/ZoneMinder/debian/zoneminder/var/run' not empty so not removed
Processing triggers for man-db ...
```
A reference to the build directory is kept in the package and dpkg is trying to delete it!

The debhelper commands also found an error about the directory for the man pages.
The man pages are installed in /usr/man but this directory is obsolete and not available in debian.
I fixed the issue by adding a debian patch (I didn't want to modify files outside this new debian directory).
The man pages are now installed in /usr/share/man.
This also fix a lot of lintian warnings about modules installed in core directory of perl.
Maybe the patch can be merged but I am not sure it is valid for all distributions.

I upgraded some versions (source package, debhelper, Standards-Version), this remove some lintian errors and warnings.
The debian source package is now in version 3.0, this introduces several important changes to build the package.
- It is now required to copy the debian folder in the root directory of the package. A symlink will introduce the following error:
```
add_directory() only handles directories at /usr/share/perl5/Dpkg/Source/Package/V2.pm line 556.
dpkg-buildpackage: error: dpkg-source -b ZoneMinder gave error exit status 29
```
- An existing uptream tarball is now required to build the package (dpkg-source will not generate it). If missing, the following error will occur:
```
dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../zoneminder_1.28.0.orig.tar.{bz2,gz,lzma,xz}
dpkg-buildpackage: error: dpkg-source -b ZoneMinder gave error exit status 255
```
As recommended by the debian policy, I added the rule "get-orig-source" to build automatically this tarball from upstream sources.
The tarball can be generated with the following command in the root directory of the package.
```bash
fakeroot debian/rules get-orig-source
```

I renamed some files for a better readability of the debian folder and this allow to build multiple packages.

I added some instructions taken from the phpmyadmin package to configure automatically apache.

Note: Lintian still reports some errors about missing source for js files:
```
E: zoneminder source: source-is-missing web/tools/mootools/mootools-more-1.3.2.1-yc.js
E: zoneminder source: source-is-missing web/tools/mootools/mootools-core-1.3.2-yc.js
E: zoneminder source: source-is-missing web/skins/flat/js/jquery-1.4.2.min.js
E: zoneminder source: source-is-missing web/skins/classic/js/jquery-1.4.2.min.js
```