Subversion Repositories DevTools

Rev

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

Rev 7300 Rev 7301
Line 54... Line 54...
54
#   Options
54
#   Options
55
#
55
#
56
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
56
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
57
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
57
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
58
my $opt_help = 0;                           # Help level
58
my $opt_help = 0;                           # Help level
59
my $opt_exact = 0;                          # Exact (escrow) build
-
 
60
my $opt_toPackage;                          # Control recursion
59
my $opt_toPackage;                          # Control recursion
61
my $opt_fromPackage;                        # Control recursion
60
my $opt_fromPackage;                        # Control recursion
62
my @opt_justPackage;                        # Control recursion
61
my @opt_justPackage;                        # Control recursion
63
my @opt_ignorePackage;                      # Control recursion
62
my @opt_ignorePackage;                      # Control recursion
64
my $opt_allSandbox;                         # Extend scope to entire sandbox
63
my $opt_allSandbox;                         # Extend scope to entire sandbox
Line 119... Line 118...
119
#   Reconfigure the options parser to allow subcommands to parse options
118
#   Reconfigure the options parser to allow subcommands to parse options
120
#
119
#
121
Getopt::Long::Configure('permute');
120
Getopt::Long::Configure('permute');
122
 
121
 
123
#
122
#
124
#   Determine Sandbox type. Exact or local
-
 
125
#
-
 
126
$opt_exact = (-f  $GBE_SANDBOX . '/sandbox_dpkg_archive/.exact' )
-
 
127
    if ( $GBE_SANDBOX );
-
 
128
 
-
 
129
#
-
 
130
#   Parse the user command and decide what to do
123
#   Parse the user command and decide what to do
131
#
124
#
132
#   Remove user command from the command line. This will leave command options
125
#   Remove user command from the command line. This will leave command options
133
#   in @ARGV so that they can be parsed by the subcommand.
126
#   in @ARGV so that they can be parsed by the subcommand.
134
#
127
#
Line 176... Line 169...
176
sub create_sandbox
169
sub create_sandbox
177
{
170
{
178
    GetOptions (
171
    GetOptions (
179
                "help:+"        => \$opt_help,
172
                "help:+"        => \$opt_help,
180
                "manual:3"      => \$opt_help,
173
                "manual:3"      => \$opt_help,
181
                "exact"         => \$opt_exact,
-
 
182
                ) || Error ("Invalid command line" );
174
                ) || Error ("Invalid command line" );
183
 
175
 
184
    SubCommandHelp( $opt_help, "Create Sandbox") if ($opt_help || $#ARGV >= 0 );
176
    SubCommandHelp( $opt_help, "Create Sandbox") if ($opt_help || $#ARGV >= 0 );
185
 
177
 
186
    Error ("Cannot create a sandbox within a sandbox",
178
    Error ("Cannot create a sandbox within a sandbox",
187
           "Sandbox base is: $GBE_SANDBOX" ) if ( $GBE_SANDBOX );
179
           "Sandbox base is: $GBE_SANDBOX" ) if ( $GBE_SANDBOX );
188
 
180
 
189
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
181
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
190
 
182
 
191
    TouchFile( 'sandbox_dpkg_archive/.exact', 'Sandbox marker file')
-
 
192
        if ($opt_exact);
183
    Message ('Sandbox created');
193
 
-
 
194
    Message ('Sandbox created' . ($opt_exact ? ' - With exact version number processing' : ''));
-
 
195
    exit  0;
184
    exit  0;
196
}
185
}
197
 
186
 
198
#-------------------------------------------------------------------------------
187
#-------------------------------------------------------------------------------
199
# Function        : delete_sandbox
188
# Function        : delete_sandbox
Line 361... Line 350...
361
    calc_sandbox_info();
350
    calc_sandbox_info();
362
 
351
 
363
    #
352
    #
364
    #   Display information
353
    #   Display information
365
    #
354
    #
366
    Message ("Type       : " . ($opt_exact ? 'Exact' : 'Development') );
-
 
367
    Message ("Scope      : " . ($opt_allSandbox ? 'Entire Sandbox' : $packages{$currentPkgTag}{dname} ));
355
    Message ("Scope      : " . ($opt_allSandbox ? 'Entire Sandbox' : $packages{$currentPkgTag}{dname} ));
368
    Message ("Base       : $GBE_SANDBOX");
356
    Message ("Base       : $GBE_SANDBOX");
369
    Message ("Archive    : $GBE_DPKG_SBOX");
357
    Message ("Archive    : $GBE_DPKG_SBOX");
370
    Message ("BuildFilter: $GBE_BUILDFILTER" . ( (-f $GBE_SANDBOX . '/buildfilter')  ? ' - Local to sandbox' : ''));
358
    Message ("BuildFilter: $GBE_BUILDFILTER" . ( (-f $GBE_SANDBOX . '/buildfilter')  ? ' - Local to sandbox' : ''));
371
 
359
 
Line 597... Line 585...
597
    }
585
    }
598
   return 0;
586
   return 0;
599
}
587
}
600
 
588
 
601
#-------------------------------------------------------------------------------
589
#-------------------------------------------------------------------------------
-
 
590
# Function        : locatePreBuiltPackage 
-
 
591
#
-
 
592
# Description     : Locate a prebuilt package
-
 
593
#                   Skip the make process if a package with a matching signature 
-
 
594
#                   can be found. ie: We have a pre-built version
-
 
595
#                   
-
 
596
# Inputs          : $fe     - Package Entry
-
 
597
#
-
 
598
# Returns         : True - Prebuilt package found
-
 
599
#                   False - Prebuild package not found
-
 
600
#
-
 
601
sub locatePreBuiltPackage
-
 
602
{
-
 
603
    my ($fe) = @_;
-
 
604
 
-
 
605
    #
-
 
606
    #   Get the package signature
-
 
607
    #   This is held in the packages interface directory
-
 
608
    #
-
 
609
    my $ifaceDir = getpkgInterface($fe);
-
 
610
    return 0 unless $ifaceDir;
-
 
611
 
-
 
612
    my $sigFile = catdir($ifaceDir, 'Package.sig');
-
 
613
    return 0 unless -f $sigFile;
-
 
614
 
-
 
615
    my $pkgSig = TagFileRead($sigFile);
-
 
616
 
-
 
617
    #
-
 
618
    #   Look in each package archive directory
-
 
619
    #   
-
 
620
    foreach my $dpkg ( $GBE_DPKG_SBOX,
-
 
621
                       $GBE_DPKG_LOCAL,
-
 
622
                       $GBE_DPKG_CACHE,
-
 
623
                       $GBE_DPKG_REPLICA,
-
 
624
                       $GBE_DPKG,
-
 
625
                       $GBE_DPLY,
-
 
626
                       $GBE_DPKG_STORE )
-
 
627
    {
-
 
628
        my $pkgDir = catdir( $dpkg, $fe->{mname}, $pkgSig);
-
 
629
        if (-d $pkgDir )
-
 
630
        {
-
 
631
            Debug("Prebuilt Package found: $pkgSig");
-
 
632
            return 1;
-
 
633
        }
-
 
634
    }
-
 
635
    return 0;
-
 
636
}
-
 
637
 
-
 
638
#-------------------------------------------------------------------------------
602
# Function        : getpkgInterface 
639
# Function        : getpkgInterface 
603
#
640
#
604
# Description     : Locate the packages interface directory 
641
# Description     : Locate the packages interface directory 
605
#
642
#
606
# Inputs          : $fe     - Package Entry 
643
# Inputs          : $fe     - Package Entry 
Line 771... Line 808...
771
    my %multi;
808
    my %multi;
772
    foreach my $be ( @build_list )
809
    foreach my $be ( @build_list )
773
    {
810
    {
774
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
811
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
775
        #
812
        #
776
        #   Sandbox vs Exact processing
813
        #   Sandbox 
777
        #       Set a suitable display name
814
        #       Set a suitable display name
778
        #       Set a suitable tag
815
        #       Set a suitable tag
779
        #
816
        #
780
        $be->{dname} = $opt_exact ? $be->{full}    : $be->{mname};
817
        $be->{dname} = $be->{mname};
781
        $be->{tag}   = $opt_exact ? $be->{fullTag} : $be->{package};
818
        $be->{tag}   = $be->{package};
782
        $be->{fname} = join ('_', $be->{name}, $be->{version});
819
        $be->{fname} = join ('_', $be->{name}, $be->{version});
783
 
820
 
784
#        DebugDumpData ("be", $be );
821
#        DebugDumpData ("be", $be );
785
 
822
 
786
        #
823
        #
Line 1266... Line 1303...
1266
            } else {
1303
            } else {
1267
                    $mustBuild = 2;
1304
                    $mustBuild = 2;
1268
                    $sigMatch = -1;
1305
                    $sigMatch = -1;
1269
            }
1306
            }
1270
 
1307
 
1271
#Debug0("Skip: $opt_skip, sigMatch: $sigMatch, Build: $mustBuild, Opts: @make_opts",);
1308
Debug0("Skip: $opt_skip, sigMatch: $sigMatch, Build: $mustBuild, Opts: @make_opts",);
1272
            if ($mustBuild)
1309
            if ($mustBuild)
1273
            {
1310
            {
1274
                if (1)
1311
                if (1)
1275
                {
1312
                {
1276
                    unlink $tagFile;
1313
                    unlink $tagFile;
Line 1290... Line 1327...
1290
 
1327
 
1291
                    #
1328
                    #
1292
                    #   Skip make if we have a prebuilt package
1329
                    #   Skip make if we have a prebuilt package
1293
                    #
1330
                    #
1294
                    my $mustMake = 1;
1331
                    my $mustMake = 1;
-
 
1332
                    if ($mustBuild == 2)
-
 
1333
                    {
-
 
1334
                        my $pbFound = locatePreBuiltPackage($fe);
-
 
1335
                        Debug0("Prebuilt: $pbFound");
-
 
1336
                        $mustMake = 0 if $pbFound;
-
 
1337
                    }
1295
 
1338
 
1296
                    if ($mustMake)
1339
                    if ($mustMake)
1297
                    {
1340
                    {
1298
                        JatsCmd( "-cd=$dir", 'make', 'clean') if $opt_clean;
1341
                        JatsCmd( "-cd=$dir", 'make', 'clean') if $opt_clean;
1299
                        $result = JatsCmd( "-cd=$dir", 'make',  @make_opts);
1342
                        $result = JatsCmd( "-cd=$dir", 'make',  @make_opts);
Line 2046... Line 2089...
2046
    {
2089
    {
2047
        $sigFile =~ s~ffp$~nob~;
2090
        $sigFile =~ s~ffp$~nob~;
2048
        if (-f $sigFile) {
2091
        if (-f $sigFile) {
2049
            $txt .= ' [NoBuild]';
2092
            $txt .= ' [NoBuild]';
2050
            $statusB = '-';
2093
            $statusB = '-';
2051
#        } elsif (locatePreBuiltPackage($fe)) {
2094
        } elsif (locatePreBuiltPackage($fe)) {
2052
#            $txt .= ' [PreBuilt]';
2095
            $txt .= ' [PreBuilt]';
2053
#            $statusB = 'P';
2096
            $statusB = 'P';
2054
        } else {
2097
        } else {
2055
            $txt .= ' [Built]';
2098
            $txt .= ' [Built]';
2056
            $statusB = 'B';
2099
            $statusB = 'B';
2057
        }
2100
        }
2058
 
2101
 
Line 2240... Line 2283...
2240
 
2283
 
2241
    #
2284
    #
2242
    #   Debugging - delete later
2285
    #   Debugging - delete later
2243
    #   Save FP data to a file
2286
    #   Save FP data to a file
2244
    #
2287
    #
2245
#   my $fpDebugFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', $fe->{name} . '.' . $fe->{prj} . '_' . time() . '.fpd');
2288
    my $fpDebugFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', $fe->{name} . '.' . $fe->{prj} . '_' . time() . '.fpd');
2246
#   Debug0("fpDebugFile: $fpDebugFile");
2289
Debug0("fpDebugFile: $fpDebugFile");
2247
#   FileCreate($fpDebugFile, @fpdata);
2290
    FileCreate($fpDebugFile, @fpdata);
2248
 
2291
 
2249
    return $genPkgFingerPrintSha1->hexdigest;
2292
    return $genPkgFingerPrintSha1->hexdigest;
2250
}
2293
}
2251
 
2294
 
2252
 
2295
 
Line 2558... Line 2601...
2558
jats sandbox create [command options]
2601
jats sandbox create [command options]
2559
 
2602
 
2560
 Command Options
2603
 Command Options
2561
    -help[=n]               - Command specific help, [n=1,2,3]
2604
    -help[=n]               - Command specific help, [n=1,2,3]
2562
    -verbose[=n]            - Verbose operation
2605
    -verbose[=n]            - Verbose operation
2563
    -exact                  - Create sandbox to reproduce exact versions
-
 
2564
 
2606
 
2565
=head2 OPTIONS
2607
=head2 OPTIONS
2566
 
2608
 
2567
The 'create' command takes the following options:
2609
The 'create' command takes no options.
2568
 
-
 
2569
=over 8
-
 
2570
 
-
 
2571
=item -exact
-
 
2572
 
-
 
2573
When this option is specified the sandbox is marked for exact processing of
-
 
2574
package versions. In this mode the version numbers of the packages in the
-
 
2575
sandbox are significant. This is ideal for recreating a package-version.
-
 
2576
 
-
 
2577
The default is for in-exact processing, in which the version numbers of packages
-
 
2578
within the sandbox are not significant. The is ideal for development.
-
 
2579
 
-
 
2580
=back
-
 
2581
 
2610
 
2582
=head2 DESCRIPTION
2611
=head2 DESCRIPTION
2583
 
2612
 
2584
The 'create' command will create a sandbox in the users current directory. It is
2613
The 'create' command will create a sandbox in the users current directory. It is
2585
not possible to create a sandbox within a sandbox.
2614
not possible to create a sandbox within a sandbox.