Subversion Repositories DevTools

Rev

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

Rev 6978 Rev 6981
Line 69... Line 69...
69
#                       --SrcFile=xxx
69
#                       --SrcFile=xxx
70
#                       --SrcFileNoCopy=xxx
70
#                       --SrcFileNoCopy=xxx
71
#                       --Comment=xxx           - Add comment to Manifst
71
#                       --Comment=xxx           - Add comment to Manifst
72
#                       --NoManifestVersion     - Create unversioned Manifest File
72
#                       --NoManifestVersion     - Create unversioned Manifest File
73
#                       --PkgSubdir=xxx         - Specifies packaging subdir
73
#                       --PkgSubdir=xxx         - Specifies packaging subdir
-
 
74
#                       --LocalInstall          - Output manifest to the 'local' directory, not the output package
74
#                       --ImportManifest=Package[,--Subdir=subdir,--ReWrite] - Import Manifest from package
75
#                       --ImportManifest=Package[,--Subdir=subdir,--ReWrite] - Import Manifest from package
75
#                       --Md5                   - Add MD5 checksums to the Manifest File
76
#                       --Md5                   - Add MD5 checksums to the Manifest File
76
#                       --Dmf                   - Generate the Device Management Framework
77
#                       --Dmf                   - Generate the Device Management Framework
77
#                                                 combined archive ZIP file.
78
#                                                 combined archive ZIP file.
78
#                       --DmfVersion=xxxx       - Generate the Device Management Framework
79
#                       --DmfVersion=xxxx       - Generate the Device Management Framework
79
#                                                 combined archive ZIP using a modified
80
#                                                 combined archive ZIP using a modified
80
#                                                 version number; only for testing!
81
#                                                 version number; only for testing!
81
#                       --LineLength=nnn        - Limit line length. Default is 79
82
#                       --LineLength=nnn        - Limit line length. Default is 79
82
#                       --SubManifest           - Create a sub-manifest (not installable). Manifest will have no version.
83
#                       --SubManifest           - Create a sub-manifest (not installable). Manifest will have no version.
83
#                                                 Gives a default name, tier and subdir if not explicitly provided.
84
#                                                 Gives a default name, tier and subdir if not explicitly provided.
84
#                       --NoSignatures          - Prevent the generation of .sig files
85
#                       --[No]Signatures        - Control generation of .sig files
85
#                                                 Default is to generate .sigFiles
86
#                                                 Default is to not generate .sigFiles
86
#                       --ManifestInsertionPoint[,--All,--Name,--Name=xxxx,--Tier,--Tier=Name,--Current]
87
#                       --ManifestInsertionPoint[,--All,--Name,--Name=xxxx,--Tier,--Tier=Name,--Current]
87
#                                                 Create template insertion hook
88
#                                                 Create template insertion hook
-
 
89
#                       --Template=Package[,--Subdir=subdir,File=name]
88
#                       --Template=Package[,--Subdir=subdir,File=name]                                                                           
90
#                                                 Use Specified template                                                                           
89
#                       --NoWarn                - Supress warnings about unused packages
91
#                       --NoWarn                - Supress warnings about unused packages
90
#                                                 Will supress sanity test. Useful when generating multiple
92
#                                                 Will supress sanity test. Useful when generating multiple
91
#                                                 manifests.                          
93
#                                                 manifests.                          
92
#                                                 
94
#                                                 
93
# Notes: On sig file generation
95
# Notes: On sig file generation
Line 135... Line 137...
135
                ReportError ("ManifestFiles:--Tier option is only allowed once");
137
                ReportError ("ManifestFiles:--Tier option is only allowed once");
136
                next;
138
                next;
137
            }
139
            }
138
            $tier = $1;
140
            $tier = $1;
139
 
141
 
-
 
142
            
-
 
143
        } elsif ( m~^--LocalInstall~ ) {
-
 
144
            $ManifestFiles::localInstall = 1;
-
 
145
 
140
        } elsif ( m~^--Comment=~ ) {
146
        } elsif ( m~^--Comment=~ ) {
141
            my $cmt = $_;
147
            my $cmt = $_;
142
            $cmt =~ s~.+=~~;
148
            $cmt =~ s~.+=~~;
143
            $cmt =~ s~\s*\n\s*~\n~g;
149
            $cmt =~ s~\s*\n\s*~\n~g;
144
            push @files, {'cmt' => $cmt };
150
            push @files, {'cmt' => $cmt };
Line 200... Line 206...
200
            push @files, {'insertPoint' => $insert_info };
206
            push @files, {'insertPoint' => $insert_info };
201
 
207
 
202
        } elsif ( m/^--Template=(.+)/i ) {
208
        } elsif ( m/^--Template=(.+)/i ) {
203
            my $template_info = ManifestFiles::_Template($1, $tier, $name);
209
            my $template_info = ManifestFiles::_Template($1, $tier, $name);
204
#DebugDumpData("TemplateInfo", $template_info );
210
#DebugDumpData("TemplateInfo", $template_info );
205
            push @files, {'template' => $template_info };
-
 
206
 
211
 
207
        } elsif (m/^--Md5/i) {
212
        } elsif (m/^--Md5/i) {
208
            $include_md5 = 1;
213
            $include_md5 = 1;
209
            $useDefaultLineWidth = 0;
214
            $useDefaultLineWidth = 0;
210
 
215
 
Line 315... Line 320...
315
our $ManifestFiles;                 # Files in the Manifest
320
our $ManifestFiles;                 # Files in the Manifest
316
our $noWarn = 0;                    # Control unused package warnings
321
our $noWarn = 0;                    # Control unused package warnings
317
our $pkgBase;                       # Where the package is being sourced from
322
our $pkgBase;                       # Where the package is being sourced from
318
our $noSigs = 1;                    # Control signature generation (Force noSigs. could use use undef)
323
our $noSigs = 1;                    # Control signature generation (Force noSigs. could use use undef)
319
our $templateMode;                  # In templating mode
324
our $templateMode;                  # In templating mode
-
 
325
our $localInstall;                  # Install or Package the manifest
320
 
326
 
321
#
327
#
322
#   Internal
328
#   Internal
323
#   Used while generating a manifest
329
#   Used while generating a manifest
324
#
330
#
Line 785... Line 791...
785
        #
791
        #
786
        s~\s+$~~;
792
        s~\s+$~~;
787
        s~(\s*\[Version])~#$1~;
793
        s~(\s*\[Version])~#$1~;
788
 
794
 
789
        #
795
        #
790
        #   Part lines and determine files
796
        #   Parse lines and determine files
791
        #
797
        #
792
        next unless ( $_ );
798
        next unless ( $_ );
793
        if (( m~\s*#~ ) || ( m~\s*\[~ )) {
799
        if (( m~\s*#~ ) || ( m~\s*\[~ )) {
794
            push @item_list, { 'comment' => $_ };
800
            push @item_list, { 'comment' => $_ };
795
            next;
801
            next;
Line 1006... Line 1012...
1006
    #
1012
    #
1007
    #   Return paramters for later processing
1013
    #   Return paramters for later processing
1008
    #
1014
    #
1009
 
1015
 
1010
    $package_dirs{$pkg_root}{used} = 1;
1016
    $package_dirs{$pkg_root}{used} = 1;
1011
    return { 'manifest' => $manifest,
1017
    $templateMode = { 'manifest' => $manifest,
1012
             'pkg_dir' => $pkg_root,
1018
             'pkg_dir' => $pkg_root,
1013
             'subdir' => $subdir,
1019
             'subdir' => $subdir,
1014
             'manifest_dir' => $pkgDir,
1020
             'manifest_dir' => $pkgDir,
1015
             'package' => $package_name,
1021
             'package' => $package_name,
1016
    }; 
1022
    };
-
 
1023
    return $templateMode; 
1017
}
1024
}
1018
 
1025
 
1019
 
-
 
1020
#-------------------------------------------------------------------------------
1026
#-------------------------------------------------------------------------------
1021
# Function        : Generate
1027
# Function        : Generate
1022
#
1028
#
1023
# Description     : Internal Function
1029
# Description     : Internal Function
1024
#                   Process all the collected data and create directives
1030
#                   Process all the collected data and create directives
Line 1076... Line 1082...
1076
    my $manifest_dir = "$::ScmPlatform.LIB";
1082
    my $manifest_dir = "$::ScmPlatform.LIB";
1077
    System( "$::GBE_BIN/mkdir -p $manifest_dir" );
1083
    System( "$::GBE_BIN/mkdir -p $manifest_dir" );
1078
 
1084
 
1079
    $manifestName = $manifest_dir . '/Manifest';
1085
    $manifestName = $manifest_dir . '/Manifest';
1080
    $manifestName .= '_' . $::ScmBuildVersion if ( $Manifest_has_version );
1086
    $manifestName .= '_' . $::ScmBuildVersion if ( $Manifest_has_version );
1081
    ::PackageFile ('*', $manifestName, '--Subdir=' . $pkg_subdir, '--Strip' );
1087
    PackageFile ('*', $manifestName, '--Subdir=' . $pkg_subdir, '--Strip' );
1082
    ::ToolsetGenerate( $manifestName );
1088
    ::ToolsetGenerate( $manifestName );
1083
 
1089
 
1084
    Verbose ("Generate: File: $manifestName");
1090
    Verbose ("Generate: File: $manifestName");
1085
 
1091
 
1086
    open (MF, '>', $manifestName ) || Error ("Cannot create the Manifest file: $manifestName");
1092
    open (MF, '>', $manifestName ) || Error ("Cannot create the Manifest file: $manifestName");
Line 1108... Line 1114...
1108
        print_mf ("");
1114
        print_mf ("");
1109
        print_mf ("#");
1115
        print_mf ("#");
1110
        print_mf ("# Signing Certificate");
1116
        print_mf ("# Signing Certificate");
1111
        print_mf ("[Certificate],$certName");
1117
        print_mf ("[Certificate],$certName");
1112
 
1118
 
1113
        ::PackageFile ('*', $certFile, '--Subdir=' . $pkg_subdir, '--Strip' );
1119
        PackageFile ('*', $certFile, '--Subdir=' . $pkg_subdir, '--Strip' );
1114
    }
1120
    }
1115
        
1121
 
1116
    #
1122
    #
1117
    #   Process each tier in the order presented in the source file
1123
    #   If in templating mode, then process the base template
1118
    #
1124
    #
1119
    my $last_was_comment = 0;
1125
    if ($templateMode) {
1120
    my $last_was_insert = 0;
-
 
1121
    foreach my $entry ( @Manifests )
-
 
1122
    {
-
 
1123
 
-
 
1124
#DebugDumpData ( "Manifest Entry", $entry );
-
 
1125
 
-
 
1126
        my $tier = $entry->{tier};
-
 
1127
        my $name = $entry->{name};
1126
        templateProcessing();
1128
        my $include_md5 = $entry->{md5};
-
 
1129
 
1127
 
1130
        if ( $entry->{dmf} )
-
 
1131
        {
1128
    } else {
1132
            DmfGenerate($entry);
-
 
1133
        }
-
 
1134
 
1129
 
1135
        #
1130
        #
1136
        #   Insert all the files that have been specified
1131
        #   Process each tier in the order presented in the source file
1137
        #   The user specified order is preserved
-
 
1138
        #
-
 
1139
        #   Entries may be either a file or a comment
-
 
1140
        #   Comments: Merge multiple comments and create blocks
-
 
1141
        #
-
 
1142
        #
1132
        #
1143
        my @files = @{ $entry->{files} };
-
 
1144
        foreach my $fentry ( @files )
1133
        foreach my $entry ( @Manifests )
1145
        {
1134
        {
1146
            if ( my $cmt = $fentry->{'cmt'} )
1135
            DmfGenerate($entry) if ( $entry->{dmf} );
1147
            {
-
 
1148
                print_mf ('') unless ( $last_was_comment ) ;
-
 
1149
                print_mf ( map (('# ' . $_) , split ("\n", $cmt) ));
-
 
1150
                $last_was_comment = 1;
1136
            processManifestEntry($entry);
1151
                next;
1137
        }
1152
            }
1138
    }
1153
 
1139
 
-
 
1140
    #
-
 
1141
    #   Complete the creation of the Manifest File
-
 
1142
    #
1154
            print_mf ('#') if ( $last_was_comment);
1143
    print_mf ("# end of $::ScmBuildPackage");
-
 
1144
    close MF;
1155
            $last_was_comment = 0;
1145
    ErrorDoExit();
1156
 
1146
 
1157
            if ( my $ip = $fentry->{'insertPoint'} ) {
-
 
1158
               #
-
 
1159
               #   Create an insertion point
-
 
1160
               #   Looks like a comment for the purposes of backward compatability
-
 
1161
               #
1147
    #
1162
 
-
 
1163
               print_mf ('') unless $last_was_insert;
1148
    #   Post process files from the manifest
1164
               print_mf ("##INSERT POINT [Name:$ip->{name}] [Tier:$ip->{tier}]");
-
 
1165
               $last_was_insert = 1;
1149
    #   May include signature generation
1166
               next;
1150
    GenSignatures();
1167
            }
-
 
1168
            print_mf ('#') if ( $last_was_insert);
-
 
1169
            $last_was_insert = 0;
-
 
1170
 
1151
 
1171
            if ( my $file = $fentry->{'file'} )
-
 
1172
            {
1152
    #
1173
                my $base_file = StripDir( $file );
1153
    #   Sanity test of packages that did not provide a debian file
1174
                my @items = ($name, $tier, $base_file);
1154
    #   Just a hint that something may have been missed
-
 
1155
    #
1175
                if ($include_md5) {
1156
    unless ($noWarn) {
1176
                    my $md5 = digest_file_hex($file, 'MD5');
-
 
1177
                    push @items, "MD5=$md5" ;
1157
        my @not_used_packages;
1178
                }
-
 
1179
                if (exists $entry->{fileVersions} && exists $entry->{fileVersions}{$file} ) {
1158
        foreach my $package_dir ( getPackagePaths ('--All') ) {
1180
                    push @items, "VERSION=" . $entry->{fileVersions}{$file};
1159
            next if ( $package_dir =~ m~/manifest-tool/~ );
1181
                }
-
 
1182
                print_mf (join (',', @items));
1160
            unless ( exists $package_dirs{$package_dir}{used} ) {
1183
                PackageManifestFile ($name, $tier, $file );
1161
                push @not_used_packages, $package_dir;
1184
            }
1162
            }
-
 
1163
        }
-
 
1164
        if ( @not_used_packages ) {
-
 
1165
            Warning ("Packages that did not contribute packages to the manifest:",
-
 
1166
                      @not_used_packages );
-
 
1167
        }
-
 
1168
    }
-
 
1169
}
1185
 
1170
 
-
 
1171
#-------------------------------------------------------------------------------
-
 
1172
# Function        : processManifestEntry 
-
 
1173
#
-
 
1174
# Description     : Process a single Manifest entry 
-
 
1175
#
-
 
1176
# Inputs          : Globals
-
 
1177
#
-
 
1178
# Returns         : 
-
 
1179
#
-
 
1180
sub processManifestEntry
-
 
1181
{
-
 
1182
    my ($entry) = @_;
-
 
1183
#DebugDumpData ( "Manifest Entry", $entry );
-
 
1184
 
-
 
1185
    my $tier = $entry->{tier};
-
 
1186
    my $name = $entry->{name};
-
 
1187
    my $include_md5 = $entry->{md5};
-
 
1188
    my $last_was_comment = 0;
-
 
1189
    my $last_was_insert = 0;
-
 
1190
 
-
 
1191
    #
-
 
1192
    #   Flag that this entry has been processed
-
 
1193
    #
-
 
1194
    $entry->{wasProcessed}++;
-
 
1195
 
-
 
1196
    #
-
 
1197
    #   Insert all the files that have been specified
-
 
1198
    #   The user specified order is preserved
-
 
1199
    #
-
 
1200
    #   Entries may be either a file or a comment
-
 
1201
    #   Comments: Merge multiple comments and create blocks
-
 
1202
    #
-
 
1203
    #
-
 
1204
    my @files = @{ $entry->{files} };
-
 
1205
    foreach my $fentry ( @files ) {
-
 
1206
        if ( my $cmt = $fentry->{'cmt'} ) {
-
 
1207
            print_mf ('') unless ( $last_was_comment ) ;
-
 
1208
            print_mf ( map (('# ' . $_) , split ("\n", $cmt) ));
-
 
1209
            $last_was_comment = 1;
-
 
1210
            next;
-
 
1211
        }
-
 
1212
 
-
 
1213
        print_mf ('#') if ( $last_was_comment);
-
 
1214
        $last_was_comment = 0;
-
 
1215
 
1186
            if ( my $file = $fentry->{'filenocopy'} )
1216
        if ( my $ip = $fentry->{'insertPoint'} ) {
-
 
1217
           #
-
 
1218
           #   Create an insertion point
-
 
1219
           #   Looks like a comment for the purposes of backward compatability
1187
            {
1220
           #
-
 
1221
 
-
 
1222
           print_mf ('') unless $last_was_insert;
-
 
1223
           print_mf ("##INSERT POINT [Name:$ip->{name}] [Tier:$ip->{tier}]");
-
 
1224
           $last_was_insert = 1;
-
 
1225
           next;
-
 
1226
        }
-
 
1227
        print_mf ('#') if ( $last_was_insert);
-
 
1228
        $last_was_insert = 0;
-
 
1229
 
-
 
1230
        if ( my $file = $fentry->{'file'} ) {
-
 
1231
            my $base_file = StripDir( $file );
1188
                print_mf ("$name,$tier,$file");
1232
            my @items = ($name, $tier, $base_file);
-
 
1233
            if ($include_md5) {
-
 
1234
                my $md5 = digest_file_hex($file, 'MD5');
-
 
1235
                push @items, "MD5=$md5" ;
-
 
1236
            }
-
 
1237
            if (exists $entry->{fileVersions} && exists $entry->{fileVersions}{$file} ) {
-
 
1238
                push @items, "VERSION=" . $entry->{fileVersions}{$file};
1189
            }
1239
            }
-
 
1240
            print_mf (join (',', @items));
-
 
1241
            PackageManifestFile ($name, $tier, $file );
-
 
1242
        }
1190
 
1243
 
1191
            if ( my $emf = $fentry->{'manifest'} )
1244
        if ( my $file = $fentry->{'filenocopy'} ) {
-
 
1245
            print_mf ("$name,$tier,$file");
1192
            {
1246
        }
-
 
1247
 
-
 
1248
        if ( my $emf = $fentry->{'manifest'} ) {
1193
                #
1249
            #
1194
                #   Insert the entire manifest
1250
            #   Insert the entire manifest
1195
                #   Items are:
1251
            #   Items are:
1196
                #        contents
1252
            #        contents
1197
                #        items:
1253
            #        items:
1198
                #               file_name + arrays of file_info
1254
            #               file_name + arrays of file_info
1199
                #           or  comment line to copy
1255
            #           or  comment line to copy
1200
                #        file_base
1256
            #        file_base
1201
                #        manifest
1257
            #        manifest
1202
                #
1258
            #
1203
#DebugDumpData ( "Embedded Manifest Entry", $emf );
1259
#DebugDumpData ( "Embedded Manifest Entry", $emf );
1204
                if ($emf->{'rewrite'}) {
1260
            if ($emf->{'rewrite'}) {
1205
                    foreach my $item ( @{$emf->{'items'}}) {
1261
                foreach my $item ( @{$emf->{'items'}}) {
1206
                        if (defined($item->{'file_name'}))
1262
                    if (defined($item->{'file_name'}))
1207
                        {
1263
                    {
1208
                            my @items = ($name, $tier, $item->{'file_name'});
1264
                        my @items = ($name, $tier, $item->{'file_name'});
1209
                            my $md5_added = 0;
1265
                        my $md5_added = 0;
1210
                            foreach my $info (@{$item->{'file_info'}}) {
1266
                        foreach my $info (@{$item->{'file_info'}}) {
1211
                                push @items, $info;
1267
                            push @items, $info;
1212
                                $md5_added = 1 if ($info =~ m~^MD5=~i);
1268
                            $md5_added = 1 if ($info =~ m~^MD5=~i);
1213
                            }
-
 
1214
                            if ($include_md5 && $md5_added == 0) { # add md5 if requested and not already added from submanifest
-
 
1215
                                my $md5 = digest_file_hex($emf->{'file_base'} . '/' . $item->{'file_name'}, 'MD5');
-
 
1216
                                push @items, "MD5=$md5";
-
 
1217
                            }
-
 
1218
                            print_mf (join (',', @items));
-
 
1219
                            PackageManifestFile ( $name, $tier, $emf->{'file_base'} . '/' . $item->{'file_name'} );
-
 
1220
                        }
1269
                        }
-
 
1270
                        if ($include_md5 && $md5_added == 0) { # add md5 if requested and not already added from submanifest
1221
                        elsif (defined($item->{'comment'})) {
1271
                            my $md5 = digest_file_hex($emf->{'file_base'} . '/' . $item->{'file_name'}, 'MD5');
1222
                            print_mf($item->{'comment'});
1272
                            push @items, "MD5=$md5";
1223
                        }
1273
                        }
-
 
1274
                        print_mf (join (',', @items));
-
 
1275
                        PackageManifestFile ( $name, $tier, $emf->{'file_base'} . '/' . $item->{'file_name'} );
-
 
1276
                    }
-
 
1277
                    elsif (defined($item->{'comment'})) {
-
 
1278
                        print_mf($item->{'comment'});
1224
                    }
1279
                    }
1225
                    print_mf('#');
-
 
1226
                }
1280
                }
-
 
1281
                print_mf('#');
-
 
1282
            }
1227
                else {
1283
            else {
1228
                    print_mf ($_) foreach  ( @{$emf->{'contents'}} );
1284
                print_mf ($_) foreach  ( @{$emf->{'contents'}} );
1229
                    foreach my $item ( @{$emf->{'items'}}) {
1285
                foreach my $item ( @{$emf->{'items'}}) {
1230
                        if (defined($item->{'file_name'})) {
1286
                    if (defined($item->{'file_name'})) {
1231
                            PackageManifestFile ( $name, $tier, $emf->{'file_base'} . '/' . $item->{'file_name'} );
1287
                        PackageManifestFile ( $name, $tier, $emf->{'file_base'} . '/' . $item->{'file_name'} );
1232
                        }
-
 
1233
                    }
1288
                    }
1234
                    print_mf('#');
-
 
1235
                }
1289
                }
-
 
1290
                print_mf('#');
1236
            }
1291
            }
1237
        }
1292
        }
-
 
1293
    }
1238
 
1294
 
1239
        #
1295
    #
1240
        #   Expand out the entire MUG directory
1296
    #   Expand out the entire MUG directory
1241
        #   All .mug files in the MUG directory will be added to the manifest
1297
    #   All .mug files in the MUG directory will be added to the manifest
1242
        #   The assumption is that the MUG directory has been created by
1298
    #   The assumption is that the MUG directory has been created by
1243
        #   something that knows what its doing
1299
    #   something that knows what its doing
1244
        #
1300
    #
1245
        if ( my $mugdir = $entry->{mugdir} )
1301
    if ( my $mugdir = $entry->{mugdir} )
-
 
1302
    {
-
 
1303
        foreach my $file ( glob ($mugdir . '/*.mug' ) )
1246
        {
1304
        {
1247
            foreach my $file ( glob ($mugdir . '/*.mug' ) )
-
 
1248
            {
-
 
1249
                next unless ( -f $file );
1305
            next unless ( -f $file );
1250
                my $base_file = StripDir($file);
1306
            my $base_file = StripDir($file);
1251
 
1307
 
1252
                my @items = ($name, $tier, $base_file);
1308
            my @items = ($name, $tier, $base_file);
1253
 
1309
 
1254
                if ($include_md5) {
1310
            if ($include_md5) {
1255
                    my $md5 = digest_file_hex($file, 'MD5');
1311
                my $md5 = digest_file_hex($file, 'MD5');
1256
                    push @items, "MD5=$md5" ;
1312
                push @items, "MD5=$md5" ;
1257
                }
-
 
1258
                print_mf (join (',', @items));
-
 
1259
                PackageManifestFile ($name, $tier, $file );
-
 
1260
            }
1313
            }
-
 
1314
            print_mf (join (',', @items));
-
 
1315
            PackageManifestFile ($name, $tier, $file );
1261
        }
1316
        }
1262
    }
1317
    }
-
 
1318
}
-
 
1319
 
-
 
1320
 
-
 
1321
#-------------------------------------------------------------------------------
-
 
1322
# Function        : templateProcessing 
-
 
1323
#
-
 
1324
# Description     : The manifest is created from a povided manifest with MUST
-
 
1325
#                   have one or more insertion points
-
 
1326
#                   
-
 
1327
#                   Purpose: Pulse can provide a template and SI teams can
-
 
1328
#                            insert there own packages 
-
 
1329
#
-
 
1330
# Inputs          : Globals
-
 
1331
#
-
 
1332
# Returns         : 
-
 
1333
#
-
 
1334
sub templateProcessing
-
 
1335
{
-
 
1336
    my $insertFound;
-
 
1337
    my $last_was_comment;
1263
 
1338
 
1264
    #
1339
    #
1265
    #   Complete the creation of the Manifest File
1340
    #   Open the template manifest and process each line
1266
    #
1341
    #
1267
    print_mf ("# end of $::ScmBuildPackage");
1342
    print_mf( '#Start of Template from: ' . $templateMode->{'package'} );
-
 
1343
    my $tfile;
1268
    close MF;
1344
    my $line;
-
 
1345
    open( $tfile, '<', $templateMode->{'manifest'} ) || Error ("Cound not open template manifest: $?", "File: $templateMode->{'manifest'}");
-
 
1346
    while ( <$tfile> ) {
-
 
1347
        $line = $_;
-
 
1348
        $line =~ s~\s+$~~;
-
 
1349
        next unless ($line);
-
 
1350
 
-
 
1351
        #
-
 
1352
        #   Detect insertion point
-
 
1353
        #
-
 
1354
        if ($line =~ m~^##INSERT POINT~) {
-
 
1355
            $line =~ m~\[Name:(.+)\].*\[Tier:(.+)\]~i;
-
 
1356
            my $iname = $1;
-
 
1357
            my $itier = $2;
-
 
1358
            print_mf ("# Start of Template Insert: $iname, $itier");
-
 
1359
            templateInsert($iname,$itier);
-
 
1360
            print_mf ("# End of Template Insert: $iname, $itier");
-
 
1361
            $insertFound = 1;
-
 
1362
            next;
-
 
1363
        
-
 
1364
        } elsif( $line =~ m~^#$~) {
-
 
1365
            # Ignore 'empty' comment lines
-
 
1366
            # They will be regenerated
1269
    ErrorDoExit();
1367
            next;
1270
 
1368
 
-
 
1369
        } elsif( $line =~ m~^#~) {
-
 
1370
            # Non empty comments are transferred
-
 
1371
            print_mf ('') unless ( $last_was_comment ) ;
-
 
1372
            print_mf( $line);
-
 
1373
            $last_was_comment = 1;
-
 
1374
            next;
-
 
1375
 
-
 
1376
        } elsif ($line =~ m~^\[~ ) {
-
 
1377
            # Metadata from the template
-
 
1378
            # Insert it as a comment
-
 
1379
            print_mf( '#' . $line);
-
 
1380
            next;
1271
    #
1381
        }
1272
    #   Post process files from the manifest
1382
        print_mf ('#') if ( $last_was_comment);
1273
    #   May include signature generation
1383
        $last_was_comment = 0;
-
 
1384
 
-
 
1385
        my( $aname, $atier, $afile, @additionnal_info) = split(/\s*\,\s*/, $line);
-
 
1386
        my $test = CatPaths($templateMode->{manifest_dir}, $afile);
-
 
1387
        ReportError("Template processing: File not found with template: $afile", $test) unless -f $test;
-
 
1388
 
-
 
1389
        print_mf( $line);
-
 
1390
        PackageManifestFile ( $aname, $atier, $test );
-
 
1391
 
-
 
1392
    }
1274
    GenSignatures();
1393
    close $tfile;
1275
 
1394
 
1276
    #
1395
    #
-
 
1396
    #   Sanity Checks
1277
    #   Sanity test of packages that did not provide a debian file
1397
    #       Was an insertion point found
1278
    #   Just a hint that something may have been missed
1398
    #       Were all manifest bits used
1279
    #
1399
    #
1280
    unless ($noWarn) {
-
 
1281
        my @not_used_packages;
-
 
1282
        foreach my $package_dir ( getPackagePaths ('--All') )
1400
    ReportError ("No insertion points in template") unless $insertFound;
1283
        {
1401
    
1284
            next if ( $package_dir =~ m~/manifest-tool/~ );
-
 
1285
            unless ( exists $package_dirs{$package_dir}{used} )
-
 
1286
            {
1402
    my @notUsed;
1287
                push @not_used_packages, $package_dir;
-
 
1288
            }
1403
    my @overUsed;
1289
        }
1404
 
1290
        if ( @not_used_packages )
1405
    foreach my $entry ( @Manifests ) {
1291
        {
1406
        if ( !exists $entry->{wasProcessed}) {
1292
            Warning ("Packages that did not contribute packages to the manifest:",
1407
            push @notUsed, "Name: $entry->{name}, Tier: $entry->{tier}";
1293
                      @not_used_packages );
1408
        } elsif ($entry->{wasProcessed} > 1) {
-
 
1409
            push @overUsed, "Name: $entry->{name}, Tier: $entry->{tier}";
1294
        }
1410
        }
1295
    }
1411
    }
-
 
1412
    Warning ("Template did not used data from: ", @notUsed)  if @notUsed;
-
 
1413
    Warning ("Template used data multiple times from: ", @overUsed)  if @overUsed;
-
 
1414
    ErrorDoExit();
-
 
1415
}
-
 
1416
 
-
 
1417
#-------------------------------------------------------------------------------
-
 
1418
# Function        : templateInsert 
-
 
1419
#
-
 
1420
# Description     : Helper routine to insert required bits into the template
-
 
1421
#                   Need to scan the manifest entries and determine which need
-
 
1422
#                   to be inserted at this point in the template.
-
 
1423
#
-
 
1424
# Inputs          : $iname  - Insert name
-
 
1425
#                   $itier  - Insert Tier
-
 
1426
#
-
 
1427
# Returns         : Nothing
-
 
1428
#
-
 
1429
sub templateInsert
-
 
1430
{
-
 
1431
    my ($iname, $itier) = @_;
-
 
1432
    foreach my $entry ( @Manifests ) {
-
 
1433
        next unless ((($iname eq '*') || ($iname eq $entry->{name}) ) && (($itier eq '*') || ($itier eq $entry->{tier})) );
-
 
1434
        processManifestEntry($entry);
-
 
1435
    }
1296
}
1436
}
1297
 
1437
 
1298
#-------------------------------------------------------------------------------
1438
#-------------------------------------------------------------------------------
1299
# Function        : print_mf
1439
# Function        : print_mf
1300
#
1440
#
Line 1334... Line 1474...
1334
#
1474
#
1335
sub PackageManifestFile {
1475
sub PackageManifestFile {
1336
    my ($name, $tier, $srcFile ) = @_;
1476
    my ($name, $tier, $srcFile ) = @_;
1337
    push @{$ManifestFiles}, ({srcFile => $srcFile, name =>$name, tier => $tier});
1477
    push @{$ManifestFiles}, ({srcFile => $srcFile, name =>$name, tier => $tier});
1338
 
1478
 
1339
    ::PackageFile ('*', $srcFile, '--Subdir=' . $pkg_subdir, '--Strip' );
1479
    PackageFile ('*', $srcFile, '--Subdir=' . $pkg_subdir, '--Strip' );
1340
}
1480
}
1341
 
1481
 
1342
#-------------------------------------------------------------------------------
1482
#-------------------------------------------------------------------------------
1343
# Function        : GenSigInit 
1483
# Function        : GenSigInit 
1344
#
1484
#
Line 1451... Line 1591...
1451
        #
1591
        #
1452
        #   Generate the name of the signature file
1592
        #   Generate the name of the signature file
1453
        #   Generate Packaging directives for the signature
1593
        #   Generate Packaging directives for the signature
1454
        #   
1594
        #   
1455
        my $sigFileName = CatPaths( "$::ScmPlatform.LIB", StripDir($entry->{srcFile}) . '.sig' );
1595
        my $sigFileName = CatPaths( "$::ScmPlatform.LIB", StripDir($entry->{srcFile}) . '.sig' );
1456
        ::PackageFile ('*', $sigFileName, '--Subdir=' . $pkg_subdir, '--Strip' );
1596
        PackageFile ('*', $sigFileName, '--Subdir=' . $pkg_subdir, '--Strip' );
1457
        ::ToolsetGenerate($sigFileName);
1597
        ::ToolsetGenerate($sigFileName);
1458
 
1598
 
1459
        #
1599
        #
1460
        #   Generate the name/tier for the manifest signature
1600
        #   Generate the name/tier for the manifest signature
1461
        #       ie: Manifest_<name>_<tier>.sig
1601
        #       ie: Manifest_<name>_<tier>.sig
Line 1480... Line 1620...
1480
    {
1620
    {
1481
        Verbose("PostProcessSig: $nameTier");
1621
        Verbose("PostProcessSig: $nameTier");
1482
        my $sigSigTemp = $manifestName . '_' . $nameTier . '.sig';
1622
        my $sigSigTemp = $manifestName . '_' . $nameTier . '.sig';
1483
        my $sigSigTempCat = $sigSigTemp . '.content';
1623
        my $sigSigTempCat = $sigSigTemp . '.content';
1484
        ::ToolsetGenerate($sigSigTemp, $sigSigTempCat);
1624
        ::ToolsetGenerate($sigSigTemp, $sigSigTempCat);
1485
        ::PackageFile ('*', $sigSigTemp, '--Subdir=' . $pkg_subdir, '--Strip' );
1625
        PackageFile ('*', $sigSigTemp, '--Subdir=' . $pkg_subdir, '--Strip' );
1486
 
1626
 
1487
        #
1627
        #
1488
        #   Concatenate the contents of the required .sig files
1628
        #   Concatenate the contents of the required .sig files
1489
        #   Treat them as binary files. 
1629
        #   Treat them as binary files. 
1490
        #
1630
        #
Line 1672... Line 1812...
1672
    my $zip_filename = $work_dir . $name . '_' . $version . '.zip';
1812
    my $zip_filename = $work_dir . $name . '_' . $version . '.zip';
1673
    if ( $zip->writeToFileNamed($zip_filename) != AZ_OK )
1813
    if ( $zip->writeToFileNamed($zip_filename) != AZ_OK )
1674
    {
1814
    {
1675
        ReportError("DMF ZIP file creation failed");
1815
        ReportError("DMF ZIP file creation failed");
1676
    }
1816
    }
1677
    ::PackageFile('*', $zip_filename, '--Strip');
1817
    PackageFile('*', $zip_filename, '--Strip');
1678
    ::PackageFile('*', $manifest_file, '--Strip');
1818
    PackageFile('*', $manifest_file, '--Strip');
-
 
1819
 
-
 
1820
}
1679
 
1821
 
-
 
1822
#-------------------------------------------------------------------------------
-
 
1823
# Function        : PackageFile  
-
 
1824
#
-
 
1825
# Description     : Package or Install a manifest file
-
 
1826
#
-
 
1827
# Inputs          : Same as PackageFile
-
 
1828
#
-
 
1829
# Returns         : 
-
 
1830
#
-
 
1831
sub PackageFile
-
 
1832
{
-
 
1833
    if ($localInstall) {
-
 
1834
        ::InstallHdr(@_);
-
 
1835
    } else {
-
 
1836
        ::PackageFile(@_);
-
 
1837
    }
1680
}
1838
}
1681
 
1839
 
1682
#-------------------------------------------------------------------------------
1840
#-------------------------------------------------------------------------------
1683
# Function        : GenerateCesFile
1841
# Function        : GenerateCesFile
1684
#
1842
#