[subversion-commit] SVN tex-common commit + diffs: r1246 - tex-common/trunk/scripts

Frank Küster frank at costa.debian.org
Wed Apr 26 10:50:38 UTC 2006


Author: frank
Date: 2006-04-26 10:50:38 +0000 (Wed, 26 Apr 2006)
New Revision: 1246

Modified:
   tex-common/trunk/scripts/tpm2licenses
Log:
all subroutines were defined *within* the list_files subroutine.  They
are now defined outside (one curly brace has been moved lots of lines
up), and reindented (which makes up for all other changes in this big
diff)


Modified: tex-common/trunk/scripts/tpm2licenses
===================================================================
--- tex-common/trunk/scripts/tpm2licenses	2006-04-26 10:48:13 UTC (rev 1245)
+++ tex-common/trunk/scripts/tpm2licenses	2006-04-26 10:50:38 UTC (rev 1246)
@@ -241,197 +241,196 @@
     }
   }
   $what eq "files" && ! $nocoverage && CheckCoverage();
+}
 
+sub printFiles {
+  my ($LocalTPM,$licline)= @_;
+  my $pkg_header = "";
+  my $dom_parser = new XML::DOM::Parser;
+  my $doc = $dom_parser->parsefile($LocalTPM);
+  my %SourceFiles = Tpm::getListField($doc, "SourceFiles");
+  my %RunFiles = Tpm::getListField($doc, "RunFiles");
+  my %DocFiles = Tpm::getListField($doc, "DocFiles");
 
-  sub printFiles {
-    my ($LocalTPM,$licline)= @_;
-    my $pkg_header = "";
-    my $dom_parser = new XML::DOM::Parser;
-    my $doc = $dom_parser->parsefile($LocalTPM);
-    my %SourceFiles = Tpm::getListField($doc, "SourceFiles");
-    my %RunFiles = Tpm::getListField($doc, "RunFiles");
-    my %DocFiles = Tpm::getListField($doc, "DocFiles");
+  #
+  # NORBERT
+  # getListField returns a hash, and s{text} SHOULD be an array reference
+  # why isn't it like this???
+  # If it would be an array reference one could easily check whether
+  # sourcefile(text) is empty or not!!!
+  # Trick: If it was emtpy there is not size key!
+  #
+  if (!defined($SourceFiles{"size"})) { 
+    $SourceFiles{"text"} = ""; 
+  }
+  if (!defined($DocFiles{"size"})) { 
+    $DocFiles{"text"} = ""; 
+  }
+  if (!defined($RunFiles{"size"})) { 
+    $RunFiles{"text"} = ""; 
+  }
+  
+  foreach ($RunFiles{"text"}, $DocFiles{"text"}, $SourceFiles{"text"}) { 
+    # this is already done in Tpm.pm, why isn't that sufficient?
+    $_ =~ s/^\n*// ;
+    # remove the texmf-dist/ we don't need
+    $_ =~ s at texmf-dist/@@g;
+    # make sure there's exactly one newline at the end
+    chomp;
+    $_ =~ s/$/\n/ ;
+  };
 
-    #
-    # NORBERT
-    # getListField returns a hash, and s{text} SHOULD be an array reference
-    # why isn't it like this???
-    # If it would be an array reference one could easily check whether
-    # sourcefile(text) is empty or not!!!
-    # Trick: If it was emtpy there is not size key!
-    #
-    if (!defined($SourceFiles{"size"})) { 
-	$SourceFiles{"text"} = ""; 
-    }
-    if (!defined($DocFiles{"size"})) { 
-	$DocFiles{"text"} = ""; 
-    }
-    if (!defined($RunFiles{"size"})) { 
-	$RunFiles{"text"} = ""; 
-    }
-     
-    foreach ($RunFiles{"text"}, $DocFiles{"text"}, $SourceFiles{"text"}) { 
-      # this is already done in Tpm.pm, why isn't that sufficient?
-      $_ =~ s/^\n*// ;
-      # remove the texmf-dist/ we don't need
-      $_ =~ s at texmf-dist/@@g;
-      # make sure there's exactly one newline at the end
-      chomp;
-      $_ =~ s/$/\n/ ;
-    };
+  # we don't want the tpm file which isn't installed
+  $RunFiles{"text"} =~ s/\n.*\.tpm$//m;
 
-    # we don't want the tpm file which isn't installed
-    $RunFiles{"text"} =~ s/\n.*\.tpm$//m;
+  my @SourceFiles = split(/\n/m,$SourceFiles{"text"});
+  my @RunFiles = split(/\n/m,$RunFiles{"text"});
+  my @DocFiles = split(/\n/m,$DocFiles{"text"});
+  foreach (@SourceFiles) { 
+    s/^\s//;
+    s@^[\s\n]*(.*)[\s\n]*$@$1 at so;
+    s@\n\s*@\n at gm;
+  };
+  foreach (@RunFiles) { 
+    s/\s//;
+    s@^[\s\n]*(.*)[\s\n]*$@$1 at so;
+    s@\n\s*@\n at gm;
+  };
+  foreach (@DocFiles) { 
+    s/\s//;
+    s@^[\s\n]*(.*)[\s\n]*$@$1 at so;
+    s@\n\s*@\n at gm;
+  };
+  @DocFiles = grep(!/^$/, at DocFiles);
+  @RunFiles = grep(!/^$/, at RunFiles);
+  @SourceFiles = grep(!/^$/, at SourceFiles);
 
-    my @SourceFiles = split(/\n/m,$SourceFiles{"text"});
-    my @RunFiles = split(/\n/m,$RunFiles{"text"});
-    my @DocFiles = split(/\n/m,$DocFiles{"text"});
-    foreach (@SourceFiles) { 
-      s/^\s//;
-      s@^[\s\n]*(.*)[\s\n]*$@$1 at so;
-      s@\n\s*@\n at gm;
+  for ($debian_package) {
+    #my @texmfPath;
+    if ( /^texlive/ ) { 
+      #@texmfPath = ("texmf","texmf-dist","texmf-doc");
+      #
+      # DocFiles are installed into /u/s/d/pkg/...
+      # do we have to strip the first doc/ part
+      @DocFiles = map { $_ =~ s,^doc/,, ; $_; } @DocFiles ;
+      foreach (@RunFiles) {CheckFileExistence($_)};
+      foreach (@DocFiles) {CheckFileExistence($_)};
+      foreach (@SourceFiles) {CheckFileExistence($_)};
+      MergeDirectories(\@RunFiles);
+      MergeDirectories(\@DocFiles) if (@DocFiles);
+      MergeDirectories(\@SourceFiles) if (@SourceFiles);
+      print @RunFiles;
+      print @DocFiles;
+      print @SourceFiles;
     };
-    foreach (@RunFiles) { 
-      s/\s//;
-      s@^[\s\n]*(.*)[\s\n]*$@$1 at so;
-      s@\n\s*@\n at gm;
-    };
-    foreach (@DocFiles) { 
-      s/\s//;
-      s@^[\s\n]*(.*)[\s\n]*$@$1 at so;
-      s@\n\s*@\n at gm;
-    };
-    @DocFiles = grep(!/^$/, at DocFiles);
-    @RunFiles = grep(!/^$/, at RunFiles);
-    @SourceFiles = grep(!/^$/, at SourceFiles);
+    if ( /^tetex-base$/ ) {
+      #@texmfPath = (".");
+      foreach (@RunFiles) {CheckFileExistence($_)};
+      foreach (@DocFiles) {CheckFileExistence($_)};
 
-    for ($debian_package) {
-      #my @texmfPath;
-      if ( /^texlive/ ) { 
-	#@texmfPath = ("texmf","texmf-dist","texmf-doc");
-	#
-	# DocFiles are installed into /u/s/d/pkg/...
-	# do we have to strip the first doc/ part
-	@DocFiles = map { $_ =~ s,^doc/,, ; $_; } @DocFiles ;
-	foreach (@RunFiles) {CheckFileExistence($_)};
-	foreach (@DocFiles) {CheckFileExistence($_)};
-	foreach (@SourceFiles) {CheckFileExistence($_)};
-	MergeDirectories(\@RunFiles);
-	MergeDirectories(\@DocFiles) if (@DocFiles);
-	MergeDirectories(\@SourceFiles) if (@SourceFiles);
-	print @RunFiles;
-	print @DocFiles;
+      MergeDirectories(\@RunFiles);
+      MergeDirectories(\@DocFiles) if (@DocFiles);
+      print @RunFiles;
+      print @DocFiles;
+    };
+    if ( /^tetex-src$/ ) {
+      #@texmfPath = (".");
+      foreach (@SourceFiles) {CheckFileExistence($_)};
+      MergeDirectories(\@SourceFiles);
+      unless (! @SourceFiles) {
 	print @SourceFiles;
-      };
-      if ( /^tetex-base$/ ) {
-	#@texmfPath = (".");
-	foreach (@RunFiles) {CheckFileExistence($_)};
-	foreach (@DocFiles) {CheckFileExistence($_)};
-
-	MergeDirectories(\@RunFiles);
-	MergeDirectories(\@DocFiles) if (@DocFiles);
-	print @RunFiles;
-	print @DocFiles;
-      };
-      if ( /^tetex-src$/ ) {
-	#@texmfPath = (".");
-	foreach (@SourceFiles) {CheckFileExistence($_)};
-	MergeDirectories(\@SourceFiles);
-	unless (! @SourceFiles) {
-	  print @SourceFiles;
-	}
-      };
+      }
     };
-  }
+  };
+}
 
-  sub CheckCoverage {
-    my @allfilesinpackage;
-    my @notcoveredfiles;
-    foreach my $tmf (@texmfPath) {
-      push @allfilesinpackage, `find $tmf -type f`;
+sub CheckCoverage {
+  my @allfilesinpackage;
+  my @notcoveredfiles;
+  foreach my $tmf (@texmfPath) {
+    push @allfilesinpackage, `find $tmf -type f`;
+  }
+  chomp @allfilesinpackage;
+  foreach (@allfilesinpackage) {
+    next if (m/\.tpm$/);
+    if (!(in_list($_, at coveredfiles))) {
+      push @notcoveredfiles, $_;
     }
-    chomp @allfilesinpackage;
-    foreach (@allfilesinpackage) {
-      next if (m/\.tpm$/);
-      if (!(in_list($_, at coveredfiles))) {
-        push @notcoveredfiles, $_;
-      }
-    }
-    print "\n\nCOVERAGE CHECK:";
-    if ($#notcoveredfiles < 0) {
-      print "OK\n";
-    } else {
-      print "NOT COVERED FILES:\n";
-      foreach (@notcoveredfiles) {
-        print $_,"\n";
-      }
-    }
   }
-
-  sub in_list {
-    my ($what, @list) = @_;
-    foreach (@list) { 
-      if ($what eq $_) { return 1; }
+  print "\n\nCOVERAGE CHECK:";
+  if ($#notcoveredfiles < 0) {
+    print "OK\n";
+  } else {
+    print "NOT COVERED FILES:\n";
+    foreach (@notcoveredfiles) {
+      print $_,"\n";
     }
-    return 0;
   }
+}
 
-  sub CheckFileExistence {
-    my ($file) = @_;
-    my $found = 0;
-    foreach my $texmfDir (@texmfPath) {
-      -f $texmfDir . "/" . $file && ($found =1) && push @coveredfiles , "$texmfDir/$file" ;
-    };
-    print STDERR "$file: Does not exist!\n" if ! $found;
+sub in_list {
+  my ($what, @list) = @_;
+  foreach (@list) { 
+    if ($what eq $_) { return 1; }
   }
+  return 0;
+}
 
-  sub MergeDirectories {
-    my ($filelist) = @_; # filelist is actually a pointer
-    # create a list of dirnames, and remove duplicates
-    my @dirnames = map {dirname($_) } @{$filelist};
-    my %UniqueHash = map { $_ , 1 } @dirnames;
-    @dirnames = keys %UniqueHash;
+sub CheckFileExistence {
+  my ($file) = @_;
+  my $found = 0;
+  foreach my $texmfDir (@texmfPath) {
+    -f $texmfDir . "/" . $file && ($found =1) && push @coveredfiles , "$texmfDir/$file" ;
+  };
+  print STDERR "$file: Does not exist!\n" if ! $found;
+}
 
-    # For searching, we create a hash that contains the filenames as keys:
-    my %SearchHash;
-    %SearchHash = map { $_, 1 } @{$filelist} ;
+sub MergeDirectories {
+  my ($filelist) = @_; # filelist is actually a pointer
+  # create a list of dirnames, and remove duplicates
+  my @dirnames = map {dirname($_) } @{$filelist};
+  my %UniqueHash = map { $_ , 1 } @dirnames;
+  @dirnames = keys %UniqueHash;
 
-    my %DirComplete = map { $_, 1 } @dirnames;
-    for (@dirnames) {
-      my $dirname = $_;
-      my $fullDir;
-      my $rootDir;
-      for (@texmfPath) {
-	if ( -d ( $_ . "/" . $dirname )) { 
-	  $rootDir = $_;
-	  $fullDir =  ( $_ . "/" . $dirname );
-	  last;
-	};
+  # For searching, we create a hash that contains the filenames as keys:
+  my %SearchHash;
+  %SearchHash = map { $_, 1 } @{$filelist} ;
+
+  my %DirComplete = map { $_, 1 } @dirnames;
+  for (@dirnames) {
+    my $dirname = $_;
+    my $fullDir;
+    my $rootDir;
+    for (@texmfPath) {
+      if ( -d ( $_ . "/" . $dirname )) { 
+	$rootDir = $_;
+	$fullDir =  ( $_ . "/" . $dirname );
+	last;
       };
-      if (!$fullDir) {
-        printf STDERR "This should not happen: no directory $dirname, nowhere.\n";
-	next;
-      }
-      my  @InstalledFiles = `find $fullDir -maxdepth 1 -type f 2>/dev/null | grep -v tetex` 
-	  or die "Calling find for $dirname, expanded to $fullDir, failed.";
-      for (@InstalledFiles) {
-	chomp;
-	s@^$rootDir/@@;
-	$DirComplete{$dirname} = 0 unless $SearchHash{$_};
+    };
+    if (!$fullDir) {
+      printf STDERR "This should not happen: no directory $dirname, nowhere.\n";
+      next;
+    }
+    my  @InstalledFiles = `find $fullDir -maxdepth 1 -type f 2>/dev/null | grep -v tetex` 
+	or die "Calling find for $dirname, expanded to $fullDir, failed.";
+    for (@InstalledFiles) {
+      chomp;
+      s@^$rootDir/@@;
+      $DirComplete{$dirname} = 0 unless $SearchHash{$_};
+    };
+    if ( $DirComplete{$dirname} ) {
+      for (@{$filelist} ) {
+	# replace the file by its directory name
+	s@$dirname/.*@$dirname/*@;
       };
-      if ( $DirComplete{$dirname} ) {
-	for (@{$filelist} ) {
-	  # replace the file by its directory name
-	  s@$dirname/.*@$dirname/*@;
-	};
-      };
-# 	print STDERR "Directory $_ is $DirComplete{$dirname}\n";
     };
+# 	print STDERR "Directory $_ is $DirComplete{$dirname}\n";
+  };
 
-    # now the complete directories occur multiple times, remove duplicates again
-    %UniqueHash = map { ("$_\n" , 1) } @{$filelist} ;
-    @{$filelist} = keys %UniqueHash;
-  }
-
+  # now the complete directories occur multiple times, remove duplicates again
+  %UniqueHash = map { ("$_\n" , 1) } @{$filelist} ;
+  @{$filelist} = keys %UniqueHash;
 }
 
+




More information about the Pkg-tetex-commits mailing list