(packaging) (#20148) Update logrotate script when appropriate

Logrotate versions > 3.8 complain about permissions unless the su directive
is explicitly set.

This commit updates the RPM and Debian package to set the su directive properly on
dists that need it (Debian >= 7, Ubuntu >= 13.04, EL >= 7, SLES >= 12, Fedora >= 16)
(packaging) (maint) Clean up the Debian rules file

Improve the use of templates to remove redundant code and improve
consistency.
Move catalog/resource hash computation functions out of
scf/storage.clj and into scf/hash.clj
Moved storage utility functions out of storage.clj to prevent a cyclic
dependency between storage.clj and query.clj
Simplified string-contains?

Replaced Java .indexOf string method with .contains for clarity, added
tests to cover the function.
Extended the test for dissoc-if-nil

Added a test case for multiple keys, only some of which are nil.
Minor changes to string-contains? and string-contains?-test
Merge pull request #745 from holguinj/master

Clojure cleanup in string-contains?, add/extend tests for string-contains? and dissoc-if-nil.
Changed the storage-utils require alias from sutil -> sutils
Merge pull request #742 from shrug/bugs/1.5.x/20148

(packaging) (#20148) Update logrotate script when appropriate
Merge pull request #743 from senior/maint/master/scf-storage-split

Move storage utility and hashing functions out of scf/storage.clj and into their on namespaces
Merge branch '1.5.x'

* 1.5.x:
  (packaging) (maint) Clean up the Debian rules file
  (packaging) (#20148) Update logrotate script when appropriate
PDB-67 Converting to using a bigint for catalogs table primary key

In preparation for differential updates to catalog related data (metadata and
edges) this patch converts the usage of the current catalog hash as primary
key over to using a bigint sequence instead. This allows us to update foreign
tables keys without having to also update the foreign key table.

This also has some index and table sized benefits, as the catalog hash is not
replicated multiple times but stored once. Instead the bigint is what is
replicated which is smaller (8 bits versus a 40 bit sha1 hash in this case).

Signed-off-by: Ken Barber <ken@bob.sh>
PDB-67 Remove match simple definitions from create table

This is to avoid confusion, and since we don't care about the match status for
these single column foreign keys anyway the setting is superfluous.

Signed-off-by: Ken Barber <ken@bob.sh>
PDB-67 Switch add-resources! and add-edges! to use catalog id instead of hash

For performance reasons, its better if we use a catalog id for both the
functions add-resources! and add-edges! so we can avoid the need to do a
select beforehand.

With this in mind this patch changes the behaviour of add-catalog-metadata! to
return the full generated id's so we can pluck out the id and use that later
for add-resources! and add-edges!.

Signed-off-by: Ken Barber <ken@bob.sh>
Merge pull request #746 from kbarber/ticket/master/PDB-67-change-catalog-to-use-ids

PDB-67 Converting to using a bigint for catalogs table primary key
(22977) Add a debugging option to help diagnose catalogs for a host that hash to different values

Added a new global config parameter to allow debugging of catalogs that hash to
a different value. This commit also changes the JSON format of the catalog used
for hashing to something more human readable. The following PRs were also related
to this change:

https://github.com/puppetlabs/puppetdb/pull/743
https://github.com/puppetlabs/puppetdb/pull/740
PDB-70 Add index on catalog_resources.exported

This increases performance for exported resource collection queries. For
postgresql the index is only a partial on exported = true, since indexing on
the very common 'false' case is not that effective.

Signed-off-by: Ken Barber <ken@bob.sh>
Replace insert-values with a select query for postgresql <= 8.1

Returning support was not added until PostgreSQL 8.2. This code has instead
been modified to fake it for PostgreSQL 8.1 by doing an SQL query on the
data in question after inserting.

This concept is known as RETURNING and was added in 8.2 as documented
in E.24.1 of the 8.2 guide:

    http://www.postgresql.org/docs/8.2/static/release-8-2.html

Signed-off-by: Ken Barber <ken@bob.sh>
PDB-84 Update to latest version of PostgreSQL JDBC driver

The PostgreSQL upstream finally has uploaded a new revision of their JDBC
driver, but to a new organisation name on maven it seems:

    http://mvnrepository.com/artifact/org.postgresql/postgresql

As linked from their download site:

    http://jdbc.postgresql.org/download.html

Signed-off-by: Ken Barber <ken@bob.sh>