ietf
[Top] [All Lists]

Re: watersprings.org archive of expired Internet Drafts

2011-10-09 10:36:19

"Fred" == Fred Baker <fred(_at_)cisco(_dot_)com> writes:
    Fred> To make my own mirror of such on my laptop, I rsync -avz
    Fred> rsync.tools.ietf.org::tools.id /Users/fred/all-drafts/id

I further sort the IDs by author... and since I forget to unlink them, I
wind up with an archive.  I don't think consider_linking_rfc works anymore.


#!/usr/bin/perl

chdir('/corp/ietf');

if(@ARGV == 0) {
  system("/corp/ietf/newRFCs.sh");

  system("rsync -avz optimus.ietf.org::internet-drafts 
ftp.ietf.org/internet-drafts");
  system("cd html.charters; wget -r -l 1 -nv -np -nd -nc 
http://www.ietf.org/html.charters/";);
} else {
  print "SKIPPING RSYNC (@ARGV) \n";
}

opendir(DRAFTS,"ftp.ietf.org/internet-drafts");
@drafts=readdir(DRAFTS);
closedir(DRAFTS);

sub consider_linking_rfc {
  local($dir, $draft) = @_;

  open(DRAFT, "$draft") || warn "can not open $draft: $!\n";
  #print "Searching $draft\n";

  my $line=0;
  while(<DRAFT>) {
  #while(<DRAFT>) {
    last if ($line > 9);
    #print "line: $line $_";
    chop;
    #    This Internet-Draft was published as a Proposed Standard, RFC 3664
    if(/This Internet\-Draft was published .*RFC (\d+)/) {
      $rfc=$1;
      print "rfc$rfc -> $dir/rfc$rfc.txt\n";
      link("ftp.ietf.org/rfc/rfc$rfc.txt", "$dir/rfc$rfc.txt");
      #unlink($draft);
      close(DRAFT);
      return;
    }
    $line++;
  }
  close(DRAFT);
}
      

foreach $draft (@drafts) {
    next if ($draft =~ /^\./);
    $draft =~ m,draft-([^-]*)-([^-]*)-(.*),;
    
    if($1 eq "ietf") {
        $dir = "id/$1/$2";
        $base= $3;
    } else {
        $dir = "id/$1";
        $base ="$2-$3";
    }

    next if (length($base) < 1);
    next if (-f "$dir/$base");
    
    print "$draft -> $dir/$base\n";
    system("mkdir -p $dir") unless (-d "$dir");
    link("ftp.ietf.org/internet-drafts/$draft","$dir/$base");
    &consider_linking_rfc($dir, "$dir/$base");
} 

_______________________________________________
Ietf mailing list
Ietf(_at_)ietf(_dot_)org
https://www.ietf.org/mailman/listinfo/ietf