Subversion Repositories DevTools

Rev

Rev 1131 | Rev 5649 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1119 dpurdie 1
########################################################################
2
# Copyright (C) 2007 ERG Limited, All rights reserved
3
#
4
# Module name   : jats.sh
5
# Module type   : Makefile system
6
# Compiler(s)   : n/a
7
# Environment(s): jats
8
#
9
# Description   : This package extends the JATS toolset at build time
10
#                 It provides additional directives to the JATS makefiles
11
#                 to simplify the directives.
12
#
13
#                 This directive does all its work at 'build' time
14
#                 It uses makefile.pl directives
15
#
16
# Operation     : This package adds the JATS directive ManifestFiles
17
#                 This is used to create linux manifest files
18
#
19
# Syntax        : ManifestFiles (<platforms>, Options+);
20
#                 See the function header for details
21
#
22
#......................................................................#
23
 
24
require 5.6.1;
25
use strict;
26
use warnings;
27
 
28
#
29
#   Globals
30
#
31
my @Manifests;                      # Manifest entries
1125 alewis 32
my $Manifest_has_version = 1;       # Create Manifest_xxxx by default
1121 dpurdie 33
my %package_dirs;                   # Package dirs discovered and used
1125 alewis 34
my $pkg_subdir;                     # Alternate packaging
1119 dpurdie 35
 
36
#-------------------------------------------------------------------------------
37
# Function        : BEGIN
38
#
39
# Description     : Setup directive hooks
40
#                   Register a function to be called just before we start to
41
#                   generate makefiles. This will be used to process the data
42
#                   collected in all the ManifestFiles directives
43
#
44
# Inputs          : None
45
#
46
# Returns         : None
47
#
48
BEGIN
49
{
50
    RegisterMakefileGenerate (\&ManifestFiles_Generate);
51
}
52
 
53
#-------------------------------------------------------------------------------
54
# Function        : ManifestFiles
55
#
56
# Description     : Create a ManifestFiles entry
57
#
58
# Inputs          : Platform             - Active Platform Selector
59
#                   Options              - One or more options
60
#                       --Name=Name             - Mandatory
61
#                       --Tier=Name             - Mandatory
62
#                       --Architecture=xxxx     - Default actitecture is the current target
63
#                       --Product=yyyy          - Product Family
64
#                       --Debian=BaseName[,--Prod,--Debug,--Arch=xxxx,--Product=yyyy]
65
#                       --MugPackage=Package[,--Subdir=subdir[,subdir]+]
66
#                       --SrcFile=xxx
1125 alewis 67
#                       --SrcFileNoCopy=xxx
1123 dpurdie 68
#                       --Comment=xxx           - Add comment to Manifst
1125 alewis 69
#                       --NoManifestVersion     - Create unversioned Manifest File
70
#                       --PkgSubdir=xxx         - Specifies packaging subdir
5105 dpurdie 71
#                       --ImportManifest=Package[,--Subdir=subdir,--ReWrite] - Import Manifest from package
1119 dpurdie 72
#
73
# Returns         : Nothing
74
#
75
sub ManifestFiles
76
{
77
    my( $platforms, @elements ) = @_;
78
    Debug2( "ManifestFiles($platforms, @elements)" );
79
    return if ( ! ActivePlatform($platforms) );
80
 
81
    my $name;
82
    my $tier;
83
    my @files;
84
    my $mug_dir;
85
    my $default_arch = $::ScmPlatform;
86
    my $default_prod = '';
1129 dpurdie 87
    my $imported_manifest = 0;
1119 dpurdie 88
 
89
    #
90
    #   Collect user options
91
    #
92
    foreach ( @elements )
93
    {
94
        if ( m~^--Name=(.+)~ ) {
95
            if ( $name )
96
            {
97
                ReportError ("ManifestFiles:--Name option is only allowed once");
98
                next;
99
            }
100
            $name = $1;
101
 
102
        } elsif ( m~^--Tier=(.+)~ ) {
103
            if ( $tier )
104
            {
105
                ReportError ("ManifestFiles:--Tier option is only allowed once");
106
                next;
107
            }
108
            $tier = $1;
109
 
1123 dpurdie 110
        } elsif ( m~^--Comment=~ ) {
111
            my $cmt = $_;
112
            $cmt =~ s~.+=~~;
113
            $cmt =~ s~\s*\n\s*~\n~g;
114
            push @files, {'cmt' => $cmt };
115
 
1119 dpurdie 116
        } elsif ( m~^--Debian=(.+)~ ) {
1123 dpurdie 117
            push @files, {'file' => LocateDebianFile($1, $default_arch, $default_prod)};
1119 dpurdie 118
 
119
        } elsif ( m~^--SrcFile=(.+)~ ) {
1123 dpurdie 120
            push @files, {'file' => LocatePreReq($1)};
1119 dpurdie 121
 
1125 alewis 122
        } elsif ( m~^--SrcFileNoCopy=(.+)~ ) {
123
            push @files, {'filenocopy' => $1};
124
 
1119 dpurdie 125
        } elsif ( m~^--MugPackage=(.+)~ ) {
126
            if ( $mug_dir )
127
            {
128
                ReportError ("ManifestFiles:--MugPackage option is only allowed once");
129
                next;
130
            }    
131
            $mug_dir = LocateMugDir($1);
132
 
133
        } elsif ( m/^--Arch(.*)=(.+)/ ) {
134
            $default_arch = $2;
135
 
136
        } elsif ( m/^--Product=(.+)/ ) {
137
            $default_prod = $1;
138
 
1125 alewis 139
        } elsif ( m/^--NoManifestVersion/i ) {
140
            $Manifest_has_version = 0;
141
 
142
        } elsif ( m/^--PkgSubdir=(.+)/i ) {
143
            if ( $pkg_subdir )
144
            {
1129 dpurdie 145
                ReportError ("ManifestFiles:--PkgSubdir option is only allowed once");
1125 alewis 146
                next;
147
            }
148
            $pkg_subdir = $1;
149
 
1129 dpurdie 150
        } elsif ( m/^--ImportManifest=(.+)/i ) {
5105 dpurdie 151
            my $import_info = ImportManifest($1, $tier, $name);
1129 dpurdie 152
#DebugDumpData("ImportInfo", $import_info );
153
            push @files, {'manifest' => $import_info };
154
 
155
            #
156
            #   Fill in details unless already provided
157
            #
158
            $tier = $import_info->{'tier'} unless ( defined $tier );
159
            $name = $import_info->{'name'} unless ( defined $name );
160
 
161
            $imported_manifest = 1;
162
 
1119 dpurdie 163
        } else {
164
            ReportError ("ManifestFiles: Unknown option or argument: $_");
165
 
166
        }
167
    }
168
 
169
    #
170
    #   Sanity test the user options
171
    #
172
    ReportError ("ManifestFiles: No name specified")
173
        unless $name;
174
    ReportError ("ManifestFiles: No tier specified")
1129 dpurdie 175
        unless defined ($tier);
1119 dpurdie 176
    ReportError ("ManifestFiles: Cannot mix --Debian/--SrcFile with --MugPackage in one directive")
1129 dpurdie 177
        if ( $mug_dir && (@files || $imported_manifest) );
1119 dpurdie 178
    ReportError ("ManifestFiles: Must specify files to add to Manifest")
1129 dpurdie 179
        unless ( $mug_dir ||  @files || $imported_manifest);
1119 dpurdie 180
    ErrorDoExit();
181
 
182
    #
183
    #   Save information for processing at the end of the parsing phase
184
    #   Data collected from ALL the ManifestFiles directives will be collected
185
    #   and processed into one Manifest file
186
    #
187
    my %data;
188
    $data{tier} = $tier;
189
    $data{name} = $name;
190
    $data{files} = \@files;
191
    $data{mugdir} = $mug_dir;
1125 alewis 192
    $data{pkgsubdir} = $pkg_subdir;
1129 dpurdie 193
#DebugDumpData("DirectiveData", \%data );
1119 dpurdie 194
 
195
    push @Manifests, \%data;
196
    return;
197
 
198
    #-------------------------------------------------------------------------------
199
    # Function        : LocateDebianFile
200
    #
201
    # Description     : Locate a debian file
202
    #                   Internal Function
203
    #
204
    #                   Scan packages for the Debian package specified
205
    #                   The user provides the base name of the package
206
    #                   A Debian Package name has several fields
207
    #                   These are:
208
    #                       1) Base Name - Provided by the user
209
    #                       2) Version - Version will be wildcarded
210
    #                       3) Architecture - Wildcarded. Uses bin/arch directory
211
    #                   
212
    #                   Expect to find Debian Packages in the bin/PLATFORM subdir
213
    #
214
    # Inputs          : Debian base name, complete with suboptions
215
    #
216
    # Returns         : Full path of the file
217
    #
218
    sub LocateDebianFile
219
    {
220
        my ($arg, $arch, $product) = @_;
221
        Verbose("LocateDebianFile: Processing: $arg");
222
 
223
        my @type = qw( P D );
224
        my @debian_file_path;
225
 
226
        #
227
        #   Extract sub-options
228
        #       --Prod[uction]
229
        #       --Debug
230
        #       --Arch[itecture]=yyy
231
        #
232
        my ($base_name, @opts) = split( ',', $arg );
233
        foreach ( @opts )
234
        {
235
            if ( m/^--Arch(.*)=(.+)/ ) {
236
                $arch=$2;
237
            } elsif ( m/^--Product=(.+)/ ) {
238
                $product=$1;
239
            } elsif ( m/^--Prod/ ) {
240
                @type = 'P';
241
            } elsif ( m/^--Debug/ ) {
242
                @type = 'D';
243
            }
244
        }
245
 
246
        #
247
        #   Create a list of products
248
        #   ie: PRODUCT_ARCH
249
        #
250
        my @products;
251
        push @products, $product . '_' . $arch if ( $product );
252
        push @products, $arch;
253
 
254
        #
255
        #   Scan all packages for the specified debian package
256
        #
257
        foreach my $package_dir ( getPackagePaths ('--All') )
258
        {
259
            foreach my $type ( @type )
260
            {
261
                foreach my $prd ( @products )
262
                {
263
                    foreach my $joiner ( qw(/ .) )
264
                    {
265
                        my $dir = "$package_dir/bin$joiner$prd$type";
266
                        Verbose("ManifestFiles: Search in $dir");
267
                        next unless ( -d $dir );
268
                        my @files = glob ( "$dir/${base_name}_*.deb" );
269
                        next unless ( @files );
270
                        push @debian_file_path, @files;
1121 dpurdie 271
                        $package_dirs{$package_dir}{used} = 1;
1119 dpurdie 272
                    }
273
                }
274
            }
275
        }
276
 
277
        ReportError ("Required Debain package not found: $base_name") unless @debian_file_path;
1121 dpurdie 278
        ReportError ("Multiple matching Debian Packages located: $base_name", @debian_file_path ) if ( $#debian_file_path > 0 );
1119 dpurdie 279
        return $debian_file_path[0];
280
    }
281
 
282
    #-------------------------------------------------------------------------------
283
    # Function        : LocateMugDir
284
    #
285
    # Description     : Locate the directory containing the mugfiles
286
    #                   Internal Function
287
    #
288
    # Inputs          : Mufile package, with embedded options
289
    #
290
    # Returns         : Full path
291
    #
292
    sub LocateMugDir
293
    {
294
        my ($mug_package) = @_;
295
 
296
        #
297
        #   Locate the mugfile subdir
298
        #
299
        my $package_name = $mug_package;
300
        my @dirs = 'mug';
301
        my $mug_dir;
302
 
303
        #
304
        #   Extract sub options
305
        #       --Subdir=xxxx,yyyy,zzzz
306
        #
307
        if ( $package_name =~ m/(.*?),--Subdir=(.*)/ )
308
        {
309
            $package_name = $1;
310
            @dirs = split( ',', $2 );
311
        }
312
 
313
        my $package = GetPackageEntry( $package_name );
314
        unless ( $package )
315
        {
316
            ReportError ("ManifestFiles: Package not known to build: $package_name");
317
            return undef;
318
        }
319
 
320
        foreach my $subdir ( @dirs )
321
        {
322
            my $dir = "$package->{'ROOT'}/$subdir";
323
            if ( -d $dir )
324
            {
325
                Warning ("Multiple Mugfile directories located. Only the first will be used",
326
                         "Ignoring: $subdir" )if ( $mug_dir );
327
                $mug_dir = $dir;
328
            }
329
        }
330
        ReportError ("Mugfile directory not found in package: $package_name")
331
            unless $mug_dir;
332
 
333
        return $mug_dir;
334
    }
1129 dpurdie 335
 
336
    #-------------------------------------------------------------------------------
337
    # Function        : ImportManifest
338
    #
339
    # Description     : Import an existing manifest
340
    #
5105 dpurdie 341
    # Inputs          : Args    - PackageName[,Subdir=name,--ReWrite]
342
    #                   tier    - May be null
343
    #                   name    - May be null
1129 dpurdie 344
    #
345
    # Returns         : A hash of data to be used later
346
    #
347
    sub ImportManifest
348
    {
5105 dpurdie 349
        my ($args, $tier, $name) = @_;
1129 dpurdie 350
        my @file_contents;
351
        my @file_list;
352
 
353
        #
354
        #   Locate the mugfile subdir
355
        #
356
        my $package_name = $args;
357
        my @dirs = 'mug';
358
        my $pkg_dir;
359
        my $pkg_root;
360
        my $manifest;
361
        my $first_tier;
362
        my $first_name;
5105 dpurdie 363
        my $rewrite;
1129 dpurdie 364
 
365
        #
366
        #   Extract sub options
367
        #       --Subdir=xxxx,yyyy,zzzz
5105 dpurdie 368
        #       --ReWrite
1129 dpurdie 369
        #
5105 dpurdie 370
        if ( $package_name =~ m/(.*?)(,.*)/ )
1129 dpurdie 371
        {
372
            $package_name = $1;
5105 dpurdie 373
            my @subargs = split(',--', $2);
374
            foreach ( @subargs)
375
            {
376
                next unless (length($_) > 0);
377
                if (m~^Subdir=(.*)~i){
378
                    @dirs = split( ',', $1 );
379
 
380
                } elsif (m~^ReWrite~i) {
381
                    $rewrite = 1;
382
 
383
                } else {
384
                    ReportError("ManifestFiles: Unknown suboption to ImportManifest:" . $_);
385
                }
386
            }
1129 dpurdie 387
        }
388
 
389
        my $package = GetPackageEntry( $package_name );
390
        unless ( $package )
391
        {
392
            ReportError ("ManifestFiles: Package not known to build: $package_name");
393
            return undef;
394
        }
395
 
5105 dpurdie 396
        if (defined ($rewrite) && ( !defined($tier) || !defined($name)))
397
        {
398
            ReportError ("ManifestFiles: ImportManifest. --ReWrite cannot be used unless tier and name are specified");
399
            return undef;
400
        }
401
 
1129 dpurdie 402
        foreach my $subdir ( @dirs )
403
        {
404
            my $dir = "$package->{'ROOT'}/$subdir";
405
            my $root = $package->{'ROOT'};
406
            if ( -d $dir )
407
            {
408
                Warning ("Multiple Package directories located. Only the first will be used",
409
                         "Ignoring: $subdir" )if ( $pkg_dir );
410
                $pkg_dir = $dir;
411
                $pkg_root = $root;
412
            }
413
        }
414
 
5105 dpurdie 415
        unless ($pkg_dir)
416
        {
417
            ReportError ("Package directory not found in package: $package_name");
418
            return undef;
419
        }
420
 
1129 dpurdie 421
        #
422
        #   Determine Manifest File name
423
        #
424
        foreach my $file ( glob ($pkg_dir . '/Manifest*' ) )
425
        {
426
                next unless ( -f $file );
427
                Warning ("Multiple Manifest Files find. Only the first will be used",
428
                         "Using: $manifest",
429
                         "Ignoring: $file" ) if ( $manifest );
430
                $manifest = $file;
431
        }
432
 
5105 dpurdie 433
        unless ($manifest)
434
        {
435
            ReportError ("ImportManifest. No Manifest found: $package_name");
436
            return undef;
437
        }
1129 dpurdie 438
 
5105 dpurdie 439
 
1129 dpurdie 440
        #
441
        #   
442
        #
443
        open (MF, '<', $manifest ) || Error ("Cannot open the Manifest file: $manifest", $!);
444
        while ( <MF> )
445
        {
1131 dpurdie 446
            #
447
            #   Clean traling whitespace ( line-feed and new lines )
448
            #   Comment out [Version] data
449
            #
1129 dpurdie 450
            s~\s+$~~;
1131 dpurdie 451
            s~(\s*\[Version])~#$1~;
1129 dpurdie 452
 
453
            #
454
            #   Part lines and determine files
455
            #
456
            next unless ( $_ );
457
            next if ( m~\s*#~ );
458
            next if ( m~\s*\[~ );
459
            my( $aname, $atier, $afile) = split(/\s*\,\s*/, $_);
460
#            print "---------- $_\n";
461
#            print "T: $atier, N:$aname, F:$afile\n";
462
            push @file_list, $afile;
463
 
464
            #
5105 dpurdie 465
            #   Rewrite the name and tier
1129 dpurdie 466
            #
5105 dpurdie 467
            if ($rewrite)
468
            {
469
                $_ = join(',', $name, $tier, $afile);
470
                $first_tier = $tier;
471
                $first_name = $name;
472
            }
473
            else
474
            {
475
                #
476
                #   Capture first tier and name
477
                #
478
                $first_tier = $atier unless ( defined $first_tier );
479
                $first_name = $aname unless ( defined $first_name );
480
            }
1129 dpurdie 481
        }
5105 dpurdie 482
        continue
483
        {
484
            push @file_contents, $_;
485
        }
1129 dpurdie 486
        close MF;
487
 
488
        #
489
        #   Create a hash of data that describes the manifest that has
490
        #   just been read in.
491
        #
492
        $package_dirs{$pkg_root}{used} = 1;
493
        $manifest =~ s~.*/~~;
494
        return { 'contents' => \@file_contents,
495
                  'files' => \@file_list,
496
                  'file_base' => $pkg_dir,
497
                  'manifest' => $manifest,
498
                  'pkg_dir' => $pkg_root,
499
                  'tier' => $first_tier,
500
                  'name' => $first_name,
5105 dpurdie 501
                  'rewrite' => $rewrite,
1129 dpurdie 502
                };
503
    }
1119 dpurdie 504
}
505
 
506
#-------------------------------------------------------------------------------
507
# Function        : ManifestFiles_Generate
508
#
509
# Description     : Internal Function
510
#                   Process all the collected data and create directives
511
#                   for the creation of the manifest
512
#
513
#                   This function will be called, just before the Makefile
514
#                   is created. The function will:
515
#                       1) Create the Manifest File
516
#                       2) Package the Manifest File
517
#                       3) Package the manifest file contents
518
#
519
#                   using (mostly) normal makefile.pl directives.
520
#
521
# Inputs          : None
522
#
523
# Returns         : Nothing
524
#
525
sub ManifestFiles_Generate
526
{
527
    Debug ("ManifestFiles_Generate");
528
    Message ("Generating Manifest File");
1123 dpurdie 529
 
530
    #
531
    #   Need at least one Manifest Entry
532
    #
533
    return unless ( @Manifests );
1119 dpurdie 534
#DebugDumpData ( "Manifests", \@Manifests );
535
 
536
    #
1125 alewis 537
    #   Determine the target packaging directory
538
    #   Default is .../mug
539
    #
540
    my $pkgdir = 'mug';
1129 dpurdie 541
    if ( exists $Manifests[0]->{pkgsubdir} && defined $Manifests[0]->{pkgsubdir} )
1125 alewis 542
    {
543
        my $subdir = $Manifests[0]->{pkgsubdir};
544
        $pkgdir .= '/' . $subdir;
545
        $pkgdir =~ s~^mug/mug~mug~;
546
    }
547
 
548
    #
1119 dpurdie 549
    #   Create the Manifest File as we process the lists
1125 alewis 550
    #   Place this in the 'lib' directory:
1119 dpurdie 551
    #       - So that it will be deleted on clobber
1123 dpurdie 552
    #       - So that it can be placed in a target-specific subdir
1125 alewis 553
    #       - So that we can have one per makefile.pl
1119 dpurdie 554
    #
555
    Error ("ManifestFiles: Needs local directory specified in build.pl") unless ( $::ScmLocal );
556
 
1125 alewis 557
    my $manifest_dir = "$::ScmPlatform.LIB";
1119 dpurdie 558
    System( "$::GBE_BIN/mkdir -p $manifest_dir" );
559
 
1125 alewis 560
    my $manifest_file = $manifest_dir . '/Manifest';
561
    $manifest_file .= '_' . $::ScmBuildVersion if ( $Manifest_has_version );
562
    ToolsetGenerate( $manifest_file );
1119 dpurdie 563
    Verbose ("ManifestFiles_Generate: File: $manifest_file");
564
 
1125 alewis 565
    PackageFile ('*', $manifest_file, '--Subdir=' . $pkgdir, '--Strip' );
1119 dpurdie 566
 
567
    open (MF, '>', $manifest_file ) || Error ("Cannot create the Manifest file: $manifest_file");
568
 
569
    print_mf ("# PackageName: $::ScmBuildPackage");
570
    print_mf ("# PackageVersion: $::ScmBuildVersion");
571
    print_mf ("# BuildDate: $::CurrentTime");
572
    print_mf ("#");
573
    print_mf ("[Version],$::ScmBuildVersion");
574
    print_mf ("#");
575
 
576
    #
1125 alewis 577
    #   Process each tier in the order presented in the source file
1119 dpurdie 578
    #
1123 dpurdie 579
    my $last_was_comment = 0;
1119 dpurdie 580
    foreach my $entry ( @Manifests )
581
    {
1127 alewis 582
    #print_mf ("#");
1119 dpurdie 583
 
584
#DebugDumpData ( "Manifest Entry", $entry );
585
 
586
        my $tier = $entry->{tier};
587
        my $name = $entry->{name};
588
 
589
        #
590
        #   Insert all the files that have been specified
591
        #   The user specified order is preserved
592
        #
1123 dpurdie 593
        #   Entries may be either a file or a comment
594
        #   Comments: Merge multiple comments and create blocks
595
        #
596
        #
1119 dpurdie 597
        my @files = @{ $entry->{files} };
1123 dpurdie 598
        foreach my $fentry ( @files )
1119 dpurdie 599
        {
1123 dpurdie 600
            if ( my $cmt = $fentry->{'cmt'} )
601
            {
602
                print_mf ('') unless ( $last_was_comment ) ;
603
                print_mf ( map (('# ' . $_) , split ("\n", $cmt) ));
604
                $last_was_comment = 1;
605
                next;
606
            }
607
 
608
            print_mf ('#') if ( $last_was_comment );
609
            if ( my $file = $fentry->{'file'} )
610
            {
611
                my $base_file = StripDir( $file );
612
                print_mf ("$name,$tier,$base_file");
1125 alewis 613
                PackageFile ('*', $file, '--Subdir=' . $pkgdir, '--Strip' );
1123 dpurdie 614
                $last_was_comment = 0;
615
            }
1125 alewis 616
 
617
            if ( my $file = $fentry->{'filenocopy'} )
618
            {
619
                print_mf ("$name,$tier,$file");
620
                $last_was_comment = 0;
621
            }
1129 dpurdie 622
 
623
            if ( my $emf = $fentry->{'manifest'} )
624
            {
625
                $last_was_comment = 0;
626
                #
627
                #   Insert the entire manifest
628
                #   Items are:
629
                #        contents
630
                #        files
631
                #        file_base
632
                #        manifest
633
                #
634
#DebugDumpData ( "Embedded Manifest Entry", $emf );
635
                print_mf ( '## Included Manifest: ' .  $emf->{'manifest'}  );
636
                print_mf ($_) foreach  ( @{$emf->{'contents'}} );
637
                PackageFile ('*', $emf->{'file_base'}. '/' . $_, '--Subdir=' . $pkgdir, '--Strip' )foreach  ( @{$emf->{'files'}});;
638
                print_mf ( '## End Included Manifest' );
639
            }
1119 dpurdie 640
        }
641
 
642
        #
643
        #   Expand out the entire MUG directory
644
        #   All .mug files in the MUG directory will be added to the manifest
645
        #   The assumption is that the MUG directory has been created by
646
        #   something that knows what its doing
647
        #
648
        if ( my $mugdir = $entry->{mugdir} )
649
        {
650
            foreach my $file ( glob ($mugdir . '/*.mug' ) )
651
            {
652
                next unless ( -f $file );
653
                my $base_file = StripDir($file);
654
                print_mf ("$name,$tier,$base_file");
655
                PackageFile ('*', $file, '--Subdir=mug', '--Strip' );
656
            }
657
        }
658
    }
659
 
660
    #
661
    #   Complete the creation of the Manifest File
662
    #
663
    print_mf ("#");
664
    print_mf ("# End of File");
665
    close MF;
666
    ErrorDoExit();
1121 dpurdie 667
 
668
    #
669
    #   Sanity test of packages that did not provide a debian file
670
    #   Just a hint that something may have been missed
671
    #
672
    my @not_used_packages;
673
    foreach my $package_dir ( getPackagePaths ('--All') )
674
    {
675
        next if ( $package_dir =~ m~/manifest-tool/~ );
676
        unless ( exists $package_dirs{$package_dir}{used} )
677
        {
678
            push @not_used_packages, $package_dir;
679
        }
680
    }
681
    if ( @not_used_packages )
682
    {
683
        Warning ("Packages that did not contribute packages to the manifest:",
684
                  @not_used_packages );
685
    }
686
 
1119 dpurdie 687
    return;
688
 
689
    #-------------------------------------------------------------------------------
690
    # Function        : print_mf
691
    #
692
    # Description     : Internal Function
693
    #                   Print one line to the Manifest File
694
    #                   Checks the length of the line being created
695
    #
696
    # Inputs          : $line
697
    #
698
    # Returns         : 
699
    #
700
 
701
    sub print_mf
702
    {
703
        foreach  ( @_ )
704
        {
705
            ReportError ( "Manifest line too long",
706
                    "Line: $_" ) if ( length ($_) > 79 );
707
            print MF $_ . "\n";
708
        }
709
    }
710
 
711
}
712
 
713
1;