[BACK]Return to MakeTorrents.pl CVS log [TXT][DIR] Up to [local] / openbsd / OpenBSDTorrents

Diff for /openbsd/OpenBSDTorrents/MakeTorrents.pl between version 1.2 and 1.3

version 1.2, 2005/03/22 04:19:03 version 1.3, 2005/03/22 23:07:23
Line 14 
Line 14 
 my $BTMake   = '/usr/local/bin/btmake';  my $BTMake   = '/usr/local/bin/btmake';
 my $Tracker  = 'http://OpenBSD.somedomain.net/announce.php';  my $Tracker  = 'http://OpenBSD.somedomain.net/announce.php';
   
   my $MinFiles = 5;
   
 # These are regexes that tell what files to skip;  # These are regexes that tell what files to skip;
 my $SkipDirs;  my $SkipDirs  = qr/\/patches$/;
 my $SkipFiles = qr/^\./;  my $SkipFiles = qr/^\./;
   
   
 my $StartDir = shift || $BaseName;  my $StartDir = shift || $BaseName;
 $StartDir =~ s#/$##;  $StartDir =~ s#/$##;
   
Line 33 
Line 36 
         if (@$files) {          if (@$files) {
                 Make_Torrent($basedir, $files);                  Make_Torrent($basedir, $files);
         }          }
   
           # don't recurse if we were called on a specific directory
           return 1 if $StartDir ne $BaseName;
   
         foreach my $subdir (@$dirs) {          foreach my $subdir (@$dirs) {
                 #next if $subdir eq '.';                  #next if $subdir eq '.';
                 #next if $subdir eq '..';                  #next if $subdir eq '..';
Line 45 
Line 52 
         my $basedir = shift;          my $basedir = shift;
         my $files   = shift;          my $files   = shift;
   
         if ($basedir =~ /^([\w\/\.-]+)$/) {          if ($#files < $MinFiles) {
                   print "Too few files in $basedir, skipping . . .\n";
                   return undef;
           }
   
           if ($basedir !~ /\.\./ && $basedir =~ /^([\w\/\.-]+)$/) {
                 $basedir = $1;                  $basedir = $1;
         } else {          } else {
                 die "Invalid characters in dir '$basedir'";                  die "Invalid characters in dir '$basedir'";
Line 59 
Line 71 
                 }                  }
         }          }
   
           my $date = Torrent_Date();
   
         my $torrent = $basedir;          my $torrent = $basedir;
         $torrent =~ s/\W/_/g;          $torrent =~ s/\W/_/g;
         $torrent .= '-' . Torrent_Date();          $torrent .= '-' . $date;
         $torrent .= '.torrent';          $torrent .= '.torrent';
   
         print Dump $torrent, $basedir, $files;          #print Dump $torrent, $basedir, $files;
         print "Creating $torrent\n";          print "Creating $torrent\n";
   
           my $comment = "Files from $basedir\n" .
                         "Created by andrew fresh (andrew\@mad-techies.org)\n" .
                         "http://OpenBSD.somedomain.net/",
   
         system($BTMake,          system($BTMake,
                '-C',                 '-C',
                '-c', "Created by andrew fresh <andrew\@mad-techies.org>\n" .                 '-c', $comment,
                      "See http://OpenBSD.somedomain.net/",  
                '-n', $BaseName,                 '-n', $BaseName,
                '-o', "$OutDir/$torrent",                 '-o', "$OutDir/$torrent",
                '-a', $Tracker,                 '-a', $Tracker,
                @$files                 @$files
         );# || die "Couldn't system $BTMake $torrent: $!";          );# || die "Couldn't system $BTMake $torrent: $!";
 }  }
   
   
 sub Get_Files_and_Dirs  sub Get_Files_and_Dirs
 {  {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>