summaryrefslogtreecommitdiff
path: root/Master/texmf
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-06-06 17:09:55 +0000
committerNorbert Preining <preining@logic.at>2009-06-06 17:09:55 +0000
commite08ed8299a4973061c37dd704f8bdbd7db8c8fce (patch)
treee28c32550c6e728aecd08ab5b26ce7d45909b4c2 /Master/texmf
parent8b4b86d3c266463d7516622d3709b04f5e60ba65 (diff)
move the removed_dirs to TLUtils, and use it in TLMedia
git-svn-id: svn://tug.org/texlive/trunk@13646 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl71
1 files changed, 0 insertions, 71 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 26b4d2dcc6b..0c21efda53b 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -2671,77 +2671,6 @@ sub check_for_critical_updates
}
-# return all the directories from which all content will be removed
-#
-# idea:
-# - create a hashes by_dir listing all files that should be removed
-# by directory, i.e., key = dir, value is list of files
-# - for each of the dirs (keys of by_dir and ordered deepest first)
-# check that all actually contained files are removed
-# and all the contained dirs are in the removal list. If this is the
-# case put that directory into the removal list
-# - return this removal list
-#
-sub removed_dirs
-{
- my (@files) = @_;
- my %removed_dirs;
- my %by_dir;
-
- # construct hash of all directories mentioned, values are lists of the
- # files/dirs in that directory.
- for my $f (@files) {
- # what should we do with not existing entries????
- next if (! -r "$f");
- my $abs_f = abs_path ($f);
- if (!$abs_f) {
- warn ("oops, no abs_path($f) from " . `pwd`);
- next;
- }
- (my $d = $abs_f) =~ s,/[^/]*$,,;
- my @a = exists $by_dir{$d} ? @{$by_dir{$d}} : ();
- push (@a, $abs_f);
- $by_dir{$d} = \@a;
- }
-
- # for each of our directories, see if we are removing everything in
- # the directory. if so, return the directory; else return the
- # individual files.
- for my $d (reverse sort keys %by_dir) {
- opendir (DIR, $d) || die "opendir($d) failed: $!";
- my @dirents = readdir (DIR);
- closedir (DIR) || warn "closedir($d) failed: $!";
-
- # initialize test hash with all the files we saw in this dir.
- # (These idioms are due to "Finding Elements in One Array and Not
- # Another" in the Perl Cookbook.)
- my %seen;
- my @rmfiles = @{$by_dir{$d}};
- @seen{@rmfiles} = ();
-
- # see if everything is the same.
- my $cleandir = 1;
- for my $dirent (@dirents) {
- next if $dirent =~ /^\.(\.|svn)?$/; # ignore . .. .svn
- my $item = "$d/$dirent"; # prepend directory for comparison
- if (
- ((-d $item) && (defined($removed_dirs{$item})))
- ||
- (exists $seen{$item})
- ) {
- # do nothing
- } else {
- $cleandir = 0;
- last;
- }
- }
- if ($cleandir) {
- $removed_dirs{$d} = 1;
- }
- }
- return keys %removed_dirs;
-}
-
__END__
=head1 NAME