[subversion-commit] SVN tetex-base commit + diffs: r1100 - tetex-base/trunk/debian

Frank Küster frank at costa.debian.org
Thu Mar 23 13:04:29 UTC 2006


Author: frank
Date: 2006-03-23 13:04:27 +0000 (Thu, 23 Mar 2006)
New Revision: 1100

Added:
   tetex-base/trunk/debian/tpm2license.cfg
Modified:
   tetex-base/trunk/debian/tpm2licenses-new.pl
Log:
tpm2licenses-new.pl now reads a configuration file!

Added: tetex-base/trunk/debian/tpm2license.cfg
===================================================================
--- tetex-base/trunk/debian/tpm2license.cfg	2006-03-23 13:03:53 UTC (rev 1099)
+++ tetex-base/trunk/debian/tpm2license.cfg	2006-03-23 13:04:27 UTC (rev 1100)
@@ -0,0 +1,2 @@
+Catalogue = /home/frank/src/Upstream-source/texcatalogue
+Master = /home/frank/src/Packages/texlive/texlive/LocalTPM

Modified: tetex-base/trunk/debian/tpm2licenses-new.pl
===================================================================
--- tetex-base/trunk/debian/tpm2licenses-new.pl	2006-03-23 13:03:53 UTC (rev 1099)
+++ tetex-base/trunk/debian/tpm2licenses-new.pl	2006-03-23 13:04:27 UTC (rev 1100)
@@ -22,12 +22,12 @@
 
 use strict;
 use Data::Dumper;
-use Getopt::Long;
+#use Getopt::Long;
 use File::Basename;
 use File::Copy;
 use File::Path;
 use File::Temp qw/ tempfile tempdir /;
-use Config::General;
+use AppConfig;
 #use XML::DOM;
 use Cwd;
 #use FileUtils qw(canon_dir cleandir make_link newpath member
@@ -36,53 +36,30 @@
 #use Tpm;
 
 
-# $opt_debug=0; # unused
-my $Master=".";
-my $Catalogue="/src/TeX/texcatalogue/";
-my $what="license";
-my $debian_package = "";
-my $tpmdir = "./debian/tpm";
-my $nocatalogue = '';
+# initialize AppConfig
+my $config = AppConfig->new("master=s", "catalogue=s", "nocheckcatalogue", "tpmdir=s", "package=s", "what=s");
 
 # parse configurationfile, if present
 my @cfgDirs = (".","./debian","..","~");
 my $cfgName = "tpm2license.cfg";
-my %Option;
 
 for my $cfgDir (@cfgDirs) {
     if ( -r "$cfgDir/$cfgName" ) {
 	print "Using configuration file $cfgDir/$cfgName\n";
-	my $conf = new Config::General("$cfgDir/$cfgName");
-	my %LocalCfgHash = $conf->getall;
-	foreach (keys %LocalCfgHash) {
-	    $Option{$_} = $LocalCfgHash{$_};
-	};
+	$config->file("$cfgDir/$cfgName");
     };
 };
+# now parse commandline
+$config->getopt();
 
-my @CmdLineOptionsList = ("Master", "Catalogue", "what", "debian_package", "tpmdir", "nocatalogue");
+# assign conffile, commandline or default values:
+my $Master = $config->master() ? $config->master() : "." ;
+my $Catalogue = $config->catalogue() ? $config->catalogue() : "/src/TeX/texcatalogue/" ;
+my $what = $config->what() ? $config->what() : "files";
+my $debian_package = $config->package() ? $config->package() : "tetex-base";
+my $tpmdir = $config->tpmdir() ? $config->tpmdir() : "./debian/tpm";
+my $nocatalogue = $config->nocheckcatalogue() ? $config->nocheckcatalogue() : '';
 
-foreach my $CurrentOption (@CmdLineOptionsList) {
-    if ($Option{$CurrentOption}){print "$Option{$CurrentOption}\n"};
-}
-
-# print Dumper %Option;
-
-exit 0; 
-
-GetOptions ("debug!", 	# debug mode
-	"master=s" => \$Master,	# location of Master
-	"catalogue=s" => \$Catalogue,	# location of the catalogue
-	"what=s" => \$what,      # print licenses or files in a tpm?
-	"debian=s" => \$debian_package, # tetex-base: print RunFiles, DocFiles; -src: SourceFiles, texlive: To be implemented.
-        "tpmdir=s" => \$tpmdir, # directory with tpm's (for teTeX)
-	"nocatalogue" => \$nocatalogue # list files even if no catalogue entry is found
-	);
-
-
-
-
-
 # if (!($opt_master =~ m,/.*$,,)) {
 #     $Master = `pwd`;
 #     chomp($Master);
@@ -106,8 +83,12 @@
 # my $TpmDirGlob = $Master . "./texmf-dist/tpm/*.tpm";
 # teTeX
 my $TpmDirGlob = "$tpmdir/*.tpm";
-my $sourceDir = "/home/frank/src/Packages/tetex-src/tetex-src-3.0/";
 
+# only needed if we're in the sourcedir, so no need to bother
+my $sourceDir;
+chomp( $sourceDir = `pwd`); 
+$sourceDir .= "/";
+
 #
 # put Master/Tools/ into the include path to find TeX live perl modules
 #
@@ -179,7 +160,6 @@
 
 sub list_licenses {
    foreach $LocalTPM (<$TpmDirGlob >) {
-#     foreach $LocalTPM (</home/frank/src/Packages/texlive/texlive/LocalTPM/texmf-dist/tpm/*.tpm>) {
       $licline = "";
       $bn = &basename($LocalTPM,".tpm");
       if (defined($Tpm2Catalogue{$bn})) {
@@ -227,6 +207,8 @@
 		  $printfiles = '1';
 	      }
 	  } else {
+	      $version ||= ''; # make sure we have no uninitialized string values
+	      $lversion ||= '';
 	      $licline .= "$ltype (verification data:$version:$lversion:$lchecked:$luser:$lfile)";
 	      $printfiles = '1';
 	  }




More information about the Pkg-tetex-commits mailing list