Subversion Repositories DevTools

Rev

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

Rev 1456 Rev 2040
Line 64... Line 64...
64
my $opt_beta;                               # Create beta release
64
my $opt_beta;                               # Create beta release
65
my $opt_merge;                              # Merge release
65
my $opt_merge;                              # Merge release
66
my $opt_path;                               # Path for view spec
66
my $opt_path;                               # Path for view spec
67
my $opt_runtests = 1;                       # Run unit tests after build
67
my $opt_runtests = 1;                       # Run unit tests after build
68
my $opt_branch;                             # Create config spec with branch
68
my $opt_branch;                             # Create config spec with branch
-
 
69
my $opt_mkbranch;                           # Create branch
69
my $opt_debug_build = 0;                    # Build Debug Only
70
my $opt_debug_build = 0;                    # Build Debug Only
70
my $opt_prod_build = 0;                     # Build ion Only
71
my $opt_prod_build = 0;                     # Build ion Only
71
my $opt_view_root = $ENV{'GBE_VIEWBASE'};   # Root of the view
72
my $opt_view_root = $ENV{'GBE_VIEWBASE'};   # Root of the view
72
my $opt_prefix = 1;                         # Prefix the view tag with user-name
73
my $opt_prefix = 1;                         # Prefix the view tag with user-name
73
my $opt_tag;                                # View tag insert (build or export or user)
74
my $opt_tag;                                # View tag insert (build or export or user)
Line 158... Line 159...
158
                'beta!'         => \$opt_beta,                  # [no]flag
159
                'beta!'         => \$opt_beta,                  # [no]flag
159
                'merge'         => \$opt_merge,                 # [no]flag
160
                'merge'         => \$opt_merge,                 # [no]flag
160
                'path=s'        => \$opt_path,                  # string
161
                'path=s'        => \$opt_path,                  # string
161
                'runtests!'     => \$opt_runtests,              # [no]flag
162
                'runtests!'     => \$opt_runtests,              # [no]flag
162
                'branch=s'      => \$opt_branch,                # String
163
                'branch=s'      => \$opt_branch,                # String
163
                'mkbranch=s'    => \$opt_branch,                # String
164
                'mkbranch=s'    => \$opt_mkbranch,              # String
164
                'prodOnly'      => \$opt_prod_build,            # flag
165
                'prodOnly'      => \$opt_prod_build,            # flag
165
                'debugOnly'     => \$opt_debug_build,           # flag
166
                'debugOnly'     => \$opt_debug_build,           # flag
166
                'root=s'        => \$GBE_VIEWBASE,              # string
167
                'root=s'        => \$GBE_VIEWBASE,              # string
167
                'prefix!'       => \$opt_prefix,                # flag
168
                'prefix!'       => \$opt_prefix,                # flag
168
                'tag=s'         => \$opt_tag,                   # string
169
                'tag=s'         => \$opt_tag,                   # string
Line 193... Line 194...
193
#
194
#
194
Error ("Cannot mix -extractfiles and -branch")
195
Error ("Cannot mix -extractfiles and -branch")
195
    if ( $opt_branch && $opt_extract_files );
196
    if ( $opt_branch && $opt_extract_files );
196
Error ("Unexpected command line arguments present.","Cannot mix -label and command line label" )
197
Error ("Unexpected command line arguments present.","Cannot mix -label and command line label" )
197
    if ( $#opt_spec >= 0 && $#ARGV >= 0);
198
    if ( $#opt_spec >= 0 && $#ARGV >= 0);
-
 
199
Error ("Cannot specify both '-mkbranch' and '-branch'")
-
 
200
    if ( $opt_mkbranch && $opt_branch );
198
 
201
 
199
push @opt_spec, @ARGV;
202
push @opt_spec, @ARGV;
200
 
203
 
201
unless(  @opt_spec  )
204
unless(  @opt_spec  )
202
{
205
{
203
    Error ("Need a workspace or a label. -help for options") if ( $opt_delete  && ! $opt_viewname );
206
    Error ("Need a workspace or a label. -help for options") if ( $opt_delete  && ! $opt_viewname );
204
    Error ("Need a Subversion Reference or URL. -help for options") unless $opt_delete;
207
    Error ("Need a Subversion Reference or URL. -help for options") unless $opt_delete;
205
}
208
}
206
 
209
 
-
 
210
#
-
 
211
#   Set up branching values
-
 
212
#       mkbranck    - Create if not exists. Error if it exists
-
 
213
#       branch      - Error if not exists
-
 
214
#
-
 
215
if ( $opt_mkbranch ) {
-
 
216
    $opt_branch = $opt_mkbranch;
-
 
217
    $opt_mkbranch = 1;
-
 
218
}
-
 
219
$opt_branch = SvnIsaSimpleLabel($opt_branch) if ( $opt_branch );
-
 
220
 
207
#   Determine extraction mode
221
#   Determine extraction mode
208
#       Working- Default
222
#       Working- Default
209
#               Extract point on development branch were tag was taken
223
#               Extract point on development branch were tag was taken
210
#               Update build files
224
#               Update build files
211
#               Warn about files that have changed
225
#               Warn about files that have changed
Line 237... Line 251...
237
        $noReleaseWs = 0;
251
        $noReleaseWs = 0;
238
    } elsif ( $opt_devModeStr =~ m/^Exact$/i) {
252
    } elsif ( $opt_devModeStr =~ m/^Exact$/i) {
239
        $opt_devMode = 'exact';
253
        $opt_devMode = 'exact';
240
        $checkDelta = 1;
254
        $checkDelta = 1;
241
        $noReleaseWs = 0;
255
        $noReleaseWs = 0;
242
        Error ('Cannot mix -branch and -devMode=' . $opt_devModeStr ) if ( $opt_branch );
256
        Error ('Cannot mix -[mk]branch and -devMode=' . $opt_devModeStr ) if ( $opt_branch );
243
    } elsif ( $opt_devModeStr =~ m/^escrow$/i) {
257
    } elsif ( $opt_devModeStr =~ m/^escrow$/i) {
244
        # JATS internal use only. Not advertised
258
        # JATS internal use only. Not advertised
245
        $opt_devMode = 'exact';
259
        $opt_devMode = 'exact';
246
        $checkDelta = 0;
260
        $checkDelta = 0;
247
        $noReleaseWs = 0;
261
        $noReleaseWs = 0;
248
        $traceBack = 1;
262
        $traceBack = 1;
249
        Error ('Cannot mix -branch and -devMode=' . $opt_devModeStr ) if ( $opt_branch );
263
        Error ('Cannot mix -[mk]branch and -devMode=' . $opt_devModeStr ) if ( $opt_branch );
250
    } else {
264
    } else {
251
        Error ("Unknown development mode: $opt_devModeStr");
265
        Error ("Unknown development mode: $opt_devModeStr");
252
    }
266
    }
253
}
267
}
254
 
268
 
Line 277... Line 291...
277
parseSubversionRef($opt_spec[0]);
291
parseSubversionRef($opt_spec[0]);
278
Error ("INTERNAL: initialUrl not set") unless ( $initialUrl );
292
Error ("INTERNAL: initialUrl not set") unless ( $initialUrl );
279
Error ("Cannot interprete the URL or Subversion Reference: $opt_spec[0]") unless ( $srcPathPkg  );
293
Error ("Cannot interprete the URL or Subversion Reference: $opt_spec[0]") unless ( $srcPathPkg  );
280
 
294
 
281
#
295
#
282
#   Check branch name
-
 
283
#
-
 
284
if ( $opt_branch )
-
 
285
{
-
 
286
    $opt_branch = SvnIsaSimpleLabel($opt_branch);
-
 
287
}
-
 
288
 
-
 
289
#
-
 
290
#   User has specified both debug and production
296
#   User has specified both debug and production
291
#   Then set both to 0 : ie default
297
#   Then set both to 0 : ie default
292
#
298
#
293
if ( $opt_debug_build + $opt_prod_build > 1 )
299
if ( $opt_debug_build + $opt_prod_build > 1 )
294
{
300
{
Line 393... Line 399...
393
}
399
}
394
$workSpace = $VIEWDIR . $opt_path;
400
$workSpace = $VIEWDIR . $opt_path;
395
Verbose( "workSpace : $workSpace" );
401
Verbose( "workSpace : $workSpace" );
396
 
402
 
397
#
403
#
-
 
404
#   Operation
398
#   If the view currently exists then it will be deleted if allowed
405
#   If all we are doing is deleting the view then do it now
399
#
-
 
400
delete_view()
-
 
401
    unless ( $opt_reuse );
406
#   If we are going to extract stuff, then we will delay the deletion
402
 
-
 
403
#
-
 
404
#   If the user is simply deleting the view then all has been done
407
#   as long as possible - incase we decide we can't
405
#
408
#
406
exit 0
409
if ( $opt_delete )
-
 
410
{
-
 
411
    delete_view()
407
    if ( $opt_delete );
412
        unless ( $opt_reuse );
-
 
413
    exit 0;
-
 
414
}
408
 
415
 
409
#
416
#
410
#   Ensure that the label is present within the specified Repository
417
#   Ensure that the label is present within the specified Repository
411
#
418
#
412
Verbose("Ensure Labels can be found in a Repository");
419
Verbose("Ensure Labels can be found in a Repository");
Line 590... Line 597...
590
    $view_tag = $svnSession->FullPath() . '/' .$view_tag;
597
    $view_tag = $svnSession->FullPath() . '/' .$view_tag;
591
    Verbose("Creating Workspace:", $view_tag);
598
    Verbose("Creating Workspace:", $view_tag);
592
    
599
    
593
    #
600
    #
594
    #   If a branch is required ...
601
    #   If a branch is required ...
-
 
602
    #   Two modes:
-
 
603
    #       mkbranch    - Ensure that the branch does not exist
-
 
604
    #                     Make a new one
-
 
605
    #       branch      - Ensure that the branch does exist
-
 
606
    #                     Use existing branch
595
    #   Ensure that the branch is NOT in the Repository
607
    #   Ensure that the branch is NOT in the Repository
596
    #
608
    #
597
    if ( $opt_branch )
609
    if ( $opt_branch )
598
    {
610
    {
599
        $branch = $svnSession->BranchName($opt_branch, 'branches' );
611
        $branch = $svnSession->BranchName($opt_branch, 'branches' );
600
        $svnSession->SvnValidateTarget (
612
        $svnSession->SvnValidateTarget (
601
                        'cmd'    => 'SvnRelease: Validate Branch',
613
                        'cmd'    => 'SvnRelease: Validate Branch',
602
                        'target' => $branch,
614
                        'target' => $branch,
-
 
615
                        'require' =>   (! $opt_mkbranch),
603
                        'available' => 1,
616
                        'available' => (  $opt_mkbranch),
604
                        );
617
                        );
-
 
618
 
-
 
619
        #
-
 
620
        #   If using an existing branch, then set up the name
-
 
621
        #   of the source.
-
 
622
        #
-
 
623
        $view_tag = $branch if ( ! $opt_mkbranch );
605
    }
624
    }
-
 
625
 
606
    
626
    #
-
 
627
    #   Perform delayed delete of any existign view
-
 
628
    #   The process has been delayed as much as possible - incase other tests
-
 
629
    #   fail
-
 
630
    #
-
 
631
    delete_view();
-
 
632
 
607
    #
633
    #
608
    #   Create the workspace
634
    #   Create the workspace
609
    #
635
    #
610
    $svnSession->SvnCo ( $view_tag, $workSpace );
636
    $svnSession->SvnCo ( $view_tag, $workSpace );
611
    Error ("Cannot locate the created Workspace")
637
    Error ("Cannot locate the created Workspace")
Line 618... Line 644...
618
    #       Copy the WS to URL
644
    #       Copy the WS to URL
619
    #       Switch to new URL
645
    #       Switch to new URL
620
    #   The bulk of the copy will be done on the server-side
646
    #   The bulk of the copy will be done on the server-side
621
    #   and not over the network. This is  good.
647
    #   and not over the network. This is  good.
622
    #
648
    #
623
    if ( $opt_branch )
649
    if ( $opt_mkbranch )
624
    {
650
    {
625
        #
651
        #
626
        #   Branch does not exist
652
        #   Branch does not exist
627
        #   Create it be copying the base view
653
        #   Create it be copying the base view
628
        #
654
        #
Line 905... Line 931...
905
 
931
 
906
            SvnRmView ('path'     => $workSpace,
932
            SvnRmView ('path'     => $workSpace,
907
                       'force'    => ($opt_delete > 1) || ($opt_extract > 1),
933
                       'force'    => ($opt_delete > 1) || ($opt_extract > 1),
908
                       'modified' => [ 'local_dpkg_archive' ] );
934
                       'modified' => [ 'local_dpkg_archive' ] );
909
        }
935
        }
910
        Error ("View was not deleted. Will Delete view directory")
936
        Warning ("View was not deleted. Will Delete view directory")
911
            if ( -d $workSpace );
937
            if ( -d $workSpace );
912
        RmDirTree( $VIEWDIR ) if $opt_path;
938
        RmDirTree( $VIEWDIR ) if $opt_path;
913
    }
939
    }
914
 
940
 
915
    Error ("View was not deleted")
941
    Error ("View was not deleted")
Line 1194... Line 1220...
1194
# Returns         : Will not return if changes are not allowed
1220
# Returns         : Will not return if changes are not allowed
1195
#
1221
#
1196
sub determineChangedFiles
1222
sub determineChangedFiles
1197
{
1223
{
1198
    my @msgText;
1224
    my @msgText;
-
 
1225
    my $onlyWarn = ($checkDelta == 1);
1199
 
1226
 
1200
    #
1227
    #
1201
    #   No checking required
1228
    #   No checking required
1202
    #   Skip the hard bit if running on a build machine
1229
    #   Skip the hard bit if running on a build machine
1203
    #
1230
    #
Line 1223... Line 1250...
1223
    my $rv = $svn_check->SvnInfo( $svn_check->Full, 'InfoRepo' );
1250
    my $rv = $svn_check->SvnInfo( $svn_check->Full, 'InfoRepo' );
1224
    if ( $rv )
1251
    if ( $rv )
1225
    {
1252
    {
1226
        push (@msgText, "Cannot read information for the head of the development branch",
1253
        push (@msgText, "Cannot read information for the head of the development branch",
1227
                        "Branch may not exist: $baseBranch");
1254
                        "Branch may not exist: $baseBranch");
-
 
1255
        $onlyWarn = 1;
1228
    }
1256
    }
1229
    else
1257
    else
1230
    {
1258
    {
1231
        $devBranchHead = $svn_check->{'InfoRepo'}{'Last Changed Rev'};
1259
        $devBranchHead = $svn_check->{'InfoRepo'}{'Last Changed Rev'};
1232
        Verbose2("devBranchHead: $devBranchHead");
1260
        Verbose2("devBranchHead: $devBranchHead");
Line 1281... Line 1309...
1281
        push (@msgText, "Changed file count: $rv") if ( $rv );
1309
        push (@msgText, "Changed file count: $rv") if ( $rv );
1282
        push (@msgText, "More than 10 files have changed. First 10 are:") if ( $rv > 10);
1310
        push (@msgText, "More than 10 files have changed. First 10 are:") if ( $rv > 10);
1283
        push (@msgText, @{$svn_check->{tmp}{files}} );
1311
        push (@msgText, @{$svn_check->{tmp}{files}} );
1284
    }
1312
    }
1285
 
1313
 
1286
    if ( $checkDelta == 1) {
1314
    if ($onlyWarn) {
1287
        push @messageText, @msgText;
1315
        push @messageText, @msgText;
1288
    } else {
1316
    } else {
1289
        Error ( @msgText );
1317
        Error ( @msgText );
1290
    }
1318
    }
1291
}
1319
}
Line 1619... Line 1647...
1619
    -spec=xxx          - Same as -label=xxx
1647
    -spec=xxx          - Same as -label=xxx
1620
    -path=xxx          - Source Path
1648
    -path=xxx          - Source Path
1621
    -view=xxx          - Modify the name of the created view
1649
    -view=xxx          - Modify the name of the created view
1622
    -build=xxx         - Package Name to build
1650
    -build=xxx         - Package Name to build
1623
    -root=xxx          - Root directory for generated view
1651
    -root=xxx          - Root directory for generated view
1624
    -[mk]branch=xxx    - Will create a view with a branch rule
1652
    -[mk]branch=xxx    - Will create/use a branch
1625
    -tag=xxx           - Compatibility. Not used
1653
    -tag=xxx           - Compatibility. Not used
1626
    -extract           - Extract the view and exit
1654
    -extract           - Extract the view and exit
1627
    -extractfiles      - Extract files, without a view
1655
    -extractfiles      - Extract files, without a view
1628
    -devMode=xxx       - Create Workspace suitable for development.(Tip,Tag,...)
1656
    -devMode=xxx       - Create Workspace suitable for development.(Tip,Tag,...)
1629
    -cache             - Refresh local dpkg_archive cache
1657
    -cache             - Refresh local dpkg_archive cache
Line 1747... Line 1775...
1747
command line. It overrides the value of GBE_VIEWBASE.
1775
command line. It overrides the value of GBE_VIEWBASE.
1748
 
1776
 
1749
If the command is invoked within a development sandbox, then the default
1777
If the command is invoked within a development sandbox, then the default
1750
location will be the root directory of the development sandbox.
1778
location will be the root directory of the development sandbox.
1751
 
1779
 
1752
=item B<-branch=xxx or -mkbranch=xxx>
1780
=item B<-mkbranch=xxx>
1753
 
1781
 
1754
This option will create a workspace associated with a branch within the
1782
This option will create a workspace associated with a branch within the
1755
repository. This is intended to facilitate the maintenance of existing packages
1783
repository. This is intended to facilitate the maintenance of existing packages
1756
and the creation of project or development branches in a manner similar to
1784
and the creation of project or development branches.
1757
ClearCase.
1785
 
-
 
1786
The named branch must not exist. It is an error for the branch to exist.
1758
 
1787
 
1759
If the named branch exists, then the workspace will be based on the branch and
1788
This tool will copy the specified source version to the branch, create a
1760
not on the specified label.
1789
workspace based on the branch and then switch to the branch.
1761
 
1790
 
1762
If the named branch does not exist, then this tool will copy the specified
-
 
1763
source version to the branch and then create a workspace based on the branch.
1791
This option is intended to create a development thread, for project or private
-
 
1792
use.
1764
 
1793
 
1765
A branch name of TIMESTAMP will be treated in special manner. The name will be
1794
A branch name of TIMESTAMP will be treated in special manner. The name will be
1766
replaced with a unique name based on the users name and the current date time.
1795
replaced with a unique name based on the users name and the current date time.
1767
 
1796
 
-
 
1797
=item B<-branch=xxx>
-
 
1798
 
-
 
1799
This option will create a workspace associated with a branch within the
-
 
1800
repository. This is intended to facilitate the maintenance of existing packages
-
 
1801
and the creation of project or development branches in a manner similar to
-
 
1802
ClearCase.
-
 
1803
 
-
 
1804
The named branch must exist. It is an error for the branch to not exist.
-
 
1805
 
-
 
1806
If the named branch does exist, then this tool will create a workspace based
-
 
1807
on the head of the branch.
-
 
1808
 
-
 
1809
This option is intended to extract the tip of a development thread.
-
 
1810
 
1768
=item B<-tag=text>
1811
=item B<-tag=text>
1769
 
1812
 
1770
This option is not used.
1813
This option is not used.
1771
It is present to maintain compatibility with the buildtool interface.
1814
It is present to maintain compatibility with the buildtool interface.
1772
 
1815