Subversion Repositories DevTools

Rev

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

Rev 5499 Rev 5527
Line 5... Line 5...
5
# Module type   : Makefile system
5
# Module type   : Makefile system
6
# Compiler(s)   : Perl
6
# Compiler(s)   : Perl
7
# Environment(s): jats
7
# Environment(s): jats
8
#
8
#
9
# Description   : This script is used to create a dpkg_archive.
9
# Description   : This script is used to create a dpkg_archive.
10
#                 Based on create_dpkg with following changes
10
#                 Features:
11
#                   * No user interaction
11
#                   * No user interaction
12
#                   * Generates files list for ReleaseNote integration 
12
#                   * Generates files list for ReleaseNote integration
-
 
13
#                   * Can generate package fragemts as a tarball for build system
13
#
14
#
14
# Usage:        : See POD
15
# Usage:        : See POD
15
#
16
#
16
#......................................................................#
17
#......................................................................#
17
 
18
 
Line 35... Line 36...
35
 
36
 
36
use JatsError;
37
use JatsError;
37
use JatsEnv;
38
use JatsEnv;
38
use DescPkg;
39
use DescPkg;
39
use FileUtils;
40
use FileUtils;
-
 
41
use JatsSystem;
40
 
42
 
41
#
43
#
42
#   Under Windows we need the Win32::FileSecurity module
44
#   Under Windows we need the Win32::FileSecurity module
43
#   It only exists under windows
45
#   It only exists under windows
44
#
46
#
Line 89... Line 91...
89
my $opt_pversion;
91
my $opt_pversion;
90
my $opt_test;
92
my $opt_test;
91
my $opt_md5 = 1;
93
my $opt_md5 = 1;
92
my $opt_outfile;
94
my $opt_outfile;
93
my $opt_info;
95
my $opt_info;
-
 
96
my $opt_tarmode;
-
 
97
my $opt_testArchive;
94
 
98
 
95
 
99
 
96
#
100
#
97
#   Structure to translate -archive=xxx option to archive variable
101
#   Structure to translate -archive=xxx option to archive variable
98
#   These are the various dpkg_archives known to JATS
102
#   These are the various dpkg_archives known to JATS
Line 119... Line 123...
119
#       This sub-routine is used to generate a consistent informational log
123
#       This sub-routine is used to generate a consistent informational log
120
#------------------------------------------------------------------------------
124
#------------------------------------------------------------------------------
121
{
125
{
122
    my ($opr, $file) = @_;
126
    my ($opr, $file) = @_;
123
    $file =~ s/$DPKG_ROOT/DPKG/;
127
    $file =~ s/$DPKG_ROOT/DPKG/;
-
 
128
    $file =~ s/$SRC_ROOT/PKG/;
124
 
129
 
125
    Information (sprintf( "%-15s [%s]", $opr, $file));
130
    Information (sprintf( "%-15s [%s]", $opr, $file));
126
}
131
}
127
 
132
 
128
#-------------------------------------------------------------------------------
133
#-------------------------------------------------------------------------------
Line 193... Line 198...
193
# Function        : writeFileInfo 
198
# Function        : writeFileInfo 
194
#
199
#
195
# Description     : Write out an XML file that contains this processes
200
# Description     : Write out an XML file that contains this processes
196
#                   contribution to the output package 
201
#                   contribution to the output package 
197
#
202
#
198
# Inputs          : 
203
# Inputs          : $targetDir          - Base directory for the file 
199
#
204
#
200
# Returns         : 
205
# Returns         : 
201
#
206
#
202
sub writeFileInfo
207
sub writeFileInfo
203
{
208
{
-
 
209
    my ($targetDir) = @_;
204
    my $data;
210
    my $data;
205
    $data->{file} = \@fileList;
211
    $data->{file} = \@fileList;
206
 
212
 
207
    #
213
    #
208
    #   Write out sections of XML
214
    #   Write out sections of XML
209
    #       Want control over the output order
215
    #       Want control over the output order
210
    #       Use lots of attributes and only elements for arrays
216
    #       Use lots of attributes and only elements for arrays
211
    #       Save as one attribute per line - for readability
217
    #       Save as one attribute per line - for readability
212
    #
218
    #
213
    $opt_outfile = $opt_generic ? "$DPKG_DIR/built.files.generic.xml" : "$DPKG_DIR/built.files.$GBE_HOSTNAME.xml";
219
    $opt_outfile = $opt_generic ? "built.files.generic.xml" : "built.files.$GBE_HOSTNAME.xml";
-
 
220
    $opt_outfile = catfile( $targetDir, $opt_outfile); 
214
 
221
 
215
    LogFileOp ('Meta File', $opt_outfile);
222
    LogFileOp ('Meta File', $opt_outfile);
216
    my $xs = XML::Simple->new( NoAttr =>0, AttrIndent => 1 );
223
    my $xs = XML::Simple->new( NoAttr =>0, AttrIndent => 1 );
217
 
224
 
218
    open (my $XML, '>', $opt_outfile) || Error ("Cannot create output file: $opt_outfile", $!);
225
    open (my $XML, '>', $opt_outfile) || Error ("Cannot create output file: $opt_outfile", $!);
Line 233... Line 240...
233
#
240
#
234
#------------------------------------------------------------------------------
241
#------------------------------------------------------------------------------
235
{
242
{
236
    # Process any command line arguements...
243
    # Process any command line arguements...
237
    my $result = GetOptions (
244
    my $result = GetOptions (
238
                "help:+"        => \$opt_help,              # flag, multiple use allowed
245
                'help:+'        => \$opt_help,              # flag, multiple use allowed
239
                "manual:3"      => \$opt_help,              # flag
246
                'manual:3'      => \$opt_help,              # flag
240
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
247
                'verbose:+'     => \$opt_verbose,           # flag, multiple use allowed
241
                "override!"     => \$opt_override,          # [no]flag (No longer used. Backward compat with build tool)
248
                'override!'     => \$opt_override,          # [no]flag (No longer used. Backward compat with build tool)
242
                "delete!"       => \$opt_delete,            # [no]flag
249
                'delete!'       => \$opt_delete,            # [no]flag
243
                "merge|m!"      => \$opt_merge,             # [no]flag.
250
                'merge|m!'      => \$opt_merge,             # [no]flag.
244
                "archive=s"     => \$opt_archive,           # string
251
                'archive=s'     => \$opt_archive,           # string
245
                "quiet+"        => \$opt_quiet,             # Flag
252
                'quiet+'        => \$opt_quiet,             # Flag
246
                "generic!"      => \$opt_generic,           # [no]Flag
253
                'generic!'      => \$opt_generic,           # [no]Flag
247
                "pname=s"       => \$opt_pname,             # string
254
                'pname=s'       => \$opt_pname,             # string
248
                "pversion=s"    => \$opt_pversion,          # string
255
                'pversion=s'    => \$opt_pversion,          # string
249
                "test!"         => \$opt_test,              # [no]flag
256
                'test!'         => \$opt_test,              # [no]flag
250
                "md5!"          => \$opt_md5,               # [no]flag
257
                'md5!'          => \$opt_md5,               # [no]flag
251
                "info!"         => \$opt_info,              # [no]flag
258
                'info!'         => \$opt_info,              # [no]flag
-
 
259
                'tarmode!'      => \$opt_tarmode,           # [no]flag
-
 
260
                'testArchive'   => \$opt_testArchive,       # [no]flag
252
                );
261
                );
253
 
262
 
254
 
263
 
255
    #
264
    #
256
    #   Process help and manual options
265
    #   Process help and manual options
Line 291... Line 300...
291
    $DPKG_ROOT = $ENV{$archive_tag} || '';
300
    $DPKG_ROOT = $ENV{$archive_tag} || '';
292
    Verbose ("Archive Variable: $archive_tag" );
301
    Verbose ("Archive Variable: $archive_tag" );
293
    Verbose2 ("Archive Path: $DPKG_ROOT" );
302
    Verbose2 ("Archive Path: $DPKG_ROOT" );
294
 
303
 
295
    #
304
    #
-
 
305
    #   Append testArchive path
-
 
306
    #
-
 
307
    $DPKG_ROOT = catdir ($DPKG_ROOT, '.dpkg_archive', 'test_dpkg') if $opt_testArchive;
-
 
308
 
-
 
309
    #
296
    #   Detect NoBuild marker
310
    #   Detect NoBuild marker
297
    #   This will bypass most of the operation of this package
311
    #   This will bypass most of the operation of this package
298
    #
312
    #
299
    if ( -f 'noBuild.gbe' )
313
    if ( -f 'noBuild.gbe' )
300
    {
314
    {
Line 454... Line 468...
454
{
468
{
455
    #
469
    #
456
    #   Set up the target directory path and name
470
    #   Set up the target directory path and name
457
    #   It will be created later
471
    #   It will be created later
458
    #
472
    #
-
 
473
    if ($opt_tarmode)
-
 
474
    {
-
 
475
        $DPKG_DIR = catdir($DPKG_ROOT, '.dpkg_archive', 'fragments');
-
 
476
    }
-
 
477
    else
-
 
478
    {
459
    $DPKG_DIR = "$DPKG_ROOT/$DPKG_NAME/$DPKG_VERSION";
479
        $DPKG_DIR = catdir($DPKG_ROOT, $DPKG_NAME, $DPKG_VERSION );
-
 
480
    }
460
    
481
    
461
    #
482
    #
462
    #   Information for the user
483
    #   Information for the user
463
    #
484
    #
464
    Information ("---------------------------------------------------------------");
485
    Information ("---------------------------------------------------------------");
Line 475... Line 496...
475
    Information1("DPKG_VERSION  = [$DPKG_VERSION]");
496
    Information1("DPKG_VERSION  = [$DPKG_VERSION]");
476
    Information1("GBE_MACHTYPE  = [$GBE_MACHTYPE]");
497
    Information1("GBE_MACHTYPE  = [$GBE_MACHTYPE]");
477
    Information1("GBE_HOSTNAME  = [$GBE_HOSTNAME]");
498
    Information1("GBE_HOSTNAME  = [$GBE_HOSTNAME]");
478
    Information1("GBE_ABT       = [$GBE_ABT]");
499
    Information1("GBE_ABT       = [$GBE_ABT]");
479
    Information1("USER          = [$USER]");
500
    Information1("USER          = [$USER]");
480
    Information ("")                                if ( $opt_merge || $opt_delete || $opt_info);
501
    Information ("")                                if ( $opt_merge || $opt_delete || $opt_info || $opt_tarmode || $opt_testArchive);
-
 
502
    Information ("Opt:TarMode       = Enabled")     if ( $opt_tarmode );
481
    Information ("Opt:Delete    = Enabled")         if ( $opt_delete );
503
    Information ("Opt:Delete        = Enabled")     if ( $opt_delete );
482
    Information ("Opt:Merge     = Enabled")         if ( $opt_merge );
504
    Information ("Opt:Merge         = Enabled")     if ( $opt_merge );
-
 
505
    Information ("Opt:testArchive   = Enabled")     if ( $opt_testArchive );
483
    Information ("Opt:TestMode  = Enabled. No Package Transferred") if ( $opt_test );
506
    Information ("Opt:TestMode      = Enabled. No Package Transferred") if ( $opt_test );
484
    Information ("Opt:Info      = Enabled. No Package Transferred") if ( $opt_info );
507
    Information ("Opt:Info          = Enabled. No Package Transferred") if ( $opt_info );
485
    Warning     ("Sandbox Build = Yes") if ($ENV{GBE_DPKG_SBOX}) ;
508
    Warning     ("Sandbox Build     = Yes") if ($ENV{GBE_DPKG_SBOX}) ;
486
    Information ("---------------------------------------------------------------");
509
    Information ("---------------------------------------------------------------");
487
 
510
 
488
    #
511
    #
489
    #   If the environment variable GBE_DPKG_SBOX is defined then the package
512
    #   If the environment variable GBE_DPKG_SBOX is defined then the package
490
    #   is being built within a development sandbox. In such a sandbox the
513
    #   is being built within a development sandbox. In such a sandbox the
Line 648... Line 671...
648
        }
671
        }
649
    }
672
    }
650
    Information("");
673
    Information("");
651
 
674
 
652
    #
675
    #
653
    #   Create a file handle based in the Repository Root to allow
-
 
654
    #   locking while we create the package directory
-
 
655
    #   Note: Windows can't do a flock on a directory handle
-
 
656
    #         so we must create a file
-
 
657
    #
-
 
658
    my $dirLockfile = "$DPKG_ROOT/lockfile";
-
 
659
    my $pkgLockfile = "$DPKG_DIR/lockfile";
-
 
660
    if ($GBE_ABT)
-
 
661
    {
-
 
662
        Verbose ("Acquiring archive lock");
-
 
663
        open (ARCHIVE_LOCK, '>', $dirLockfile) || Error ("Cannot open archive root for locking: $!", $dirLockfile );
-
 
664
        flock ARCHIVE_LOCK, 2;
-
 
665
    }
-
 
666
 
-
 
667
    #
-
 
668
    #   Create the top level directory
676
    #   Create the top level directory
669
    #
677
    #
670
    mkpath($DPKG_DIR, 0, 0775);
678
    mkpath($DPKG_DIR, 0, 0775);
671
 
679
 
672
    #
680
    #
673
    #   Release the lock that we have in the target file system
-
 
674
    #   Create a lock on the package version directory
-
 
675
    #   This allows others to create new package versions
-
 
676
    #
-
 
677
    if ($GBE_ABT)
-
 
678
    {
-
 
679
        Verbose ("Releasing archive lock");
-
 
680
        close ARCHIVE_LOCK;
-
 
681
        unlink $dirLockfile;
-
 
682
    }
-
 
683
 
-
 
684
    Verbose ("Acquiring packageVersion lock");
-
 
685
    open (ARCHIVE_LOCK, '>', $pkgLockfile) || Error ("Cannot open package directory for locking: $!", $pkgLockfile );
-
 
686
    flock ARCHIVE_LOCK, 2;
-
 
687
 
-
 
688
    #
-
 
689
    #   Transfer source directory, unless this is a noBuild
681
    #   Transfer source directory, unless this is a noBuild
690
    #
682
    #
691
    if ( $SRC_ROOT ne '' )
683
    if ( $SRC_ROOT ne '' )
692
    {
684
    {
693
        # Process the files
685
        # Process the files
Line 719... Line 711...
719
    #
711
    #
720
    #   Transfer of data is complete
712
    #   Transfer of data is complete
721
    #       Mark the archive with the build machine to indicate which parts of
713
    #       Mark the archive with the build machine to indicate which parts of
722
    #       a multi-machine build have been performed
714
    #       a multi-machine build have been performed
723
    #
715
    #
724
    my $touchfile = $opt_generic ? "$DPKG_DIR/built.generic" : "$DPKG_DIR/built.$GBE_HOSTNAME";
-
 
725
 
-
 
726
    #
-
 
727
    #   Create a string to be appended to the 'built' file
-
 
728
    #   Comma seperated list of (possibly) useful info
-
 
729
    #       Date-Time ( Local and GMT)
-
 
730
    #       machine type, machine name and the user
-
 
731
    #       GBE_ABT value
-
 
732
    #
-
 
733
    #   flock the file in an attempt to flush it out across the network
-
 
734
    #   Having build issues where the file is not seen for a very long time
-
 
735
    #
-
 
736
    my $built_info = localtime() ."," . gmtime() . " GMT,$GBE_MACHTYPE,$GBE_HOSTNAME,$USER,$GBE_ABT";
-
 
737
    LogFileOp("Mark File",$touchfile);
-
 
738
    FileAppend ( $touchfile, $built_info );
716
    my $touchfile = createBuiltFile($DPKG_DIR);
739
 
-
 
740
    open (TOUCH_LOCK, '>', $touchfile) || Error ("Cannot build marker for locking: $!", $touchfile );
-
 
741
    flock TOUCH_LOCK, 2;
-
 
742
    close TOUCH_LOCK;
-
 
743
 
-
 
744
    addFile('file', $touchfile, $touchfile);
717
    addFile('file', $touchfile, $touchfile);
745
 
718
 
746
    #
719
    #
747
    #   If there is a .lnk file in the archive then remove it now that the
720
    #   If there is a .lnk file in the archive then remove it now that the
748
    #   archive has been transferred. The .lnk files are created in 'local'
721
    #   archive has been transferred. The .lnk files are created in 'local'
Line 754... Line 727...
754
        LogFileOp("Removing Link",$link_file);
727
        LogFileOp("Removing Link",$link_file);
755
        unlink $link_file;
728
        unlink $link_file;
756
    }
729
    }
757
 
730
 
758
    #
731
    #
759
    #   Release the file lock
732
    #   Create the MD5 info file
760
    #
733
    #   
761
    Verbose ("Releasing packageVersion lock");
-
 
762
    close ARCHIVE_LOCK;
734
    writeFileInfo($DPKG_DIR);
763
    unlink $pkgLockfile;
-
 
764
    return 1;
735
    return 1;
765
}
736
}
766
 
737
 
767
 
-
 
768
#------------------------------------------------------------------------------
738
#------------------------------------------------------------------------------
769
sub pkgFind2
739
sub pkgFind2
770
#
740
#
771
# Description:
741
# Description:
772
#   This subroutine is used to locate all associated pkg files in
742
#   This subroutine is used to locate all associated pkg files in
Line 935... Line 905...
935
        }
905
        }
936
    }
906
    }
937
}
907
}
938
 
908
 
939
#-------------------------------------------------------------------------------
909
#-------------------------------------------------------------------------------
-
 
910
# Function        : CreateDpkgArchiveTarBall 
-
 
911
#
-
 
912
# Description     : Similar to CreateDpkgArchive, but it will create a tar file within the target
-
 
913
#                   directory.
-
 
914
#                   
-
 
915
#                   This is used by the build system to:
-
 
916
#                       1) Greatly speedup the transfer of packages with a very large number of files
-
 
917
#                       2) Remove the need for an multi-filesytem, multi OS atomic lock on the package
-
 
918
#                       
-
 
919
#                   The build system will process the tarball and create the package archive
-
 
920
#                   In doing so it will handle merge errors
-
 
921
#
-
 
922
# Inputs          : 
-
 
923
#
-
 
924
# Returns         : 
-
 
925
#
-
 
926
sub CreateDpkgArchiveTarBall
-
 
927
{
-
 
928
    Information("");
-
 
929
    InitFileUtils();
-
 
930
 
-
 
931
 
-
 
932
    #
-
 
933
    #   Locate the tar utility
-
 
934
    #   Use gtar if its available otherwise use tar
-
 
935
    #   
-
 
936
    my $tarProg = LocateProgInPath('gtar', '--All');
-
 
937
    $tarProg = LocateProgInPath('tar', '--All') unless $tarProg;
-
 
938
    Error ("Tar utility not found in path") unless $tarProg;
-
 
939
 
-
 
940
    #
-
 
941
    #   If a 'noBuild' then create a dummy package directory simply
-
 
942
    #   to contain the metadata. 
-
 
943
    #   Delete any existing dir of the same name to ensure its clean.
-
 
944
    #
-
 
945
    if ( $SRC_ROOT eq '' )
-
 
946
    {
-
 
947
        $SRC_ROOT = AbsPath('pkg/noBuild');
-
 
948
        RmDirTree ($SRC_ROOT);
-
 
949
        mkpath($SRC_ROOT, 0, 0775);
-
 
950
    }
-
 
951
 
-
 
952
    #
-
 
953
    #   Mark the archive with the build machine to indicate which parts of
-
 
954
    #   a multi-machine build have been performed
-
 
955
    #
-
 
956
    createBuiltFile($SRC_ROOT);
-
 
957
 
-
 
958
    #   Process the source directory
-
 
959
    #   A NoBuild will contain one metafile
-
 
960
    #
-
 
961
    if ( -d $SRC_ROOT )
-
 
962
    {
-
 
963
        File::Find::find( \&pkgFindTarBall, $SRC_ROOT );
-
 
964
 
-
 
965
        if (@bad_symlinks)
-
 
966
        {
-
 
967
            my $msg = "Bad Symlinks: " . scalar @bad_symlinks;
-
 
968
            $opt_test ? ReportError($msg, @bad_symlinks) : Warning($msg, @bad_symlinks);
-
 
969
        }
-
 
970
        ErrorDoExit();
-
 
971
    }
-
 
972
    else
-
 
973
    {
-
 
974
        Error("Failed to find dir [$SRC_ROOT]",
-
 
975
              "Check JATS config.");
-
 
976
    }
-
 
977
 
-
 
978
    #
-
 
979
    #   Create the MD5 info file
-
 
980
    #   
-
 
981
    writeFileInfo($SRC_ROOT);
-
 
982
 
-
 
983
    #
-
 
984
    #   Create the target path in the target archive
-
 
985
    #
-
 
986
    LogFileOp ('Creating', $DPKG_DIR);
-
 
987
    mkpath($DPKG_DIR, 0, 0775);
-
 
988
 
-
 
989
 
-
 
990
    #
-
 
991
    #   Create the TAR file
-
 
992
    #   Use gzip compression (tar.gz) as it provides a good compromise bewteen speed and size
-
 
993
    #
-
 
994
    my $tarTarget = join('_', $DPKG_NAME, $DPKG_VERSION, $GBE_HOSTNAME) . '.tar.gz';
-
 
995
    my $tarPath = catfile($DPKG_DIR, $tarTarget);
-
 
996
    LogFileOp ('TarZip', $tarPath);
-
 
997
    my @tarArgs;
-
 
998
    push @tarArgs, '-v' if IsVerbose(1);
-
 
999
    my $rv = System ('--NoShell', '--NoExit',$tarProg, @tarArgs, '-czf', $tarPath, '-C', $SRC_ROOT, '.' );
-
 
1000
    if ($rv)
-
 
1001
    {
-
 
1002
        unlink $tarPath;
-
 
1003
        unlink $opt_outfile; 
-
 
1004
        Error ('Cannot create tarball', "Path:$tarPath");
-
 
1005
    }
-
 
1006
 
-
 
1007
    return 1;
-
 
1008
}
-
 
1009
 
-
 
1010
#-------------------------------------------------------------------------------
-
 
1011
# Function        : pkgFindTarBall 
-
 
1012
#
-
 
1013
# Description     : Used by CreateDpkgArchiveTarBall
-
 
1014
#                   File::Find processing function
-
 
1015
#                   
-
 
1016
#                   This routine is called for each file and directory within the package
-
 
1017
#
-
 
1018
# Inputs          : As per File::Find 
-
 
1019
#
-
 
1020
# Returns         : Nothing
-
 
1021
#
-
 
1022
sub pkgFindTarBall
-
 
1023
{
-
 
1024
    my $item = $File::Find::name;
-
 
1025
    my $base = File::Basename::basename($item);
-
 
1026
    my $type;
-
 
1027
 
-
 
1028
    #
-
 
1029
    #   Ignore the top level directory
-
 
1030
    #
-
 
1031
    return
-
 
1032
        if ( $item eq $SRC_ROOT );
-
 
1033
 
-
 
1034
    #
-
 
1035
    #   Determine type of this item
-
 
1036
    #       file
-
 
1037
    #       link, badlink
-
 
1038
    #       dir
-
 
1039
    if ( -l $item)
-
 
1040
    {
-
 
1041
        if (-f $item) {
-
 
1042
            $type = 'link';
-
 
1043
        }
-
 
1044
        else
-
 
1045
        {
-
 
1046
            # Broken symlink
-
 
1047
            #   Remove it from the 'pkg'
-
 
1048
            #   Could try other ways of excluding it from the tar, but this is the simplest  
-
 
1049
            LogFileOp("Broken SymLink", $item);
-
 
1050
            push @bad_symlinks, substr ( $item, 1+length ($SRC_ROOT) );
-
 
1051
            $type = 'badlink';
-
 
1052
            unlink $item;
-
 
1053
            return;
-
 
1054
        }
-
 
1055
    } elsif ( -f $item) {
-
 
1056
        $type = 'file';
-
 
1057
    } elsif ( -d $item) {
-
 
1058
        $type = 'dir';
-
 
1059
    } else {
-
 
1060
        Error("Unknown file type. Cannot be packaged");
-
 
1061
    }
-
 
1062
 
-
 
1063
    #
-
 
1064
    #   Calculate the target directory name
-
 
1065
    #
-
 
1066
    my $target = $item;
-
 
1067
    $target = $DPKG_DIR . substr ( $item, length ($SRC_ROOT) );
-
 
1068
 
-
 
1069
    addFile($type, $item, $target);
-
 
1070
    LogFileOp('Process',$item);
-
 
1071
}
-
 
1072
 
-
 
1073
#-------------------------------------------------------------------------------
940
# Function        : TestDpkgArchive
1074
# Function        : TestDpkgArchive
941
#
1075
#
942
# Description     : Test the structure of the source achive
1076
# Description     : Test the structure of the source achive
943
#                   Ensure that it has some files
1077
#                   Ensure that it has some files
944
#                   Warn if files are present in the root directory
1078
#                   Warn if files are present in the root directory
Line 1014... Line 1148...
1014
            push @bad_symlinks, substr ( $File::Find::name, 1+length ($SRC_ROOT) );
1148
            push @bad_symlinks, substr ( $File::Find::name, 1+length ($SRC_ROOT) );
1015
        }
1149
        }
1016
    }
1150
    }
1017
}
1151
}
1018
 
1152
 
-
 
1153
#-------------------------------------------------------------------------------
-
 
1154
# Function        : createBuiltFile 
-
 
1155
#
-
 
1156
# Description     : Create the packages built.xxxx file
-
 
1157
#                   Used to track which build machines have contributed to the build 
-
 
1158
#
-
 
1159
# Inputs          : $targetDir          - Base directory for the file 
-
 
1160
#
-
 
1161
# Returns         : Full pathname of the generatde file
-
 
1162
#
-
 
1163
sub createBuiltFile
-
 
1164
{
-
 
1165
    my ($targetDir) = @_;
-
 
1166
 
-
 
1167
    #
-
 
1168
    #   Mark the archive with the build machine to indicate which parts of
-
 
1169
    #   a multi-machine build have been performed
-
 
1170
    #
-
 
1171
    my $touchfile = catfile( $targetDir, $opt_generic ? 'built.generic' : "built.$GBE_HOSTNAME");
-
 
1172
 
-
 
1173
    #
-
 
1174
    #   Create a string to be appended to the 'built' file
-
 
1175
    #   Comma seperated list of (possibly) useful info
-
 
1176
    #       Date-Time ( Local and GMT)
-
 
1177
    #       machine type, machine name and the user
-
 
1178
    #       GBE_ABT value
-
 
1179
    #
-
 
1180
    #   Having build issues where the file is not seen for a very long time
-
 
1181
    #
-
 
1182
    my $built_info = localtime() ."," . gmtime() . " GMT,$GBE_MACHTYPE,$GBE_HOSTNAME,$USER,$GBE_ABT";
-
 
1183
    LogFileOp("Mark File",$touchfile);
-
 
1184
    FileAppend ( $touchfile, $built_info );
-
 
1185
 
-
 
1186
    return $touchfile;
-
 
1187
}
-
 
1188
 
-
 
1189
 
1019
# ---------------------------------------------------------
1190
# ---------------------------------------------------------
1020
# ---------------------------------------------------------
1191
# ---------------------------------------------------------
1021
# Main
1192
# Main
1022
# ---------------------------------------------------------
1193
# ---------------------------------------------------------
1023
# ---------------------------------------------------------
1194
# ---------------------------------------------------------
Line 1030... Line 1201...
1030
ShowInfo();
1201
ShowInfo();
1031
unless ($opt_info)
1202
unless ($opt_info)
1032
{
1203
{
1033
    unless ( $opt_test )
1204
    unless ( $opt_test )
1034
    {
1205
    {
-
 
1206
        if ($opt_tarmode)
-
 
1207
        {
1035
        Information("Creating dpkg_archive package:", $DPKG_DIR);
1208
            Information("Creating dpkg_archive tarball:", $DPKG_DIR);
1036
        CreateDpkgArchive();
1209
            CreateDpkgArchiveTarBall();
-
 
1210
        }
-
 
1211
        else
-
 
1212
        {
-
 
1213
            Information("Creating dpkg_archive package:", $DPKG_DIR);
1037
        writeFileInfo();
1214
            CreateDpkgArchive();
-
 
1215
        }
1038
    }
1216
    }
1039
    else
1217
    else
1040
    {
1218
    {
1041
        Information("Testing user package.");
1219
        Information("Testing user package.");
1042
        TestDpkgArchive();
1220
        TestDpkgArchive();
Line 1076... Line 1254...
1076
    -[no]merge         - merge with existing version of the package
1254
    -[no]merge         - merge with existing version of the package
1077
    -archive=name      - Specify archive (cache, local, main, store, sandbox, deploy)
1255
    -archive=name      - Specify archive (cache, local, main, store, sandbox, deploy)
1078
    -pname=name        - Ensure package is named correctly
1256
    -pname=name        - Ensure package is named correctly
1079
    -pversion=version  - Ensure package version is correct
1257
    -pversion=version  - Ensure package version is correct
1080
    -generic           - Create a built.generic file
1258
    -generic           - Create a built.generic file
-
 
1259
    -[no]tarmode       - Transfer package as tarball
1081
    -[no]md5           - Use MD5 comparison of merged files(enabled)
1260
    -[no]md5           - Use MD5 comparison of merged files(enabled)
-
 
1261
 
-
 
1262
  Debug and Testing:
1082
    -[no]test          - Test package. Do not transfer.
1263
    -[no]test          - Test package. Do not transfer.
1083
    -[no]info          - Display packaging info. Do not transfer.
1264
    -[no]info          - Display packaging info. Do not transfer.
-
 
1265
    -[no]testArchive   - Perform operations within a test archive
1084
 
1266
 
1085
=head1 OPTIONS
1267
=head1 OPTIONS
1086
 
1268
 
1087
=over 8
1269
=over 8
1088
 
1270
 
Line 1174... Line 1356...
1174
=item B<-generic>
1356
=item B<-generic>
1175
 
1357
 
1176
This option will create a built.generic file, instead of one based on the machine
1358
This option will create a built.generic file, instead of one based on the machine
1177
that actually built the package. This is used by the AutoBuilder toolchain.
1359
that actually built the package. This is used by the AutoBuilder toolchain.
1178
 
1360
 
-
 
1361
=item B<-[no]tarmode>
-
 
1362
 
-
 
1363
This option will cause the package to be transferred into the package archive as
-
 
1364
a tar ball. Used in the build system to address two issues:
-
 
1365
 
-
 
1366
=over 4
-
 
1367
 
-
 
1368
=item 1 
-
 
1369
 
-
 
1370
Slow speed in copying lots of files from the build machine to the package server.
-
 
1371
 
-
 
1372
=item 2 
-
 
1373
 
-
 
1374
Need for cross platform file lock in order to prevent copy collisions.  
-
 
1375
 
-
 
1376
=back
-
 
1377
 
1179
=item B<-[no]md5>
1378
=item B<-[no]md5>
1180
 
1379
 
1181
If package builds are being merged then a validity check is performed using
1380
If package builds are being merged then a validity check is performed using
1182
an MD5 digest over the current and the existing file.
1381
an MD5 digest over the current and the existing file.
1183
 
1382
 
Line 1196... Line 1395...
1196
This option will cause the program to display information about the packaging 
1395
This option will cause the program to display information about the packaging 
1197
process and then exit. 
1396
process and then exit. 
1198
 
1397
 
1199
No data will be transferred to the archive.
1398
No data will be transferred to the archive.
1200
 
1399
 
-
 
1400
=item B<-[no]testArchive>
-
 
1401
 
-
 
1402
If this option is enabled then the assembly operation is performed within a test area within
-
 
1403
the currently configured dpkg_archive. The test area is a subdirectory 
-
 
1404
called C<.dpkg_archive/test_dpkg>
-
 
1405
 
-
 
1406
This option is intended for testing use only.
-
 
1407
 
1201
=back
1408
=back
1202
 
1409
 
1203
=head1 DESCRIPTION
1410
=head1 DESCRIPTION
1204
 
1411
 
1205
This utility program is used to transfer a package that has been built into
1412
This utility program is used to transfer a package that has been built into
Line 1222... Line 1429...
1222
 
1429
 
1223
Detect file conflicts when different builds are merged into a single package. Header files are 
1430
Detect file conflicts when different builds are merged into a single package. Header files are 
1224
allowed to differ in line ending style, but other files must not conflict. The package will not be 
1431
allowed to differ in line ending style, but other files must not conflict. The package will not be 
1225
reproducible if file conflicts exist.
1432
reproducible if file conflicts exist.
1226
 
1433
 
-
 
1434
In 'tarmode' the package merging needs to be done by another utility.
-
 
1435
 
1227
=item *
1436
=item *
1228
 
1437
 
1229
Suppress dead symbolic links. A valid symlink will be preserved, but invalid links will be 
1438
Suppress dead symbolic links. A valid symlink will be preserved, but invalid links will be 
1230
removed from the transferred image.
1439
removed from the transferred image.
1231
 
1440
 
Line 1249... Line 1458...
1249
 
1458
 
1250
=item ./build/pkg
1459
=item ./build/pkg
1251
 
1460
 
1252
This format is generated by ANT builds.
1461
This format is generated by ANT builds.
1253
 
1462
 
-
 
1463
=item ./pkg/noBuild
-
 
1464
 
-
 
1465
This format is used internally by this utilty. It will be generated by the build system 
-
 
1466
in cases where there is no build to be performs on the current machine.
-
 
1467
 
1254
=back
1468
=back
1255
 
1469
 
1256
The program should be run in the same directory as the build control files as
1470
The program should be run in the same directory as the build control files as
1257
the package subdirectory will be created in that directory.
1471
the package subdirectory will be created in that directory.
1258
 
1472