Commit fc9c5198 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Display warning when flagging VCS packages



VCS packages should not be flagged out-of-date when the package version
does not match the most recent commit.

Implements FS#62733.

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent 5a66a381
......@@ -195,3 +195,7 @@ label.confirmation,
.comments .more {
font-weight: normal;
}
.error {
color: red;
}
......@@ -50,6 +50,15 @@ if (has_credential(CRED_PKGBASE_FLAG)): ?>
<li><?= htmlspecialchars($pkgname) ?></li>
<?php endforeach; ?>
</ul>
<?php if (pkgbase_is_vcs($base_id)): ?>
<p class="error">
This seems to be a VCS package. Please do <strong>not</strong>
flag it out-of-date if the package version in the AUR does not
match the most recent commit. Flagging this package should only
be done if the sources moved or changes in the PKGBUILD are
required because of recent upstream changes.
</p>
<?php endif; ?>
<p>
<?= __('Please do %snot%s use this form to report bugs. Use the package comments instead.',
'<strong>', '</strong>'); ?>
......
......@@ -367,6 +367,27 @@ function pkgbase_get_pkgnames($base_id) {
return $result->fetchAll(PDO::FETCH_COLUMN, 0);
}
/**
* Determine whether a package base is (or contains a) VCS package
*
* @param int $base_id The ID of the package base
*
* @return bool True if the package base is/contains a VCS package
*/
function pkgbase_is_vcs($base_id) {
$suffixes = array("-cvs", "-svn", "-git", "-hg", "-bzr", "-darcs");
$haystack = pkgbase_get_pkgnames($base_id);
array_push($haystack, pkgbase_name_from_id($base_id));
foreach ($haystack as $pkgname) {
foreach ($suffixes as $suffix) {
if (substr_compare($pkgname, $suffix, -strlen($suffix)) === 0) {
return true;
}
}
}
return false;
}
/**
* Delete all packages belonging to a package base
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment