summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-10-02 22:21:41 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-10-02 22:21:41 +0000
commitcf643b58650b5f839617deb64c86370ccfe113ef (patch)
tree2fa4672b2d11c4ae69bfeb74b0d8fd9b1c5bfad1 /Master
parent33db17ffed0b24fcb11209625538571dfdefcc9d (diff)
Fix reading ctan_path from the catalogue:
- handles multi-line ctan tag - with "" or '' as quotes - attributes in any order - no more sensitive to spurious spaces at EOL. git-svn-id: svn://tug.org/texlive/trunk@10830 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-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,