Fix database schema

Replace "ON SET NULL" with "ON DELETE SET NULL". Fixes a regression
introduced in commit fb7bde3 (Add support for anonymous comments,
2014-02-04).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Add provisional support for package bases

This adds a PackageBases table to the database schema and moves the
following fields from the Packages table to PackageBases:

* CategoryID
* NumVotes
* OutOfDateTS
* SubmittedTS
* ModifiedTS
* SubmitterUID
* MaintainerUID

It also fixes all database accesses to comply with the new layout.

Having a separate PackageBases table is the first step to split package
support. By now, we create one PackageBases entry per package (where the
package base has the same name as the corresponding package). When
adding full support for split packages later, the package base name will
be derived from the pkgbase variable and a single package base will be
shared amongst all packages built from one source package.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Store comments on a per-package base basis

Move comments from the Packages table to PackageBases. Sharing comments
makes sense since they almost always refer to a source package.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
routing.inc.php: Add get_pkgbase_uri()

This will be used to create links to package base pages later. For now,
this just returns a link to the corresponding package page since a
package base currently only consists of a single package having the same
name as the base itself.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Make the delete function remove package bases

Deleting a single package without deleting the whole package base makes
no sense. Comments and votes are already stored on a per-package basis,
making this a straightforward extension.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Add full support for the new .AURINFO format

This adds full support for the new .AURINFO format used by mkaurball,
including support for split packages.

The old PKGBUILD parser is still available for compatibility reasons.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Add package base detail pages

This adds package base details pages, similar to the package details
pages. Each package base details page contains general information
(package base name, category, submitter, maintainer, ...) and links to
all the corresponding packages. As on the package details pages,
comments and links to several package actions are also provided.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
pkg_details.php: Add link to package base details

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Do not allow for overwriting arbitrary packages

A package should only be overwritten if it already belongs to the
package base that is trying to overwrite it.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Factor out PKGBUILD parsing

This is legacy code. Move it to a separate source file in order to clean
up the submission code. The code will be removed altogether in an
upcoming release.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Only parse PKGBUILD when required

Instead of always parsing the PKGBUILD, only invoke the parser when
there is no meta data (.AURINFO) available. This speeds up the general
case (packages including meta data).

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
UPGRADING: Add migration instructions for 3.0.0

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Allow for searching by package base name

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Move package actions to package bases

Package actions now operate on package bases instead of packages. Move
all actions to the correct locations.

This also fixes some issues with comment notifications.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Use snake case for all package functions

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Prefix package functions with pkg_/pkgbase_

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Split out package base functions

Move functions operating on package bases to a separate file.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
pkgfuncs.inc.php: Remove several unused functions

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
pkgbasefuncs.inc.php: Fix leftover bits

Fix some places that incorrectly referred to packages instead of package
bases.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Add full package list to the removal form

In addition to naming the package base that is going to be removed or
merged, list every single package that is affected.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>