summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apk_browser.module23
1 files changed, 20 insertions, 3 deletions
diff --git a/apk_browser.module b/apk_browser.module
index 61f2993..a5ec0ac 100644
--- a/apk_browser.module
+++ b/apk_browser.module
@@ -357,16 +357,33 @@ function apk_browser_apkindex_reader($apk_string) {
//depend and install_if lines
case "D":
case "i":
- $apackages[$key][$apk_line[0]] = explode(" ", substr($apk_line, 2));
+ $result[$key][$apk_line[0]] = explode(" ", substr($apk_line, 2));
break;
//other apk variables
default:
- $apackages[$key][$apk_line[0]] = substr($apk_line, 2);
+ $result[$key][$apk_line[0]] = substr($apk_line, 2);
}
}
}
+ /*
+ * this should take care of having multiple packages with different
+ * version in repositories
+ */
+ foreach ($result as $pkg) {
+ //check if package name already exit in result array
+ if (isset($output[$pkg['P']])) {
+ //check if version number is higher then previous
+ if ($output[$pkg['P']]['V'] < $pkg['V']) {
+ //if version is higher we overwrite package
+ $output[$pkg['P']] = $pkg;
+ }
+ //all not matching packages we just write them
+ } else {
+ $output[$pkg['P']] = $pkg;
+ }
+ }
unlink($temp);
- return $apackages;
+ return $output;
}
function apk_browser_apk_check($title, $arch, $repo) {