summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2019-05-25 18:48:58 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2019-05-26 01:01:33 +0200
commitfc9c519852d2081a10d1d86a067316b65e48acb3 (patch)
treee98e9af15f14ba8a836b78a8891e13c998b84463 /web/lib
parent5a66a381fba8455e9d9458689677d35c8ae24619 (diff)
downloadaur-fc9c519852d2081a10d1d86a067316b65e48acb3.tar.gz
aur-fc9c519852d2081a10d1d86a067316b65e48acb3.tar.xz
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 <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/pkgbasefuncs.inc.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 1df21a2b..a4925891 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -368,6 +368,27 @@ function pkgbase_get_pkgnames($base_id) {
}
/**
+ * 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
*
* @param int $base_id The ID of the package base