Make url and pkgdesc fields optional

The url and pkgdesc PKGBUILD variables are optional, so they should be
in the AUR as well.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Johannes Löthberg 2015-06-20 12:47:23 +02:00 committed by Lukas Fleischer
parent 5d9a80a546
commit 61cdf09cd0
4 changed files with 24 additions and 5 deletions

View file

@ -77,6 +77,10 @@ def save_srcinfo(srcinfo, db, cur, user):
else: else:
ver = '%s-%s' % (pkginfo['pkgver'], pkginfo['pkgrel']) ver = '%s-%s' % (pkginfo['pkgver'], pkginfo['pkgrel'])
for field in ('pkgdesc', 'url'):
if not field in pkginfo:
pkginfo[field] = None
# Create a new package. # Create a new package.
cur.execute("INSERT INTO Packages (PackageBaseID, Name, " + cur.execute("INSERT INTO Packages (PackageBaseID, Name, " +
"Version, Description, URL) " + "Version, Description, URL) " +
@ -247,7 +251,7 @@ for commit in walker:
for pkgname in srcinfo.GetPackageNames(): for pkgname in srcinfo.GetPackageNames():
pkginfo = srcinfo.GetMergedPackage(pkgname) pkginfo = srcinfo.GetMergedPackage(pkgname)
for field in ('pkgver', 'pkgrel', 'pkgname', 'pkgdesc', 'url'): for field in ('pkgver', 'pkgrel', 'pkgname'):
if not field in pkginfo: if not field in pkginfo:
die_commit('missing mandatory field: %s' % (field), commit.id) die_commit('missing mandatory field: %s' % (field), commit.id)
@ -259,7 +263,7 @@ for commit in walker:
commit.id) commit.id)
for field in ('pkgname', 'pkgdesc', 'url'): for field in ('pkgname', 'pkgdesc', 'url'):
if len(pkginfo[field]) > 255: if field in pkginfo and len(pkginfo[field]) > 255:
die_commit('%s field too long: %s' % (field, pkginfo[field]), die_commit('%s field too long: %s' % (field, pkginfo[field]),
commit.id) commit.id)

View file

@ -107,8 +107,8 @@ CREATE TABLE Packages (
PackageBaseID INTEGER UNSIGNED NOT NULL, PackageBaseID INTEGER UNSIGNED NOT NULL,
Name VARCHAR(255) NOT NULL, Name VARCHAR(255) NOT NULL,
Version VARCHAR(255) NOT NULL DEFAULT '', Version VARCHAR(255) NOT NULL DEFAULT '',
Description VARCHAR(255) NOT NULL DEFAULT "An Arch Package", Description VARCHAR(255) NULL DEFAULT NULL,
URL VARCHAR(255) NOT NULL DEFAULT "https://www.archlinux.org", URL VARCHAR(255) NULL DEFAULT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
UNIQUE (Name), UNIQUE (Name),
FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE FOREIGN KEY (PackageBaseID) REFERENCES PackageBases(ID) ON DELETE CASCADE

View file

@ -58,4 +58,11 @@ CREATE TABLE PackageKeywords (
) ENGINE = InnoDB; ) ENGINE = InnoDB;
---- ----
8. (optional) Setup cgit to browse the Git repositories via HTTP. 8. Let Description and URL store nulls
----
ALTER TABLE Packages MODIFY Description VARCHAR(255) NULL DEFAULT NULL,
MODIFY URL VARCHAR(255) NULL DEFAULT NULL;
----
9. (optional) Setup cgit to browse the Git repositories via HTTP.

View file

@ -189,11 +189,19 @@ $sources = pkg_sources($row["ID"]);
</tr> </tr>
<tr> <tr>
<th><?= __('Description') . ': ' ?></th> <th><?= __('Description') . ': ' ?></th>
<?php if (!empty($row['Description'])): ?>
<td class="wrap"><?= htmlspecialchars($row['Description']); ?></td> <td class="wrap"><?= htmlspecialchars($row['Description']); ?></td>
<?php else: ?>
<td class="wrap"><?= __('None') ?></td>
<?php endif; ?>
</tr> </tr>
<tr> <tr>
<th><?= __('Upstream URL') . ': ' ?></th> <th><?= __('Upstream URL') . ': ' ?></th>
<?php if (!empty($row['URL'])): ?>
<td><a href="<?= htmlspecialchars($row['URL'], ENT_QUOTES) ?>" title="<?= __('Visit the website for') . ' ' . htmlspecialchars( $row['Name'])?>"><?= htmlspecialchars($row['URL'], ENT_QUOTES) ?></a></td> <td><a href="<?= htmlspecialchars($row['URL'], ENT_QUOTES) ?>" title="<?= __('Visit the website for') . ' ' . htmlspecialchars( $row['Name'])?>"><?= htmlspecialchars($row['URL'], ENT_QUOTES) ?></a></td>
<?php else: ?>
<td class="wrap"><?= __('None') ?></td>
<?php endif; ?>
</tr> </tr>
<?php <?php
if (has_credential(CRED_PKGBASE_SET_KEYWORDS, $maintainers) || count($keywords) > 0): if (has_credential(CRED_PKGBASE_SET_KEYWORDS, $maintainers) || count($keywords) > 0):