Subversion Repositories DevTools

Rev

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

Rev 255 Rev 279
Line 33... Line 33...
33
#-------------------------------------------------------------------------------
33
#-------------------------------------------------------------------------------
34
#   Global variables
34
#   Global variables
35
#
35
#
36
my $VERSION = "1.0.0";                      # Update this
36
my $VERSION = "1.0.0";                      # Update this
37
my $GBE_DPKG = $ENV{ GBE_DPKG };
37
my $GBE_DPKG = $ENV{ GBE_DPKG };
38
my $CWD_DIR = cwd;
-
 
39
my %subdirs;
38
my %subdirs;
40
my %files;
39
my %files;
41
my $DESTDIR = 'src';           # 'src'
40
my $DESTDIR = 'src';           # 'src'
42
my $last_result;
41
my $last_result;
43
my @error_list;
42
my @error_list;
Line 51... Line 50...
51
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
50
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
52
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
51
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
53
my $opt_help = 0;
52
my $opt_help = 0;
54
my $opt_manual = 0;
53
my $opt_manual = 0;
55
my $opt_label;
54
my $opt_label;
56
my $opt_vob = 'COTS';
55
my $opt_vob;
57
my $opt_test;
56
my $opt_test;
58
my $opt_keep;
57
my $opt_keep;
59
my $opt_delete;
-
 
60
my $opt_subdir;
58
my $opt_subdir;
61
my $opt_image;
59
my $opt_image;
62
 
60
 
63
 
61
 
64
#-------------------------------------------------------------------------------
62
#-------------------------------------------------------------------------------
Line 74... Line 72...
74
                "verbose+"      => \$opt_verbose,           # flag, multiple use allowed
72
                "verbose+"      => \$opt_verbose,           # flag, multiple use allowed
75
                "label=s"       => \$opt_label,             # String
73
                "label=s"       => \$opt_label,             # String
76
                "vob=s"         => \$opt_vob,               # String
74
                "vob=s"         => \$opt_vob,               # String
77
                "test"          => \$opt_test,              # Flag
75
                "test"          => \$opt_test,              # Flag
78
                "keep"          => \$opt_keep,              # Flag
76
                "keep"          => \$opt_keep,              # Flag
79
                "delete"        => \$opt_delete,            # Flag
-
 
80
                "subdir=s"      => \$opt_subdir,            # string
77
                "subdir=s"      => \$opt_subdir,            # string
81
                "image=s"       => \$opt_image,             # string
78
                "image=s"       => \$opt_image,             # string
82
 
79
 
83
                );
80
                );
84
 
81
 
Line 133... Line 130...
133
 
130
 
134
#
131
#
135
#   Ensure target directory is not present
132
#   Ensure target directory is not present
136
#
133
#
137
$opt_subdir = $ARGV[0] unless ( $opt_subdir );
134
$opt_subdir = $ARGV[0] unless ( $opt_subdir );
138
my $temp_dir = "$CWD_DIR/gen_cots";
135
my $temp_dir = $ENV{TMP} || $ENV{TEMP};
-
 
136
Error ("Cannot locate TEMP directory") unless ( $temp_dir );
-
 
137
$temp_dir =~ s~\\~/~g;
-
 
138
Error ("TEMPDIR is not a directory" ) unless ( -d $temp_dir );
139
my $dest_dir = "$temp_dir/$opt_subdir";
139
my $dest_dir = "$temp_dir/gen_cots/$opt_subdir";
140
Error ("Temp dest dir already exists: $dest_dir" ) if ( !$opt_delete && -r $dest_dir );
140
Verbose ("Work Dir: $dest_dir");
141
 
141
 
142
#
142
#
143
#   Validate / locate the target VOB
143
#   Validate / locate the target VOB
144
#
144
#
145
locate_vob();
145
locate_vob();
Line 171... Line 171...
171
}
171
}
172
 
172
 
173
#
173
#
174
#   Transfer source to target and remove generated files
174
#   Transfer source to target and remove generated files
175
#
175
#
176
if ( $opt_delete && -d $temp_dir )
176
if ( -d $dest_dir )
177
{
177
{
178
    Message ("Delete temp directory");
178
    Message ("Delete temp directory from previous operation");
179
    rmtree( $temp_dir );
179
    rmtree( $dest_dir );
180
}
180
}
181
 
181
 
182
mkpath ($temp_dir,$opt_verbose);
182
mkpath ($dest_dir,$opt_verbose);
183
Error( "Cannot create directory: $temp_dir") unless( -d $temp_dir);
183
Error( "Cannot create directory: $dest_dir") unless( -d $dest_dir);
184
 
184
 
185
mkpath ($dest_dir,$opt_verbose);
185
mkpath ($dest_dir,$opt_verbose);
186
Error( "Cannot create target directory") unless ( -d $dest_dir);
186
Error( "Cannot create target directory") unless ( -d $dest_dir);
187
 
187
 
188
Message ("Transfer package to local directory");
188
Message ("Transfer package to local directory");
Line 292... Line 292...
292
Message ("Import to clearcase vob: $opt_vob");
292
Message ("Import to clearcase vob: $opt_vob");
293
my $cmd = "clearfsimport.exe -nsetevent -rec -rmname";
293
my $cmd = "clearfsimport.exe -nsetevent -rec -rmname";
294
   $cmd .= " -preview" if $opt_test;
294
   $cmd .= " -preview" if $opt_test;
295
   $cmd .= " -mklabel $opt_label";
295
   $cmd .= " -mklabel $opt_label";
296
   $cmd .= " -c \"Package snapshot $ARGV[0]_$ARGV[1]\"";
296
   $cmd .= " -c \"Package snapshot $ARGV[0]_$ARGV[1]\"";
297
   $cmd .= " gen_cots/$opt_subdir $opt_vob$target_path";
297
   $cmd .= " $dest_dir $opt_vob$target_path";
298
 
298
 
299
Verbose($cmd);
299
Verbose($cmd);
300
@error_list = ();
300
@error_list = ();
301
open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
301
open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
302
while (<CMD>)
302
while (<CMD>)
Line 339... Line 339...
339
#
339
#
340
#   Remove the created directory
340
#   Remove the created directory
341
#
341
#
342
if ( $opt_keep )
342
if ( $opt_keep )
343
{
343
{
344
    Warning ("KEEP temp directory: $temp_dir");
344
    Warning ("KEEP temp directory: $dest_dir");
345
}
345
}
346
else
346
else
347
{
347
{
348
    Message ("Delete temp directory");
348
    Message ("Delete temp directory");
349
    rmtree( $temp_dir );
349
    rmtree( $dest_dir );
350
}
350
}
351
 
351
 
352
#
352
#
353
#   All done
353
#   All done
354
#
354
#
Line 637... Line 637...
637
    -label=name        - Specify a label for the versions source
637
    -label=name        - Specify a label for the versions source
638
    -vob=vvv           - VOB to use, my be a full path. default is COTS
638
    -vob=vvv           - VOB to use, my be a full path. default is COTS
639
    -subdir=nnn        - Named subdir in VOB
639
    -subdir=nnn        - Named subdir in VOB
640
    -test              - Do not perform any clearcase operations
640
    -test              - Do not perform any clearcase operations
641
    -keep              - Keep the creating dpkg_archive image
641
    -keep              - Keep the creating dpkg_archive image
642
    -delete            - Unconditional delete the temp directory before use
-
 
643
    -image=path        - Path to alternate source image
642
    -image=path        - Path to alternate source image
644
 
643
 
645
=head1 OPTIONS
644
=head1 OPTIONS
646
 
645
 
647
=over 8
646
=over 8
Line 700... Line 699...
700
=item B<-keep>
699
=item B<-keep>
701
 
700
 
702
If this option is selected then the program will retain the working directory
701
If this option is selected then the program will retain the working directory
703
that it has created.
702
that it has created.
704
 
703
 
705
=item B<-delete>
-
 
706
 
-
 
707
If this option is selected then the temp work directory will be deleted before
-
 
708
the script attempts to use it.
-
 
709
 
-
 
710
 
-
 
711
=item B<-image=path>
704
=item B<-image=path>
712
 
705
 
713
If this option is specified then the package will be created using the
706
If this option is specified then the package will be created using the
714
specified source path, otherwise the package will be extracted from dpkg_acrhive.
707
specified source path, otherwise the package will be extracted from dpkg_acrhive.
715
 
708