Handle pkgbase array overrides gracefully

Instead of overwriting arrays, such as depends, from the pkgbase
section, new entries should be appended. Replace array_merge() with a
mixture of array_merge_recursive() and array_replace_recursive() that
merges array fields and replaces non-array fields.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2014-04-19 10:32:43 +02:00
parent e582cfe182
commit 34453d3295
2 changed files with 27 additions and 2 deletions

View file

@ -147,7 +147,7 @@ if ($uid):
if (isset($section_info['pkgbase'])) {
$pkgbase_info = $section_info;
} elseif (isset($section_info['pkgname'])) {
$pkginfo[] = array_merge($pkgbase_info, $section_info);
$pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info);
}
}
$section_info = array(
@ -180,7 +180,7 @@ if ($uid):
if (isset($section_info['pkgbase'])) {
$pkgbase_info = $section_info;
} elseif (isset($section_info['pkgname'])) {
$pkginfo[] = array_merge($pkgbase_info, $section_info);
$pkginfo[] = array_pkgbuild_merge($pkgbase_info, $section_info);
}
} else {
/* Use data from the PKGBUILD parser (deprecated!) */