Subversion Repositories DevTools

Rev

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

Rev 6535 Rev 6738
Line 20... Line 20...
20
# Syntax        : MakeDebianPackage (<platforms>, Options+);
20
# Syntax        : MakeDebianPackage (<platforms>, Options+);
21
#                 Where Options may be one of:
21
#                 Where Options may be one of:
22
#                   --Script=PackagerScript             - Mandatory. Name of a the packaging script
22
#                   --Script=PackagerScript             - Mandatory. Name of a the packaging script
23
#                   --Name=Name                         - Debian Package name(optional)
23
#                   --Name=Name                         - Debian Package name(optional)
24
#                   --Variant=Text                      - Package Variant(optional)
24
#                   --Variant=Text                      - Package Variant(optional)
-
 
25
#                   --VersionPrefix=Text                - Prefixes the version with the passed text(optional)
-
 
26
#                   --ExtDesc=Text                      - Stored in the variable $opt_extdesc availabe in the
-
 
27
#                                                         packaging script(optional)
25
#                   --DeployMode                        - Create Deployable packages(optional)
28
#                   --DeployMode                        - Create Deployable packages(optional)
26
#                                                         Default for native targets
29
#                                                         Default for native targets
27
#                                                         These are:
30
#                                                         These are:
28
#                                                           * Packaged into the root of target pkg
31
#                                                           * Packaged into the root of target pkg
29
#                                                           * Have P or D in the name
32
#                                                           * Have P or D in the name
Line 66... Line 69...
66
    return if ( ! ActivePlatform($platforms) );
69
    return if ( ! ActivePlatform($platforms) );
67
 
70
 
68
    my $build_name =  $::ScmBuildPackage;
71
    my $build_name =  $::ScmBuildPackage;
69
    my $build_version = $::ScmBuildVersionFull;
72
    my $build_version = $::ScmBuildVersionFull;
70
    my $build_variant = '';
73
    my $build_variant = '';
-
 
74
    my $build_version_prefix = '';
-
 
75
    my $build_extdesc = '';
71
 
76
 
72
    my $name_set=0;
77
    my $name_set=0;
73
    my $variant_set=0;
78
    my $variant_set=0;
-
 
79
    my $version_prefix_set=0;
-
 
80
    my $extdesc_set=0;
74
 
81
 
75
    my $deploy_mode = GetGlobalOption('DEBIAN_PACKAGE_DEPLOYABLE', 0);
82
    my $deploy_mode = GetGlobalOption('DEBIAN_PACKAGE_DEPLOYABLE', 0);
76
 
83
 
77
    my $tarOnly;
84
    my $tarOnly;
78
    my $tarFileName = '';
85
    my $tarFileName = '';
Line 116... Line 123...
116
 
123
 
117
        } elsif ( m/^--Variant=(.+)/i ) {
124
        } elsif ( m/^--Variant=(.+)/i ) {
118
            $build_variant = $1;
125
            $build_variant = $1;
119
            $variant_set++;
126
            $variant_set++;
120
 
127
 
-
 
128
        } elsif ( m/^--VersionPrefix=(.+)/i ) {
-
 
129
            $build_version_prefix = $1;
-
 
130
            $version_prefix_set++;
-
 
131
 
-
 
132
        } elsif ( m/^--ExtDesc=(.+)/i ) {
-
 
133
            $build_extdesc = $1;
-
 
134
            $extdesc_set++;
-
 
135
 
121
        } elsif ( m/^--(No)?DeployMode/i ) {
136
        } elsif ( m/^--(No)?DeployMode/i ) {
122
            $deploy_mode = ! defined($1);
137
            $deploy_mode = ! defined($1);
123
 
138
 
124
        } elsif ( m/^--NoArch$/i ) {
139
        } elsif ( m/^--NoArch$/i ) {
125
            $noArch = 1;
140
            $noArch = 1;
Line 143... Line 158...
143
    #
158
    #
144
    ReportError ("MakeDebianPackage: Not supported on a GENERIC target") if ( $ScmPlatform eq 'GENERIC' );
159
    ReportError ("MakeDebianPackage: Not supported on a GENERIC target") if ( $ScmPlatform eq 'GENERIC' );
145
    ReportError ("MakeDebianPackage: Script name not defined") unless ( $debianScript || $rpmScript );
160
    ReportError ("MakeDebianPackage: Script name not defined") unless ( $debianScript || $rpmScript );
146
    ReportError ("MakeDebianPackage: --Name option can only be used once") if ( $name_set > 1 );
161
    ReportError ("MakeDebianPackage: --Name option can only be used once") if ( $name_set > 1 );
147
    ReportError ("MakeDebianPackage: --Variant option can only be used once") if ( $variant_set > 1 );
162
    ReportError ("MakeDebianPackage: --Variant option can only be used once") if ( $variant_set > 1 );
-
 
163
    ReportError ("MakeDebianPackage: --VersionPrefix option can only be used once") if ( $version_prefix_set > 1 );
-
 
164
    ReportError ("MakeDebianPackage: --ExtDesc option can only be used once") if ( $extdesc_set > 1 );
148
    ErrorDoExit();
165
    ErrorDoExit();
149
 
166
 
150
    #
167
    #
151
    #   Determine what we are really doing
168
    #   Determine what we are really doing
152
    #       Under Redhat we will generate an RPM
169
    #       Under Redhat we will generate an RPM
Line 177... Line 194...
177
    #
194
    #
178
    if ( $build_variant )
195
    if ( $build_variant )
179
    {
196
    {
180
        $build_name .= '-' . $build_variant;
197
        $build_name .= '-' . $build_variant;
181
    }
198
    }
-
 
199
    
-
 
200
    #
-
 
201
    #   Build up the version 
-
 
202
    #       Add the version prefix to the base version
-
 
203
    if ( $build_version_prefix )
-
 
204
    {
-
 
205
        $build_version = $build_version_prefix . '-' . $build_version;
-
 
206
    }
182
 
207
 
183
    #
208
    #
184
    #   Sanity check the package name and version
209
    #   Sanity check the package name and version
185
    #   Debian has stricter requirements than JATS
210
    #   Debian has stricter requirements than JATS
186
    #       Name:    Lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.).
211
    #       Name:    Lower case letters (a-z), digits (0-9), plus (+) and minus (-) signs, and periods (.).
Line 202... Line 227...
202
    $build_name = canonicalName ($build_name, 'Debian');
227
    $build_name = canonicalName ($build_name, 'Debian');
203
 
228
 
204
    #
229
    #
205
    #   Sanity test the version information
230
    #   Sanity test the version information
206
    #   
231
    #   
207
    unless ( $::ScmBuildVersionFull =~ m/^[0-9][-+:.A-Za-z0-9]+$/ )
232
    unless ( $build_version =~ m/^[0-9][-+:.A-Za-z0-9]+$/ )
208
    {
233
    {
209
        Error ("Package Version does not conform to Debian Requirements",
234
        Error ("Package Version does not conform to Debian Requirements",
210
               "Must only contain: (a-zA-Z) (0-9), - and .",
235
               "Must only contain: (a-zA-Z) (0-9), - and .",
211
               "Must start with a number",
236
               "Must start with a number",
212
               );
237
               );
Line 228... Line 253...
228
            $Platform = 'all';
253
            $Platform = 'all';
229
            $PkgType = '';
254
            $PkgType = '';
230
            push @optArgs, "-NoArch";
255
            push @optArgs, "-NoArch";
231
        }
256
        }
232
 
257
 
233
    my $PkgName = "${build_name}_${::ScmBuildVersionFull}_${Platform}${PkgType}.deb";
258
    my $PkgName = "${build_name}_${build_version}_${Platform}${PkgType}.deb";
234
    push @optArgs, "-PkgArch=$PkgArch";
259
    push @optArgs, "-PkgArch=$PkgArch";
235
    unless ($tarOnly) {
260
    unless ($tarOnly) {
236
        push (@outputFiles, $PkgName);
261
        push (@outputFiles, $PkgName);
237
        push @optArgs, "-Output=--GeneratedProg{$PkgName}";
262
        push @optArgs, "-Output=--GeneratedProg{$PkgName}";
238
    }
263
    }
Line 255... Line 280...
255
        if ($noArch) {
280
        if ($noArch) {
256
            $PkgArch = 'all';
281
            $PkgArch = 'all';
257
        }
282
        }
258
 
283
 
259
        $tarFileName =~ s~PACKAGE~${build_name}~g;
284
        $tarFileName =~ s~PACKAGE~${build_name}~g;
260
        $tarFileName =~ s~VERSION~${::ScmBuildVersionFull}~g;
285
        $tarFileName =~ s~VERSION~${build_version}~g;
261
        $tarFileName =~ s~PLATFORM~${Platform}~g;
286
        $tarFileName =~ s~PLATFORM~${Platform}~g;
262
        $tarFileName =~ s~ARCH~${PkgArch}~g;
287
        $tarFileName =~ s~ARCH~${PkgArch}~g;
263
        $tarFileName =~ s~TYPE~\$(GBE_TYPE)~;
288
        $tarFileName =~ s~TYPE~\$(GBE_TYPE)~;
264
        $tarFileName .= '.tgz' unless $tarFileName =~ m~\.tgz$~;
289
        $tarFileName .= '.tgz' unless $tarFileName =~ m~\.tgz$~;
265
        push @outputFiles,  $tarFileName;
290
        push @outputFiles,  $tarFileName;
Line 307... Line 332...
307
                        '--Var(LocalBinDir)',
332
                        '--Var(LocalBinDir)',
308
 
333
 
309
                        "-genDeb",                                # Type to generate
334
                        "-genDeb",                                # Type to generate
310
                        "-Script=--Prerequisite($script)",        # Packager script
335
                        "-Script=--Prerequisite($script)",        # Packager script
311
                        "-Name=$build_name",                      # Massaged Package Name
336
                        "-Name=$build_name",                      # Massaged Package Name
-
 
337
                        "-Version=$build_version",                # Massaged Version
312
                        "-Variant=$build_variant",                # Variant Name
338
                        "-Variant=$build_variant",                # Variant Name
-
 
339
                        "-VersionPrefix=$build_version_prefix",   # Version Prefix
-
 
340
                        "-ExtDesc=$build_extdesc",                # External Description of Package
313
                        @optArgs,                                 # Optional args
341
                        @optArgs,                                 # Optional args
314
                        );
342
                        );
315
 
343
 
316
    #
344
    #
317
    #   The Packager has created a binary in the 'PROG' directory
345
    #   The Packager has created a binary in the 'PROG' directory