From 9a79d2105e2dea9876883da65a00d245d475bed2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 9 Aug 2011 17:01:13 -0500 Subject: Segment the upload directory by package name prefix This implements the following scheme: * /packages/cower/ --> /packages/co/cower/ * /packages/j/ --> /packages/j/j/ * /packages/zqy/ --> /packages/zq/zqy/ We take up to the first two characters of each package name as a intermediate subdirectory, and then the full package name lives underneath that. Shorter named packages live in a single letter directory. Why, you ask? Well because earlier today the AUR hit 32,000 entries in the unsupported/ directory, making new package uploads impossible. While some might argue we shouldn't have so many damn packages in the repos, we should be able to handle this case. Why two characters instead of one? Our two biggest two-char groups, 'pe' and 'py', both start with 'p', and have nearly 2000 packages each. Go Python and Perl. Still needed is a "move the existing data" script, as well as a set of rewrite rules for those wishing to preserve backward compatible URLs for any helper programs doing the wrong thing and relying on them. Signed-off-by: Dan McGee Signed-off-by: Lukas Fleischer --- web/html/pkgsubmit.php | 7 ++++--- web/lib/aurjson.class.php | 2 +- web/template/pkg_details.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'web') diff --git a/web/html/pkgsubmit.php b/web/html/pkgsubmit.php index 793f8ca8..d21e6ae3 100644 --- a/web/html/pkgsubmit.php +++ b/web/html/pkgsubmit.php @@ -256,7 +256,7 @@ if ($uid): } if (isset($pkg_name)) { - $incoming_pkgdir = INCOMING_DIR . $pkg_name; + $incoming_pkgdir = INCOMING_DIR . substr($pkg_name, 0, 2) . "/" . $pkg_name; } if (!$error) { @@ -268,7 +268,8 @@ if ($uid): rm_tree($incoming_pkgdir); } - if (!@mkdir($incoming_pkgdir)) { + # The mode is masked by the current umask, so not as scary as it looks + if (!mkdir($incoming_pkgdir, 0777, true)) { $error = __( "Could not create directory %s.", $incoming_pkgdir); } } else { @@ -286,7 +287,7 @@ if ($uid): } if (!$error) { - if (!@chdir($incoming_pkgdir)) { + if (!chdir($incoming_pkgdir)) { $error = __("Could not change directory to %s.", $incoming_pkgdir); } diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index 5d15b890..277c824e 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -125,7 +125,7 @@ class AurJSON { $search_data = array(); while ( $row = mysql_fetch_assoc($result) ) { $name = $row['Name']; - $row['URLPath'] = URL_DIR . $name . "/" . $name . ".tar.gz"; + $row['URLPath'] = URL_DIR . substr($name, 0, 2) . "/" . $name . "/" . $name . ".tar.gz"; if ($type == 'info') { $search_data = $row; diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 06580639..52391232 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -90,7 +90,7 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[

".__("Tarball")." :: "; print "".__("PKGBUILD").""; -- cgit v1.2.3-24-g4f1b