diff options
author | Loui Chang <louipc.ist@gmail.com> | 2008-11-20 06:01:59 +0100 |
---|---|---|
committer | Loui Chang <louipc.ist@gmail.com> | 2008-11-21 19:52:04 +0100 |
commit | 8d80ff50af614cec78cf667a492c29f85f8f9343 (patch) | |
tree | 1aac75113fece92f62adfa9ecd5b8ffd970ce137 | |
parent | 36ed3ff201c10591b4bcb5aa5116cdd2b06901af (diff) | |
download | aur-8d80ff50af614cec78cf667a492c29f85f8f9343.tar.gz aur-8d80ff50af614cec78cf667a492c29f85f8f9343.tar.xz |
Add a script to clean up files of deleted unsupported packages.
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
-rwxr-xr-x | scripts/cleanup | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/cleanup b/scripts/cleanup new file mode 100755 index 00000000..4fc9ea2d --- /dev/null +++ b/scripts/cleanup @@ -0,0 +1,36 @@ +#!/usr/bin/php +<?php +# Run this script by providing it with the top path of AUR. +# In that path you should see a file lib/aur.inc +# +# This will remove files which belong to deleted packages +# in unsupported. +# +# ex: php cleanup dev/aur/web +# +$dir = $argv[1]; + +if (empty($dir)) { + echo "Please specify AUR directory.\n"; + exit; +} + +set_include_path(get_include_path() . PATH_SEPARATOR . "$dir/lib"); +include("config.inc"); +include("aur.inc"); +include("pkgfuncs.inc"); + +exec('ls ' . INCOMING_DIR, $files); + +$count = 0; + +foreach ($files as $pkgname) { + if (!package_exists($pkgname)) { + echo 'Removing ' . INCOMING_DIR . "$pkgname\n"; + system('rm -r ' . INCOMING_DIR . $pkgname); + $count++; + } +} + +echo "\nRemoved $count directories.\n"; + |