summaryrefslogtreecommitdiff
path: root/Master/tlpkg/libexec/ctan2tds
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/libexec/ctan2tds')
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds28
1 files changed, 24 insertions, 4 deletions
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index add8c4f5444..1bcaf1478d1 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -2070,29 +2070,45 @@ sub runjob
# if MORE is true, remove additional files matching something in
# $moreclean and create a README.TEXLIVE which lists the removed files.
#
-# This only deletes files in the current directory. Should fix.
+# As a kludge created for rangen, if KILLPATT starts with a directory
+# path (e.g., doc/), we cd to that directory before globbing (and cd
+# back at the end).
+#
+# (Switching all the kill patterns to globs, so we could just use the
+# glob function, seemed too ugly. And removing the file in a posthook
+# would have meant a separate fn for README.TEXLIVE, also ugly.)
#
sub killfiles
{
my ($killpatt,$more) = @_;
+ print "killfiles($killpatt,$more)\n";
+ return unless $killpatt;
+
+ # cd to a leading directory name in KILLPATT.
+ my $origdir = "";
+ if ($killpatt =~ m,^(.*)/,,) {
+ chomp ($origdir = `pwd`);
+ &xchdir ($1);
+ $killpatt =~ s,^$1/,,;
+ }
+
local *DOT;
opendir (DOT, ".") || die "opendir(.) failed: $! in " . `pwd`;
my @delfiles = ();
for (grep (/$killpatt/, readdir (DOT))) {
- print "\t Removing $_\n";
if (unlink ($_)) {
+ print "\t Removing $_\n";
push (@delfiles, $_);
} else {
warn "unlink($_) failed: $!";
}
}
-
for (grep (/\.ps$/, @filenames)) {
(my $pdf = $_) =~ s/ps$/pdf/;
next unless grep (/$pdf/, @filenames);
- print "\t Remove ps $_ (since have $pdf)\n";
+ print "\t Removing ps $_ (since have $pdf)\n";
unlink ($_) && push (@delfiles, $_);
}
@@ -2111,6 +2127,10 @@ EOF
}
close RTL;
}
+
+ # if we cd'd, cd back.
+ &xchdir ($origdir) if $origdir;
+
&buildfilelist();
}