OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-tools                    Date:   09-Jul-2004 15:13:37
  Branch: HEAD                             Handle: 2004070914133600

  Modified files:
    openpkg-tools/cmd       fetch.pl

  Log:
    fix error handling

  Summary:
    Revision    Changes     Path
    1.3         +11 -3      openpkg-tools/cmd/fetch.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-tools/cmd/fetch.pl
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 fetch.pl
  --- openpkg-tools/cmd/fetch.pl        9 Apr 2004 20:30:46 -0000       1.2
  +++ openpkg-tools/cmd/fetch.pl        9 Jul 2004 13:13:36 -0000       1.3
  @@ -100,6 +100,7 @@
   my $DEF = {};
   my $SRC = {};
   open(SPEC, "<$spec");
  +my $failed = 0;
   while (<SPEC>) {
       s|\n+$||s;
       if (m/^([a-zA-Z_][a-zA-Z0-9_]*):\s*(.+?)\s*$/) {
  @@ -169,7 +170,8 @@
               foreach my $fetch_srcdir (@fetch_srcdir) {
                   $fetch_srcdir =~ s|/+$||s;
                   print STDERR "openpkg:fetch: fetching from $fetch_srcdir/\n";
  -                if ((my $err = &fetch_url("$fetch_srcdir/$remote_srcfile", 
"$local_srcdir/$remote_srcfile"))) {
  +                my $err;
  +                if (($err = &fetch_url("$fetch_srcdir/$remote_srcfile", 
"$local_srcdir/$remote_srcfile")) ne '') {
                       $err = substr($err, 0, 37)."..." if (length($err) > 40);
                       print STDOUT "openpkg:fetch:ERROR: $err\n";
                       next;
  @@ -178,13 +180,19 @@
               }
               if (not -f "$local_srcdir/$remote_srcfile") {
                   print STDERR "openpkg:fetch: failed to fetch source file 
`$remote_srcfile'\n";
  -                return 1;
  +                $failed++;
               }
           }
       }
   }
   close(SPEC);
  -exit(0);
  +if ($failed > 0) {
  +    print STDERR "openpkg:fetch: failed to fetch $failed source files\n";
  +    exit(1);
  +}
  +else {
  +    exit(0);
  +}
   
   sub fetch_url {
       my ($src, $dst) = @_;
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to