Subversion Repositories DevTools

Rev

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

Rev 6962 Rev 6978
Line 81... Line 81...
81
#                       --LineLength=nnn        - Limit line length. Default is 79
81
#                       --LineLength=nnn        - Limit line length. Default is 79
82
#                       --SubManifest           - Create a sub-manifest (not installable). Manifest will have no version.
82
#                       --SubManifest           - Create a sub-manifest (not installable). Manifest will have no version.
83
#                                                 Gives a default name, tier and subdir if not explicitly provided.
83
#                                                 Gives a default name, tier and subdir if not explicitly provided.
84
#                       --NoSignatures          - Prevent the generation of .sig files
84
#                       --NoSignatures          - Prevent the generation of .sig files
85
#                                                 Default is to generate .sigFiles
85
#                                                 Default is to generate .sigFiles
-
 
86
#                       --ManifestInsertionPoint[,--All,--Name,--Name=xxxx,--Tier,--Tier=Name,--Current]
-
 
87
#                                                 Create template insertion hook
-
 
88
#                       --Template=Package[,--Subdir=subdir,File=name]                                                                           
86
#                       --NoWarn                - Supress warnings about unused packages
89
#                       --NoWarn                - Supress warnings about unused packages
87
#                                                 Will supress sanity test. Useful when generating multiple
90
#                                                 Will supress sanity test. Useful when generating multiple
88
#                                                 manifests.                          
91
#                                                 manifests.                          
89
#                                                 
92
#                                                 
90
# Notes: On sig file generation
93
# Notes: On sig file generation
Line 189... Line 192...
189
            #
192
            #
190
            $tier = $import_info->{'tier'} unless ( defined $tier );
193
            $tier = $import_info->{'tier'} unless ( defined $tier );
191
            $name = $import_info->{'name'} unless ( defined $name );
194
            $name = $import_info->{'name'} unless ( defined $name );
192
            $imported_manifest = 1;
195
            $imported_manifest = 1;
193
 
196
 
-
 
197
        } elsif ( m/^--ManifestInsertionPoint(.*)/i ) {
-
 
198
            my $insert_info = ManifestFiles::_InsertPoint($1, $tier, $name);
-
 
199
#DebugDumpData("InsertPoint", $insert_info );
-
 
200
            push @files, {'insertPoint' => $insert_info };
-
 
201
 
-
 
202
        } elsif ( m/^--Template=(.+)/i ) {
-
 
203
            my $template_info = ManifestFiles::_Template($1, $tier, $name);
-
 
204
#DebugDumpData("TemplateInfo", $template_info );
-
 
205
            push @files, {'template' => $template_info };
-
 
206
 
194
        } elsif (m/^--Md5/i) {
207
        } elsif (m/^--Md5/i) {
195
            $include_md5 = 1;
208
            $include_md5 = 1;
196
            $useDefaultLineWidth = 0;
209
            $useDefaultLineWidth = 0;
197
 
210
 
198
        } elsif (m/^--Dmf/i) {
211
        } elsif (m/^--Dmf/i) {
Line 301... Line 314...
301
our %package_dirs;                  # Package dirs discovered and used
314
our %package_dirs;                  # Package dirs discovered and used
302
our $ManifestFiles;                 # Files in the Manifest
315
our $ManifestFiles;                 # Files in the Manifest
303
our $noWarn = 0;                    # Control unused package warnings
316
our $noWarn = 0;                    # Control unused package warnings
304
our $pkgBase;                       # Where the package is being sourced from
317
our $pkgBase;                       # Where the package is being sourced from
305
our $noSigs = 1;                    # Control signature generation (Force noSigs. could use use undef)
318
our $noSigs = 1;                    # Control signature generation (Force noSigs. could use use undef)
-
 
319
our $templateMode;                  # In templating mode
306
 
320
 
307
#
321
#
308
#   Internal
322
#   Internal
309
#   Used while generating a manifest
323
#   Used while generating a manifest
310
#
324
#
Line 629... Line 643...
629
    {
643
    {
630
        $package_name = $1;
644
        $package_name = $1;
631
        @dirs = split( ',', $2 );
645
        @dirs = split( ',', $2 );
632
    }
646
    }
633
 
647
 
634
    my $package = GetPackageEntry( $package_name );
648
    my $package = ::GetPackageEntry( $package_name );
635
    unless ( $package )
649
    unless ( $package )
636
    {
650
    {
637
        ReportError ("ManifestFiles: Package not known to build: $package_name");
651
        ReportError ("ManifestFiles: Package not known to build: $package_name");
638
        return undef;
652
        return undef;
639
    }
653
    }
Line 706... Line 720...
706
                ReportError("ManifestFiles: Unknown suboption to ImportManifest:" . $_);
720
                ReportError("ManifestFiles: Unknown suboption to ImportManifest:" . $_);
707
            }
721
            }
708
        }
722
        }
709
    }
723
    }
710
 
724
 
711
    my $package = GetPackageEntry( $package_name );
725
    my $package = ::GetPackageEntry( $package_name );
712
    unless ( $package )
726
    unless ( $package )
713
    {
727
    {
714
        ReportError ("ManifestFiles: Package not known to build: $package_name");
728
        ReportError ("ManifestFiles: Package not known to build: $package_name");
715
        return undef;
729
        return undef;
716
    }
730
    }
Line 828... Line 842...
828
              'rewrite' => $rewrite,
842
              'rewrite' => $rewrite,
829
            };
843
            };
830
}
844
}
831
 
845
 
832
#-------------------------------------------------------------------------------
846
#-------------------------------------------------------------------------------
-
 
847
# Function        : _InsertPoint
-
 
848
#
-
 
849
# Description     : Create a Manifest Insertion Point
-
 
850
#
-
 
851
# Inputs          : Args    - [,--All,--Name,--Name=xxxx,--Tier,--Tier=Name, --Current]
-
 
852
#                   tier    - May be null
-
 
853
#                   name    - May be null
-
 
854
#
-
 
855
# Returns         : A hash of data to be used later
-
 
856
#
-
 
857
sub _InsertPoint
-
 
858
{
-
 
859
    my ($args, $tier, $name) = @_;
-
 
860
    my @item_list;
-
 
861
 
-
 
862
    ReportError("ManifestFiles: ManifestInsertionPoint. Name not yet specified") unless defined $name;
-
 
863
    ReportError("ManifestFiles: ManifestInsertionPoint. Tier not yet specified") unless defined $tier;
-
 
864
 
-
 
865
    my $argName = $name;
-
 
866
    my $argTier = $tier;
-
 
867
 
-
 
868
    #
-
 
869
    #   Extract sub options
-
 
870
    #
-
 
871
    my @subargs = split(',--', $args);
-
 
872
    foreach ( @subargs)
-
 
873
    {
-
 
874
        next unless (length($_) > 0);
-
 
875
        if (m~^All$~i){
-
 
876
            $argName = '*';
-
 
877
            $argTier = '*';
-
 
878
 
-
 
879
        } elsif (m~^Name(=(.*))?~i){
-
 
880
            if ( $1 ){
-
 
881
                $argName = $2;
-
 
882
            } else {
-
 
883
                $argName = $name;
-
 
884
            }
-
 
885
 
-
 
886
        } elsif (m~^Tier(=(.*))?~i){
-
 
887
            if ( $1 ){
-
 
888
                $argTier = $2;
-
 
889
            } else {
-
 
890
                $argTier = $tier;
-
 
891
            }
-
 
892
 
-
 
893
        } elsif (m~^Current$~i){
-
 
894
            $argName = $name;
-
 
895
            $argTier = $tier;
-
 
896
 
-
 
897
        } else {
-
 
898
            ReportError("ManifestFiles: Unknown suboption to ManifestInsertionPoint:" . $_);
-
 
899
        }
-
 
900
    }
-
 
901
 
-
 
902
    return { 'tier' => $argTier,
-
 
903
             'name' => $argName,
-
 
904
           };
-
 
905
}
-
 
906
 
-
 
907
#-------------------------------------------------------------------------------
-
 
908
# Function        : _Template
-
 
909
#
-
 
910
# Description     : Capture templating information
-
 
911
#
-
 
912
# Inputs          : --Template=Package[,--Subdir=subdir,File=name] 
-
 
913
#                   tier    - May be null
-
 
914
#                   name    - May be null
-
 
915
#
-
 
916
# Returns         : A hash of data to be used later
-
 
917
#
-
 
918
sub _Template
-
 
919
{
-
 
920
    my ($args, $tier, $name) = @_;
-
 
921
    my $subdir = 'mug';
-
 
922
    my $manifest;
-
 
923
 
-
 
924
    #
-
 
925
    #   Can only use the Template directive once
-
 
926
    #   
-
 
927
    if ($templateMode) {
-
 
928
        ReportError ("ManifestFiles:--Template option is only allowed once");
-
 
929
        return undef;
-
 
930
    }
-
 
931
    $templateMode = 1;
-
 
932
 
-
 
933
 
-
 
934
    #
-
 
935
    #   Locate the mugfile subdir
-
 
936
    #
-
 
937
    my $package_name = $args;
-
 
938
 
-
 
939
    #
-
 
940
    #   Extract sub options
-
 
941
    #       --Subdir=xxxx
-
 
942
    #       --File=name
-
 
943
    #       
-
 
944
    if ( $package_name =~ m/(.*?)(,.*)/ )
-
 
945
    {
-
 
946
        $package_name = $1;
-
 
947
        my @subargs = split(',--', $2);
-
 
948
        foreach ( @subargs)
-
 
949
        {
-
 
950
            next unless (length($_) > 0);
-
 
951
            if (m~^Subdir=(.*)~i){
-
 
952
                $subdir = $1;
-
 
953
 
-
 
954
            } elsif (m~^File=(.*)~i) {
-
 
955
                $manifest = $1;
-
 
956
 
-
 
957
            } else {
-
 
958
                ReportError("ManifestFiles: Unknown suboption to Template:" . $_);
-
 
959
            }
-
 
960
        }
-
 
961
    }
-
 
962
 
-
 
963
    my $package = ::GetPackageEntry( $package_name );
-
 
964
    unless ( $package )
-
 
965
    {
-
 
966
        ReportError ("ManifestFiles: Package not known to build: $package_name");
-
 
967
        return undef;
-
 
968
    }
-
 
969
 
-
 
970
    my $pkg_root = $package->{'ROOT'};
-
 
971
    my $pkgDir = CatPaths( $pkg_root, $subdir);
-
 
972
    unless (-d $pkgDir) {
-
 
973
        ReportError ("ManifestFiles: Template subdir not found in $package_name: $subdir");
-
 
974
        return undef;
-
 
975
    }
-
 
976
 
-
 
977
    #
-
 
978
    #   Determine Manifest File name, unless specified by user
-
 
979
    #
-
 
980
    unless ($manifest) {
-
 
981
        foreach my $file ( glob ($pkgDir . '/Manifest*' ) )
-
 
982
        {
-
 
983
                next unless ( -f $file );
-
 
984
                if ( $manifest ) {
-
 
985
                    Warning ("Multiple Manifest Files find. Only the first will be used",
-
 
986
                             "Using: $manifest",
-
 
987
                             "Ignoring: $file" ) ;
-
 
988
                    next;
-
 
989
                }
-
 
990
                $manifest = $file;
-
 
991
        }
-
 
992
        unless ($manifest)
-
 
993
        {
-
 
994
            ReportError ("ImportManifest. No Manifest template found: $package_name");
-
 
995
            return undef;
-
 
996
        }
-
 
997
    } else { 
-
 
998
        $manifest = CatPaths($pkgDir, $manifest);
-
 
999
    }
-
 
1000
 
-
 
1001
    unless (-f $manifest) {
-
 
1002
        ReportError ("ImportManifest. No Manifest template found: $package_name, $subdir, $manifest");
-
 
1003
        return undef;
-
 
1004
    }
-
 
1005
 
-
 
1006
    #
-
 
1007
    #   Return paramters for later processing
-
 
1008
    #
-
 
1009
 
-
 
1010
    $package_dirs{$pkg_root}{used} = 1;
-
 
1011
    return { 'manifest' => $manifest,
-
 
1012
             'pkg_dir' => $pkg_root,
-
 
1013
             'subdir' => $subdir,
-
 
1014
             'manifest_dir' => $pkgDir,
-
 
1015
             'package' => $package_name,
-
 
1016
    }; 
-
 
1017
}
-
 
1018
 
-
 
1019
 
-
 
1020
#-------------------------------------------------------------------------------
833
# Function        : Generate
1021
# Function        : Generate
834
#
1022
#
835
# Description     : Internal Function
1023
# Description     : Internal Function
836
#                   Process all the collected data and create directives
1024
#                   Process all the collected data and create directives
837
#                   for the creation of the manifest
1025
#                   for the creation of the manifest
Line 927... Line 1115...
927
        
1115
        
928
    #
1116
    #
929
    #   Process each tier in the order presented in the source file
1117
    #   Process each tier in the order presented in the source file
930
    #
1118
    #
931
    my $last_was_comment = 0;
1119
    my $last_was_comment = 0;
-
 
1120
    my $last_was_insert = 0;
932
    foreach my $entry ( @Manifests )
1121
    foreach my $entry ( @Manifests )
933
    {
1122
    {
934
 
1123
 
935
#DebugDumpData ( "Manifest Entry", $entry );
1124
#DebugDumpData ( "Manifest Entry", $entry );
936
 
1125
 
Line 960... Line 1149...
960
                print_mf ( map (('# ' . $_) , split ("\n", $cmt) ));
1149
                print_mf ( map (('# ' . $_) , split ("\n", $cmt) ));
961
                $last_was_comment = 1;
1150
                $last_was_comment = 1;
962
                next;
1151
                next;
963
            }
1152
            }
964
 
1153
 
965
            print_mf ('#') if ( $last_was_comment );
1154
            print_mf ('#') if ( $last_was_comment);
-
 
1155
            $last_was_comment = 0;
-
 
1156
 
-
 
1157
            if ( my $ip = $fentry->{'insertPoint'} ) {
-
 
1158
               #
-
 
1159
               #   Create an insertion point
-
 
1160
               #   Looks like a comment for the purposes of backward compatability
-
 
1161
               #
-
 
1162
 
-
 
1163
               print_mf ('') unless $last_was_insert;
-
 
1164
               print_mf ("##INSERT POINT [Name:$ip->{name}] [Tier:$ip->{tier}]");
-
 
1165
               $last_was_insert = 1;
-
 
1166
               next;
-
 
1167
            }
-
 
1168
            print_mf ('#') if ( $last_was_insert);
-
 
1169
            $last_was_insert = 0;
-
 
1170
 
966
            if ( my $file = $fentry->{'file'} )
1171
            if ( my $file = $fentry->{'file'} )
967
            {
1172
            {
968
                my $base_file = StripDir( $file );
1173
                my $base_file = StripDir( $file );
969
                my @items = ($name, $tier, $base_file);
1174
                my @items = ($name, $tier, $base_file);
970
                if ($include_md5) {
1175
                if ($include_md5) {
Line 974... Line 1179...
974
                if (exists $entry->{fileVersions} && exists $entry->{fileVersions}{$file} ) {
1179
                if (exists $entry->{fileVersions} && exists $entry->{fileVersions}{$file} ) {
975
                    push @items, "VERSION=" . $entry->{fileVersions}{$file};
1180
                    push @items, "VERSION=" . $entry->{fileVersions}{$file};
976
                }
1181
                }
977
                print_mf (join (',', @items));
1182
                print_mf (join (',', @items));
978
                PackageManifestFile ($name, $tier, $file );
1183
                PackageManifestFile ($name, $tier, $file );
979
                $last_was_comment = 0;
-
 
980
            }
1184
            }
981
 
1185
 
982
            if ( my $file = $fentry->{'filenocopy'} )
1186
            if ( my $file = $fentry->{'filenocopy'} )
983
            {
1187
            {
984
                print_mf ("$name,$tier,$file");
1188
                print_mf ("$name,$tier,$file");
985
                $last_was_comment = 0;
-
 
986
            }
1189
            }
987
 
1190
 
988
            if ( my $emf = $fentry->{'manifest'} )
1191
            if ( my $emf = $fentry->{'manifest'} )
989
            {
1192
            {
990
                $last_was_comment = 0;
-
 
991
                #
1193
                #
992
                #   Insert the entire manifest
1194
                #   Insert the entire manifest
993
                #   Items are:
1195
                #   Items are:
994
                #        contents
1196
                #        contents
995
                #        items:
1197
                #        items:
Line 1118... Line 1320...
1118
 
1320
 
1119
#-------------------------------------------------------------------------------
1321
#-------------------------------------------------------------------------------
1120
# Function        : PackageManifestFile  
1322
# Function        : PackageManifestFile  
1121
#
1323
#
1122
# Description     : Process and package a manifest file
1324
# Description     : Process and package a manifest file
1123
#                       Reatin a list of files in the mnifest to allow postprocessing
1325
#                       Retain a list of files in the manifest to allow postprocessing
1124
#                       such as signature generation
1326
#                       such as signature generation
1125
#                   
1327
#                   
1126
#
1328
#
1127
# Inputs          : $name           - Target platform name
1329
# Inputs          : $name           - Target platform name
1128
#                   $tier           - Target tier
1330
#                   $tier           - Target tier