| 227 |
dpurdie |
1 |
########################################################################
|
| 263 |
dpurdie |
2 |
# Copyright (C) 2008 ERG Limited, All rights reserved
|
| 227 |
dpurdie |
3 |
#
|
| 263 |
dpurdie |
4 |
# Module name : jats_sandbox.pl
|
|
|
5 |
# Module type : JATS Utility
|
|
|
6 |
# Compiler(s) : Perl
|
|
|
7 |
# Environment(s): JATS
|
| 227 |
dpurdie |
8 |
#
|
|
|
9 |
# Description : A script to build a collection of packages in the
|
|
|
10 |
# same sandbox. This script will:
|
|
|
11 |
#
|
|
|
12 |
# Determine the packages in the sandbox
|
|
|
13 |
# Determine the build order of the packages
|
|
|
14 |
# Build the packages in the correct order
|
|
|
15 |
# Make the packages in the correct order
|
|
|
16 |
#
|
|
|
17 |
# The script will allow for:
|
|
|
18 |
# The creation of a sandbox
|
|
|
19 |
# The addition of packages to the sandbox
|
|
|
20 |
# Removal of packages from the sandbox
|
|
|
21 |
#
|
|
|
22 |
#
|
|
|
23 |
# Command syntax (basic)
|
|
|
24 |
# jats sandbox <command> (options | actions)@
|
|
|
25 |
#
|
|
|
26 |
# Commands include:
|
|
|
27 |
# create - Create a sandbox
|
|
|
28 |
# delete - Delete a sandbox
|
| 337 |
dpurdie |
29 |
# info - Show sandbox info
|
| 227 |
dpurdie |
30 |
#
|
|
|
31 |
# build - Build all packages in the sandbox
|
|
|
32 |
# make - make all packages in the sandbox
|
|
|
33 |
#
|
|
|
34 |
#......................................................................#
|
|
|
35 |
|
| 263 |
dpurdie |
36 |
require 5.008_002;
|
| 227 |
dpurdie |
37 |
use strict;
|
|
|
38 |
use warnings;
|
|
|
39 |
use JatsError;
|
|
|
40 |
use JatsSystem;
|
|
|
41 |
use FileUtils;
|
| 245 |
dpurdie |
42 |
use JatsBuildFiles;
|
| 227 |
dpurdie |
43 |
use JatsVersionUtils;
|
| 299 |
dpurdie |
44 |
use File::Path qw(rmtree);
|
| 227 |
dpurdie |
45 |
|
|
|
46 |
|
|
|
47 |
use Pod::Usage; # required for help support
|
|
|
48 |
use Getopt::Long qw(:config require_order); # Stop on non-option
|
|
|
49 |
my $VERSION = "1.0.0"; # Update this
|
|
|
50 |
|
|
|
51 |
#
|
|
|
52 |
# Options
|
|
|
53 |
#
|
|
|
54 |
my $opt_debug = $ENV{'GBE_DEBUG'}; # Allow global debug
|
|
|
55 |
my $opt_verbose = $ENV{'GBE_VERBOSE'}; # Allow global verbose
|
| 359 |
dpurdie |
56 |
my $opt_help = 0; # Help level
|
|
|
57 |
my $opt_exact = 0; # Exact (escrow) build
|
| 227 |
dpurdie |
58 |
|
|
|
59 |
#
|
|
|
60 |
# Globals - Provided by the JATS environment
|
|
|
61 |
#
|
|
|
62 |
my $USER = $ENV{'USER'};
|
|
|
63 |
my $UNIX = $ENV{'GBE_UNIX'};
|
|
|
64 |
my $HOME = $ENV{'HOME'};
|
|
|
65 |
my $GBE_SANDBOX = $ENV{'GBE_SANDBOX'};
|
|
|
66 |
my $GBE_DPKG_SBOX= $ENV{'GBE_DPKG_SBOX'};
|
| 325 |
dpurdie |
67 |
my $GBE_MACHTYPE = $ENV{'GBE_MACHTYPE'};
|
| 227 |
dpurdie |
68 |
|
| 335 |
dpurdie |
69 |
my $GBE_DPKG_LOCAL = $ENV{'GBE_DPKG_LOCAL'};
|
|
|
70 |
my $GBE_DPKG_CACHE = $ENV{'GBE_DPKG_CACHE'};
|
|
|
71 |
my $GBE_DPKG = $ENV{'GBE_DPKG'};
|
|
|
72 |
my $GBE_DPLY = $ENV{'GBE_DPLY'};
|
|
|
73 |
my $GBE_DPKG_STORE = $ENV{'GBE_DPKG_STORE'};
|
|
|
74 |
|
| 227 |
dpurdie |
75 |
#
|
|
|
76 |
# Globals
|
|
|
77 |
#
|
|
|
78 |
my @build_order = (); # Build Ordered list of entries
|
| 255 |
dpurdie |
79 |
my %extern_deps; # Hash of external dependencies
|
| 227 |
dpurdie |
80 |
my %packages; # Hash of packages
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
#-------------------------------------------------------------------------------
|
|
|
84 |
# Function : Mainline Entry Point
|
|
|
85 |
#
|
|
|
86 |
# Description :
|
|
|
87 |
#
|
|
|
88 |
# Inputs :
|
|
|
89 |
#
|
|
|
90 |
my $result = GetOptions (
|
| 299 |
dpurdie |
91 |
"help|h:+" => \$opt_help,
|
|
|
92 |
"manual:3" => \$opt_help,
|
| 337 |
dpurdie |
93 |
"verbose:+" => \$opt_verbose, # flag, multiple use allowed
|
| 227 |
dpurdie |
94 |
);
|
|
|
95 |
|
|
|
96 |
#
|
|
|
97 |
# UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
|
|
|
98 |
#
|
|
|
99 |
|
|
|
100 |
#
|
|
|
101 |
# Process help and manual options
|
|
|
102 |
#
|
|
|
103 |
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
|
|
|
104 |
pod2usage(-verbose => 1) if ($opt_help == 2 );
|
| 299 |
dpurdie |
105 |
pod2usage(-verbose => 2) if ($opt_help > 2 );
|
| 227 |
dpurdie |
106 |
|
|
|
107 |
#
|
|
|
108 |
# Configure the error reporting process now that we have the user options
|
|
|
109 |
#
|
|
|
110 |
ErrorConfig( 'name' => 'SANDBOX',
|
|
|
111 |
'verbose' => $opt_verbose );
|
|
|
112 |
|
|
|
113 |
#
|
| 359 |
dpurdie |
114 |
# Reconfigure the options parser to allow subcommands to parse options
|
| 227 |
dpurdie |
115 |
#
|
| 359 |
dpurdie |
116 |
Getopt::Long::Configure('permute');
|
| 227 |
dpurdie |
117 |
|
|
|
118 |
#
|
| 359 |
dpurdie |
119 |
# Determine Sandbox type. Exact or local
|
|
|
120 |
#
|
|
|
121 |
$opt_exact = (-f $GBE_SANDBOX . '/sandbox_dpkg_archive/.exact' )
|
|
|
122 |
if ( $GBE_SANDBOX );
|
|
|
123 |
|
|
|
124 |
#
|
| 227 |
dpurdie |
125 |
# Parse the user command and decide what to do
|
|
|
126 |
#
|
| 359 |
dpurdie |
127 |
# Remove user command from the command line. This will leave command options
|
|
|
128 |
# in @ARGV so that they can be parsed by the subcommand.
|
| 227 |
dpurdie |
129 |
#
|
|
|
130 |
my $cmd = shift @ARGV || "";
|
|
|
131 |
help(1) if ( $cmd =~ m/^help$/ || $cmd eq "" );
|
| 359 |
dpurdie |
132 |
buildcmd($cmd, @ARGV ) if ( $cmd =~ m/(^all$)|(^build$)/ );
|
|
|
133 |
cache(@ARGV) if ( $cmd =~ m/^cache$/ );
|
|
|
134 |
clean($cmd, @ARGV) if ( $cmd =~ m/(^clobber$)|(^clean$)/ );
|
|
|
135 |
cmd('make', $cmd, @ARGV ) if ( $cmd =~ m/(^make$)/ );
|
|
|
136 |
cmd('cmd', @ARGV) if ( $cmd =~ m/^cmd$/ );
|
|
|
137 |
create_sandbox() if ( $cmd =~ m/^create$/ );
|
| 299 |
dpurdie |
138 |
delete_sandbox() if ( $cmd =~ m/^delete$/ );
|
| 227 |
dpurdie |
139 |
info(@ARGV) if ( $cmd =~ m/^info$/ );
|
| 359 |
dpurdie |
140 |
populate(@ARGV) if ( $cmd =~ m/^populate$/ );
|
| 227 |
dpurdie |
141 |
|
|
|
142 |
Error ("Unknown sandbox command: $cmd");
|
|
|
143 |
exit 1;
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
#-------------------------------------------------------------------------------
|
|
|
147 |
#
|
|
|
148 |
# Give the user a clue
|
|
|
149 |
#
|
|
|
150 |
sub help
|
|
|
151 |
{
|
|
|
152 |
my ($level) = @_;
|
|
|
153 |
$level = $opt_help unless ( $level );
|
|
|
154 |
|
|
|
155 |
pod2usage(-verbose => 0, -message => "Version: ". $VERSION) if ($level == 1 );
|
|
|
156 |
pod2usage(-verbose => $level -1 );
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
#-------------------------------------------------------------------------------
|
|
|
160 |
# Function : create_sandbox
|
|
|
161 |
#
|
|
|
162 |
# Description : create a sandbox in the current current directory
|
|
|
163 |
#
|
|
|
164 |
# Inputs : None
|
|
|
165 |
#
|
|
|
166 |
#
|
|
|
167 |
sub create_sandbox
|
|
|
168 |
{
|
| 359 |
dpurdie |
169 |
GetOptions (
|
|
|
170 |
"help:+" => \$opt_help,
|
|
|
171 |
"manual:3" => \$opt_help,
|
|
|
172 |
"exact" => \$opt_exact,
|
|
|
173 |
) || Error ("Invalid command line" );
|
|
|
174 |
|
|
|
175 |
SubCommandHelp( $opt_help, "Create Sandbox") if ($opt_help || $#ARGV >= 0 );
|
|
|
176 |
|
| 227 |
dpurdie |
177 |
Error ("Cannot create a sandbox within a sandbox",
|
|
|
178 |
"Sandbox base is: $GBE_SANDBOX" ) if ( $GBE_SANDBOX );
|
| 359 |
dpurdie |
179 |
|
| 227 |
dpurdie |
180 |
mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
|
| 359 |
dpurdie |
181 |
|
|
|
182 |
TouchFile( 'sandbox_dpkg_archive/.exact', 'Sandbox marker file')
|
|
|
183 |
if ($opt_exact);
|
|
|
184 |
|
|
|
185 |
Message ('Sandbox created' . ($opt_exact ? ' - With exact version number processing' : ''));
|
| 227 |
dpurdie |
186 |
exit 0;
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
#-------------------------------------------------------------------------------
|
| 299 |
dpurdie |
190 |
# Function : delete_sandbox
|
|
|
191 |
#
|
|
|
192 |
# Description : Delete a sandbox
|
|
|
193 |
# Its up to the user the delete the components in the sandbox
|
|
|
194 |
#
|
|
|
195 |
# Inputs : None
|
|
|
196 |
#
|
|
|
197 |
# Returns :
|
|
|
198 |
#
|
|
|
199 |
sub delete_sandbox
|
|
|
200 |
{
|
| 359 |
dpurdie |
201 |
GetOptions (
|
|
|
202 |
"help:+" => \$opt_help,
|
|
|
203 |
"manual:3" => \$opt_help,
|
|
|
204 |
) || Error ("Invalid command line" );
|
|
|
205 |
|
|
|
206 |
SubCommandHelp( $opt_help, "Delete Sandbox") if ($opt_help || $#ARGV >= 0 );
|
|
|
207 |
|
| 299 |
dpurdie |
208 |
unless ( $GBE_SANDBOX )
|
|
|
209 |
{
|
|
|
210 |
Warning("No sandbox found to delete");
|
|
|
211 |
}
|
|
|
212 |
else
|
|
|
213 |
{
|
|
|
214 |
my $sdir = "$GBE_SANDBOX/sandbox_dpkg_archive";
|
|
|
215 |
rmtree($sdir,0,0);
|
|
|
216 |
Error ("Sandbox directory not completly removed")
|
|
|
217 |
if ( -e $sdir );
|
|
|
218 |
|
|
|
219 |
Message("Sandbox information deleted",
|
|
|
220 |
"Sandbox components must be manually deleted");
|
|
|
221 |
}
|
|
|
222 |
exit 0;
|
|
|
223 |
}
|
|
|
224 |
|
|
|
225 |
#-------------------------------------------------------------------------------
|
| 227 |
dpurdie |
226 |
# Function : info
|
|
|
227 |
#
|
|
|
228 |
# Description : Display Sandbox information
|
|
|
229 |
#
|
|
|
230 |
# Inputs : Command line args
|
|
|
231 |
# -v - Be more verbose
|
|
|
232 |
#
|
|
|
233 |
# Returns : Will exit
|
|
|
234 |
#
|
|
|
235 |
sub info
|
|
|
236 |
{
|
| 359 |
dpurdie |
237 |
GetOptions (
|
|
|
238 |
"help:+" => \$opt_help,
|
|
|
239 |
"manual:3" => \$opt_help,
|
|
|
240 |
"verbose:+" => \$opt_verbose,
|
|
|
241 |
) || Error ("Invalid command line" );
|
| 227 |
dpurdie |
242 |
|
| 359 |
dpurdie |
243 |
SubCommandHelp( $opt_help, "Sandbox Information") if ($opt_help || $#ARGV >=0 );
|
|
|
244 |
|
| 227 |
dpurdie |
245 |
#
|
|
|
246 |
# Determine Sandbox information
|
|
|
247 |
# Populate global variables
|
|
|
248 |
#
|
|
|
249 |
calc_sandbox_info();
|
|
|
250 |
|
|
|
251 |
#
|
|
|
252 |
# Display information
|
|
|
253 |
#
|
| 359 |
dpurdie |
254 |
Message ("Type : " . ($opt_exact ? 'Exact' : 'Development') );
|
|
|
255 |
Message ("Base : $GBE_SANDBOX");
|
| 227 |
dpurdie |
256 |
Message ("Archive: $GBE_DPKG_SBOX");
|
|
|
257 |
|
|
|
258 |
Message ("Build Order");
|
|
|
259 |
foreach my $fe ( @build_order )
|
|
|
260 |
{
|
| 359 |
dpurdie |
261 |
Message( " Level:" . $fe->{level} . " Name: " . $fe->{dname} );
|
| 227 |
dpurdie |
262 |
Message( DisplayPath (" Path: $fe->{dir}" )) if $opt_verbose;
|
|
|
263 |
|
|
|
264 |
if ( $opt_verbose )
|
|
|
265 |
{
|
| 359 |
dpurdie |
266 |
foreach my $idep ( sort values %{$fe->{'ideps'}} )
|
| 227 |
dpurdie |
267 |
{
|
| 359 |
dpurdie |
268 |
Message (" I:$idep");
|
| 227 |
dpurdie |
269 |
}
|
|
|
270 |
|
| 359 |
dpurdie |
271 |
foreach my $edep ( sort keys %{$fe->{'edeps'}} )
|
| 227 |
dpurdie |
272 |
{
|
| 359 |
dpurdie |
273 |
my ($ppn,$ppv) = split( $; , $edep);
|
|
|
274 |
Message (" E:$ppn $ppv");
|
| 227 |
dpurdie |
275 |
}
|
|
|
276 |
|
|
|
277 |
}
|
|
|
278 |
}
|
|
|
279 |
|
| 359 |
dpurdie |
280 |
#
|
|
|
281 |
# External dependencies flags
|
|
|
282 |
# * - Package does not exist in dpkg_archive
|
|
|
283 |
# + - Multiple versions of this package are used
|
|
|
284 |
|
| 255 |
dpurdie |
285 |
Message("External Dependencies");
|
| 227 |
dpurdie |
286 |
foreach my $de ( sort keys %extern_deps )
|
|
|
287 |
{
|
|
|
288 |
my @vlist = keys %{$extern_deps{$de}};
|
| 335 |
dpurdie |
289 |
my $flag = $#vlist ? '+' : '';
|
| 359 |
dpurdie |
290 |
foreach my $pve ( @vlist )
|
| 227 |
dpurdie |
291 |
{
|
| 359 |
dpurdie |
292 |
my ($pn,$pv) = split( $; , $pve );
|
|
|
293 |
my $exists = check_package_existance($pn,$pv ) ? '' : '*';
|
| 335 |
dpurdie |
294 |
my $flags = sprintf ("%4.4s", $flag . $exists);
|
| 359 |
dpurdie |
295 |
Message ("${flags}${pn} ${pv}");
|
| 227 |
dpurdie |
296 |
if ( $opt_verbose )
|
|
|
297 |
{
|
| 359 |
dpurdie |
298 |
foreach my $pkg ( @{$extern_deps{$de}{$pve}} )
|
| 227 |
dpurdie |
299 |
{
|
| 359 |
dpurdie |
300 |
my $ppn = join ('.', split( $; , $pkg));
|
|
|
301 |
Message (" U:$ppn");
|
| 227 |
dpurdie |
302 |
}
|
|
|
303 |
}
|
| 359 |
dpurdie |
304 |
|
| 227 |
dpurdie |
305 |
}
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
if ( $opt_verbose > 2 )
|
|
|
309 |
{
|
|
|
310 |
DebugDumpData( "extern_deps", \%extern_deps);
|
|
|
311 |
DebugDumpData( "build_order", \@build_order);
|
|
|
312 |
DebugDumpData( "packages", \%packages);
|
|
|
313 |
}
|
|
|
314 |
exit (0);
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
#-------------------------------------------------------------------------------
|
| 335 |
dpurdie |
318 |
# Function : check_package_existance
|
|
|
319 |
#
|
|
|
320 |
# Description : Determine if a given package-version exists
|
|
|
321 |
#
|
|
|
322 |
# Inputs : $name - Package Name
|
|
|
323 |
# $ver - Package Version
|
|
|
324 |
#
|
|
|
325 |
# Returns : true - Package exists
|
|
|
326 |
#
|
|
|
327 |
sub check_package_existance
|
|
|
328 |
{
|
|
|
329 |
my ($name, $ver) = @_;
|
|
|
330 |
#
|
|
|
331 |
# Look in each package archive directory
|
|
|
332 |
#
|
|
|
333 |
foreach my $dpkg ( $GBE_DPKG_SBOX,
|
|
|
334 |
$GBE_DPKG_LOCAL,
|
|
|
335 |
$GBE_DPKG_CACHE,
|
|
|
336 |
$GBE_DPKG,
|
|
|
337 |
$GBE_DPLY,
|
|
|
338 |
$GBE_DPKG_STORE )
|
|
|
339 |
{
|
|
|
340 |
next unless ( $dpkg );
|
|
|
341 |
if ( -d "$dpkg/$name/$ver" )
|
|
|
342 |
{
|
|
|
343 |
return 1;
|
|
|
344 |
}
|
|
|
345 |
}
|
|
|
346 |
return 0;
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
|
|
|
350 |
#-------------------------------------------------------------------------------
|
| 227 |
dpurdie |
351 |
# Function : calc_sandbox_info
|
|
|
352 |
#
|
|
|
353 |
# Description : Examine the sandbox and determine all the important
|
|
|
354 |
# information
|
|
|
355 |
#
|
|
|
356 |
# Inputs : None
|
|
|
357 |
#
|
|
|
358 |
# Returns : Will exit if not in a sandbox
|
|
|
359 |
# Populates global variables
|
|
|
360 |
# @build_order - build ordered array of build entries
|
|
|
361 |
#
|
|
|
362 |
sub calc_sandbox_info
|
|
|
363 |
{
|
|
|
364 |
#
|
|
|
365 |
# Start from the root of the sandbox
|
|
|
366 |
#
|
|
|
367 |
Error ("Command must be executed from within a Sandbox") unless ( $GBE_SANDBOX );
|
|
|
368 |
chdir ($GBE_SANDBOX) || Error ("Cannot chdir to $GBE_SANDBOX");
|
|
|
369 |
|
|
|
370 |
#
|
|
|
371 |
# Locate all packages within the sandbox
|
|
|
372 |
# These will be top-level directories - one per package
|
|
|
373 |
#
|
|
|
374 |
my @dirlist;
|
|
|
375 |
my @build_list;
|
| 255 |
dpurdie |
376 |
foreach my $pname ( glob("*") )
|
| 227 |
dpurdie |
377 |
{
|
| 255 |
dpurdie |
378 |
next if ( $pname =~ m~^\.~ );
|
|
|
379 |
next if ( $pname =~ m~dpkg_archive$~ );
|
| 297 |
dpurdie |
380 |
next if ( $pname =~ m~^CVS$~ );
|
| 255 |
dpurdie |
381 |
next unless ( -d $pname );
|
|
|
382 |
Verbose ("Package discovered: $pname");
|
| 275 |
dpurdie |
383 |
|
| 325 |
dpurdie |
384 |
if ( -f "$pname/stop" || -f "$pname/stop.$GBE_MACHTYPE" )
|
| 275 |
dpurdie |
385 |
{
|
|
|
386 |
Warning("Package contains stop file: $pname");
|
|
|
387 |
next;
|
|
|
388 |
}
|
|
|
389 |
|
| 255 |
dpurdie |
390 |
push @dirlist, $pname;
|
| 227 |
dpurdie |
391 |
|
|
|
392 |
#
|
|
|
393 |
# Locate the build files in each package
|
| 245 |
dpurdie |
394 |
# Scan the build files and extract dependancy information
|
| 227 |
dpurdie |
395 |
#
|
| 359 |
dpurdie |
396 |
my $bscanner = BuildFileScanner( $pname, 'build.pl',
|
|
|
397 |
'--LocateAll',
|
|
|
398 |
$opt_exact ? '--ScanExactDependencies' : '--ScanDependencies' );
|
| 245 |
dpurdie |
399 |
$bscanner->scan();
|
|
|
400 |
my @blist = $bscanner->getInfo();
|
| 255 |
dpurdie |
401 |
Warning ("Package does not have build files: $pname") unless ( @blist );
|
|
|
402 |
Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
|
| 245 |
dpurdie |
403 |
push @build_list, @blist;
|
| 227 |
dpurdie |
404 |
}
|
|
|
405 |
|
|
|
406 |
#
|
|
|
407 |
# Process each build file and extract
|
|
|
408 |
# Name of the Package
|
|
|
409 |
# Dependency list
|
|
|
410 |
# Build up a hash of dependence information
|
|
|
411 |
#
|
|
|
412 |
|
|
|
413 |
my %depends;
|
| 299 |
dpurdie |
414 |
my %multi;
|
| 245 |
dpurdie |
415 |
foreach my $be ( @build_list )
|
| 227 |
dpurdie |
416 |
{
|
| 245 |
dpurdie |
417 |
Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
|
| 359 |
dpurdie |
418 |
|
|
|
419 |
#
|
|
|
420 |
# Sandbox vs Exact processing
|
|
|
421 |
# Set a suitable display name
|
|
|
422 |
# Set a suitable tag
|
|
|
423 |
#
|
|
|
424 |
$be->{dname} = $opt_exact ? $be->{full} : $be->{mname};
|
|
|
425 |
$be->{tag} = $opt_exact ? $be->{fullTag} : $be->{package};
|
|
|
426 |
|
| 245 |
dpurdie |
427 |
# DebugDumpData ("be", $be );
|
| 227 |
dpurdie |
428 |
|
|
|
429 |
#
|
| 299 |
dpurdie |
430 |
# Catch multiple builds for the same package
|
|
|
431 |
# Report later - when we have all
|
|
|
432 |
#
|
| 359 |
dpurdie |
433 |
next unless ( $be->{dname} );
|
|
|
434 |
push @{$multi{$be->{dname}}},$be->{dir};
|
| 299 |
dpurdie |
435 |
|
|
|
436 |
#
|
| 227 |
dpurdie |
437 |
# Add into dependency struct
|
|
|
438 |
#
|
| 359 |
dpurdie |
439 |
$depends{$be->{tag}}{entry} = $be;
|
|
|
440 |
$depends{$be->{tag}}{depends} = $be->{depends};
|
| 227 |
dpurdie |
441 |
}
|
|
|
442 |
|
| 359 |
dpurdie |
443 |
foreach my $dname ( sort keys %multi )
|
| 299 |
dpurdie |
444 |
{
|
| 359 |
dpurdie |
445 |
ReportError ("Mutiple builders for : $dname", @{$multi{$dname}} )
|
|
|
446 |
if ( scalar @{$multi{$dname}} > 1 );
|
| 299 |
dpurdie |
447 |
}
|
|
|
448 |
ErrorDoExit();
|
|
|
449 |
|
| 245 |
dpurdie |
450 |
#DebugDumpData ("depends", \%depends );
|
|
|
451 |
|
| 227 |
dpurdie |
452 |
#
|
|
|
453 |
# Determine the build order
|
|
|
454 |
#
|
|
|
455 |
@build_order = ();
|
|
|
456 |
my $more = 1;
|
|
|
457 |
my $level = 0;
|
|
|
458 |
|
|
|
459 |
#
|
| 255 |
dpurdie |
460 |
# Remove any dependencies to 'external' packages
|
| 227 |
dpurdie |
461 |
# These will not be met internally and can be regarded as constant
|
|
|
462 |
#
|
|
|
463 |
foreach my $key ( keys %depends )
|
|
|
464 |
{
|
|
|
465 |
foreach my $build ( keys( %{$depends{$key}{depends}} ))
|
|
|
466 |
{
|
|
|
467 |
unless (exists $depends{$build})
|
|
|
468 |
{
|
| 359 |
dpurdie |
469 |
push @{$extern_deps{$build} {$depends{$key}{depends}{$build}} }, $key;
|
|
|
470 |
|
|
|
471 |
$depends{$key}{entry}{'edeps'}{$depends{$key}{depends}{$build}} = 1;
|
| 227 |
dpurdie |
472 |
delete ($depends{$key}{depends}{$build}) ;
|
|
|
473 |
Verbose2( "Not in set: $build");
|
|
|
474 |
}
|
|
|
475 |
else
|
|
|
476 |
{
|
| 359 |
dpurdie |
477 |
$depends{$key}{entry}{'ideps'}{$build} = $depends{$build}{entry}{dname};
|
| 227 |
dpurdie |
478 |
}
|
|
|
479 |
}
|
|
|
480 |
}
|
| 359 |
dpurdie |
481 |
|
|
|
482 |
#DebugDumpData ("depends", \%depends );
|
|
|
483 |
#DebugDumpData ("External Depends", \%extern_deps );
|
|
|
484 |
|
|
|
485 |
|
|
|
486 |
#
|
|
|
487 |
# Determine package build order
|
|
|
488 |
# Scan the list of packages in the build set and determine
|
|
|
489 |
# those with no dependencies. These can be built.
|
|
|
490 |
# Remove those packages as dependents from all packages
|
|
|
491 |
# Repeat.
|
|
|
492 |
#
|
| 227 |
dpurdie |
493 |
while ( $more )
|
|
|
494 |
{
|
|
|
495 |
$more = 0;
|
|
|
496 |
$level++;
|
|
|
497 |
my @build;
|
|
|
498 |
|
|
|
499 |
#
|
|
|
500 |
# Locate packages with no dependencies
|
|
|
501 |
#
|
|
|
502 |
foreach my $key ( keys %depends )
|
|
|
503 |
{
|
|
|
504 |
next if ( keys( %{$depends{$key}{depends}} ) );
|
|
|
505 |
push @build, $key;
|
|
|
506 |
}
|
|
|
507 |
|
|
|
508 |
foreach my $build ( @build )
|
|
|
509 |
{
|
|
|
510 |
$more = 1;
|
|
|
511 |
my $fe = $depends{$build}{entry};
|
|
|
512 |
$fe->{level} = $level;
|
|
|
513 |
$packages{$build} = $fe;
|
|
|
514 |
push @build_order, $fe;
|
|
|
515 |
delete $depends{$build};
|
|
|
516 |
delete $fe->{depends}; # remove now its not needed
|
|
|
517 |
}
|
|
|
518 |
|
|
|
519 |
foreach my $key ( keys %depends )
|
|
|
520 |
{
|
|
|
521 |
foreach my $build ( @build )
|
|
|
522 |
{
|
|
|
523 |
delete $depends{$key}{depends}{$build};
|
|
|
524 |
}
|
|
|
525 |
}
|
|
|
526 |
}
|
|
|
527 |
|
|
|
528 |
#
|
|
|
529 |
# Just to be sure to be sure
|
|
|
530 |
#
|
| 245 |
dpurdie |
531 |
if ( keys %depends )
|
|
|
532 |
{
|
|
|
533 |
#DebugDumpData ("depends", \%depends );
|
|
|
534 |
Error( "Internal algorithm error: Bad dependancy walk",
|
|
|
535 |
"Possible circular dependency");
|
|
|
536 |
}
|
| 227 |
dpurdie |
537 |
|
| 359 |
dpurdie |
538 |
# DebugDumpData ("Order", \@build_order);
|
|
|
539 |
# DebugDumpData("External Depends", \%extern_deps );
|
| 227 |
dpurdie |
540 |
}
|
|
|
541 |
|
|
|
542 |
#-------------------------------------------------------------------------------
|
|
|
543 |
# Function : cmd
|
|
|
544 |
#
|
|
|
545 |
# Description : Execute a command in all the sandboxes
|
|
|
546 |
# Locate the base of the sandbox
|
|
|
547 |
# Locate all packages in the sandbox
|
|
|
548 |
# Locate all build files in each sandbox
|
|
|
549 |
# Determine build order
|
|
|
550 |
# Issue commands for each sandbox in order
|
|
|
551 |
#
|
| 255 |
dpurdie |
552 |
# Inputs : Arguments passed to jats build
|
| 227 |
dpurdie |
553 |
#
|
|
|
554 |
# Returns : Will exit
|
|
|
555 |
#
|
|
|
556 |
sub cmd
|
|
|
557 |
{
|
| 359 |
dpurdie |
558 |
my ($hcmd, @cmds ) = @_;
|
|
|
559 |
|
|
|
560 |
Getopt::Long::Configure('pass_through');
|
|
|
561 |
GetOptions (
|
|
|
562 |
"help:+" => \$opt_help,
|
|
|
563 |
"manual:3" => \$opt_help,
|
|
|
564 |
) || Error ("Invalid command line" );
|
|
|
565 |
|
|
|
566 |
SubCommandHelp( $opt_help, $hcmd) if ($opt_help );
|
|
|
567 |
|
| 227 |
dpurdie |
568 |
#
|
|
|
569 |
# Determine Sandbox information
|
|
|
570 |
# Populate global variables
|
|
|
571 |
#
|
|
|
572 |
calc_sandbox_info();
|
|
|
573 |
foreach my $fe ( @build_order )
|
|
|
574 |
{
|
|
|
575 |
my $dir = $fe->{dir};
|
| 359 |
dpurdie |
576 |
Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
|
| 227 |
dpurdie |
577 |
DisplayPath (" Path: $fe->{dir}" ));
|
|
|
578 |
|
| 263 |
dpurdie |
579 |
my $result = JatsCmd( "-cd=$dir", @cmds);
|
| 255 |
dpurdie |
580 |
Error ("Cmd failure") if ( $result );
|
| 227 |
dpurdie |
581 |
}
|
|
|
582 |
|
|
|
583 |
exit 0;
|
|
|
584 |
}
|
|
|
585 |
|
|
|
586 |
#-------------------------------------------------------------------------------
|
| 331 |
dpurdie |
587 |
# Function : buildcmd
|
|
|
588 |
#
|
|
|
589 |
# Description : Build the entire sandbox
|
|
|
590 |
# The all and the build are similar.
|
|
|
591 |
# Its not really useful to do a build without a make
|
|
|
592 |
# so we don't try
|
|
|
593 |
#
|
|
|
594 |
# Inputs : Arguments passed to jats make
|
|
|
595 |
#
|
|
|
596 |
#
|
|
|
597 |
# Returns : Will exit
|
|
|
598 |
#
|
|
|
599 |
|
|
|
600 |
sub buildcmd
|
|
|
601 |
{
|
| 337 |
dpurdie |
602 |
my ($cmd, @cmd_opts) = @_;
|
| 331 |
dpurdie |
603 |
my @build_opts;
|
| 337 |
dpurdie |
604 |
my @make_opts;
|
| 331 |
dpurdie |
605 |
|
|
|
606 |
#
|
| 359 |
dpurdie |
607 |
# Extract and options
|
|
|
608 |
#
|
|
|
609 |
Getopt::Long::Configure('pass_through');
|
|
|
610 |
GetOptions (
|
|
|
611 |
"help:+" => \$opt_help,
|
|
|
612 |
"manual:3" => \$opt_help,
|
|
|
613 |
) || Error ("Invalid command line" );
|
|
|
614 |
|
|
|
615 |
SubCommandHelp( $opt_help, "Command $cmd") if ($opt_help );
|
|
|
616 |
|
|
|
617 |
#
|
| 331 |
dpurdie |
618 |
# Insert default options
|
|
|
619 |
#
|
|
|
620 |
push @build_opts, '-noforce' if ( $cmd eq 'all' );
|
|
|
621 |
push @build_opts, '-force' if ( $cmd ne 'all' );
|
|
|
622 |
|
| 337 |
dpurdie |
623 |
#
|
|
|
624 |
# Attempt to split the options into build and make options
|
|
|
625 |
# Only handle the often used options to build.
|
|
|
626 |
#
|
|
|
627 |
foreach ( @cmd_opts )
|
|
|
628 |
{
|
|
|
629 |
if ( m/^-cache/ || m/^-package/ || m/^-forcebuildpkg/ || m/-expert/) {
|
|
|
630 |
push @build_opts, $_;
|
|
|
631 |
} else {
|
|
|
632 |
push @make_opts, $_;
|
|
|
633 |
}
|
|
|
634 |
}
|
|
|
635 |
|
| 331 |
dpurdie |
636 |
push @make_opts, 'all' unless ( @make_opts );
|
|
|
637 |
|
|
|
638 |
#
|
|
|
639 |
# Determine Sandbox information
|
|
|
640 |
# Populate global variables
|
|
|
641 |
#
|
|
|
642 |
calc_sandbox_info();
|
|
|
643 |
foreach my $fe ( @build_order )
|
|
|
644 |
{
|
|
|
645 |
my $dir = $fe->{dir};
|
| 359 |
dpurdie |
646 |
Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
|
| 331 |
dpurdie |
647 |
DisplayPath (" Path: $fe->{dir}" ));
|
|
|
648 |
|
|
|
649 |
JatsCmd( "-cd=$dir", 'build', @build_opts) && Error ("Build Cmd failure") if ( $result );
|
|
|
650 |
JatsCmd( "-cd=$dir", 'make', @make_opts) && Error ("Make Cmd failure") if ( $result );
|
|
|
651 |
}
|
|
|
652 |
|
|
|
653 |
exit 0;
|
|
|
654 |
}
|
|
|
655 |
|
|
|
656 |
|
|
|
657 |
#-------------------------------------------------------------------------------
|
| 273 |
dpurdie |
658 |
# Function : clean
|
|
|
659 |
#
|
|
|
660 |
# Description : Execute a command in all the sandboxes
|
|
|
661 |
# Locate the base of the sandbox
|
|
|
662 |
# Locate all packages in the sandbox
|
|
|
663 |
# Locate all build files in each sandbox
|
|
|
664 |
# Determine build order
|
|
|
665 |
# Issue commands for each sandbox in order
|
|
|
666 |
#
|
|
|
667 |
# Inputs : Arguments passed to jats build
|
|
|
668 |
#
|
|
|
669 |
# Returns : Will exit
|
|
|
670 |
#
|
|
|
671 |
sub clean
|
|
|
672 |
{
|
|
|
673 |
my ($mode, @cmds ) = @_;
|
| 359 |
dpurdie |
674 |
|
| 273 |
dpurdie |
675 |
#
|
| 359 |
dpurdie |
676 |
# Extract and options
|
|
|
677 |
#
|
|
|
678 |
Getopt::Long::Configure('pass_through');
|
|
|
679 |
GetOptions (
|
|
|
680 |
"help:+" => \$opt_help,
|
|
|
681 |
"manual:3" => \$opt_help,
|
|
|
682 |
) || Error ("Invalid command line" );
|
|
|
683 |
|
|
|
684 |
SubCommandHelp( $opt_help, "Clean") if ($opt_help );
|
|
|
685 |
|
|
|
686 |
#
|
| 273 |
dpurdie |
687 |
# Determine Sandbox information
|
|
|
688 |
# Populate global variables
|
|
|
689 |
#
|
|
|
690 |
calc_sandbox_info();
|
|
|
691 |
|
|
|
692 |
my @cmd = $mode eq 'clobber' ? ('clobber') : ('make', 'clean' );
|
|
|
693 |
|
|
|
694 |
#
|
|
|
695 |
# Clobber and clean need to be done in the reverse order
|
|
|
696 |
#
|
|
|
697 |
foreach my $fe ( reverse @build_order )
|
|
|
698 |
{
|
|
|
699 |
my $dir = $fe->{dir};
|
| 359 |
dpurdie |
700 |
Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
|
| 273 |
dpurdie |
701 |
DisplayPath (" Path: $fe->{dir}" ));
|
|
|
702 |
|
|
|
703 |
my $result = JatsCmd( "-cd=$dir", @cmd, @cmds);
|
|
|
704 |
Error ("Cmd failure") if ( $result );
|
|
|
705 |
}
|
|
|
706 |
|
|
|
707 |
exit 0;
|
|
|
708 |
}
|
|
|
709 |
|
|
|
710 |
|
|
|
711 |
#-------------------------------------------------------------------------------
|
| 337 |
dpurdie |
712 |
# Function : cache
|
|
|
713 |
#
|
|
|
714 |
# Description : Cache external packages into the sandbox
|
|
|
715 |
#
|
|
|
716 |
# Inputs : @opts - User options
|
|
|
717 |
#
|
|
|
718 |
# Returns : Nothing
|
|
|
719 |
#
|
|
|
720 |
sub cache
|
|
|
721 |
{
|
|
|
722 |
my (@opts) = @_;
|
|
|
723 |
|
| 359 |
dpurdie |
724 |
GetOptions (
|
|
|
725 |
"help:+" => \$opt_help,
|
|
|
726 |
"manual:3" => \$opt_help,
|
|
|
727 |
) || Error ("Invalid command line" );
|
|
|
728 |
|
|
|
729 |
SubCommandHelp( $opt_help, "Cache") if ($opt_help || $#ARGV >= 0 );
|
|
|
730 |
|
| 337 |
dpurdie |
731 |
#
|
|
|
732 |
# Determine Sandbox information
|
|
|
733 |
# Populate global variables
|
|
|
734 |
#
|
|
|
735 |
Message("Cache External Dependencies");
|
|
|
736 |
calc_sandbox_info();
|
|
|
737 |
|
|
|
738 |
#
|
|
|
739 |
# Walk the list of external depenedencies and cache each one
|
|
|
740 |
#
|
|
|
741 |
foreach my $de ( sort keys %extern_deps )
|
|
|
742 |
{
|
|
|
743 |
my @vlist = keys %{$extern_deps{$de}};
|
| 359 |
dpurdie |
744 |
foreach my $pve ( @vlist )
|
| 337 |
dpurdie |
745 |
{
|
| 359 |
dpurdie |
746 |
my ($pn,$pv) = split( $; , $pve );
|
|
|
747 |
Message ("Cache ${pn} ${pv}");
|
|
|
748 |
JatsTool ('cache_dpkg', "${pn}/${pv}" );
|
| 337 |
dpurdie |
749 |
}
|
|
|
750 |
}
|
|
|
751 |
|
|
|
752 |
exit 0;
|
|
|
753 |
|
|
|
754 |
}
|
|
|
755 |
|
| 359 |
dpurdie |
756 |
#-------------------------------------------------------------------------------
|
|
|
757 |
# Function : populate
|
|
|
758 |
#
|
|
|
759 |
# Description : Populate the sandbox with package versions
|
|
|
760 |
#
|
|
|
761 |
#
|
|
|
762 |
# Inputs : commands - Array of command line arguments
|
|
|
763 |
# Mode-0:
|
|
|
764 |
#
|
|
|
765 |
# pkg_name pkg_version - Import files for named package
|
|
|
766 |
# options:
|
|
|
767 |
# -recurse - Import dependent packages too
|
|
|
768 |
# -missing - Import dependencies not in dpkg_archive
|
|
|
769 |
# -test - Show what would be done
|
|
|
770 |
# -extractfiles - Extract file, no view
|
|
|
771 |
#
|
|
|
772 |
#
|
|
|
773 |
#
|
|
|
774 |
#
|
|
|
775 |
# Returns : Does not return
|
|
|
776 |
#
|
|
|
777 |
use JatsRmApi;
|
|
|
778 |
use DBI;
|
| 337 |
dpurdie |
779 |
|
| 359 |
dpurdie |
780 |
#
|
|
|
781 |
# Data Base Interface
|
|
|
782 |
#
|
|
|
783 |
my $RM_DB;
|
|
|
784 |
my $PopLevel = 0;
|
|
|
785 |
my %PopPackage;
|
|
|
786 |
my @StrayPackages;
|
|
|
787 |
my @PopBase;
|
|
|
788 |
|
|
|
789 |
sub populate
|
|
|
790 |
{
|
|
|
791 |
my $opt_missing = 0;
|
|
|
792 |
my $opt_recurse = 0;
|
|
|
793 |
my $opt_test = 0;
|
|
|
794 |
my $opt_extractfiles;
|
|
|
795 |
my @opt_extract = qw(-extract);
|
|
|
796 |
my @opt_fnames;
|
|
|
797 |
|
|
|
798 |
Getopt::Long::Configure('pass_through');
|
|
|
799 |
GetOptions (
|
|
|
800 |
"help:+" => \$opt_help,
|
|
|
801 |
"manual:3" => \$opt_help,
|
|
|
802 |
"missing" => \$opt_missing,
|
|
|
803 |
"test" => \$opt_test,
|
|
|
804 |
"recurse:100" => \$opt_recurse,
|
|
|
805 |
) || Error ("Invalid command line" );
|
|
|
806 |
|
|
|
807 |
SubCommandHelp( $opt_help, "Populate Sandbox") if ($opt_help );
|
|
|
808 |
|
|
|
809 |
#
|
|
|
810 |
# Extract options for the jats extract utility
|
|
|
811 |
#
|
|
|
812 |
foreach ( @ARGV )
|
|
|
813 |
{
|
|
|
814 |
if ( m~^-~ ) {
|
|
|
815 |
push ( @opt_extract, $_);
|
|
|
816 |
} else {
|
|
|
817 |
push ( @opt_fnames, $_);
|
|
|
818 |
}
|
|
|
819 |
}
|
|
|
820 |
|
|
|
821 |
#
|
|
|
822 |
# Allow exactly zero or two 'bare' arguments
|
|
|
823 |
# Create an array of package-versions to be processed.
|
|
|
824 |
#
|
|
|
825 |
if ( $#opt_fnames >= 0 )
|
|
|
826 |
{
|
|
|
827 |
Error ("Populate: Must speicfy both a package name and version")
|
|
|
828 |
if ( $#opt_fnames != 1 );
|
|
|
829 |
push @PopBase, join( $;, @opt_fnames );
|
|
|
830 |
}
|
|
|
831 |
elsif ( $opt_missing )
|
|
|
832 |
{
|
|
|
833 |
#
|
|
|
834 |
# User has not provided a package name to extract
|
|
|
835 |
# Assume that the user will want missing dependencies
|
|
|
836 |
#
|
|
|
837 |
# Determine packages that are not present
|
|
|
838 |
#
|
|
|
839 |
calc_sandbox_info();
|
|
|
840 |
|
|
|
841 |
#
|
|
|
842 |
# Scan for missing dependencies
|
|
|
843 |
#
|
|
|
844 |
foreach my $de ( sort keys %extern_deps )
|
|
|
845 |
{
|
|
|
846 |
my @vlist = keys %{$extern_deps{$de}};
|
|
|
847 |
foreach my $pve ( @vlist )
|
|
|
848 |
{
|
|
|
849 |
my ($pn,$pv) = split( $; , $pve );
|
|
|
850 |
unless (check_package_existance( $pn, $pv ))
|
|
|
851 |
{
|
|
|
852 |
push @PopBase, join( $;, $pn , $pv );
|
|
|
853 |
}
|
|
|
854 |
}
|
|
|
855 |
}
|
|
|
856 |
}
|
|
|
857 |
else
|
|
|
858 |
{
|
|
|
859 |
Error ("No command or option specified. See help for command usage");
|
|
|
860 |
}
|
|
|
861 |
|
|
|
862 |
#
|
|
|
863 |
# Process the list of package-versions
|
|
|
864 |
# These are top level packages. Get details from Release Manager
|
|
|
865 |
#
|
|
|
866 |
#DebugDumpData("Data", \@PopBase );
|
|
|
867 |
$PopLevel = 0;
|
|
|
868 |
foreach my $entry ( @PopBase )
|
|
|
869 |
{
|
|
|
870 |
my ($pname, $pver ) = split( $; , $entry);
|
|
|
871 |
|
|
|
872 |
my $pv_id = getPkgDetailsByName($pname, $pver);
|
|
|
873 |
Error ("populate: $pname, $pver not found in Release Manager" )
|
|
|
874 |
unless ( $pv_id );
|
|
|
875 |
getPkgDetailsByPV_ID($pv_id);
|
|
|
876 |
}
|
|
|
877 |
#
|
|
|
878 |
# If recursing then process packages that have yet to
|
|
|
879 |
# be processed. At the start there will be the initial user specified
|
|
|
880 |
# packages on the list. Place a marker at the end so that we can
|
|
|
881 |
# determine how far we are recursing down the dependency tree.
|
|
|
882 |
#
|
|
|
883 |
if ( $opt_recurse )
|
|
|
884 |
{
|
|
|
885 |
my $marker = join($; , '_NEXT_LEVEL_', 0, 0 );
|
|
|
886 |
push @StrayPackages, $marker;
|
|
|
887 |
$PopLevel++;
|
|
|
888 |
|
|
|
889 |
while ( $#StrayPackages >= 0 )
|
|
|
890 |
{
|
|
|
891 |
my ($name, $ver, $pv_id) = split($;, shift @StrayPackages);
|
|
|
892 |
|
|
|
893 |
#
|
|
|
894 |
# Marker.
|
|
|
895 |
# Increment the level of recursion
|
|
|
896 |
# Detect end conditions
|
|
|
897 |
#
|
|
|
898 |
if ( $name eq '_NEXT_LEVEL_' )
|
|
|
899 |
{
|
|
|
900 |
last unless ($#StrayPackages >= 0 );
|
|
|
901 |
$PopLevel++;
|
|
|
902 |
last if ( $PopLevel > $opt_recurse );
|
|
|
903 |
push @StrayPackages, $marker;
|
|
|
904 |
next;
|
|
|
905 |
}
|
|
|
906 |
|
|
|
907 |
next if ( exists $PopPackage{$name}{$ver}{done} );
|
|
|
908 |
getPkgDetailsByPV_ID ( $pv_id );
|
|
|
909 |
#print "Stray: $pv_id, $name, $ver\n";
|
|
|
910 |
}
|
|
|
911 |
}
|
|
|
912 |
#DebugDumpData("Data", \%PopPackage );
|
|
|
913 |
|
|
|
914 |
#
|
|
|
915 |
# Determine packages that need to be extracted
|
|
|
916 |
# Not ordered in any way. Could order by level if we wanted
|
|
|
917 |
#
|
|
|
918 |
foreach my $pname ( sort keys %PopPackage )
|
|
|
919 |
{
|
|
|
920 |
foreach my $pver ( sort keys %{$PopPackage{$pname}} )
|
|
|
921 |
{
|
|
|
922 |
#
|
|
|
923 |
# Create a nice view name for the extraction
|
|
|
924 |
# Will also be used to test for package existance
|
|
|
925 |
#
|
|
|
926 |
my $vname = "$pname $pver";
|
|
|
927 |
$vname =~ s~ ~_~g;
|
|
|
928 |
$vname =~ s~__~~g;
|
|
|
929 |
|
|
|
930 |
if ( -d "$GBE_SANDBOX/$vname" )
|
|
|
931 |
{
|
|
|
932 |
Warning("Package already in sandbox: $pname, $pver");
|
|
|
933 |
next;
|
|
|
934 |
}
|
|
|
935 |
|
|
|
936 |
#
|
|
|
937 |
# If scanning for missing packages, then examine archives
|
|
|
938 |
# for the packages existence. Don't do this on level-0 packages
|
|
|
939 |
# These have been user specified.
|
|
|
940 |
#
|
|
|
941 |
if ( $opt_missing && $PopPackage{$pname}{$pver}{level} )
|
|
|
942 |
{
|
|
|
943 |
my $found = check_package_existance( $pname, $pver );
|
|
|
944 |
if ( $found )
|
|
|
945 |
{
|
|
|
946 |
Verbose ("Package found in archive - skipped: $pname, $pver");
|
|
|
947 |
next;
|
|
|
948 |
}
|
|
|
949 |
}
|
|
|
950 |
|
|
|
951 |
#
|
|
|
952 |
# Generate commands to extract the package
|
|
|
953 |
#
|
|
|
954 |
my $vcstag = $PopPackage{$pname}{$pver}{vcstag};
|
|
|
955 |
my @cmd = qw(jats_vcsrelease);
|
|
|
956 |
push @cmd, "-view=$vname", "-label=$vcstag", @opt_extract;
|
|
|
957 |
if ( $opt_test )
|
|
|
958 |
{
|
|
|
959 |
Message "jats " . QuoteCommand (@cmd );
|
|
|
960 |
}
|
|
|
961 |
else
|
|
|
962 |
{
|
|
|
963 |
Message "Extracting: $pname $pver";
|
|
|
964 |
my $rv = JatsCmd (@cmd);
|
|
|
965 |
Error ("Package version not extracted")
|
|
|
966 |
if ( $rv );
|
|
|
967 |
}
|
|
|
968 |
}
|
|
|
969 |
}
|
|
|
970 |
|
|
|
971 |
#
|
|
|
972 |
# This command does not return
|
|
|
973 |
#
|
|
|
974 |
exit (0);
|
|
|
975 |
}
|
|
|
976 |
|
| 337 |
dpurdie |
977 |
#-------------------------------------------------------------------------------
|
| 359 |
dpurdie |
978 |
# Function : getPkgDetailsByName
|
|
|
979 |
#
|
|
|
980 |
# Description : Determine the PVID for a given package name and version
|
|
|
981 |
#
|
|
|
982 |
# Inputs : $pname - Package name
|
|
|
983 |
# $pver - Package Version
|
|
|
984 |
#
|
|
|
985 |
# Returns :
|
|
|
986 |
#
|
|
|
987 |
|
|
|
988 |
sub getPkgDetailsByName
|
|
|
989 |
{
|
|
|
990 |
my ($pname, $pver) = @_;
|
|
|
991 |
my $pv_id;
|
|
|
992 |
my (@row);
|
|
|
993 |
|
|
|
994 |
connectRM(\$RM_DB) unless ($RM_DB);
|
|
|
995 |
|
|
|
996 |
# First get details for a given package version
|
|
|
997 |
|
|
|
998 |
my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION" .
|
|
|
999 |
" FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
|
|
|
1000 |
" WHERE pkg.PKG_NAME = \'$pname\' AND pv.PKG_VERSION = \'$pver\' AND pv.PKG_ID = pkg.PKG_ID";
|
|
|
1001 |
my $sth = $RM_DB->prepare($m_sqlstr);
|
|
|
1002 |
if ( defined($sth) )
|
|
|
1003 |
{
|
|
|
1004 |
if ( $sth->execute( ) )
|
|
|
1005 |
{
|
|
|
1006 |
if ( $sth->rows )
|
|
|
1007 |
{
|
|
|
1008 |
while ( @row = $sth->fetchrow_array )
|
|
|
1009 |
{
|
|
|
1010 |
$pv_id = $row[0];
|
|
|
1011 |
my $name = $row[1];
|
|
|
1012 |
my $ver = $row[2];
|
|
|
1013 |
Verbose( "getPkgDetailsByName :PV_ID= $pv_id");
|
|
|
1014 |
}
|
|
|
1015 |
}
|
|
|
1016 |
$sth->finish();
|
|
|
1017 |
}
|
|
|
1018 |
}
|
|
|
1019 |
else
|
|
|
1020 |
{
|
|
|
1021 |
Error("Prepare failure" );
|
|
|
1022 |
}
|
|
|
1023 |
return $pv_id;
|
|
|
1024 |
}
|
|
|
1025 |
|
|
|
1026 |
#-------------------------------------------------------------------------------
|
|
|
1027 |
# Function : getPkgDetailsByPV_ID
|
|
|
1028 |
#
|
|
|
1029 |
# Description : Populate the Packages structure given a PV_ID
|
|
|
1030 |
# Called for each package in the SBOM
|
|
|
1031 |
#
|
|
|
1032 |
# Inputs : PV_ID - Package Unique Identifier
|
|
|
1033 |
#
|
|
|
1034 |
# Returns : Populates Package
|
|
|
1035 |
#
|
|
|
1036 |
sub getPkgDetailsByPV_ID
|
|
|
1037 |
{
|
|
|
1038 |
my ($PV_ID) = @_;
|
|
|
1039 |
my $foundDetails = 0;
|
|
|
1040 |
my (@row);
|
|
|
1041 |
|
|
|
1042 |
connectRM(\$RM_DB) unless ($RM_DB);
|
|
|
1043 |
|
|
|
1044 |
# First get details from pv_id
|
|
|
1045 |
|
|
|
1046 |
my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, release_manager.PK_RMAPI.return_vcs_tag($PV_ID)" .
|
|
|
1047 |
" FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg " .
|
|
|
1048 |
" WHERE pv.PV_ID = \'$PV_ID\' AND pv.PKG_ID = pkg.PKG_ID";
|
|
|
1049 |
|
|
|
1050 |
my $sth = $RM_DB->prepare($m_sqlstr);
|
|
|
1051 |
if ( defined($sth) )
|
|
|
1052 |
{
|
|
|
1053 |
if ( $sth->execute( ) )
|
|
|
1054 |
{
|
|
|
1055 |
if ( $sth->rows )
|
|
|
1056 |
{
|
|
|
1057 |
while ( @row = $sth->fetchrow_array )
|
|
|
1058 |
{
|
|
|
1059 |
my $pv_id = $row[0];
|
|
|
1060 |
my $name = $row[1];
|
|
|
1061 |
my $ver = $row[2];
|
|
|
1062 |
my $vcstag = $row[3] || '';
|
|
|
1063 |
|
|
|
1064 |
$vcstag =~ tr~\\/~/~;
|
|
|
1065 |
Verbose ("getPkgDetailsByPV_ID: $PV_ID, $name, $ver, $vcstag");
|
|
|
1066 |
|
|
|
1067 |
$PopPackage{$name}{$ver}{pvid} = $PV_ID;
|
|
|
1068 |
$PopPackage{$name}{$ver}{done} = 1;
|
|
|
1069 |
$PopPackage{$name}{$ver}{vcstag} = $vcstag;
|
|
|
1070 |
$PopPackage{$name}{$ver}{level} = $PopLevel;
|
|
|
1071 |
getDependsByPV_ID( $pv_id, $name, $ver );
|
|
|
1072 |
}
|
|
|
1073 |
}
|
|
|
1074 |
else
|
|
|
1075 |
{
|
|
|
1076 |
Warning ("No Package details for: PVID: $PV_ID");
|
|
|
1077 |
}
|
|
|
1078 |
$sth->finish();
|
|
|
1079 |
}
|
|
|
1080 |
else
|
|
|
1081 |
{
|
|
|
1082 |
Error("getPkgDetailsByPV_ID: Execute failure", $m_sqlstr );
|
|
|
1083 |
}
|
|
|
1084 |
}
|
|
|
1085 |
else
|
|
|
1086 |
{
|
|
|
1087 |
Error("Prepare failure" );
|
|
|
1088 |
}
|
|
|
1089 |
}
|
|
|
1090 |
|
|
|
1091 |
#-------------------------------------------------------------------------------
|
|
|
1092 |
# Function : getDependsByPV_ID
|
|
|
1093 |
#
|
|
|
1094 |
# Description : Extract the dependancies for a given package version
|
|
|
1095 |
#
|
|
|
1096 |
# Inputs : $pvid
|
|
|
1097 |
#
|
|
|
1098 |
# Returns :
|
|
|
1099 |
#
|
|
|
1100 |
sub getDependsByPV_ID
|
|
|
1101 |
{
|
|
|
1102 |
my ($pv_id, $pname, $pver) = @_;
|
|
|
1103 |
|
|
|
1104 |
connectRM(\$RM_DB) unless ($RM_DB);
|
|
|
1105 |
|
|
|
1106 |
#
|
|
|
1107 |
# Now extract the package dependacies
|
|
|
1108 |
#
|
|
|
1109 |
my $m_sqlstr = "SELECT pkg.PKG_NAME, pv.PKG_VERSION, pd.DPV_ID" .
|
|
|
1110 |
" FROM RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd, RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
|
|
|
1111 |
" WHERE pd.PV_ID = \'$pv_id\' AND pd.DPV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID";
|
|
|
1112 |
my $sth = $RM_DB->prepare($m_sqlstr);
|
|
|
1113 |
if ( defined($sth) )
|
|
|
1114 |
{
|
|
|
1115 |
if ( $sth->execute( ) )
|
|
|
1116 |
{
|
|
|
1117 |
if ( $sth->rows )
|
|
|
1118 |
{
|
|
|
1119 |
while ( my @row = $sth->fetchrow_array )
|
|
|
1120 |
{
|
|
|
1121 |
my $name = $row[0];
|
|
|
1122 |
my $ver = $row[1];
|
|
|
1123 |
|
|
|
1124 |
Verbose2( " Depends: $name, $ver");
|
|
|
1125 |
unless ( exists $PopPackage{$name} && exists $PopPackage{$name}{$ver} && exists $PopPackage{$name}{$ver}{done} )
|
|
|
1126 |
{
|
|
|
1127 |
push @StrayPackages, join($;, $name, $ver, $row[2] );
|
|
|
1128 |
}
|
|
|
1129 |
}
|
|
|
1130 |
}
|
|
|
1131 |
$sth->finish();
|
|
|
1132 |
}
|
|
|
1133 |
}
|
|
|
1134 |
else
|
|
|
1135 |
{
|
|
|
1136 |
Error("GetDepends:Prepare failure" );
|
|
|
1137 |
}
|
|
|
1138 |
}
|
|
|
1139 |
|
|
|
1140 |
#-------------------------------------------------------------------------------
|
|
|
1141 |
# Function : SubCommandHelp
|
|
|
1142 |
#
|
|
|
1143 |
# Description : Provide help on a subcommand
|
|
|
1144 |
#
|
|
|
1145 |
# Inputs : $help_level - Help Level 1,2,3
|
|
|
1146 |
# $topic - Topic Name
|
|
|
1147 |
#
|
|
|
1148 |
# Returns : This function does not return
|
|
|
1149 |
#
|
|
|
1150 |
sub SubCommandHelp
|
|
|
1151 |
{
|
|
|
1152 |
my ($help_level, $topic) = @_;
|
|
|
1153 |
my @sections;
|
|
|
1154 |
#
|
|
|
1155 |
# Spell out the section we want to display
|
|
|
1156 |
#
|
|
|
1157 |
# Note:
|
|
|
1158 |
# Due to bug in pod2usage can't use 'head1' by itself
|
|
|
1159 |
# Each one needs a subsection.
|
|
|
1160 |
#
|
|
|
1161 |
push @sections, qw( NAME SYNOPSIS ) ;
|
|
|
1162 |
push @sections, qw( ARGUMENTS OPTIONS ) if ( $help_level > 1 );
|
|
|
1163 |
push @sections, qw( DESCRIPTION EXAMPLES ) if ( $help_level > 2 );
|
|
|
1164 |
|
|
|
1165 |
#
|
|
|
1166 |
# Extract section from the POD
|
|
|
1167 |
#
|
|
|
1168 |
pod2usage({-verbose => 99,
|
|
|
1169 |
-noperldoc => 1,
|
|
|
1170 |
-sections => $topic . '/' . join('|', @sections) } );
|
|
|
1171 |
}
|
|
|
1172 |
|
|
|
1173 |
#-------------------------------------------------------------------------------
|
| 227 |
dpurdie |
1174 |
# Documentation
|
| 359 |
dpurdie |
1175 |
# NOTE
|
| 227 |
dpurdie |
1176 |
#
|
| 359 |
dpurdie |
1177 |
# Each subcommand MUST have
|
|
|
1178 |
# head1 section as used by the subcommand
|
|
|
1179 |
# This should be empty, as the contents will NOT be displayed
|
|
|
1180 |
# head2 sections called
|
|
|
1181 |
# NAME SYNOPSIS ARGUMENTS OPTIONS DESCRIPTION EXAMPLES
|
|
|
1182 |
#
|
|
|
1183 |
#=head1 xxxxxx
|
|
|
1184 |
#=head2 NAME
|
|
|
1185 |
#=head2 SYNOPSIS
|
|
|
1186 |
#=head2 ARGUMENTS
|
|
|
1187 |
#=head2 OPTIONS
|
|
|
1188 |
#=head2 DESCRIPTION
|
|
|
1189 |
#=head2 EXAMPLES
|
|
|
1190 |
#
|
| 227 |
dpurdie |
1191 |
|
|
|
1192 |
=pod
|
|
|
1193 |
|
|
|
1194 |
=head1 NAME
|
|
|
1195 |
|
|
|
1196 |
jats_sandbox - Build in a Development Sandbox
|
|
|
1197 |
|
|
|
1198 |
=head1 SYNOPSIS
|
|
|
1199 |
|
| 359 |
dpurdie |
1200 |
jats sandbox [options] {command} [command options]
|
| 227 |
dpurdie |
1201 |
|
|
|
1202 |
Options:
|
| 299 |
dpurdie |
1203 |
-help[=n] - Display help with specified detail
|
| 227 |
dpurdie |
1204 |
-help -help - Detailed help message
|
|
|
1205 |
-man - Full documentation
|
|
|
1206 |
|
|
|
1207 |
Commands:
|
|
|
1208 |
help - Same as -help
|
|
|
1209 |
create - Create a sandbox in the current directory
|
| 359 |
dpurdie |
1210 |
populate - Populate the sandbox with packages
|
| 299 |
dpurdie |
1211 |
delete - Delete the sandbox
|
| 255 |
dpurdie |
1212 |
info [[-v]-v] - Sandbox information. -v: Be more verbose
|
| 227 |
dpurdie |
1213 |
cmd - Do commands in all sandbox components
|
| 331 |
dpurdie |
1214 |
all - Do 'build', if required, then a make in all sandbox components
|
|
|
1215 |
build - Force 'build and make' in all sandbox components
|
| 275 |
dpurdie |
1216 |
make - Do 'make' in all sandbox components
|
| 273 |
dpurdie |
1217 |
clean - Do 'make clean' in all sandbox components
|
|
|
1218 |
clobber - Do 'build clobber' is all sandbox components
|
| 337 |
dpurdie |
1219 |
cache - Cache external dependent packages
|
| 227 |
dpurdie |
1220 |
|
| 359 |
dpurdie |
1221 |
Use the command
|
|
|
1222 |
jats sandbox 'command' -h
|
|
|
1223 |
for command specific help
|
|
|
1224 |
|
| 227 |
dpurdie |
1225 |
=head1 OPTIONS
|
|
|
1226 |
|
|
|
1227 |
=over 8
|
|
|
1228 |
|
| 299 |
dpurdie |
1229 |
=item B<-help[=n]>
|
| 227 |
dpurdie |
1230 |
|
|
|
1231 |
Print a brief help message and exits.
|
| 299 |
dpurdie |
1232 |
There are three levels of help
|
| 227 |
dpurdie |
1233 |
|
| 299 |
dpurdie |
1234 |
=over 8
|
|
|
1235 |
|
|
|
1236 |
=item 1 Brief synopsis
|
|
|
1237 |
|
|
|
1238 |
=item 2 Synopsis and option summary
|
|
|
1239 |
|
|
|
1240 |
=item 3 Detailed help in man format
|
|
|
1241 |
|
|
|
1242 |
=back 8
|
|
|
1243 |
|
| 227 |
dpurdie |
1244 |
=item B<-help -help>
|
|
|
1245 |
|
|
|
1246 |
Print a detailed help message with an explanation for each option.
|
|
|
1247 |
|
|
|
1248 |
=item B<-man>
|
|
|
1249 |
|
| 299 |
dpurdie |
1250 |
Prints the manual page and exits. This is the same a -help=3
|
| 227 |
dpurdie |
1251 |
|
| 279 |
dpurdie |
1252 |
=back
|
|
|
1253 |
|
| 227 |
dpurdie |
1254 |
=head1 DESCRIPTION
|
|
|
1255 |
|
| 299 |
dpurdie |
1256 |
This program is the primary tool for the maintenance of Development Sandboxes.
|
|
|
1257 |
|
| 227 |
dpurdie |
1258 |
More documentation will follow.
|
|
|
1259 |
|
| 279 |
dpurdie |
1260 |
=head2 SANDBOX DIRECTORY
|
|
|
1261 |
|
| 299 |
dpurdie |
1262 |
The sandbox directory is marked as being a sandbox through the use of the
|
|
|
1263 |
'sandbox create' command. This will create a suitable structure within the
|
| 279 |
dpurdie |
1264 |
current directory.
|
|
|
1265 |
|
|
|
1266 |
Several JATS commands operate differently within a sandbox. The 'extract' and
|
|
|
1267 |
'release' commands will create static viwes within the sandbox and not the
|
|
|
1268 |
normal directory. The 'sandbox' sub commands can only be used within a sandbox.
|
|
|
1269 |
|
|
|
1270 |
The sandbox directory contains sub directories, each should contain a single
|
| 359 |
dpurdie |
1271 |
package. Sub directories may be created with the 'jats extract' command or with the
|
|
|
1272 |
'jats sandbox populate' command.
|
| 279 |
dpurdie |
1273 |
|
|
|
1274 |
Note: Symbolic links are not supported. They cannot work as he sandbox mechanism
|
|
|
1275 |
requires that all the packages be conatined within a sub directory tree so
|
|
|
1276 |
that the root of the sandbox can be located by a simple scan of the directory
|
|
|
1277 |
tree.
|
|
|
1278 |
|
| 325 |
dpurdie |
1279 |
If a package subdirectory contains a file called 'stop' or 'stop.
|
|
|
1280 |
<GBE_MACHTYPE>', then that package will not be considered as a part of the
|
|
|
1281 |
build-set. A 'stop' file will prevent consideration all build platforms. The 'stop.
|
|
|
1282 |
<GBE_MACHTYPE>' will only prevent consideration if being built on a GBE_MACHTYPE
|
|
|
1283 |
type of computer.
|
| 279 |
dpurdie |
1284 |
|
| 359 |
dpurdie |
1285 |
=head1 Create Sandbox
|
| 299 |
dpurdie |
1286 |
|
| 359 |
dpurdie |
1287 |
=head2 NAME
|
| 299 |
dpurdie |
1288 |
|
| 359 |
dpurdie |
1289 |
Create Sandbox
|
|
|
1290 |
|
|
|
1291 |
=head2 SYNOPSIS
|
|
|
1292 |
|
|
|
1293 |
jats sandbox [options] create [command options]
|
|
|
1294 |
|
|
|
1295 |
Options:
|
|
|
1296 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1297 |
-man - Full documentation [-help=3]
|
|
|
1298 |
-verbose[=n] - Verbose command operation
|
|
|
1299 |
|
|
|
1300 |
Command Options
|
|
|
1301 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1302 |
-verbose[=n] - Verbose operation
|
|
|
1303 |
-exact - Create sandbox to reproduce exact versions
|
|
|
1304 |
|
|
|
1305 |
=head2 OPTIONS
|
|
|
1306 |
|
|
|
1307 |
The 'create' command takes the following options:
|
|
|
1308 |
|
|
|
1309 |
=over 8
|
|
|
1310 |
|
|
|
1311 |
=item -exact
|
|
|
1312 |
|
|
|
1313 |
When this option is specified the sandbox is marked for exact processing of
|
|
|
1314 |
package versions. In this mode the version numbers of the packages in the
|
|
|
1315 |
sandbox are significant. This is ideal for recreating a package-version.
|
|
|
1316 |
|
|
|
1317 |
The default is for in-exact processing, in which the version numbers of packages
|
|
|
1318 |
within the sandbox are not significant. The is ideal for development.
|
|
|
1319 |
|
|
|
1320 |
=back
|
|
|
1321 |
|
|
|
1322 |
=head2 DESCRIPTION
|
|
|
1323 |
|
| 299 |
dpurdie |
1324 |
The 'create' command will create a sandbox in the users current directory. It is
|
|
|
1325 |
not possible to create a sandbox within a sandbox.
|
|
|
1326 |
|
|
|
1327 |
A sandbox can be created in a directory that contains files and subdirectories.
|
|
|
1328 |
|
|
|
1329 |
The create command simply places a known directory in the current directory.
|
| 359 |
dpurdie |
1330 |
This directory is used by the sandboxing process. It may be manually deleted, or
|
| 299 |
dpurdie |
1331 |
deleted with the 'delete' command.
|
|
|
1332 |
|
|
|
1333 |
|
| 359 |
dpurdie |
1334 |
=head1 Populate Sandbox
|
|
|
1335 |
|
|
|
1336 |
=head2 NAME
|
|
|
1337 |
|
|
|
1338 |
Populate a Sandbox
|
|
|
1339 |
|
|
|
1340 |
=head2 SYNOPSIS
|
|
|
1341 |
|
|
|
1342 |
jats sandbox [options] populate [command options] [packageName packageVersion]
|
|
|
1343 |
|
|
|
1344 |
Options:
|
|
|
1345 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1346 |
-man - Full documentation [-help=3]
|
|
|
1347 |
-verbose[=n] - Verbose command operation
|
|
|
1348 |
|
|
|
1349 |
Command Options
|
|
|
1350 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1351 |
-recurse[=n] - Locate dependencies within packages
|
|
|
1352 |
-missing - Locate missing packages
|
|
|
1353 |
-test - Do not extract packages
|
|
|
1354 |
-<Other> - Pass options to jats extract
|
|
|
1355 |
|
|
|
1356 |
=head2 ARGUMENTS
|
|
|
1357 |
|
|
|
1358 |
The 'populate' command can take a package name and version as arguments. It will
|
|
|
1359 |
then populate the sandbox with this package. See 'DESCRIPTION' for details.
|
|
|
1360 |
|
|
|
1361 |
=head2 OPTIONS
|
|
|
1362 |
|
|
|
1363 |
The 'populate' command takes the following options:
|
|
|
1364 |
|
|
|
1365 |
=over 4
|
|
|
1366 |
|
|
|
1367 |
=over 4
|
|
|
1368 |
|
|
|
1369 |
=item -recurse[=N]
|
|
|
1370 |
|
|
|
1371 |
This option will modify the operation of the command such that dependencies
|
|
|
1372 |
of named packages can also be extracted into the sandbox.
|
|
|
1373 |
|
|
|
1374 |
The default operation is to only extract named packages. If the option is
|
|
|
1375 |
specified then all dependent packages are processed. An optional numeric argument
|
|
|
1376 |
can be specified to limit the depth of the recursion.
|
|
|
1377 |
|
|
|
1378 |
=item -missing
|
|
|
1379 |
|
|
|
1380 |
This option will modify the operation of the dependency recursion scanning such
|
|
|
1381 |
that dependent packages that exist in a package archive will not be extracted.
|
|
|
1382 |
|
|
|
1383 |
Use of this option allows a sandbox to be populated with packages that are
|
|
|
1384 |
required by packages in the sandbox, but are not available in a package archive.
|
|
|
1385 |
|
|
|
1386 |
=item -test
|
|
|
1387 |
|
|
|
1388 |
This option will prevent the command from performing the extraction. It will
|
|
|
1389 |
simply display the JATS commands that can be used to perform the extraction.
|
|
|
1390 |
|
|
|
1391 |
=item -<Other>
|
|
|
1392 |
|
|
|
1393 |
Options not understood by the 'populate' sub command will be passed through
|
|
|
1394 |
the package extraction program. Useful options include:
|
|
|
1395 |
|
|
|
1396 |
=over 8
|
|
|
1397 |
|
|
|
1398 |
=item -extractfiles
|
|
|
1399 |
|
|
|
1400 |
=item -branch=<branch name>
|
|
|
1401 |
|
|
|
1402 |
=back
|
|
|
1403 |
|
|
|
1404 |
=back
|
|
|
1405 |
|
|
|
1406 |
=back
|
|
|
1407 |
|
|
|
1408 |
=head2 DESCRIPTION
|
|
|
1409 |
|
|
|
1410 |
The 'populate' command can be used to assist in populating the sandbox. It has
|
|
|
1411 |
two modes of operation.
|
|
|
1412 |
|
|
|
1413 |
=over 8
|
|
|
1414 |
|
|
|
1415 |
=item Named Package
|
|
|
1416 |
|
|
|
1417 |
If the user specifies both a package name and a package version then he command
|
|
|
1418 |
will populate the sandbox with that package and optionally its dependencies.
|
|
|
1419 |
|
|
|
1420 |
=item Determine missing dependencies
|
|
|
1421 |
|
|
|
1422 |
If the user does not specify a package name and version, but does specify
|
|
|
1423 |
the '-missing' option, then the command will examine the current sandbox and
|
|
|
1424 |
determine missing dependent packages. It will then populate the sandbox with
|
|
|
1425 |
these packages and optionally there dependencies.
|
|
|
1426 |
|
|
|
1427 |
=back
|
|
|
1428 |
|
|
|
1429 |
=head2 EXAMPLES
|
|
|
1430 |
|
|
|
1431 |
=over 4
|
|
|
1432 |
|
|
|
1433 |
=item jats sandbox populate package1 version1
|
|
|
1434 |
|
|
|
1435 |
This command will populate the sandbox with version1 of package1, if it does not
|
|
|
1436 |
already exist in the sandbox.
|
|
|
1437 |
|
|
|
1438 |
=item jats sandbox populate package1 version1 -recurse -missing
|
|
|
1439 |
|
|
|
1440 |
This command will populate the sandbox with version1 of package1, if it does not
|
|
|
1441 |
already exist in the sandbox, together will all the packages dependencies that
|
|
|
1442 |
are not available in a package archive.
|
|
|
1443 |
|
|
|
1444 |
=item jats sandbox populate -recurse -missing
|
|
|
1445 |
|
|
|
1446 |
This command will examine the current sandbox and populate the sandbox with
|
|
|
1447 |
packages that are required to build the packages in the sandbox and the
|
|
|
1448 |
dependencies of these packages, provide the dependent package is not in a
|
|
|
1449 |
package archive.
|
|
|
1450 |
|
|
|
1451 |
=item jats sandbox populate
|
|
|
1452 |
|
|
|
1453 |
This command will examine the current sandbox and populate the sandbox with
|
|
|
1454 |
packages that are required to build the packages in the sandbox. It will not
|
|
|
1455 |
examine the dependents of these packages.
|
|
|
1456 |
|
|
|
1457 |
=back
|
|
|
1458 |
|
|
|
1459 |
=head1 Delete Sandbox
|
|
|
1460 |
|
|
|
1461 |
=head2 NAME
|
|
|
1462 |
|
|
|
1463 |
Deleta a sandbox
|
|
|
1464 |
|
|
|
1465 |
=head2 SYNOPSIS
|
|
|
1466 |
|
|
|
1467 |
jats sandbox [options] delete
|
|
|
1468 |
|
|
|
1469 |
Options:
|
|
|
1470 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1471 |
-man - Full documentation [-help=3]
|
|
|
1472 |
-verbose[=n] - Verbose command operation
|
|
|
1473 |
|
|
|
1474 |
=head2 DESCRIPTION
|
|
|
1475 |
|
| 299 |
dpurdie |
1476 |
The 'delete' command will delete the sandbox's marker directory. The command may
|
|
|
1477 |
be executed anywhere within the sandbox.
|
|
|
1478 |
|
| 359 |
dpurdie |
1479 |
Once the sandbox has been deleted, the user must remove the components within the
|
| 299 |
dpurdie |
1480 |
sandbox.
|
|
|
1481 |
|
| 359 |
dpurdie |
1482 |
=head1 Sandbox Information
|
| 299 |
dpurdie |
1483 |
|
| 359 |
dpurdie |
1484 |
=head2 NAME
|
|
|
1485 |
|
|
|
1486 |
Display Sandbox Information
|
|
|
1487 |
|
|
|
1488 |
=head2 SYNOPSIS
|
|
|
1489 |
|
|
|
1490 |
jats sandbox [options] info [command options]
|
|
|
1491 |
|
|
|
1492 |
Options:
|
|
|
1493 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1494 |
-man - Full documentation [-help=3]
|
|
|
1495 |
-verbose[=n] - Verbose command operation
|
|
|
1496 |
|
|
|
1497 |
Command Options
|
|
|
1498 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1499 |
-verbose[=n] - Display more information
|
|
|
1500 |
|
|
|
1501 |
=head2 OPTIONS
|
|
|
1502 |
|
|
|
1503 |
=over
|
|
|
1504 |
|
|
|
1505 |
=item B<-verbose[=n]>
|
|
|
1506 |
|
|
|
1507 |
This options will increase the verbosity of the information being displayed.
|
|
|
1508 |
Values 1 and 2 are described in the detailed 'DESCRIPTION'. Other values are
|
|
|
1509 |
reserved for diagnostic use.
|
|
|
1510 |
|
|
|
1511 |
=back
|
|
|
1512 |
|
|
|
1513 |
=head2 DESCRIPTION
|
|
|
1514 |
|
| 299 |
dpurdie |
1515 |
The 'info' command will display information about the build order and the
|
| 359 |
dpurdie |
1516 |
dependencies of packages that it finds within the sandbox.
|
| 299 |
dpurdie |
1517 |
|
| 359 |
dpurdie |
1518 |
The command works within various levels of verbosity:
|
| 299 |
dpurdie |
1519 |
|
|
|
1520 |
=over 8
|
|
|
1521 |
|
|
|
1522 |
=item * No Verbosity
|
|
|
1523 |
|
|
|
1524 |
The basic command will display the build order and the external
|
| 335 |
dpurdie |
1525 |
dependencies. External dependencies may be prefixed with one of the
|
|
|
1526 |
following indicators:
|
| 299 |
dpurdie |
1527 |
|
| 335 |
dpurdie |
1528 |
=over 8
|
|
|
1529 |
|
|
|
1530 |
=item + Multiple versions of this package are being used by sandboxed components.
|
|
|
1531 |
|
|
|
1532 |
=item * The package cannot be found in any of the package archives.
|
|
|
1533 |
|
|
|
1534 |
=back
|
|
|
1535 |
|
| 299 |
dpurdie |
1536 |
=item Verbosity of 1
|
|
|
1537 |
|
| 359 |
dpurdie |
1538 |
This level of verbosity will display the build order and detailed information
|
| 299 |
dpurdie |
1539 |
on the dependencies. The dependencies will be prefixed with:
|
|
|
1540 |
|
|
|
1541 |
=over 8
|
|
|
1542 |
|
|
|
1543 |
=item E Dependent Package is external to the sandbox
|
|
|
1544 |
|
|
|
1545 |
=item I Dependent Package is internal to the sandbox
|
|
|
1546 |
|
|
|
1547 |
=back
|
|
|
1548 |
|
| 335 |
dpurdie |
1549 |
External dependencies may be prefixed with one of the indicators described for
|
|
|
1550 |
no-verbosity. Additionally the internal consumer of the external package is also
|
|
|
1551 |
shown. These are prefixed with a 'U'.
|
| 299 |
dpurdie |
1552 |
|
|
|
1553 |
=item Verbosity of 2
|
|
|
1554 |
|
| 359 |
dpurdie |
1555 |
Reserved for future use
|
| 299 |
dpurdie |
1556 |
|
|
|
1557 |
=item Verbosity over 2
|
|
|
1558 |
|
| 359 |
dpurdie |
1559 |
This should be considered a debug option. Undocumented internal information will
|
| 299 |
dpurdie |
1560 |
be displayed.
|
|
|
1561 |
|
|
|
1562 |
=back
|
|
|
1563 |
|
| 359 |
dpurdie |
1564 |
=head1 Command all
|
| 331 |
dpurdie |
1565 |
|
| 359 |
dpurdie |
1566 |
=head2 NAME
|
|
|
1567 |
|
|
|
1568 |
Build packages in the sandbox
|
|
|
1569 |
|
|
|
1570 |
=head2 SYNOPSIS
|
|
|
1571 |
|
|
|
1572 |
jats sandbox [options] all [command options] [arguments]
|
|
|
1573 |
|
|
|
1574 |
Options:
|
|
|
1575 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1576 |
-man - Full documentation [-help=3]
|
|
|
1577 |
-verbose[=n] - Verbose command operation
|
|
|
1578 |
|
|
|
1579 |
Command Options
|
|
|
1580 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1581 |
|
|
|
1582 |
=head2 ARGUMENTS
|
|
|
1583 |
|
|
|
1584 |
Arguments are passed to the 'make' phase of the process.
|
|
|
1585 |
|
|
|
1586 |
=head2 OPTIONS
|
|
|
1587 |
|
|
|
1588 |
The are command specific options.
|
|
|
1589 |
|
|
|
1590 |
=head2 DESCRIPTION
|
|
|
1591 |
|
| 331 |
dpurdie |
1592 |
The 'all' command will perform build, if the build files are out of date,
|
|
|
1593 |
followed by a make in each of the packages within the sandbox, in the correct
|
|
|
1594 |
build order.
|
|
|
1595 |
|
|
|
1596 |
Any arguments are passed to the 'make' phase of the process.
|
|
|
1597 |
|
|
|
1598 |
This command may be used to:
|
|
|
1599 |
|
|
|
1600 |
=over 8
|
|
|
1601 |
|
|
|
1602 |
=item * Pickup any build file changes.
|
|
|
1603 |
|
|
|
1604 |
=item * Resume a failed build.
|
|
|
1605 |
|
|
|
1606 |
=back
|
|
|
1607 |
|
| 359 |
dpurdie |
1608 |
=head1 Command build
|
| 331 |
dpurdie |
1609 |
|
| 359 |
dpurdie |
1610 |
=head2 NAME
|
|
|
1611 |
|
|
|
1612 |
Build packages in the sandbox
|
|
|
1613 |
|
|
|
1614 |
=head2 SYNOPSIS
|
|
|
1615 |
|
|
|
1616 |
jats sandbox [options] build [command options] [arguments]
|
|
|
1617 |
|
|
|
1618 |
Options:
|
|
|
1619 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1620 |
-man - Full documentation [-help=3]
|
|
|
1621 |
-verbose[=n] - Verbose command operation
|
|
|
1622 |
|
|
|
1623 |
Command Options
|
|
|
1624 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1625 |
|
|
|
1626 |
=head2 ARGUMENTS
|
|
|
1627 |
|
|
|
1628 |
Arguments are passed to the 'make' phase of the process.
|
|
|
1629 |
|
|
|
1630 |
=head2 OPTIONS
|
|
|
1631 |
|
|
|
1632 |
The are no command specific options.
|
|
|
1633 |
|
|
|
1634 |
=head2 DESCRIPTION
|
|
|
1635 |
|
| 331 |
dpurdie |
1636 |
The 'build' command will force a build followed by a make in each of the packages
|
|
|
1637 |
within the sandbox, in the correct build order.
|
|
|
1638 |
|
|
|
1639 |
Any arguments are passed to the 'make' phase of the process.
|
|
|
1640 |
|
|
|
1641 |
In practice, the 'sandbox all' command is quicker.
|
|
|
1642 |
|
| 359 |
dpurdie |
1643 |
=head1 Clean
|
| 331 |
dpurdie |
1644 |
|
| 359 |
dpurdie |
1645 |
=head2 NAME
|
|
|
1646 |
|
|
|
1647 |
Clean all sandbox components
|
|
|
1648 |
|
|
|
1649 |
=head2 SYNOPSIS
|
|
|
1650 |
|
|
|
1651 |
jats sandbox [options] clean|clobber [command options]
|
|
|
1652 |
|
|
|
1653 |
Options:
|
|
|
1654 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1655 |
-man - Full documentation [-help=3]
|
|
|
1656 |
-verbose[=n] - Verbose command operation
|
|
|
1657 |
|
|
|
1658 |
Command Options
|
|
|
1659 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1660 |
|
|
|
1661 |
=head2 ARGUMENTS
|
|
|
1662 |
|
|
|
1663 |
None
|
|
|
1664 |
|
|
|
1665 |
=head2 OPTIONS
|
|
|
1666 |
|
|
|
1667 |
No command specific options
|
|
|
1668 |
|
|
|
1669 |
=head2 DESCRIPTION
|
|
|
1670 |
|
|
|
1671 |
The 'clean' command will perform a 'jats make clean' in all components in the
|
|
|
1672 |
sandbox.
|
|
|
1673 |
|
|
|
1674 |
The 'clobber' command will perform a 'jats clobber' in all components in the
|
|
|
1675 |
sandbox.
|
|
|
1676 |
|
|
|
1677 |
=head1 make
|
|
|
1678 |
|
|
|
1679 |
=head2 NAME
|
|
|
1680 |
|
|
|
1681 |
Make packages in the sandbox
|
|
|
1682 |
|
|
|
1683 |
=head2 SYNOPSIS
|
|
|
1684 |
|
|
|
1685 |
jats sandbox [options] make [command options] [arguments]
|
|
|
1686 |
|
|
|
1687 |
Options:
|
|
|
1688 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1689 |
-man - Full documentation [-help=3]
|
|
|
1690 |
-verbose[=n] - Verbose command operation
|
|
|
1691 |
|
|
|
1692 |
Command Options
|
|
|
1693 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1694 |
|
|
|
1695 |
=head2 ARGUMENTS
|
|
|
1696 |
|
|
|
1697 |
Arguments are passed to the 'make' phase of the process.
|
|
|
1698 |
|
|
|
1699 |
=head2 OPTIONS
|
|
|
1700 |
|
|
|
1701 |
The are no command specific options.
|
|
|
1702 |
|
|
|
1703 |
=head2 DESCRIPTION
|
|
|
1704 |
|
| 331 |
dpurdie |
1705 |
The 'make' command will perform a 'make' operation in each of the packages
|
|
|
1706 |
within the sandbox, in the correct build order.
|
|
|
1707 |
|
|
|
1708 |
Any arguments are passed to the 'make'.
|
|
|
1709 |
|
| 359 |
dpurdie |
1710 |
=head1 cmd
|
| 331 |
dpurdie |
1711 |
|
| 359 |
dpurdie |
1712 |
=head2 NAME
|
|
|
1713 |
|
|
|
1714 |
Process each package with a specified command.
|
|
|
1715 |
|
|
|
1716 |
=head2 SYNOPSIS
|
|
|
1717 |
|
|
|
1718 |
jats sandbox [options] cmd [command options] [arguments]
|
|
|
1719 |
|
|
|
1720 |
Options:
|
|
|
1721 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1722 |
-man - Full documentation [-help=3]
|
|
|
1723 |
-verbose[=n] - Verbose command operation
|
|
|
1724 |
|
|
|
1725 |
Command Options
|
|
|
1726 |
-help[=n] - Command specific help, [n=1,2,3]
|
|
|
1727 |
|
|
|
1728 |
=head2 ARGUMENTS
|
|
|
1729 |
|
|
|
1730 |
Arguments are passed to a JATS command.
|
|
|
1731 |
|
|
|
1732 |
=head2 OPTIONS
|
|
|
1733 |
|
|
|
1734 |
The are no command specific options.
|
|
|
1735 |
|
|
|
1736 |
=head2 DESCRIPTION
|
|
|
1737 |
|
| 331 |
dpurdie |
1738 |
The 'cmd' command will pass all of its arguments to JATS in the build directory
|
|
|
1739 |
of each of the packages within the sandbox, in the package build order.
|
|
|
1740 |
|
| 359 |
dpurdie |
1741 |
=head1 Cache
|
| 331 |
dpurdie |
1742 |
|
| 359 |
dpurdie |
1743 |
=head2 NAME
|
| 331 |
dpurdie |
1744 |
|
| 359 |
dpurdie |
1745 |
Cache dependent packages
|
| 331 |
dpurdie |
1746 |
|
| 359 |
dpurdie |
1747 |
jats sandbox [options] cache [command options]
|
| 331 |
dpurdie |
1748 |
|
| 359 |
dpurdie |
1749 |
Options:
|
|
|
1750 |
-help[=n] - Help message, [n=1,2,3]
|
|
|
1751 |
-man - Full documentation [-help=3]
|
|
|
1752 |
-verbose[=n] - Verbose command operation
|
| 337 |
dpurdie |
1753 |
|
| 359 |
dpurdie |
1754 |
Command Options
|
|
|
1755 |
-help[=n] - Command specific help, [n=1,2,3]
|
| 337 |
dpurdie |
1756 |
|
| 359 |
dpurdie |
1757 |
=head2 ARGUMENTS
|
|
|
1758 |
|
|
|
1759 |
The are no command specific arguments.
|
|
|
1760 |
|
|
|
1761 |
=head2 OPTIONS
|
|
|
1762 |
|
|
|
1763 |
The are no command specific options.
|
|
|
1764 |
|
|
|
1765 |
=head2 DESCRIPTION
|
|
|
1766 |
|
|
|
1767 |
The 'cache' command will cache all external dependent packages into the users
|
|
|
1768 |
dpkg_archive_cache as defined through the EnvVar GBE_DPKG_CACHE. The result is
|
|
|
1769 |
similar to the command 'jats sandbox build -cache', without the overhead of
|
|
|
1770 |
building the sandbox components.
|
|
|
1771 |
|
|
|
1772 |
This command allows the simple creation of a small development environment that
|
|
|
1773 |
is not tied to the larger Development Environment. It may then be used in a
|
| 337 |
dpurdie |
1774 |
disconnected mode to perform development.
|
|
|
1775 |
|
| 227 |
dpurdie |
1776 |
=cut
|
|
|
1777 |
|