index : website | |
Archlinux32 website - obsolete | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | packages/pkginfo.php | 56 |
diff --git a/packages/pkginfo.php b/packages/pkginfo.php index 02251d4..e3b8a2f 100644 --- a/packages/pkginfo.php +++ b/packages/pkginfo.php @@ -27,11 +27,16 @@ require_once BASE . "/lib/style.php"; else $skip_json_checks = true; + if (!array_key_exists("repo_arch",$_GET)) { + $_GET["repo_arch"] = $_GET["arch"]; + unset($_GET["arch"]); + } + if (!$skip_json_checks) { $json_content = json_decode( file_get_contents( $protocol . '://pkgapi.archlinux32.' . $tld . '/' . - urlencode($_GET["arch"]) . '/' . // TODO: this should be repo_arch + urlencode($_GET["repo_arch"]) . '/' . urlencode($_GET["repo"]) . '/' . urlencode($_GET["pkgname"]) ), @@ -60,6 +65,7 @@ require_once BASE . "/lib/style.php"; "`repositories`.`stability` AS `repo_stability`," . "`repository_stabilities`.`name` AS `repo_stability_name`," . "`repositories`.`name` AS `repo`," . + "`r_a`.`name` AS `repo_arch`," . "`architectures`.`name` AS `arch`," . "`git_repositories`.`name` AS `git_repo`," . "`package_sources`.`uses_upstream`," . @@ -71,6 +77,7 @@ require_once BASE . "/lib/style.php"; mysql_join_binary_packages_binary_packages_in_repositories() . mysql_join_binary_packages_in_repositories_repositories() . mysql_join_repositories_repository_stabilities() . + mysql_join_repositories_architectures("","r_a") . mysql_join_binary_packages_build_assignments() . mysql_join_build_assignments_package_sources() . mysql_join_package_sources_upstream_repositories() . @@ -99,7 +106,7 @@ require_once BASE . "/lib/style.php"; ") AS `sp_q`" . " ON `sp_q`.`build_assignment`=`build_assignments`.`id`" . " WHERE `binary_packages`.`pkgname`=from_base64(\"" . base64_encode($_GET["pkgname"]) . "\")" . - " AND `architectures`.`name`=from_base64(\"" . base64_encode($_GET["arch"]) . "\")" . + " AND `r_a`.`name`=from_base64(\"" . base64_encode($_GET["repo_arch"]) . "\")" . " AND `repositories`.`name`=from_base64(\"" . base64_encode($_GET["repo"]) . "\")" . " AND NOT EXISTS (" . "SELECT 1" . @@ -140,6 +147,7 @@ require_once BASE . "/lib/style.php"; "GROUP_CONCAT(" . "CONCAT(\"\\\"\",`install_target_providers`.`id`,\"\\\": \",\"{\\n\"," . "\" \\\"repo\\\": \\\"\",`repositories`.`name`,\"\\\",\\n\"," . + "\" \\\"repo_arch\\\": \\\"\",`r_a`.`name`,\"\\\",\\n\"," . "\" \\\"arch\\\": \\\"\",`architectures`.`name`,\"\\\",\\n\"," . "\" \\\"pkgname\\\": \\\"\",`binary_packages`.`pkgname`,\"\\\",\\n\"," . "\" \\\"is_to_be_deleted\\\": \\\"\",IF(`binary_packages_in_repositories`.`is_to_be_deleted`,\"1\",\"0\"),\"\\\"\\n\"," . @@ -170,6 +178,7 @@ require_once BASE . "/lib/style.php"; " LEFT JOIN (". "`binary_packages_in_repositories` AS `bpir`" . mysql_join_binary_packages_in_repositories_repositories('bpir','r') . + mysql_join_repositories_architectures('r','r_a') . ") ON `bpir`.`package`=`dependencies`.`dependent`" . mysql_join_dependencies_dependency_types() . mysql_join_dependencies_install_targets() . @@ -221,7 +230,10 @@ require_once BASE . "/lib/style.php"; $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 (array_key_exists("Depends On",$json_content)) + $js_dep = preg_replace("/[<=>].*$/","",$json_content["Depends On"]); + else + $js_dep = array(); if (!is_array($js_dep)) $js_dep = array(); if (!isset($dep_it)) @@ -260,6 +272,7 @@ require_once BASE . "/lib/style.php"; "`install_targets`.`name` AS `install_target`," . "`repositories`.`name` AS `repo`," . "`repositories`.`is_on_master_mirror`," . + "`r_a`.`name` AS `repo_arch`," . "`architectures`.`name` AS `arch`," . "`binary_packages`.`pkgname`," . "IF(`binary_packages_in_repositories`.`is_to_be_deleted`,1,0) AS `is_to_be_deleted`" . @@ -277,6 +290,7 @@ require_once BASE . "/lib/style.php"; mysql_join_binary_packages_binary_packages_in_repositories() . mysql_join_binary_packages_in_repositories_repositories() . " AND `repositories`.`architecture`=`r`.`architecture`" . + mysql_join_repositories_architectures("","r_a") . " JOIN `repository_stability_relations` ON `repository_stability_relations`.`less_stable`=`repositories`.`stability`" . " AND `repository_stability_relations`.`more_stable`=" . $mysql_content["repo_stability"] . " WHERE `install_target_providers`.`package`=" . $mysql_content["id"] . @@ -321,6 +335,7 @@ require_once BASE . "/lib/style.php"; "`repositories`.`name` AS `repo`," . "`repositories`.`is_on_master_mirror`," . "`architectures`.`name` AS `arch`," . + "`r_a`.`name` AS `repo_arch`," . "CONCAT(" . "IF(`binary_packages`.`epoch`=\"0\",\"\",CONCAT(`binary_packages`.`epoch`,\":\"))," . "`binary_packages`.`pkgver`,\"-\"," . @@ -331,6 +346,7 @@ require_once BASE . "/lib/style.php"; mysql_join_binary_packages_architectures() . mysql_join_binary_packages_binary_packages_in_repositories() . mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_architectures("","r_a") . " JOIN `binary_packages` AS `original`" . " ON `binary_packages`.`pkgname`=`original`.`pkgname`" . " AND `binary_packages`.`id`!=`original`.`id`" . @@ -419,9 +435,8 @@ require_once BASE . "/lib/style.php"; ?> </li> <li> - <a href="http://pool.mirror.archlinux32.org/i686/<?php - // TODO: 'i686' -> $repo_arch - print $content["repo"]."/".$content["pkgname"]."-".$content["version"]."-".$content["arch"]; + <a href="http://pool.mirror.archlinux32.org/<?php + print $content["repo_arch"]."/".$content["repo"]."/".$content["pkgname"]."-".$content["version"]."-".$content["arch"]; ?>.pkg.tar.xz" rel="nofollow" title="Download <?php print $content["pkgname"]; ?> from mirror">Download From Mirror</a> </li> </ul> @@ -435,8 +450,7 @@ if (count($elsewhere)>0) { print " <ul>\n"; print " <li>\n"; if ($subst["is_on_master_mirror"]) { - print " <a href=\"/" . $subst["arch"] . "/" . $subst["repo"] . "/" . $subst["pkgname"] ."/\""; - // TODO: arch -> repo_arch + print " <a href=\"/" . $subst["repo_arch"] . "/" . $subst["repo"] . "/" . $subst["pkgname"] ."/\""; print " title=\"Package details for " . $subst["pkgname"] ."\">"; } if ($subst["is_to_be_deleted"]) @@ -468,7 +482,13 @@ if (count($elsewhere)>0) { Architecture: </th> <td> - <a href="/?arch=<?php print $content["arch"]; ?>" title="Browse packages for <?php print $content["arch"]; ?> architecture"><?php print $content["arch"]; ?></a> + <a href="/?arch=<?php + print $content["arch"]; + ?>" title="Browse packages for <?php + print $content["arch"]; + ?> architecture"><?php + print $content["arch"]; + ?></a> </td> </tr> <tr> @@ -476,7 +496,13 @@ if (count($elsewhere)>0) { Repository: </th> <td> - <a href="/?repo=<?php print $content["repo"]; ?>" title="Browse the <?php print $content["repo"]; ?> repository"><?php print $content["repo"]; ?></a> + <a href="/?repo=<?php + print urlencode($content["repo_arch"] . "/" . $content["repo"]); + ?>" title="Browse the <?php + print $content["repo_arch"] . "/" . $content["repo"]; + ?> repository"><?php + print $content["repo_arch"] . "/" . $content["repo"]; + ?></a> </td> </tr> <?php @@ -490,8 +516,8 @@ if ($count > 1 || $content["pkgname"] != $content["pkgbase"]) { foreach ($content["split_packages"] as $split_package) { print " "; if ($split_package["pkgname"] != $content["pkgname"]) { - print "<a href=\"/" . $split_package["repository"]; - print "/" . $split_package["repo_arch"]; + print "<a href=\"/" . $split_package["repo_arch"]; + print "/" . $split_package["repository"]; print "/" . $split_package["pkgname"]; print "/\">"; } @@ -602,8 +628,7 @@ if ($count > 1 || $content["pkgname"] != $content["pkgbase"]) { if (!$first) print ", "; $first = false; - print "<a href=\"/".$d_p["arch"]."/".$d_p["repo"]."/".$d_p["pkgname"]."/\" "; - // TODO: $repo -> $repo_arch + print "<a href=\"/".$d_p["repo_arch"]."/".$d_p["repo"]."/".$d_p["pkgname"]."/\" "; print "title=\"View package details for ".$d_p["pkgname"]."\">"; if ($d_p["is_to_be_deleted"]) print "<s>"; @@ -637,8 +662,7 @@ if ($count > 1 || $content["pkgname"] != $content["pkgbase"]) { if ($dep["install_target"] != $content["pkgname"]) print $dep["install_target"] . " ("; if ($dep["is_on_master_mirror"]=="1") { - print "<a href=\"/".$dep["arch"]."/".$dep["repo"]."/".$dep["pkgname"]."/\" "; - // TODO: $repo -> $repo_arch + print "<a href=\"/".$dep["repo_arch"]."/".$dep["repo"]."/".$dep["pkgname"]."/\" "; print "title=\"View package details for ".$dep["pkgname"]."\">"; } if ($dep["is_to_be_deleted"]) |