Subversion Repositories DevTools

Rev

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

Rev 5744 Rev 5783
Line 51... Line 51...
51
#                       "name nn.nn.nn prj", "nn.nn.nn"
51
#                       "name nn.nn.nn prj", "nn.nn.nn"
52
#                       "name nn.nn.nn.prj", "nn.nn.nn"
52
#                       "name nn.nn.nn.prj", "nn.nn.nn"
53
#
53
#
54
#                       "name", "nn.nn.nn.prj"
54
#                       "name", "nn.nn.nn.prj"
55
#
55
#
56
#                       "name", "nn.nn.nn", "prj", --RelaxedVersion
56
#                       "name", "nn.nn.nn", "prj", --RelaxedVersion (deprecated)
-
 
57
#                       "name", "cots_version", "cots"
-
 
58
#                       "name", "nn.nn.nn", "prj"
57
#
59
#
58
# Inputs          : All the BuildName arguments
60
# Inputs          : All the BuildName arguments
59
#
61
#
60
# Returns         : A hash with various arguments
62
# Returns         : A hash with various arguments
61
#                       DEPLOY_PATCH        - Number(optional)
63
#                       DEPLOY_PATCH        - Number(optional)
Line 72... Line 74...
72
sub parseBuildName
74
sub parseBuildName
73
{
75
{
74
    my( @arguments ) = @_;
76
    my( @arguments ) = @_;
75
    my @args;
77
    my @args;
76
    my %result;
78
    my %result;
-
 
79
    my $unknownForm;
-
 
80
    my @errors;
77
 
81
 
78
    Debug( "BuildName(@arguments)" );
82
    Debug( "BuildName(@arguments)" );
79
 
83
 
80
#.. Parse arguments
84
#.. Parse arguments
81
#.
85
#.
Line 128... Line 132...
128
        #   This form will only accept two or three fields as
132
        #   This form will only accept two or three fields as
129
        #       "name", "version"
133
        #       "name", "version"
130
        #       "name", "version", "project"
134
        #       "name", "version", "project"
131
        #
135
        #
132
        $result{BUILDNAME_PACKAGE} = $args[0];
136
        $result{BUILDNAME_PACKAGE} = $args[0];
133
        $result{BUILDNAME_VERSION} = $args[1] || Error("BuildName. No version specified");;
137
        $result{BUILDNAME_VERSION} = $args[1] || '';
134
        $result{BUILDNAME_PROJECT} = $args[2] || '';
138
        $result{BUILDNAME_PROJECT} = $args[2] || '';
135
 
139
 
136
        Error ("Package Name should not contain spaces",
140
        push (@errors , "Package Name should not contain spaces",
137
               "Name: \'$args[0]\'" ) if ( $args[0] =~ m~\s~ );
141
               "Name: \'$args[0]\'" ) if ( $args[0] =~ m~\s~ );
138
 
142
 
139
        Error ("Package Version should not contain spaces",
143
        push (@errors , "Package Version not specified" ) 
140
               "Version: \'$args[1]\'" ) if ( $args[1] =~ m~\s~ );
144
            unless ( $args[1] );
141
 
145
 
-
 
146
        push (@errors , "Package Version should not contain spaces",
-
 
147
               "Version: \'$args[1]\'" ) if ( $args[1] && $args[1] =~ m~\s~ );
-
 
148
 
142
        Error ("Package Project should not contain spaces",
149
        push (@errors , "Package Project should not contain spaces",
143
               "Project: \'$args[2]\'" ) if ( $args[2] && $args[2] =~ m~\s~ );
150
               "Project: \'$args[2]\'" ) if ( $args[2] && $args[2] =~ m~\s~ );
144
 
151
 
145
    }
152
    }
-
 
153
    elsif ( $#args == 2 )
-
 
154
    {
-
 
155
        # Three argument form
-
 
156
        # 'name', 'nn.nn.nn', 'prj'
-
 
157
        # 
-
 
158
        $result{BUILDNAME_PACKAGE} = $args[0];
-
 
159
        $result{BUILDNAME_VERSION} = $args[1] || '';
-
 
160
        $result{BUILDNAME_PROJECT} = $args[2] || '';
-
 
161
 
-
 
162
        push (@errors , "Package Name should not contain spaces",
-
 
163
               "Name: \'$args[0]\'" ) if ( $args[0] =~ m~\s~ );
-
 
164
 
-
 
165
        push (@errors , "Package Version not specified" ) 
-
 
166
            unless ( $args[1] );
-
 
167
 
-
 
168
        push (@errors , "Package Project not specified" ) 
-
 
169
            unless ( $args[2] );
-
 
170
 
-
 
171
        push (@errors , "Package Project should not contain spaces",
-
 
172
               "Project: \'$args[2]\'" ) if ( $args[2] && $args[2] =~ m~\s~ );
-
 
173
 
-
 
174
         push (@errors , "Package Version is not in form nn.nn.nn",
-
 
175
               "Version: \'$args[1]\'" ) unless ( $args[1] =~ m~^\d+\.\d+\.\d+$~ );
-
 
176
 
-
 
177
    }
146
    elsif ( $BUILDNAME =~ m~^\s*([\w-]+)\s+(\d+\.\d+\.\d+)[\s.]+(\w+)\s*$~ )
178
    elsif ( $BUILDNAME =~ m~^\s*([\w-]+)\s+(\d+\.\d+\.\d+)[\s.]+(\w+)\s*$~ )
147
    {
179
    {
-
 
180
        # One argument form
-
 
181
        #   name nn.nn.nn prj
148
        $result{BUILDNAME_PACKAGE} = $1;
182
        $result{BUILDNAME_PACKAGE} = $1;
149
        $result{BUILDNAME_VERSION} = $2;
183
        $result{BUILDNAME_VERSION} = $2;
150
        $result{BUILDNAME_PROJECT} = $3;
184
        $result{BUILDNAME_PROJECT} = $3;
151
 
185
 
152
    }
186
    }
153
    elsif ( $BUILDNAME =~ m~^\s*[\w-]+$~ and $BUILDVERSION =~ m~^(\d+\.\d+\.\d+)\.(\w+)\s*$~ )
187
    elsif ( $BUILDNAME =~ m~^\s*[\w-]+$~ and $BUILDVERSION =~ m~^(\d+\.\d+\.\d+)\.(\w+)\s*$~ )
154
    {
188
    {
-
 
189
        # Two argument form
-
 
190
        # 'name', 'nn.nn.nn prj'
155
        $result{BUILDNAME_PACKAGE} = $BUILDNAME;
191
        $result{BUILDNAME_PACKAGE} = $BUILDNAME;
156
        $result{BUILDNAME_VERSION} = $1;
192
        $result{BUILDNAME_VERSION} = $1;
157
        $result{BUILDNAME_PROJECT} = $2;
193
        $result{BUILDNAME_PROJECT} = $2;
158
    }
194
    }
159
    else
195
    else
160
    {
196
    {
-
 
197
        $unknownForm = 1;
-
 
198
    }
-
 
199
 
-
 
200
    #
-
 
201
    #   Descriptive error message
-
 
202
    if (@errors || $unknownForm)
-
 
203
    {
161
        Error( "BUILDNAME is not compatible with dpkg_archive tools",
204
        Error("BUILDNAME is not compatible with dpkg_archive tools","Allowed formats:",
-
 
205
                    "'name nn.nn.nn prj'",
162
               "Allowed formats: 'name nn.nn.nn prj' or 'name', 'nn.nn.nn.prj' ",
206
                    "'name', 'nn.nn.nn.prj'",
-
 
207
                    "'name', 'nn.nn.nn', 'prj'",
-
 
208
                    "'name', 'cots_version', 'cots'",
-
 
209
                    @errors,
163
               "Arguments: '@arguments'" );
210
                    "Arguments: '@arguments'" );
164
    }
211
    }
165
 
212
 
166
    #
213
    #
167
    #   Compatability values
214
    #   Compatability values
168
    #       BUILDNAME       - A space seperated name of name, ver, project
215
    #       BUILDNAME       - A space seperated name of name, ver, project