summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-10 00:01:13 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2011-08-10 14:34:07 +0200
commit9a79d2105e2dea9876883da65a00d245d475bed2 (patch)
tree3ae0b4d6e98d2b83b78df183929a8d6a386e96f1 /scripts
parent1f79258e81207829c59f4a8fa4d44a32683e2a77 (diff)
downloadaur-9a79d2105e2dea9876883da65a00d245d475bed2.tar.gz
aur-9a79d2105e2dea9876883da65a00d245d475bed2.tar.xz
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>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/cleanup23
1 files changed, 15 insertions, 8 deletions
diff --git a/scripts/cleanup b/scripts/cleanup
index f2873501..d3ba3f9e 100755
--- a/scripts/cleanup
+++ b/scripts/cleanup
@@ -22,16 +22,23 @@ include("pkgfuncs.inc.php");
$count = 0;
-$files = scandir(INCOMING_DIR);
-foreach ($files as $pkgname) {
- if ($pkgname == '.' || $pkgname == '..') {
+$buckets = scandir(INCOMING_DIR);
+foreach ($buckets as $bucket) {
+ $bucketpath = INCOMING_DIR . $bucket;
+ if ($bucket == '.' || $bucket == '..' || !is_dir($bucketpath)) {
continue;
}
- $fullpath = INCOMING_DIR . $pkgname;
- if (!package_exists($pkgname) && is_dir($fullpath)) {
- echo 'Removing ' . $fullpath . "\n";
- rm_tree($fullpath);
- $count++;
+ $files = scandir(INCOMING_DIR . $bucket);
+ foreach ($files as $pkgname) {
+ if ($pkgname == '.' || $pkgname == '..') {
+ continue;
+ }
+ $fullpath = INCOMING_DIR . $bucket . "/" . $pkgname;
+ if (!package_exists($pkgname) && is_dir($fullpath)) {
+ echo 'Removing ' . $fullpath . "\n";
+ rm_tree($fullpath);
+ $count++;
+ }
}
}