summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tlpkginfo
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/bin/tlpkginfo')
-rwxr-xr-xMaster/tlpkg/bin/tlpkginfo16
1 files changed, 11 insertions, 5 deletions
diff --git a/Master/tlpkg/bin/tlpkginfo b/Master/tlpkg/bin/tlpkginfo
index bea17cd6590..9aa0f34412e 100755
--- a/Master/tlpkg/bin/tlpkginfo
+++ b/Master/tlpkg/bin/tlpkginfo
@@ -187,14 +187,20 @@ sub catalogue_find_ctan_path
my $catfile = "$CATALOGUE/$firstchar/$pkgname.xml";
return undef unless -r $catfile;
- # get the raw line from the catalogue file. (let's hope it's one line.)
- my $ctan_path = `sed -n "s,^ *<ctan path='/,,p" $catfile`;
+ # get the raw tag from the catalogue file.
+ open CATFILE, '<', $catfile or die "Cannot read $catfile: $!\nFix me!\n";
+ while ($ctan_path = <CATFILE>) { last if $ctan_path =~ /<ctan / }
+ do { close CATFILE; return undef } unless $ctan_path; # the tag may not exist
+ $ctan_path .= $_ while (($ctan_path !~ m#/>#) and (<CATFILE>));
+ close CATFILE;
+ $ctan_path =~ s/\n/ /g;
+ ($ctan_path) = ($ctan_path =~ m#(<.*?/>)#);
return undef unless $ctan_path; # in case it's not present at all
# extract just the dir or file name, without options, etc.
- (my $ctan_loc = $ctan_path) =~ s,'/>,,;
- $ctan_loc =~ s,' .*,,;
- chomp ($ctan_loc);
+ $ctan_path =~ m#path=(["'])/(.*?)\1#;
+ $ctan_loc = $2;
+ return undef unless $ctan_loc; # should never happen, but who knows
# if the Catalogue lists the path as a single file, there are two
# possibilities: (1) it really is a single file, e.g., texilikecover,