Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-08 10:45:48 +0100
committerErich Eckner <git@eckner.net>2018-11-08 10:45:48 +0100
commitcefbf32003379720bd569e8082ecf43d8c327725 (patch)
treec64f237fcd3ba598ff3629c61825a4f94b1e79c0
parent0a9cb2b3f703b53626179700d348214f6d4b0cef (diff)
packages/pkginfo.php: skip json checks for i486 packages (for now)
-rw-r--r--packages/pkginfo.php116
1 files changed, 65 insertions, 51 deletions
diff --git a/packages/pkginfo.php b/packages/pkginfo.php
index 78a07c8..931705b 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -5,18 +5,25 @@ require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
require_once BASE . "/lib/style.php";
- $json_content = json_decode(
- file_get_contents(
- "https://pkgapi.arch32.tyzoid.com/package/" .
- urlencode ($_GET["repo"].":".$_GET["pkgname"])
- ),
- true
- );
+ if ($_GET["arch"] == "i486")
+ $skip_json_checks = true;
+ else
+ $skip_json_checks = false;
+
+ if (!$skip_json_checks) {
+ $json_content = json_decode(
+ file_get_contents(
+ "https://pkgapi.arch32.tyzoid.com/package/" .
+ urlencode ($_GET["repo"].":".$_GET["pkgname"])
+ ),
+ true
+ );
- if (!isset($json_content["package"]))
- throw_http_error(404, "Package Not Found In Sync Database");
+ if (!isset($json_content["package"]))
+ throw_http_error(404, "Package Not Found In Sync Database");
- $json_content = $json_content["package"];
+ $json_content = $json_content["package"];
+ }
$mysql_result = mysql_run_query(
"SELECT " .
@@ -65,20 +72,22 @@ require_once BASE . "/lib/style.php";
$mysql_content = $mysql_result -> fetch_assoc();
- $same_keys = array (
- array("mysql" => "pkgname", "json" => "Name"),
- array("mysql" => "version", "json" => "Version", "suffix_diff" => ".0"),
- array("mysql" => "repo", "json" => "Repository"),
- array("mysql" => "arch", "json" => "Architecture")
- );
+ if (!$skip_json_checks) {
+ $same_keys = array (
+ array("mysql" => "pkgname", "json" => "Name"),
+ array("mysql" => "version", "json" => "Version", "suffix_diff" => ".0"),
+ array("mysql" => "repo", "json" => "Repository"),
+ array("mysql" => "arch", "json" => "Architecture")
+ );
- foreach ($same_keys as $same_key)
- if (($mysql_content[$same_key["mysql"]] != $json_content[$same_key["json"]]) &&
- ((!isset($same_key["suffix_diff"])) ||
- ($mysql_content[$same_key["mysql"]] != $json_content[$same_key["json"]].$same_key["suffix_diff"])))
- die_500("Inconsistency in Database found:<br>\n" .
- "buildmaster[" . $same_key["mysql"] . "] != repositories[" . $same_key["json"] . "]:<br>\n" .
- "\"" . $mysql_content[$same_key["mysql"]] . "\" != \"" . $json_content[$same_key["json"]] . "\"");
+ foreach ($same_keys as $same_key)
+ if (($mysql_content[$same_key["mysql"]] != $json_content[$same_key["json"]]) &&
+ ((!isset($same_key["suffix_diff"])) ||
+ ($mysql_content[$same_key["mysql"]] != $json_content[$same_key["json"]].$same_key["suffix_diff"])))
+ die_500("Inconsistency in Database found:<br>\n" .
+ "buildmaster[" . $same_key["mysql"] . "] != repositories[" . $same_key["json"] . "]:<br>\n" .
+ "\"" . $mysql_content[$same_key["mysql"]] . "\" != \"" . $json_content[$same_key["json"]] . "\"");
+ }
// query _all_ dependencies
@@ -148,37 +157,39 @@ require_once BASE . "/lib/style.php";
$dependencies[] = $row;
}
- function dependency_is_runtime($dep) {
- return $dep["dependency_type"]=="run";
- };
-
- function dependency_extract_name($dep) {
- return $dep["install_target"];
- };
+ if (!$skip_json_checks) {
+ function dependency_is_runtime($dep) {
+ return $dep["dependency_type"]=="run";
+ };
- $dep_it = array_filter( $dependencies, "dependency_is_runtime");
- $dep_it = array_map("dependency_extract_name", $dep_it);
- $dep_it = preg_replace("/[<=>].*$/","",$dep_it);
- $js_dep = preg_replace("/[<=>].*$/","",$json_content["Depends On"]);
- if (!is_array($js_dep))
- $js_dep = array();
- if (!isset($dep_it))
- $dep_it = array();
- $dep_errors = implode(
- ", ",
- array_diff(
- array_merge($dep_it,$js_dep),
- $dep_it
- )
- );
+ function dependency_extract_name($dep) {
+ return $dep["install_target"];
+ };
- if ($dep_errors != "")
- die_500(
- "Dependencies differ: " . $dep_errors. "<br>\n" .
- "mysql: " . implode(", ",$dep_it) . "<br>\n" .
- "json: " . implode(", ",$js_dep)
+ $dep_it = array_filter( $dependencies, "dependency_is_runtime");
+ $dep_it = array_map("dependency_extract_name", $dep_it);
+ $dep_it = preg_replace("/[<=>].*$/","",$dep_it);
+ $js_dep = preg_replace("/[<=>].*$/","",$json_content["Depends On"]);
+ if (!is_array($js_dep))
+ $js_dep = array();
+ if (!isset($dep_it))
+ $dep_it = array();
+ $dep_errors = implode(
+ ", ",
+ array_diff(
+ array_merge($dep_it,$js_dep),
+ $dep_it
+ )
);
+ if ($dep_errors != "")
+ die_500(
+ "Dependencies differ: " . $dep_errors. "<br>\n" .
+ "mysql: " . implode(", ",$dep_it) . "<br>\n" .
+ "json: " . implode(", ",$js_dep)
+ );
+ }
+
foreach ($dependencies as $key => $dep) {
if ($dep["dependency_type"]!="run") {
$dependencies[$key]["json"]="not required";
@@ -239,7 +250,10 @@ require_once BASE . "/lib/style.php";
while ($row = $mysql_result -> fetch_assoc())
$dependent[] = $row;
- $content = array_merge($mysql_content,$json_content);
+ if ($skip_json_checks)
+ $content = $mysql_content;
+ else
+ $content = array_merge($mysql_content,$json_content);
// query substitutes