Subversion Repositories DevTools

Rev

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

Rev 4625 Rev 4697
Line 34... Line 34...
34
use File::Copy;
34
use File::Copy;
35
use XML::Simple;
35
use XML::Simple;
36
use Digest::MD5;
36
use Digest::MD5;
37
use File::Find;
37
use File::Find;
38
use FindBin;                                # Determine the current directory
38
use FindBin;                                # Determine the current directory
-
 
39
use Encode qw(decode encode);
39
 
40
 
40
use JatsError;
41
use JatsError;
41
use JatsSystem;
42
use JatsSystem;
42
use Getopt::Long;
43
use Getopt::Long;
43
use Pod::Usage;
44
use Pod::Usage;
Line 191... Line 192...
191
        $item =~ s~\\~/~g;
192
        $item =~ s~\\~/~g;
192
        push @filesList, $item;
193
        push @filesList, $item;
193
    }
194
    }
194
    unless (scalar @filesList > 0)
195
    unless (scalar @filesList > 0)
195
    {
196
    {
196
        Warning("No file list found within the package");
197
        Warning("No file list found within the package: $opt_pname/$opt_pversion");
197
        #
198
        #
198
        #   No filelist found in the package
199
        #   No filelist found in the package
199
        #   This may occur for packages that did not go though the build system
200
        #   This may occur for packages that did not go though the build system
200
        #   Create a package-list
201
        #   Create a package-list
201
        #
202
        #
Line 369... Line 370...
369
        binmode $fh, ':crlf';
370
        binmode $fh, ':crlf';
370
        $md5sum = Digest::MD5->new->addfile($fh)->hexdigest;
371
        $md5sum = Digest::MD5->new->addfile($fh)->hexdigest;
371
        close $fh;
372
        close $fh;
372
    }
373
    }
373
 
374
 
-
 
375
    #
-
 
376
    #   Convert from iso-8859-1 into utf-8
-
 
377
    #
-
 
378
    $target = decode( 'iso-8859-1', $target );
-
 
379
    $target = encode( 'utf-8', $target );
374
 
380
 
375
    if (-d $source)
381
    if (-d $source)
376
    {
382
    {
377
        $data{path} = $target;
383
        $data{path} = $target;
378
    }
384
    }
Line 451... Line 457...
451
    #
457
    #
452
    #   Scan each entry and pump required data into the RM Database
458
    #   Scan each entry and pump required data into the RM Database
453
    #   The {files}{file} may be either an array or a hash XMLin appears to
459
    #   The {files}{file} may be either an array or a hash XMLin appears to
454
    #   make some decision as to which it will be, and I can't control it
460
    #   make some decision as to which it will be, and I can't control it
455
    #
461
    #
-
 
462
    #   If its a HASH, then it may be a HASH of HASH or a single entry
-
 
463
    #
456
    #   When it does happen the hash key is the 'name' element
464
    #   When it does happen the hash key is the 'name' element
457
    #
465
    #
458
    if (ref($xml->{files}{file}) eq 'HASH')
466
    if (ref($xml->{files}{file}) eq 'HASH')
459
    {
467
    {
460
        Verbose("Convert file hash to an array");
468
        Verbose("Convert file hash to an array");
461
        my @nowArray;
469
        my @nowArray;
462
        foreach my $name ( keys %{$xml->{files}{file}})
470
        foreach my $name ( keys %{$xml->{files}{file}})
463
        {
471
        {
464
            my $entry = $xml->{files}{file}{$name};
472
            my $entry = $xml->{files}{file}{$name};
-
 
473
            if (ref($entry) eq 'HASH')
-
 
474
            {
465
            $entry->{name} = $name;
475
                $entry->{name} = $name;
466
            push @nowArray, $entry;
476
                push @nowArray, $entry;
-
 
477
            }
-
 
478
            else
-
 
479
            {
-
 
480
                # Its a single entry, not a HASH of entries
-
 
481
                push @nowArray, $xml->{files}{file};
-
 
482
                last; 
-
 
483
            }
467
        }
484
        }
468
        $xml->{files}{file} = \@nowArray
485
        $xml->{files}{file} = \@nowArray
469
    }
486
    }
470
    Error("Sanity Check Failure. File Section not an ARRAY") unless(ref($xml->{files}{file}) eq 'ARRAY');
487
    Error("Sanity Check Failure. File Section not an ARRAY") unless(ref($xml->{files}{file}) eq 'ARRAY');
471
 
488