[aur-dev] [PATCH 2/2] Revert "Handle pkgbase array overrides gracefully"

Lukas Fleischer archlinux at cryptocrack.de
Thu May 1 03:56:01 EDT 2014


This reverts commit 34453d32958cc71cf08e932368952f98b46b7020.

Array fields are supposed to be handled like every other field: If a
depends line appears in a package section, it replaces everything from
the pkgbase section.

Fixes FS#40166.
---
 web/html/pkgsubmit.php |  4 ++--
 web/lib/aur.inc.php    | 25 -------------------------
 2 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php
index 180a0b2..5f56794 100644
--- a/web/html/pkgsubmit.php
+++ b/web/html/pkgsubmit.php
@@ -147,7 +147,7 @@ if ($uid):
 					if (isset($section_info['pkgbase'])) {
 						$pkgbase_info = $section_info;
 					} elseif (isset($section_info['pkgname'])) {
-						$pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info);
+						$pkginfo[] = array_merge($pkgbase_info, $section_info);
 					}
 				}
 				$section_info = array(
@@ -189,7 +189,7 @@ if ($uid):
 			if (isset($section_info['pkgbase'])) {
 				$pkgbase_info = $section_info;
 			} elseif (isset($section_info['pkgname'])) {
-				$pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info);
+				$pkginfo[] = array_merge($pkgbase_info, $section_info);
 			}
 		} else {
 			/* Use data from the PKGBUILD parser (deprecated!) */
diff --git a/web/lib/aur.inc.php b/web/lib/aur.inc.php
index b41b720..16aa261 100644
--- a/web/lib/aur.inc.php
+++ b/web/lib/aur.inc.php
@@ -572,28 +572,3 @@ function latest_pkgs($numpkgs) {
 
 	return $packages;
 }
-
-/**
- * Merge pkgbase and package options
- *
- * Merges entries of the first and the second array. If any key appears in both
- * arrays and the corresponding value is an array itself, the arrays are
- * merged. If a key appears in both arrays and the corresponding value is not
- * an array, the second value replaces the first one.
- *
- * @param array $pkgbase_info Options from the pkgbase section
- * @param array $section_info Options from the package section
- *
- * @return array Merged information from both sections
- */
-function array_pkgbuild_merge($pkgbase_info, $section_info) {
-	$pi = $pkgbase_info;
-	foreach ($section_info as $opt_key => $opt_val) {
-		if (is_array($opt_val)) {
-			$pi[$opt_key] += $opt_val;
-		} else {
-			$pi[$opt_key] = $opt_val;
-		}
-	}
-	return $pi;
-}
-- 
1.9.2



More information about the aur-dev mailing list