[tex-live] license info from catalogue to TL

Norbert Preining preining at logic.at
Wed Jun 7 19:27:31 CEST 2006


Hi Karl!

On Die, 06 Jun 2006, Karl Berry wrote:
> I recall that you (and/or Frank) put together a script last year which
> pushed license information from the Catalogue into the TL TPM files.  I
> asked you to hold off actually running it on the master files at that
> point since it was close to the release.  
> 
> So now is the time to actually instate it ... and this means a change to
> the DTD, right?

I made some changes to the Tpm.pm module to actually save this, the
changes are minimal, I include them here. If you agree I (or you) check
them in.

In fact we are not using them anymore, because we wrote some scripts to
use the texcatalogue automatically for tpm files, so to say separatng
this out. 

Furthermore, we have extended the license information in the Catalogue.
A typical entry now looks like:
In abstract.xml:

<license type='lppl' version='1.1' checked='2006-02-08' username='norbusan'/>

which means that the abstract package in version 1.1  is of lppl, and the
user norbusan (me) has checked this on checked='2006-02-08

The full dtd entry for license in the catalogue is now:
<!ELEMENT license (#PCDATA)>
<!ATTLIST license 
  type (artistic|bsd|dfsg|fdl|gfsl|gpl|gpl2|gpl3|knuth
       |lgpl|lppl|lppl1.2|lppl1.3|gfsl|nocommercial
       |nosell|nosource|opl|other|pd|shareware|unknown) "unknown"
  checked  CDATA #IMPLIED
  username CDATA #IMPLIED
  version  CDATA #IMPLIED
  file     CDATA #IMPLIED>


licence	type of license
checked	date of check
version	version of the package checked
username	who checked
file	where is the license information

Up to now only Frank and me have checked licenses and slowly adding
these information to the TeX Catalogue. It is a pain, but well ...

The patch I did did only read the license field and wrote it into the
tpm file, so either we extend this patch to copy everything, or we take
the patch as is.

Here is the patch with some comments. Please tell me how we should
continue? Extending the patch to get all the information into the tpm
file (will it work?), or...?

(patch is also attached)


--- /usr/TeX/texlive-src/Master/Tools/Tpm.pm	2005-11-19 20:49:53.000000000 +0100
+++ ./Tpm.pm	2005-11-19 20:53:07.000000000 +0100


The first block is only here to define a mapping from TeX live tpm names
to Catalogue entries. It is incomplete, I started once and continued a
bit, more should be added here.

@@ -146,6 +146,49 @@
 my $CatalogueDir = "${MasterDir}/texmf-doc/doc/english/catalogue";
 my $Catalogue;
 
+#
+# missing entries
+# ? bengali:pandey
+# ? grotesq:urwvf
+# ? helvetic:urwvf
+# ? knuthotherfonts:halftone
+# makedtx:makedtx not working!
+# ? oberdiek:twoopt, tabularht, tabularkv, settobox, refcount, alphalph, chemarr, classlist, dvipscol, engord, hypbmsec, hypcap, ifdraft, ifpdf, ifvtexm pagesel, pdfcolmk pdfcrypt, pdflscape (somehing missing???)
+my %Tpm2Catalogue = (
+	"ctib" => "ctib4tex",
+	"CJK" => "cjk",
+	"bayer" => "universa",
+	"bigfoot" => "suffix",
+	"cb" => "cbgreek",
+	"cd-cover" => "cdcover",
+	"cmex" => "cmextra",
+	"cs" => "csfonts", 
+	"cyrplain" => "t2",
+	"devanagr" => "devanagari",
+	"eCards" => "ecards",
+	"ESIEEcv" => "esieecv",
+	"euclide" => "pst-eucl",
+	"GuIT" => "guit",
+	"HA-prosper" => "prosper",
+	"ibycus" => "ibycus4",
+	"ibygrk" => "ibycus4",
+	"IEEEconf" => "ieeeconf",
+	"IEEEtran" => "ieeetran",
+	"iso" => "isostds",
+	"iso10303" => "isostds",
+	"jknapltx" => "jknappen",
+	"kastrup" => "binhex",
+	"le" => "frenchle",
+	"mathtime" => "mathtime-ltx",
+	"omega-devanagari" => "devanagari-omega",
+	"pdftexdef" => "pdftex-def",
+	"procIAGssymp" => "prociagssymp",
+	"resume" => "res",
+	"SIstyle" => "sistyle",
+	"SIunits" => "siunits",
+	"syntax" => "syntax2",
+	"Tabbing" => "tabbing" );
+
 my $Verbose = 0;
 
 sub reverse_hash {

The second block is only to get rid of a warning (AFAIR).

@@ -188,7 +231,10 @@
   my ($doc, $f) = @_;
 
   my %s = getTextField($doc, $f);
-  $str = $s{"text"};
+  my $str = "";
+  if (defined($s{"text"})) {
+    $str = $s{"text"};
+  }
   $str =~ s/^\n*//;
   $str =~ s/\n*$//;
   $str =~ s/\n/ /gomsx;

Everything is already prepared, just add the License tpm field for
recreation

@@ -413,7 +459,7 @@
   }
 
   for my $tag ("Name", "Type", "Date", "Version", "Creator", "Title",
-               "Description", "Author", "Size") { 
+               "Description", "Author", "Size", "License") { 
     my $attribute = $self->getAttribute("$tag");
     # None of these are optional
     $node = $doc->createElement("TPM:$tag");

There was a FIXME about Catalogue name versus package name, I solved
this via the above array, if one wants a different approach, you are
welcome!

@@ -1107,11 +1153,14 @@
   my $pkgname = $self->getAttribute("Name");
   $pkgname =~ s/^(bin-|lib-|tex-)//;
 
-  # FIXME : we should handle several cases where the Catalogue name
-  # is not the package name...
-  print STDERR "Looking for $pkgname in the Catalogue.\n" if $Verbose;
-  my $fletter = substr($pkgname, 0, 1);
-  my $catname = "${CatalogueDir}/entries/$fletter/${pkgname}.xml"; 
+  if (defined($Tpm2Catalogue{$pkgname})) {
+    $pkgcat = $Tpm2Catalogue{$pkgname};
+  } else {
+    $pkgcat = $pkgname;
+  }
+  print STDERR "Looking for $pkgname (as $pkgcat) in the Catalogue.\n" if $Verbose;
+  my $fletter = substr($pkgcat, 0, 1);
+  my $catname = "${CatalogueDir}/entries/$fletter/${pkgcat}.xml"; 
   return if (! -f $catname);
 #  print "catname = $catname\n";
   my $parser = new XML::DOM::Parser;

Writing the license is just a copy of the other lines.

@@ -1155,6 +1204,7 @@
   my $old_version = &trim($self->getAttribute("Version"));
   my $old_title = &trim($self->getAttribute("Title"));
   my $old_description = &trim($self->getAttribute("Description"));
+  my $old_license = &trim($self->getAttribute("License"));
 
   if ($author && $author ne $old_author) {
     $self->setAttribute("Author", $author);
@@ -1172,6 +1222,10 @@
     $self->setAttribute("Description", $description);
     print "Replacing $old_description by $description\n";
   }
+  if ($license && ($license ne $old_license)) {
+    $self->setAttribute("License", $license);
+    print "Replacing $old_license by $license\n";
+  }
 }
 
 sub buildPatternsPackage {

And the tpm.dtd has to be changed.

--- /usr/TeX/texlive-src/Master/Tools/tpm.dtd	2005-10-12 00:07:28.000000000 +0200
+++ ./tpm.dtd	2005-11-19 20:46:58.000000000 +0100
@@ -20,6 +20,7 @@
 <!ELEMENT TPM:Type (#PCDATA)>
 <!ELEMENT TPM:Date (#PCDATA)>
 <!ELEMENT TPM:Version (#PCDATA)>
+<!ELEMENT TPM:License (#PCDATA)>
 <!ELEMENT TPM:Creator (#PCDATA)>
 <!ELEMENT TPM:Author (#PCDATA)>
 <!ELEMENT TPM:Requires (TPM:Documentation*,TPM:Package*,TPM:TLCore*,TPM:Collection*,TPM:Support*)>



Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining AT logic DOT at>             Università di Siena
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
DES MOINES (pl.n.)
The two little lines which come down from your nose.
			--- Douglas Adams, The Meaning of Liff
-------------- next part --------------
--- /usr/TeX/texlive-src/Master/Tools/Tpm.pm	2005-11-19 20:49:53.000000000 +0100
+++ ./Tpm.pm	2005-11-19 20:53:07.000000000 +0100
@@ -146,6 +146,49 @@
 my $CatalogueDir = "${MasterDir}/texmf-doc/doc/english/catalogue";
 my $Catalogue;
 
+#
+# missing entries
+# ? bengali:pandey
+# ? grotesq:urwvf
+# ? helvetic:urwvf
+# ? knuthotherfonts:halftone
+# makedtx:makedtx not working!
+# ? oberdiek:twoopt, tabularht, tabularkv, settobox, refcount, alphalph, chemarr, classlist, dvipscol, engord, hypbmsec, hypcap, ifdraft, ifpdf, ifvtexm pagesel, pdfcolmk pdfcrypt, pdflscape (somehing missing???)
+my %Tpm2Catalogue = (
+	"ctib" => "ctib4tex",
+	"CJK" => "cjk",
+	"bayer" => "universa",
+	"bigfoot" => "suffix",
+	"cb" => "cbgreek",
+	"cd-cover" => "cdcover",
+	"cmex" => "cmextra",
+	"cs" => "csfonts", 
+	"cyrplain" => "t2",
+	"devanagr" => "devanagari",
+	"eCards" => "ecards",
+	"ESIEEcv" => "esieecv",
+	"euclide" => "pst-eucl",
+	"GuIT" => "guit",
+	"HA-prosper" => "prosper",
+	"ibycus" => "ibycus4",
+	"ibygrk" => "ibycus4",
+	"IEEEconf" => "ieeeconf",
+	"IEEEtran" => "ieeetran",
+	"iso" => "isostds",
+	"iso10303" => "isostds",
+	"jknapltx" => "jknappen",
+	"kastrup" => "binhex",
+	"le" => "frenchle",
+	"mathtime" => "mathtime-ltx",
+	"omega-devanagari" => "devanagari-omega",
+	"pdftexdef" => "pdftex-def",
+	"procIAGssymp" => "prociagssymp",
+	"resume" => "res",
+	"SIstyle" => "sistyle",
+	"SIunits" => "siunits",
+	"syntax" => "syntax2",
+	"Tabbing" => "tabbing" );
+
 my $Verbose = 0;
 
 sub reverse_hash {
@@ -188,7 +231,10 @@
   my ($doc, $f) = @_;
 
   my %s = getTextField($doc, $f);
-  $str = $s{"text"};
+  my $str = "";
+  if (defined($s{"text"})) {
+    $str = $s{"text"};
+  }
   $str =~ s/^\n*//;
   $str =~ s/\n*$//;
   $str =~ s/\n/ /gomsx;
@@ -413,7 +459,7 @@
   }
 
   for my $tag ("Name", "Type", "Date", "Version", "Creator", "Title",
-               "Description", "Author", "Size") { 
+               "Description", "Author", "Size", "License") { 
     my $attribute = $self->getAttribute("$tag");
     # None of these are optional
     $node = $doc->createElement("TPM:$tag");
@@ -1107,11 +1153,14 @@
   my $pkgname = $self->getAttribute("Name");
   $pkgname =~ s/^(bin-|lib-|tex-)//;
 
-  # FIXME : we should handle several cases where the Catalogue name
-  # is not the package name...
-  print STDERR "Looking for $pkgname in the Catalogue.\n" if $Verbose;
-  my $fletter = substr($pkgname, 0, 1);
-  my $catname = "${CatalogueDir}/entries/$fletter/${pkgname}.xml"; 
+  if (defined($Tpm2Catalogue{$pkgname})) {
+    $pkgcat = $Tpm2Catalogue{$pkgname};
+  } else {
+    $pkgcat = $pkgname;
+  }
+  print STDERR "Looking for $pkgname (as $pkgcat) in the Catalogue.\n" if $Verbose;
+  my $fletter = substr($pkgcat, 0, 1);
+  my $catname = "${CatalogueDir}/entries/$fletter/${pkgcat}.xml"; 
   return if (! -f $catname);
 #  print "catname = $catname\n";
   my $parser = new XML::DOM::Parser;
@@ -1155,6 +1204,7 @@
   my $old_version = &trim($self->getAttribute("Version"));
   my $old_title = &trim($self->getAttribute("Title"));
   my $old_description = &trim($self->getAttribute("Description"));
+  my $old_license = &trim($self->getAttribute("License"));
 
   if ($author && $author ne $old_author) {
     $self->setAttribute("Author", $author);
@@ -1172,6 +1222,10 @@
     $self->setAttribute("Description", $description);
     print "Replacing $old_description by $description\n";
   }
+  if ($license && ($license ne $old_license)) {
+    $self->setAttribute("License", $license);
+    print "Replacing $old_license by $license\n";
+  }
 }
 
 sub buildPatternsPackage {
--- /usr/TeX/texlive-src/Master/Tools/tpm.dtd	2005-10-12 00:07:28.000000000 +0200
+++ ./tpm.dtd	2005-11-19 20:46:58.000000000 +0100
@@ -20,6 +20,7 @@
 <!ELEMENT TPM:Type (#PCDATA)>
 <!ELEMENT TPM:Date (#PCDATA)>
 <!ELEMENT TPM:Version (#PCDATA)>
+<!ELEMENT TPM:License (#PCDATA)>
 <!ELEMENT TPM:Creator (#PCDATA)>
 <!ELEMENT TPM:Author (#PCDATA)>
 <!ELEMENT TPM:Requires (TPM:Documentation*,TPM:Package*,TPM:TLCore*,TPM:Collection*,TPM:Support*)>


More information about the tex-live mailing list