Subversion Repositories DevTools

Rev

Rev 241 | Rev 255 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 241 Rev 243
Line 307... Line 307...
307
        {
307
        {
308
            my $vname = "$name $ver";
308
            my $vname = "$name $ver";
309
            $vname =~ s~ ~_~g;
309
            $vname =~ s~ ~_~g;
310
            $vname =~ s~__~~g;
310
            $vname =~ s~__~~g;
311
 
311
 
312
            print JE "jats extract -extractfiles -view=$vname -label=$label -path=\"$path\" -root=. -noprefix\n";
312
            print JE "jats extract -extractfiles \"-view=$vname\" \"-label=$label\" \"-path=$path\" -root=. -noprefix\n";
313
        }
313
        }
314
 
314
 
315
        if ( @reason1 || @reason2 )
315
        if ( @reason1 || @reason2 )
316
        {
316
        {
317
            $Package{$name}{$ver}{bad_extract} = [@reason1, @reason2];
317
            $Package{$name}{$ver}{bad_extract} = [@reason1, @reason2];
Line 1562... Line 1562...
1562
    ErrorConfig( 'name'    => 'ESCROW-EXTRACT' );
1562
    ErrorConfig( 'name'    => 'ESCROW-EXTRACT' );
1563
 
1563
 
1564
    #
1564
    #
1565
    #   Open the file and read in data in one hit
1565
    #   Open the file and read in data in one hit
1566
    #   This will detect file errors early
1566
    #   This will detect file errors early
-
 
1567
    #   The lines may have arguments that are quoted.
-
 
1568
    #   Supported forms are:
-
 
1569
    #           "-tag=data"         - data may contain spaces
-
 
1570
    #           -tag=data           - data must not contain spaces
-
 
1571
    #
1567
    #
1572
    #
1568
    Error ("Cannot find specified file: $opt_extract")
1573
    Error ("Cannot find specified file: $opt_extract")
1569
        unless ( -f $opt_extract );
1574
        unless ( -f $opt_extract );
1570
 
1575
 
1571
    open (FH, "<$opt_extract" ) || Error ("Cannot open file");
1576
    open (FH, "<$opt_extract" ) || Error ("Cannot open file");
1572
    while ( <FH> )
1577
    while ( <FH> )
1573
    {
1578
    {
1574
        s~[\r\n]+$~~;
1579
        s~[\r\n]+$~~;
-
 
1580
        Verbose2 ($_);
1575
        next unless ( $_ );
1581
        next unless ( $_ );
1576
 
1582
 
1577
        my ($view, $label, $path);
1583
        my ($view, $label, $path);
1578
        if ( m~\s-view=(\S+)~ )
1584
        if ( m{(\s"-view=([^"]+)")|(\s-view=(\S+))} )
1579
        {
1585
        {
1580
            $view = $1;
1586
            $view = $2 || $4;
1581
        }
1587
        }
1582
 
1588
 
1583
        if ( m~\s-label=(\S+)~ )
1589
        if ( m{(\s"-label=([^"]+)")|(\s-label=(\S+))} )
1584
        {
1590
        {
1585
            $label = $1;
1591
            $label = $2 || $4;
1586
        }
1592
        }
1587
 
1593
 
1588
        if ( m~\s-path="(.+)"~ )
1594
        if ( m{(\s"-path=([^"]+)")|(\s-path=(\S+))} )
1589
        {
-
 
1590
            $path = $1;
-
 
1591
        }
-
 
1592
        elsif ( m~\s-path=(\S+)~ )
-
 
1593
        {
1595
        {
1594
            $path = $1;
1596
            $path = $2 || $4;
1595
        }
1597
        }
1596
 
1598
 
1597
        Error "Bad file format in line: $_" unless ( $view && $label );
1599
        Error "Bad file format in line: $_" unless ( $view && $label );
1598
        Error "Duplicate view name: $view" if ( exists $extract{$view} );
1600
        Error "Duplicate view name: $view" if ( exists $extract{$view} );
1599
        push @extract_order, $view;
1601
        push @extract_order, $view;
Line 1604... Line 1606...
1604
 
1606
 
1605
    #
1607
    #
1606
    #   Log the file processing
1608
    #   Log the file processing
1607
    #
1609
    #
1608
    my $lfile = "${opt_extract}.log";
1610
    my $lfile = "${opt_extract}.log";
-
 
1611
    Message ("Creating logfile: ${opt_extract}.log");
1609
    open (FH, ">$lfile" ) || Error ("Cannot open log file: $lfile");
1612
    open (FH, ">$lfile" ) || Error ("Cannot open log file: $lfile");
1610
 
1613
 
1611
    #
1614
    #
1612
    #   Process each entry
1615
    #   Process each entry
1613
    #
1616
    #
1614
    foreach my $view ( @extract_order )
1617
    foreach my $view ( @extract_order )
1615
    {
1618
    {
1616
        my $label = $extract{$view}{label};
1619
        my $label = $extract{$view}{label};
1617
        my $path = $extract{$view}{path};
1620
        my $path = $extract{$view}{path};
-
 
1621
        if ( $opt_test )
-
 
1622
        {
-
 
1623
            Verbose ("view($view) label($label) path($path)");
-
 
1624
            print FH "view($view) label($label) path($path) : TEST\n";
-
 
1625
        }
-
 
1626
        else
-
 
1627
        {
1618
        my $rv = JatsCmd ("extract -extractfiles -view=$view -label=$label -path=\"$path\" -root=. -noprefix");
1628
            my $rv = JatsCmd ("extract -extractfiles \"-view=$view\" \"-label=$label\" -path=\"$path\" -root=. -noprefix");
1619
        print FH "$view : SUCCESS\n" unless $rv;
1629
            print FH "$view : SUCCESS\n" unless $rv;
1620
        print FH "$view : ERROR\n" if $rv;
1630
            print FH "$view : ERROR\n" if $rv;
-
 
1631
        }
1621
    }
1632
    }
1622
    close FH;
1633
    close FH;
-
 
1634
    Message ("Results in logfile: ${opt_extract}.log");
1623
 
1635
 
1624
}
1636
}
1625
 
1637
 
1626
 
1638
 
1627
#-------------------------------------------------------------------------------
1639
#-------------------------------------------------------------------------------