mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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 <dan@archlinux.org> Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
1f79258e81
commit
9a79d2105e
4 changed files with 21 additions and 13 deletions
|
@ -22,17 +22,24 @@ include("pkgfuncs.inc.php");
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
$files = scandir(INCOMING_DIR);
|
$buckets = scandir(INCOMING_DIR);
|
||||||
foreach ($files as $pkgname) {
|
foreach ($buckets as $bucket) {
|
||||||
|
$bucketpath = INCOMING_DIR . $bucket;
|
||||||
|
if ($bucket == '.' || $bucket == '..' || !is_dir($bucketpath)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$files = scandir(INCOMING_DIR . $bucket);
|
||||||
|
foreach ($files as $pkgname) {
|
||||||
if ($pkgname == '.' || $pkgname == '..') {
|
if ($pkgname == '.' || $pkgname == '..') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$fullpath = INCOMING_DIR . $pkgname;
|
$fullpath = INCOMING_DIR . $bucket . "/" . $pkgname;
|
||||||
if (!package_exists($pkgname) && is_dir($fullpath)) {
|
if (!package_exists($pkgname) && is_dir($fullpath)) {
|
||||||
echo 'Removing ' . $fullpath . "\n";
|
echo 'Removing ' . $fullpath . "\n";
|
||||||
rm_tree($fullpath);
|
rm_tree($fullpath);
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "\nRemoved $count directories.\n";
|
echo "\nRemoved $count directories.\n";
|
||||||
|
|
|
@ -256,7 +256,7 @@ if ($uid):
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($pkg_name)) {
|
if (isset($pkg_name)) {
|
||||||
$incoming_pkgdir = INCOMING_DIR . $pkg_name;
|
$incoming_pkgdir = INCOMING_DIR . substr($pkg_name, 0, 2) . "/" . $pkg_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
@ -268,7 +268,8 @@ if ($uid):
|
||||||
rm_tree($incoming_pkgdir);
|
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);
|
$error = __( "Could not create directory %s.", $incoming_pkgdir);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -286,7 +287,7 @@ if ($uid):
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (!@chdir($incoming_pkgdir)) {
|
if (!chdir($incoming_pkgdir)) {
|
||||||
$error = __("Could not change directory to %s.", $incoming_pkgdir);
|
$error = __("Could not change directory to %s.", $incoming_pkgdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ class AurJSON {
|
||||||
$search_data = array();
|
$search_data = array();
|
||||||
while ( $row = mysql_fetch_assoc($result) ) {
|
while ( $row = mysql_fetch_assoc($result) ) {
|
||||||
$name = $row['Name'];
|
$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') {
|
if ($type == 'info') {
|
||||||
$search_data = $row;
|
$search_data = $row;
|
||||||
|
|
|
@ -90,7 +90,7 @@ $out_of_date_time = ($row["OutOfDateTS"] == 0) ? $msg : gmdate("r", intval($row[
|
||||||
|
|
||||||
<p><span class='f3'>
|
<p><span class='f3'>
|
||||||
<?php
|
<?php
|
||||||
$urlpath = URL_DIR . $row['Name'];
|
$urlpath = URL_DIR . substr($row['Name'], 0, 2) . "/" . $row['Name'];
|
||||||
print "<a href='$urlpath/" . $row['Name'] . ".tar.gz'>".__("Tarball")."</a> :: ";
|
print "<a href='$urlpath/" . $row['Name'] . ".tar.gz'>".__("Tarball")."</a> :: ";
|
||||||
print "<a href='$urlpath/PKGBUILD'>".__("PKGBUILD")."</a></span>";
|
print "<a href='$urlpath/PKGBUILD'>".__("PKGBUILD")."</a></span>";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue