Subversion Repositories DevTools

Rev

Rev 391 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 391 Rev 4001
Line 59... Line 59...
59
my $DESCPKG_TYPE  = "";
59
my $DESCPKG_TYPE  = "";
60
my $CWD_DIR       = cwd;
60
my $CWD_DIR       = cwd;
61
my $SRC_ROOT;
61
my $SRC_ROOT;
62
my $DPKG_DIR;
62
my $DPKG_DIR;
63
my $DPKG_ROOT;
63
my $DPKG_ROOT;
-
 
64
my $PKG_BASE;
64
my $e_repository = "";
65
my $e_repository = "";
65
my $bad_merge_count = 0;
66
my $bad_merge_count = 0;
66
 
67
 
67
#
68
#
68
#   Option variables
69
#   Option variables
Line 164... Line 165...
164
    EnvImport ('GBE_MACHTYPE');
165
    EnvImport ('GBE_MACHTYPE');
165
    EnvImport ('GBE_HOSTNAME');
166
    EnvImport ('GBE_HOSTNAME');
166
    EnvImport ('USER' );
167
    EnvImport ('USER' );
167
    EnvImportOptional ('GBE_ABT', "");
168
    EnvImportOptional ('GBE_ABT', "");
168
 
169
 
-
 
170
    #
-
 
171
    #   Determine the target archive
-
 
172
    #   The default archive is GBE_DPKG, but this may be changed
-
 
173
    #
-
 
174
    $opt_archive = 'main' unless ( $opt_archive );
-
 
175
    my $archive_tag = $Archive2Var{$opt_archive};
-
 
176
    Error("Unknown archive specified: $opt_archive")
-
 
177
        unless ( $archive_tag );
-
 
178
    $DPKG_ROOT = $ENV{$archive_tag} || '';
-
 
179
    Verbose ("Archive Variable: $archive_tag" );
-
 
180
    Verbose2 ("Archive Path: $DPKG_ROOT" );
-
 
181
 
-
 
182
    #
-
 
183
    #   Detect NoBuild marker
-
 
184
    #   This will bypass most of the operation of this package
-
 
185
    #
-
 
186
    if ( -f 'noBuild.gbe' )
-
 
187
    {
-
 
188
        Verbose ("No Build Marker file found");
-
 
189
        Error("Use of noBuild marker should only be done by a build daemon")
-
 
190
            unless ( $GBE_ABT );
-
 
191
 
-
 
192
        $SRC_ROOT = '';
-
 
193
        $DPKG_NAME = 'pkg';
-
 
194
        $DESCPKG_FILE = 'descpkg';
-
 
195
        $PKG_BASE =$CWD_DIR;
-
 
196
        return;
-
 
197
    }
169
 
198
 
170
    #
199
    #
171
    #   Check for a "pkg" directory
200
    #   Check for a "pkg" directory
172
    #   This may be in:
201
    #   This may be in:
173
    #       1) The deploy directory (DEPLOY) build/deploy/descpkg
202
    #       1) The deploy directory (DEPLOY) build/deploy/descpkg
174
    #       2) The build directory (ANT)     build/pkg/descpkg
203
    #       2) The build directory (ANT)     build/pkg/descpkg
175
    #       3) The current directory (JATS)  pkg/xxxx/descpkg
204
    #       3) The current directory (JATS)  pkg/xxxx/descpkg
176
    #
205
    #
177
    my $PKG_BASE = "$CWD_DIR/build/deploy";
206
    $PKG_BASE = "$CWD_DIR/build/deploy";
178
    Verbose2 ("Looking for descpkg: $PKG_BASE");
207
    Verbose2 ("Looking for descpkg: $PKG_BASE");
179
    if ( -f "$PKG_BASE/descpkg" )
208
    if ( -f "$PKG_BASE/descpkg" )
180
    {
209
    {
181
        #
210
        #
182
        #   This is a deployment package.
211
        #   This is a deployment package.
Line 200... Line 229...
200
                unless( -d $PKG_BASE );
229
                unless( -d $PKG_BASE );
201
        }
230
        }
202
    }
231
    }
203
    Verbose("Package directory: $PKG_BASE");
232
    Verbose("Package directory: $PKG_BASE");
204
 
233
 
205
    #
-
 
206
    #   Determine the target archive
-
 
207
    #   The default archive is GBE_DPKG, but this may be changed
-
 
208
    #
-
 
209
    $opt_archive = 'main' unless ( $opt_archive );
-
 
210
    my $archive_tag = $Archive2Var{$opt_archive};
-
 
211
    Error("Unknown archive specified: $opt_archive")
-
 
212
        unless ( $archive_tag );
-
 
213
 
-
 
214
    $DPKG_ROOT = $ENV{$archive_tag} || '';
-
 
215
    Verbose ("Archive Variable: $archive_tag" );
-
 
216
    Verbose2 ("Archive Path: $DPKG_ROOT" );
-
 
217
 
-
 
218
    Error("Repository location not specified: $archive_tag")
234
    Error("Repository location not specified: $archive_tag")
219
        unless $DPKG_ROOT;
235
        unless $DPKG_ROOT;
220
 
236
 
221
    Error("Failed to find Repository: $DPKG_ROOT")
237
    Error("Failed to find Repository: $DPKG_ROOT")
222
        unless ( -d $DPKG_ROOT );
238
        unless ( -d $DPKG_ROOT );
Line 230... Line 246...
230
    #   main package directory.
246
    #   main package directory.
231
    #
247
    #
232
    #   This installation process only handles one such file
248
    #   This installation process only handles one such file
233
    #
249
    #
234
    File::Find::find( \&pkgFind, $PKG_BASE);
250
    File::Find::find( \&pkgFind, $PKG_BASE);
-
 
251
}
235
 
252
 
-
 
253
#-------------------------------------------------------------------------------
-
 
254
# Function        : CheckDescPkg
-
 
255
#
-
 
256
# Description     : Check the descpkg file
236
 
257
#
-
 
258
# Inputs          : Globals
-
 
259
#
-
 
260
# Returns         : Will not return on error
-
 
261
#
-
 
262
sub CheckDescPkg
-
 
263
{
237
    # Get the dpkg_archive version number we are  going to create.
264
    # Get the dpkg_archive version number we are  going to create.
238
    #
265
    #
239
    Error("Descpkg file not found in package directory: $PKG_BASE")
266
    Error("Descpkg file not found in package directory: $PKG_BASE")
240
        unless ( -f "$DESCPKG_FILE" );
267
        unless ( -f "$DESCPKG_FILE" );
241
 
268
 
Line 295... Line 322...
295
        ReportError ("Package Version does not match expected version",
322
        ReportError ("Package Version does not match expected version",
296
                     "Expected: '$opt_pversion'",
323
                     "Expected: '$opt_pversion'",
297
                     "Descpkg : '$DPKG_VERSION'") unless ( $DPKG_VERSION eq $opt_pversion );
324
                     "Descpkg : '$DPKG_VERSION'") unless ( $DPKG_VERSION eq $opt_pversion );
298
    }
325
    }
299
    ErrorDoExit();
326
    ErrorDoExit();
-
 
327
}
300
 
328
 
-
 
329
#-------------------------------------------------------------------------------
-
 
330
# Function        : ShowInfo
-
 
331
#
-
 
332
# Description     : Show info to the user
-
 
333
#
-
 
334
# Inputs          : 
-
 
335
#
-
 
336
# Returns         : 
-
 
337
#
-
 
338
sub ShowInfo
-
 
339
{
301
    #
340
    #
302
    #   Set up the target directory path and name
341
    #   Set up the target directory path and name
303
    #   It will be created later
342
    #   It will be created later
304
    #
343
    #
305
    $DPKG_DIR = "$DPKG_ROOT/$DPKG_NAME/$DPKG_VERSION";
344
    $DPKG_DIR = "$DPKG_ROOT/$DPKG_NAME/$DPKG_VERSION";
306
 
345
    
307
    #
346
    #
308
    #   Information for the user
347
    #   Information for the user
309
    #
348
    #
310
    Information ("---------------------------------------------------------------");
349
    Information ("---------------------------------------------------------------");
311
    Information ("Dpkg archive creation tool...");
350
    Information ("Dpkg archive creation tool...");
Line 349... Line 388...
349
                   "is not guaranteed.",
388
                   "is not guaranteed.",
350
                   "Only version 99.99.99 is allowed");
389
                   "Only version 99.99.99 is allowed");
351
            }
390
            }
352
        }
391
        }
353
    }
392
    }
354
 
-
 
355
 
-
 
356
    # done.
-
 
357
    return 1;
-
 
358
}
393
}
359
 
394
 
-
 
395
 
360
#------------------------------------------------------------------------------
396
#------------------------------------------------------------------------------
361
sub pkgFind
397
sub pkgFind
362
#
398
#
363
# Description:
399
# Description:
364
#     This subroutine is used to locate the FIRST descpkg file in
400
#     This subroutine is used to locate the FIRST descpkg file in
Line 502... Line 538...
502
    #
538
    #
503
    #   Create the top level directory
539
    #   Create the top level directory
504
    #
540
    #
505
    mkpath($DPKG_DIR, 0, 0775);
541
    mkpath($DPKG_DIR, 0, 0775);
506
 
542
 
507
 
-
 
508
    # lets process the files.
-
 
509
    #
543
    #
-
 
544
    #   Transfer source directory, unless this is a noBuild
-
 
545
    #
510
    if ( -d $SRC_ROOT )
546
    if ( $SRC_ROOT ne '' )
511
    {
547
    {
-
 
548
        # Process the files
-
 
549
        #
-
 
550
        if ( -d $SRC_ROOT )
-
 
551
        {
512
        File::Find::find( \&pkgFind2, $SRC_ROOT );
552
            File::Find::find( \&pkgFind2, $SRC_ROOT );
513
 
553
 
514
        if ( $bad_merge_count )
554
            if ( $bad_merge_count )
-
 
555
            {
-
 
556
                my $msg = "Merged files that differ: $bad_merge_count";
-
 
557
                $opt_md5 ? Error($msg) : Warning($msg);
-
 
558
            }
-
 
559
        }
-
 
560
        else
515
        {
561
        {
516
            my $msg = "Merged files that differ: $bad_merge_count";
562
            Error("Failed to find dir [$SRC_ROOT]",
517
            $opt_md5 ? Error($msg) : Warning($msg);
563
                  "Check JATS config.");
518
        }
564
        }
519
    }
565
    }
520
    else
-
 
521
    {
-
 
522
        Error("Failed to find dir [$SRC_ROOT]",
-
 
523
              "Check JATS config.");
-
 
524
    }
-
 
525
 
566
 
526
    #
567
    #
527
    #   Transfer of data is complete
568
    #   Transfer of data is complete
528
    #       Deprecated format: ($touchfile0)
569
    #       Deprecated format: ($touchfile0)
529
    #           Mark the archive with the build type to indicate which parts of
570
    #           Mark the archive with the build type to indicate which parts of
Line 534... Line 575...
534
    #
575
    #
535
    my $touchfile = $opt_generic ? "$DPKG_DIR/built.generic" : "$DPKG_DIR/built.$GBE_HOSTNAME";
576
    my $touchfile = $opt_generic ? "$DPKG_DIR/built.generic" : "$DPKG_DIR/built.$GBE_HOSTNAME";
536
    my $touchfile0 = "$DPKG_DIR/built.$GBE_MACHTYPE";
577
    my $touchfile0 = "$DPKG_DIR/built.$GBE_MACHTYPE";
537
 
578
 
538
    #
579
    #
539
    #   Create astring to be appended to the 'built' file
580
    #   Create a string to be appended to the 'built' file
540
    #   Comma seperated list of (possibly) usefule info
581
    #   Comma seperated list of (possibly) useful info
541
    #       Date-Time ( Local and GMT)
582
    #       Date-Time ( Local and GMT)
542
    #       machine type, machine name and the user
583
    #       machine type, machine name and the user
543
    #       GBE_ABT value
584
    #       GBE_ABT value
544
    #
585
    #
545
    my $built_info = localtime() ."," . gmtime() . " GMT,$GBE_MACHTYPE,$GBE_HOSTNAME,$USER,$GBE_ABT";
586
    my $built_info = localtime() ."," . gmtime() . " GMT,$GBE_MACHTYPE,$GBE_HOSTNAME,$USER,$GBE_ABT";
Line 764... Line 805...
764
my $test_dir_count = 0;
805
my $test_dir_count = 0;
765
my $test_file_count = 0;
806
my $test_file_count = 0;
766
my @test_root_file = ();
807
my @test_root_file = ();
767
sub TestDpkgArchive
808
sub TestDpkgArchive
768
{
809
{
769
    Error("Failed to find dir [$SRC_ROOT]",
-
 
770
          "Check JATS config.") unless ( -d $SRC_ROOT );
-
 
771
 
-
 
772
 
-
 
773
    #
-
 
774
    #   Scan the package counting files and folders
-
 
775
    #
-
 
776
    $test_dir_count = 0;
810
    $test_dir_count = 0;
777
    $test_file_count = 0;
811
    $test_file_count = 0;
778
    @test_root_file = ();
812
    @test_root_file = ();
-
 
813
 
-
 
814
    if ( $SRC_ROOT ne '' )
-
 
815
    {
-
 
816
        Error("Failed to find dir [$SRC_ROOT]",
-
 
817
              "Check JATS config.") unless ( -d $SRC_ROOT );
-
 
818
 
-
 
819
 
-
 
820
        #
-
 
821
        #   Scan the package counting files and folders
-
 
822
        #
779
    File::Find::find( \&pkgFind3, $SRC_ROOT );
823
        File::Find::find( \&pkgFind3, $SRC_ROOT );
-
 
824
    }
780
 
825
 
781
    Information ("Package contains:",
826
    Information ("Package contains:",
782
                 "Files: $test_file_count",
827
                 "Files: $test_file_count",
783
                 "Dirs: $test_dir_count",
828
                 "Dirs: $test_dir_count",
784
                 );
829
                 );
Line 826... Line 871...
826
 
871
 
827
 
872
 
828
# Initialise our world
873
# Initialise our world
829
#
874
#
830
Init();
875
Init();
-
 
876
CheckDescPkg();
-
 
877
ShowInfo();
831
 
878
 
832
 
879
 
833
# Check with the user they want to proceed
880
# Check with the user they want to proceed
834
#
881
#
835
unless ( $opt_test )
882
unless ( $opt_test )