aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2018-06-04 00:47:10 -0400
committerB. Watson <yalhcru@gmail.com>2018-06-04 00:47:10 -0400
commit2c15da1b69f0211a93f6ff20f167aa71ffd504bb (patch)
treebeaf4944295e8e0e259ac2cc296c0fc3501af12f
parentc216fc408e49615c11066af3a0fcaa7d885c8f92 (diff)
downloadsbostuff-2c15da1b69f0211a93f6ff20f167aa71ffd504bb.tar.gz
sbosrcarch purge_mode fix, wip
-rwxr-xr-xsbosrcarch27
1 files changed, 18 insertions, 9 deletions
diff --git a/sbosrcarch b/sbosrcarch
index f5668cd..8810261 100755
--- a/sbosrcarch
+++ b/sbosrcarch
@@ -1199,16 +1199,24 @@ sub update_mode {
exit 0;
}
-# purge_mode() does 3 passes.
+# purge_mode() does 3 or 4 passes:
+
# 1. get all the filenames from all the info files, build hashes of filenames
# and md5sums that we want to keep.
-# 2. walk the archive tree with File::Find and rm any file that's (a) in a
-# category/name dir, but not mentioned in the filename hash, or (b) in a
+# 2. walk the archive tree with File::Find and rm any file that's in a
+# category/name dir, but not mentioned in the filename hash
+
+# If --rebuild not given:
+# 3. walk the archive tree with File::Find and rm any file that's in a
# by-md5 dir, but whose md5sum is not mentioned in the md5sum hash.
-# 3. do a trim_post() pass to delete any empty dirs and/or dangling symlinks
-# If --rebuild is given, pass 3 instead deletes the by-md5 tree and
-# recreates it.
-# If --fake is given, the 3 passes are all done, but nothing is deleted.
+# 4. do a trim_post() pass to delete any empty dirs and/or dangling symlinks
+
+# If --rebuild is given:
+# 3. delete the entire by-md5 tree and recreate it. should not be done on a
+# regular basis, only if something drastic happened to the by-md5 tree.
+
+# If --fake is given, the 4 passes are all done, but nothing is deleted. Not
+# possible to combine --rebuild and --fake!
sub purge_mode {
my $rebuild = 0;
@@ -1302,9 +1310,10 @@ sub purge_pass_3_wanted {
return unless defined $md5sum;
if($keep_md5sums{$md5sum}) {
- print "keep md5sum: $md5sum\n";
+ #print "keep md5sum: $md5sum\n";
} else {
- print "rmtree $_\n";
+ print "purge $_\n";
+ rmtree($_) unless $fake_purge;
}
}