Subversion Repositories DevTools

Rev

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

Rev 351 Rev 361
Line 255... Line 255...
255
 
255
 
256
#
256
#
257
#   Create a class to describe the complete SVN label
257
#   Create a class to describe the complete SVN label
258
#   This will parse the label and create a number of nice elements
258
#   This will parse the label and create a number of nice elements
259
#
259
#
260
my $svn_label = NewSessionByUrl ( $opt_spec[0] );
260
my $svn_label = NewSessionByUrl ( $opt_spec[0], 1 );
261
 
261
 
262
#
262
#
263
#   Setup user specified workspace
263
#   Setup user specified workspace
264
#   Include the user name to ensure that the view name is unique-ish
264
#   Include the user name to ensure that the view name is unique-ish
265
#   Keep the name as short as possible as some compilers display a fixed
265
#   Keep the name as short as possible as some compilers display a fixed
Line 298... Line 298...
298
    #
298
    #
299
    #   Create a simple dir name
299
    #   Create a simple dir name
300
    #       Remove path sep characters and replace with _
300
    #       Remove path sep characters and replace with _
301
    #       Remove Peg marker (@) as this breaks svn
301
    #       Remove Peg marker (@) as this breaks svn
302
    #       Replace multiple _ with a single _
302
    #       Replace multiple _ with a single _
-
 
303
    #       Remove trailing _ - caused by URL with a trailing /
303
    #
304
    #
304
    $opt_viewname =~ s~[^\-.:0-9a-zA-Z_]~_~g;
305
    $opt_viewname =~ s~[^\-.:0-9a-zA-Z_]~_~g;
305
    $opt_viewname =~ tr~_~_~s;
306
    $opt_viewname =~ tr~_~_~s;
-
 
307
    $opt_viewname =~ s~_+$~~;
306
}
308
}
307
$opt_viewname =~ s~^$view_prefix~~ if (defined($opt_viewname) && $view_prefix && $opt_delete );
309
$opt_viewname =~ s~^$view_prefix~~ if (defined($opt_viewname) && $view_prefix && $opt_delete );
308
 
310
 
309
#
311
#
310
#   Create a clearcase view to be used for the view
312
#   Create a clearcase view to be used for the view
Line 402... Line 404...
402
                            'old' => $view_tag,
404
                            'old' => $view_tag,
403
                            'new' => $branch,
405
                            'new' => $branch,
404
                            'comment' => 'Created by Jats SvnRelease branch request',
406
                            'comment' => 'Created by Jats SvnRelease branch request',
405
                            'replace' => 0 );
407
                            'replace' => 0 );
406
 
408
 
407
        $view_tag = $svn_label->Url( $view_tag);
409
        $view_tag = SvnPath2Url($view_tag);
408
    }
410
    }
409
 
411
 
410
    $svn_label->SvnCo ( $view_tag, $VIEWDIR . $opt_path );
412
    $svn_label->SvnCo ( $view_tag, $VIEWDIR . $opt_path );
411
    Error ("Cannot locate the created Workspace")
413
    Error ("Cannot locate the created Workspace")
412
        unless ( -d $VIEWDIR . $opt_path);
414
        unless ( -d $VIEWDIR . $opt_path);
Line 639... Line 641...
639
#
641
#
640
sub delete_view
642
sub delete_view
641
{
643
{
642
    my $cofound = 0;
644
    my $cofound = 0;
643
    my $uuid;
645
    my $uuid;
644
 
-
 
645
    #
646
    #
646
    #   Simple delete
647
    #   Simple delete
647
    #
648
    #
648
    if ( $opt_extract_files )
649
    if ( $opt_extract_files )
649
    {
650
    {
650
        if ( -d $VIEWDIR )
651
        if ( -d $VIEWDIR )
651
        {
652
        {
652
            Message("Remove extracted files: $VIEWDIR");
653
            Message("Remove extracted files: $VIEWDIR");
653
            rmtree( $VIEWDIR );
654
            RmDirTree( $VIEWDIR );
654
        }
655
        }
655
    }
656
    }
656
    else
657
    else
657
    {
658
    {
658
        #
659
        #
Line 669... Line 670...
669
 
670
 
670
            SvnRmView ('path'     => $VIEWDIR . $opt_path,
671
            SvnRmView ('path'     => $VIEWDIR . $opt_path,
671
                       'force'    => $opt_delete > 1,
672
                       'force'    => $opt_delete > 1,
672
                       'modified' => [ 'local_dpkg_archive' ] );
673
                       'modified' => [ 'local_dpkg_archive' ] );
673
        }
674
        }
674
        Error ("View was not deleted")
675
        Error ("View was not deleted. Will Delete view directory")
675
            if ( -d $VIEWDIR . $opt_path );
676
            if ( -d $VIEWDIR . $opt_path );
676
        rmtree( $VIEWDIR ) if $opt_path;
677
        RmDirTree( $VIEWDIR ) if $opt_path;
677
    }
678
    }
678
 
679
 
679
    Error ("View was not deleted")
680
    Error ("View was not deleted")
680
        if ( -d $VIEWDIR );
681
        if ( -d $VIEWDIR );
681
}
682
}
Line 833... Line 834...
833
    #
834
    #
834
    Verbose("Extracting files into $VIEWDIR");
835
    Verbose("Extracting files into $VIEWDIR");
835
    if ( -d $VIEWDIR )
836
    if ( -d $VIEWDIR )
836
    {
837
    {
837
        Verbose "Delete Directory: $VIEWDIR\n";
838
        Verbose "Delete Directory: $VIEWDIR\n";
838
        rmtree( $VIEWDIR );
839
        RmDirTree( $VIEWDIR );
839
    }
840
    }
840
 
841
 
841
    $svn_label->SvnCo ( $svn_label->Full, $VIEWDIR, '--Export' );
842
    $svn_label->SvnCo ( $svn_label->Full, $VIEWDIR, '--Export' );
842
 
843
 
843
    #
844
    #
Line 857... Line 858...
857
#   Documentation
858
#   Documentation
858
#
859
#
859
 
860
 
860
=pod
861
=pod
861
 
862
 
-
 
863
=for htmltoc    GENERAL::Subversion::
-
 
864
 
862
=head1 NAME
865
=head1 NAME
863
 
866
 
864
jats_svnrelease - Build a package given a SubVersion label
867
jats_svnrelease - Build a package given a SubVersion label
865
 
868
 
866
=head1 SYNOPSIS
869
=head1 SYNOPSIS
Line 880... Line 883...
880
    -[mk]branch=xxx    - Will create a view with a branch rule
883
    -[mk]branch=xxx    - Will create a view with a branch rule
881
    -tag=xxx           - Compatability. Not used
884
    -tag=xxx           - Compatability. Not used
882
    -extract           - Extract the view and exit
885
    -extract           - Extract the view and exit
883
    -extractfiles      - Extract files, without a view
886
    -extractfiles      - Extract files, without a view
884
    -cache             - Refresh local dpkg_archive cache
887
    -cache             - Refresh local dpkg_archive cache
885
    -delete            - Remove any existing view and exit
888
    -delete[=n]        - Remove any existing view and exit
886
    -debugOnly         - Make only the debug version
889
    -debugOnly         - Make only the debug version
887
    -prodOnly          - Make only the production version
890
    -prodOnly          - Make only the production version
888
    -[no]dpkg          - Transfer package into dpkg_archive
891
    -[no]dpkg          - Transfer package into dpkg_archive
889
    -[no]copy          - Transfer pkg directory to the current user directory
892
    -[no]copy          - Transfer pkg directory to the current user directory
890
    -[no]reuse         - Reuse the view
893
    -[no]reuse         - Reuse the view
Line 920... Line 923...
920
=item B<-view name>
923
=item B<-view name>
921
 
924
 
922
Specified an alternate view name and tag to be used. This option does not provide the
925
Specified an alternate view name and tag to be used. This option does not provide the
923
full name of the view.
926
full name of the view.
924
 
927
 
925
    The view path will be: "${USER}_${NAME}"
928
The view path will be: "${USER}_${NAME}"
926
 
929
 
927
The default "NAME" is the first label specified with the repository and tag removed.
930
The default "NAME" is the first label specified with the repository and tag removed.
928
 
931
 
929
If the user provides a view "name" that is prefixed with their user name
932
If the user provides a view "name" that is prefixed with their user name
930
('${USER}_'), then the username will be stripped of for internal processing.
933
('${USER}_'), then the username will be stripped of for internal processing.
Line 973... Line 976...
973
command line. It overides the value of GBE_VIEWBASE.
976
command line. It overides the value of GBE_VIEWBASE.
974
 
977
 
975
If the comamnd is invoked within a development sandbox, then the default
978
If the comamnd is invoked within a development sandbox, then the default
976
location will be the root directory of the development sandbox.
979
location will be the root directory of the development sandbox.
977
 
980
 
978
=back
-
 
979
 
-
 
980
=item B<-branch=xxx or -mkbranch=xxx>
981
=item B<-branch=xxx or -mkbranch=xxx>
981
 
982
 
982
This option will create workspace branch that is tagged with the named branch.
983
This option will create workspace branch that is tagged with the named branch.
983
This is intended to facilitate the maintenance of existing packages - the
984
This is intended to facilitate the maintenance of existing packages - the
984
creation of a patch.
985
creation of a patch.
Line 1013... Line 1014...
1013
 
1014
 
1014
The normal operation is to copy the packages, only if they do not already exist
1015
The normal operation is to copy the packages, only if they do not already exist
1015
in the local cache. This option may be used to ensure that the local copy is
1016
in the local cache. This option may be used to ensure that the local copy is
1016
correct and up to date.
1017
correct and up to date.
1017
 
1018
 
1018
=item B<-delete>
1019
=item B<-delete[=level]>
1019
 
1020
 
1020
Delete the view used by the program, if it exists. This option may be used to
1021
Delete the view used by the program, if it exists. This option may be used to
1021
cleanup after an error.
1022
cleanup after an error.
1022
 
1023
 
-
 
1024
The default 'level' is 1.
-
 
1025
 
1023
Note: Ensure that no files are open in the view and that the users current
1026
If the delete level is 1, then ensure that no files are open in the view and
1024
working directory is not in the view as these will prevent the view from being
1027
that the users current working directory is not in the view as these will
1025
deleted.
1028
prevent the view from being deleted.
-
 
1029
 
-
 
1030
If the delete level is greater than one, then the view will be deleted, even
-
 
1031
if there are checkout out files.
1026
 
1032
 
1027
=item B<-debugOnly>
1033
=item B<-debugOnly>
1028
 
1034
 
1029
Make only the debug version of the package. The default it to create both the
1035
Make only the debug version of the package. The default it to create both the
1030
debug and production version of the package. The type of build may be  further
1036
debug and production version of the package. The type of build may be  further
Line 1051... Line 1057...
1051
 
1057
 
1052
This flag allows the view created by the program to be re-used.
1058
This flag allows the view created by the program to be re-used.
1053
 
1059
 
1054
=over 8
1060
=over 8
1055
 
1061
 
-
 
1062
=item *
-
 
1063
 
1056
=item 1. The view is not deleted before being populated.
1064
The view is not deleted before being populated.
1057
 
1065
 
1058
=item 2. The view will not be populated if it does exist.
1066
=item *
1059
 
1067
 
-
 
1068
The view will not be populated if it does exist.
-
 
1069
 
-
 
1070
=item *
-
 
1071
 
1060
=item 3. The view will not be deleted at the end the process.
1072
The view will not be deleted at the end the process.
1061
 
1073
 
1062
=back
1074
=back
1063
 
1075
 
1064
This option is useful for debugging a build process.
1076
This option is useful for debugging a build process.
1065
 
1077
 
Line 1067... Line 1079...
1067
 
1079
 
1068
Test the building of the package. This option implies "nocopy" and "nodpkg".
1080
Test the building of the package. This option implies "nocopy" and "nodpkg".
1069
 
1081
 
1070
=item B<-[no]keep>
1082
=item B<-[no]keep>
1071
 
1083
 
1072
Keep the clearcase view after the build. The default option is "nokeep"
1084
Keep the workspace after the build. The default option is "nokeep"
1073
 
1085
 
1074
This option is different to the "reuse" in that the view will be deleted, if
1086
This option is different to the "reuse" in that the view will be deleted, if
1075
it exists, before the build, but will be retained at the completion of the
1087
it exists, before the build, but will be retained at the completion of the
1076
process. The user may then manually extract the created package.
1088
process. The user may then manually extract the created package.
1077
 
1089
 
Line 1139... Line 1151...
1139
various tests are performed to ensure the repeatability of the view and the
1151
various tests are performed to ensure the repeatability of the view and the
1140
build. These tests include:
1152
build. These tests include:
1141
 
1153
 
1142
=over 8
1154
=over 8
1143
 
1155
 
-
 
1156
=item   *
-
 
1157
 
1144
=item   * The view must be constructed from one label
1158
The view must be constructed from one label
-
 
1159
 
-
 
1160
=item   *
-
 
1161
 
-
 
1162
That label must be pegged
-
 
1163
 
-
 
1164
=item   *
1145
 
1165
 
1146
=item   * That label must be pegged
1166
The labelled view must contain exactly one build file
1147
 
1167
 
1148
=item   * The labelled view must contain exactly one build file
1168
=item   *
1149
 
1169
 
1150
=item   * The view cannot have been re-used.
1170
The view cannot have been re-used.
1151
 
1171
 
1152
=back
1172
=back
1153
 
1173
 
1154
=item Locate build files
1174
=item Locate build files
1155
 
1175