Subversion Repositories DevTools

Rev

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

Rev 5105 Rev 5649
Line 22... Line 22...
22
#......................................................................#
22
#......................................................................#
23
 
23
 
24
require 5.6.1;
24
require 5.6.1;
25
use strict;
25
use strict;
26
use warnings;
26
use warnings;
-
 
27
use Digest::file qw(digest_file_hex);
27
 
28
 
28
#
29
#
29
#   Globals
30
#   Globals
30
#
31
#
31
my @Manifests;                      # Manifest entries
32
my @Manifests;                      # Manifest entries
Line 67... Line 68...
67
#                       --SrcFileNoCopy=xxx
68
#                       --SrcFileNoCopy=xxx
68
#                       --Comment=xxx           - Add comment to Manifst
69
#                       --Comment=xxx           - Add comment to Manifst
69
#                       --NoManifestVersion     - Create unversioned Manifest File
70
#                       --NoManifestVersion     - Create unversioned Manifest File
70
#                       --PkgSubdir=xxx         - Specifies packaging subdir
71
#                       --PkgSubdir=xxx         - Specifies packaging subdir
71
#                       --ImportManifest=Package[,--Subdir=subdir,--ReWrite] - Import Manifest from package
72
#                       --ImportManifest=Package[,--Subdir=subdir,--ReWrite] - Import Manifest from package
-
 
73
#                       --Md5                   - Add MD5 checksums to the Manifest File
72
#
74
#
73
# Returns         : Nothing
75
# Returns         : Nothing
74
#
76
#
75
sub ManifestFiles
77
sub ManifestFiles
76
{
78
{
Line 83... Line 85...
83
    my @files;
85
    my @files;
84
    my $mug_dir;
86
    my $mug_dir;
85
    my $default_arch = $::ScmPlatform;
87
    my $default_arch = $::ScmPlatform;
86
    my $default_prod = '';
88
    my $default_prod = '';
87
    my $imported_manifest = 0;
89
    my $imported_manifest = 0;
-
 
90
    my $include_md5 = 0;
88
 
91
 
89
    #
92
    #
90
    #   Collect user options
93
    #   Collect user options
91
    #
94
    #
92
    foreach ( @elements )
95
    foreach ( @elements )
Line 116... Line 119...
116
        } elsif ( m~^--Debian=(.+)~ ) {
119
        } elsif ( m~^--Debian=(.+)~ ) {
117
            push @files, {'file' => LocateDebianFile($1, $default_arch, $default_prod)};
120
            push @files, {'file' => LocateDebianFile($1, $default_arch, $default_prod)};
118
 
121
 
119
        } elsif ( m~^--SrcFile=(.+)~ ) {
122
        } elsif ( m~^--SrcFile=(.+)~ ) {
120
            push @files, {'file' => LocatePreReq($1)};
123
            push @files, {'file' => LocatePreReq($1)};
121
            
124
 
122
        } elsif ( m~^--SrcFileNoCopy=(.+)~ ) {
125
        } elsif ( m~^--SrcFileNoCopy=(.+)~ ) {
123
            push @files, {'filenocopy' => $1};
126
            push @files, {'filenocopy' => $1};
124
            
127
 
125
        } elsif ( m~^--MugPackage=(.+)~ ) {
128
        } elsif ( m~^--MugPackage=(.+)~ ) {
126
            if ( $mug_dir )
129
            if ( $mug_dir )
127
            {
130
            {
128
                ReportError ("ManifestFiles:--MugPackage option is only allowed once");
131
                ReportError ("ManifestFiles:--MugPackage option is only allowed once");
129
                next;
132
                next;
130
            }    
133
            }
131
            $mug_dir = LocateMugDir($1);
134
            $mug_dir = LocateMugDir($1);
132
 
135
 
133
        } elsif ( m/^--Arch(.*)=(.+)/ ) {
136
        } elsif ( m/^--Arch(.*)=(.+)/ ) {
134
            $default_arch = $2;
137
            $default_arch = $2;
135
 
138
 
Line 155... Line 158...
155
            #
158
            #
156
            #   Fill in details unless already provided
159
            #   Fill in details unless already provided
157
            #
160
            #
158
            $tier = $import_info->{'tier'} unless ( defined $tier );
161
            $tier = $import_info->{'tier'} unless ( defined $tier );
159
            $name = $import_info->{'name'} unless ( defined $name );
162
            $name = $import_info->{'name'} unless ( defined $name );
160
 
-
 
161
            $imported_manifest = 1;
163
            $imported_manifest = 1;
162
 
164
 
-
 
165
        } elsif (m/^--Md5/i) {
-
 
166
            $include_md5 = 1
-
 
167
 
163
        } else {
168
        } else {
164
            ReportError ("ManifestFiles: Unknown option or argument: $_");
169
            ReportError ("ManifestFiles: Unknown option or argument: $_");
165
 
170
 
166
        }
171
        }
167
    }
172
    }
Line 188... Line 193...
188
    $data{tier} = $tier;
193
    $data{tier} = $tier;
189
    $data{name} = $name;
194
    $data{name} = $name;
190
    $data{files} = \@files;
195
    $data{files} = \@files;
191
    $data{mugdir} = $mug_dir;
196
    $data{mugdir} = $mug_dir;
192
    $data{pkgsubdir} = $pkg_subdir;
197
    $data{pkgsubdir} = $pkg_subdir;
-
 
198
    $data{md5} = $include_md5;
193
#DebugDumpData("DirectiveData", \%data );
199
#DebugDumpData("DirectiveData", \%data );
194
 
200
 
195
    push @Manifests, \%data;
201
    push @Manifests, \%data;
196
    return;
202
    return;
197
 
203
 
Line 206... Line 212...
206
    #                   A Debian Package name has several fields
212
    #                   A Debian Package name has several fields
207
    #                   These are:
213
    #                   These are:
208
    #                       1) Base Name - Provided by the user
214
    #                       1) Base Name - Provided by the user
209
    #                       2) Version - Version will be wildcarded
215
    #                       2) Version - Version will be wildcarded
210
    #                       3) Architecture - Wildcarded. Uses bin/arch directory
216
    #                       3) Architecture - Wildcarded. Uses bin/arch directory
211
    #                   
217
    #
212
    #                   Expect to find Debian Packages in the bin/PLATFORM subdir
218
    #                   Expect to find Debian Packages in the bin/PLATFORM subdir
213
    #
219
    #
214
    # Inputs          : Debian base name, complete with suboptions
220
    # Inputs          : Debian base name, complete with suboptions
215
    #
221
    #
216
    # Returns         : Full path of the file
222
    # Returns         : Full path of the file
Line 220... Line 226...
220
        my ($arg, $arch, $product) = @_;
226
        my ($arg, $arch, $product) = @_;
221
        Verbose("LocateDebianFile: Processing: $arg");
227
        Verbose("LocateDebianFile: Processing: $arg");
222
 
228
 
223
        my @type = qw( P D );
229
        my @type = qw( P D );
224
        my @debian_file_path;
230
        my @debian_file_path;
225
    
231
 
226
        #
232
        #
227
        #   Extract sub-options
233
        #   Extract sub-options
228
        #       --Prod[uction]
234
        #       --Prod[uction]
229
        #       --Debug
235
        #       --Debug
230
        #       --Arch[itecture]=yyy
236
        #       --Arch[itecture]=yyy
Line 436... Line 442...
436
            return undef;
442
            return undef;
437
        }
443
        }
438
 
444
 
439
 
445
 
440
        #
446
        #
441
        #   
447
        #
442
        #
448
        #
443
        open (MF, '<', $manifest ) || Error ("Cannot open the Manifest file: $manifest", $!);
449
        open (MF, '<', $manifest ) || Error ("Cannot open the Manifest file: $manifest", $!);
444
        while ( <MF> )
450
        while ( <MF> )
445
        {
451
        {
446
            #
452
            #
Line 559... Line 565...
559
 
565
 
560
    my $manifest_file = $manifest_dir . '/Manifest';
566
    my $manifest_file = $manifest_dir . '/Manifest';
561
    $manifest_file .= '_' . $::ScmBuildVersion if ( $Manifest_has_version );
567
    $manifest_file .= '_' . $::ScmBuildVersion if ( $Manifest_has_version );
562
    ToolsetGenerate( $manifest_file );
568
    ToolsetGenerate( $manifest_file );
563
    Verbose ("ManifestFiles_Generate: File: $manifest_file");
569
    Verbose ("ManifestFiles_Generate: File: $manifest_file");
564
    
570
 
565
    PackageFile ('*', $manifest_file, '--Subdir=' . $pkgdir, '--Strip' );
571
    PackageFile ('*', $manifest_file, '--Subdir=' . $pkgdir, '--Strip' );
566
 
572
 
567
    open (MF, '>', $manifest_file ) || Error ("Cannot create the Manifest file: $manifest_file");
573
    open (MF, '>', $manifest_file ) || Error ("Cannot create the Manifest file: $manifest_file");
568
 
574
 
569
    print_mf ("# PackageName: $::ScmBuildPackage");
575
    print_mf ("# PackageName: $::ScmBuildPackage");
Line 583... Line 589...
583
 
589
 
584
#DebugDumpData ( "Manifest Entry", $entry );
590
#DebugDumpData ( "Manifest Entry", $entry );
585
 
591
 
586
        my $tier = $entry->{tier};
592
        my $tier = $entry->{tier};
587
        my $name = $entry->{name};
593
        my $name = $entry->{name};
-
 
594
        my $include_md5 = $entry->{md5};
588
 
595
 
589
        #
596
        #
590
        #   Insert all the files that have been specified
597
        #   Insert all the files that have been specified
591
        #   The user specified order is preserved
598
        #   The user specified order is preserved
592
        #
599
        #
Line 607... Line 614...
607
 
614
 
608
            print_mf ('#') if ( $last_was_comment );
615
            print_mf ('#') if ( $last_was_comment );
609
            if ( my $file = $fentry->{'file'} )
616
            if ( my $file = $fentry->{'file'} )
610
            {
617
            {
611
                my $base_file = StripDir( $file );
618
                my $base_file = StripDir( $file );
-
 
619
                if ($include_md5) {
-
 
620
                    my $md5 = digest_file_hex($file, 'MD5');
-
 
621
                    print_mf ('--NoCheckLineWidth', "$name,$tier,$base_file,$md5");
-
 
622
                } else {
612
                print_mf ("$name,$tier,$base_file");
623
                    print_mf ("$name,$tier,$base_file");
-
 
624
                }
613
                PackageFile ('*', $file, '--Subdir=' . $pkgdir, '--Strip' );
625
                PackageFile ('*', $file, '--Subdir=' . $pkgdir, '--Strip' );
614
                $last_was_comment = 0;
626
                $last_was_comment = 0;
615
            }
627
            }
616
 
628
 
617
            if ( my $file = $fentry->{'filenocopy'} )
629
            if ( my $file = $fentry->{'filenocopy'} )
Line 693... Line 705...
693
    #                   Print one line to the Manifest File
705
    #                   Print one line to the Manifest File
694
    #                   Checks the length of the line being created
706
    #                   Checks the length of the line being created
695
    #
707
    #
696
    # Inputs          : $line
708
    # Inputs          : $line
697
    #
709
    #
698
    # Returns         : 
710
    # Returns         :
699
    #
711
    #
700
 
712
 
701
    sub print_mf
713
    sub print_mf
702
    {
714
    {
-
 
715
        my $check_line_width = 1;
-
 
716
 
-
 
717
        if ($_[0] eq '--NoCheckLineWidth')
-
 
718
        {
-
 
719
            shift @_;
-
 
720
            $check_line_width = 0;
-
 
721
        }
-
 
722
 
703
        foreach  ( @_ )
723
        foreach  ( @_ )
704
        {
724
        {
705
            ReportError ( "Manifest line too long",
725
            ReportError ( "Manifest line too long",
706
                    "Line: $_" ) if ( length ($_) > 79 );
726
                    "Line: $_" ) if ( $check_line_width && length ($_) > 79);
707
            print MF $_ . "\n";
727
            print MF $_ . "\n";
708
        }
728
        }
709
    }
729
    }
710
    
-
 
711
}
730
}
712
 
731
 
713
1;
732
1;