@@ -7,37 +7,30 @@ use ToolchainBuildJob;
7
7
8
8
use constant {
9
9
PERL_VERSION => " 5.38.2" ,
10
- PERL_BUILD_STEPS => 7 ,
10
+ PERL_BUILD_STEPS => 9 ,
11
11
};
12
12
13
13
our @EXPORT = qw( build_job PERL_VERSION PERL_BUILD_STEPS) ;
14
14
15
- my $ARCH = ' x64' ;
16
-
17
15
sub build_job {
18
- my ($arch , $rev ) = @_ ;
16
+ my ($arch , $rev , $notest , $dllsuffix ) = @_ ;
19
17
# ## job description for building GLPI Agent
20
18
21
19
# Available '<..>' macros:
22
20
# <package_url> is placeholder for https://strawberryperl.com/package
23
21
# <dist_sharedir> is placeholder for Perl::Dist::Strawberry's distribution sharedir
24
22
# <image_dir> is placeholder for C:\Strawberry-perl-for-GLPI-Agent
25
23
26
- $ARCH = $arch ;
24
+ my ( $MAJOR , $MINOR ) = PERL_VERSION =~ / ^( \d +) \. ( \d +) \. / ;
27
25
28
26
return {
29
27
app_version => PERL_VERSION.' .' .$rev , # BEWARE: do not use '.0.0' in the last two version digits
30
28
bits => $arch eq ' x64' ? 64 : 32,
31
29
app_fullname => ' Strawberry Perl' .($arch eq ' x64' ?' (64-bit)' :' ' ),
32
30
app_simplename => ' strawberry-perl' ,
33
31
maketool => ' gmake' , # 'dmake' or 'gmake'
34
- build_job_steps => [ _build_steps() ],
35
- }
36
- }
32
+ build_job_steps => [
37
33
38
- sub _build_steps {
39
- my ($MAJOR , $MINOR ) = PERL_VERSION =~ / ^(\d +)\. (\d +)\. / ;
40
- return
41
34
# ## FIRST STEP 0 : Binaries donwloads ##################################
42
35
{
43
36
plugin => ' Perl::Dist::GLPI::Agent::Step::ToolChain' ,
@@ -65,7 +58,7 @@ sub _build_steps {
65
58
# ## NEXT STEP 2 Build perl #############################################
66
59
{
67
60
plugin => ' Perl::Dist::GLPI::Agent::Step::InstallPerlCore' ,
68
- url => _perl_source_url() ,
61
+ url => ' https://www.cpan.org/src/5.0/perl- ' .PERL_VERSION. ' .tar.gz ' ,
69
62
cf_email => ' strawberry-perl@project' , # IMPORTANT: keep 'strawberry-perl' before @
70
63
perl_debug => 0, # can be overridden by --perl_debug=N option
71
64
perl_64bitint => 1, # ignored on 64bit, can be overridden by --perl_64bitint | --noperl_64bitint option
@@ -173,9 +166,14 @@ sub _build_steps {
173
166
},
174
167
# ## NEXT STEP 7 Install modules for test ###############################
175
168
{
176
- plugin => ' Perl::Dist::GLPI::Agent::Step::Test' ,
177
- modules => [
178
- qw(
169
+ plugin => ' Perl::Dist::GLPI::Agent::Step::InstallModules' ,
170
+ modules => [ map {
171
+ {
172
+ module => $_ ,
173
+ skiptest => 1,
174
+ install_to => ' site' ,
175
+ }
176
+ } qw(
179
177
HTTP::Proxy HTTP::Server::Simple::Authen IO::Capture::Stderr
180
178
Test::Compile Test::Deep Test::MockModule Test::MockObject
181
179
Test::NoWarnings
@@ -187,45 +185,98 @@ sub _build_steps {
187
185
plugin => ' Perl::Dist::Strawberry::Step::FilesAndDirs' ,
188
186
commands => [
189
187
{ do => ' createdir' , args => [ ' <image_dir>/perl/newbin' ] },
190
- _movebin(' libgcc_s_' .(_is64bit()? ' seh' : ' dw2' ).' -1.dll' ),
188
+ _movebin(' libgcc_s_' .($arch eq ' x64 ' ? ' seh' : ' dw2' ).' -1.dll' ),
191
189
_movebin(' libstdc++-6.dll' ),
192
190
_movebin(' libwinpthread-1.dll' ),
193
191
_movebin(' perl.exe' ),
194
192
_movebin(' perl' .$MAJOR .$MINOR .' .dll' ),
195
193
# Also move DLLs required by modules
196
- _movedll(' libxml2-2' ),
197
- _movedll(' liblzma-5' ),
198
- _movedll(' libcharset-1' ),
199
- _movedll(' libiconv-2' ),
200
- _movedll(' libcrypto-3' ),
201
- _movedll(' libssl-3' ),
202
- _movedll(' zlib1' ),
203
- _movedll(' libssh2-1' ),
194
+ _movedll(' libxml2-2' , $dllsuffix ),
195
+ _movedll(' liblzma-5' , $dllsuffix ),
196
+ _movedll(' libcharset-1' , $dllsuffix ),
197
+ _movedll(' libiconv-2' , $dllsuffix ),
198
+ _movedll(' libcrypto-3' , $dllsuffix ),
199
+ _movedll(' libssl-3' , $dllsuffix ),
200
+ _movedll(' zlib1' , $dllsuffix ),
201
+ _movedll(' libssh2-1' , $dllsuffix ),
204
202
{ do => ' removedir' , args => [ ' <image_dir>/perl/bin' ] },
205
203
{ do => ' movedir' , args => [ ' <image_dir>/perl/newbin' , ' <image_dir>/perl/bin' ] },
206
204
{ do => ' movefile' , args => [ ' <image_dir>/c/bin/gmake.exe' , ' <image_dir>/perl/bin/gmake.exe' ] }, # Needed for tests
207
205
{ do => ' removedir' , args => [ ' <image_dir>/bin' ] },
208
206
{ do => ' removedir' , args => [ ' <image_dir>/c' ] },
209
- { do => ' removedir' , args => [ ' <image_dir>/' .(_is64bit()? ' x86_64' : ' i686' ).' -w64-mingw32' ] },
207
+ { do => ' removedir' , args => [ ' <image_dir>/' .($arch eq ' x64 ' ? ' x86_64' : ' i686' ).' -w64-mingw32' ] },
210
208
{ do => ' removedir' , args => [ ' <image_dir>/include' ] },
211
209
{ do => ' removedir' , args => [ ' <image_dir>/lib' ] },
212
210
{ do => ' removedir' , args => [ ' <image_dir>/libexec' ] },
213
211
# Other binaries used by agent
214
212
{ do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/x86/dmidecode.exe' , ' <image_dir>/perl/bin' ] },
215
213
{ do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/x86/hdparm.exe' , ' <image_dir>/perl/bin' ] },
216
- { do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/' .$ARCH .' /7z.exe' , ' <image_dir>/perl/bin' ] },
217
- { do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/' .$ARCH .' /7z.dll' , ' <image_dir>/perl/bin' ] },
218
- { do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/' .$ARCH .' /GLPI-AgentMonitor-' .$ARCH .' .exe' , ' <image_dir>/perl/bin' ] },
214
+ { do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/' .$arch .' /7z.exe' , ' <image_dir>/perl/bin' ] },
215
+ { do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/' .$arch .' /7z.dll' , ' <image_dir>/perl/bin' ] },
216
+ { do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/' .$arch .' /GLPI-AgentMonitor-' .$arch .' .exe' , ' <image_dir>/perl/bin' ] },
219
217
],
220
- };
221
- }
222
-
223
- sub _is64bit {
224
- return $ARCH eq ' x64' ? 1 : 0;
225
- }
226
-
227
- sub _perl_source_url {
228
- return ' https://www.cpan.org/src/5.0/perl-' .PERL_VERSION.' .tar.gz'
218
+ },
219
+ # ## NEXT STEP 9 Run GLPI Agent test suite ##############################
220
+ {
221
+ plugin => ' Perl::Dist::GLPI::Agent::Step::Test' ,
222
+ disable => $notest ,
223
+ # By default only t/01compile.t is run
224
+ test_files => [
225
+ # ~ qw(t/*.t t/*/*.t t/*/*/*.t t/*/*/*/*.t t/*/*/*/*/*.t t/*/*/*/*/*/*.t)
226
+ ],
227
+ skip_tests => [
228
+ # Fails if not run as administrator
229
+ # ~ qw(t/agent/config.t)
230
+ ],
231
+ },
232
+ # ## NEXT STEP 10 Finalize environment ##################################
233
+ {
234
+ plugin => ' Perl::Dist::Strawberry::Step::FilesAndDirs' ,
235
+ commands => [
236
+ # Cleanup modules and files used for tests
237
+ { do => ' removedir' , args => [ ' <image_dir>/perl/site/lib' ] },
238
+ { do => ' createdir' , args => [ ' <image_dir>/perl/site/lib' ] },
239
+ { do => ' removefile' , args => [ ' <image_dir>/perl/bin/gmake.exe' ] },
240
+ # updates for glpi-agent
241
+ { do => ' createdir' , args => [ ' <image_dir>/perl/agent' ] },
242
+ { do => ' createdir' , args => [ ' <image_dir>/var' ] },
243
+ { do => ' createdir' , args => [ ' <image_dir>/logs' ] },
244
+ { do => ' movefile' , args => [ ' <image_dir>/perl/bin/perl.exe' , ' <image_dir>/perl/bin/glpi-agent.exe' ] },
245
+ { do => ' copydir' , args => [ ' lib/GLPI' , ' <image_dir>/perl/agent/GLPI' ] },
246
+ { do => ' copydir' , args => [ ' lib/GLPI' , ' <image_dir>/perl/agent/GLPI' ] },
247
+ { do => ' copydir' , args => [ ' etc' , ' <image_dir>/etc' ] },
248
+ { do => ' createdir' , args => [ ' <image_dir>/etc/conf.d' ] },
249
+ { do => ' copydir' , args => [ ' bin' , ' <image_dir>/perl/bin' ] },
250
+ { do => ' copydir' , args => [ ' share' , ' <image_dir>/share' ] },
251
+ { do => ' copyfile' , args => [ ' contrib/windows/packaging/setup.pm' , ' <image_dir>/perl/lib' ] },
252
+ ],
253
+ },
254
+ # ## NEXT STEP 11 Finalize release ######################################
255
+ {
256
+ plugin => ' Perl::Dist::GLPI::Agent::Step::Update' ,
257
+ },
258
+ # ## NEXT STEP 12 Generate Portable Archive #############################
259
+ {
260
+ plugin => ' Perl::Dist::Strawberry::Step::OutputZIP' ,
261
+ },
262
+ # ## NEXT STEP 13 Generate MSI Package ##################################
263
+ {
264
+ plugin => ' Perl::Dist::GLPI::Agent::Step::OutputMSI' ,
265
+ exclude => [],
266
+ # BEWARE: msi_upgrade_code is a fixed value for all same arch releases (for ever)
267
+ msi_upgrade_code => $arch eq ' x64' ? ' 0DEF72A8-E5EE-4116-97DC-753718E19CD5' : ' 7F25A9A4-BCAE-4C15-822D-EAFBD752CFEC' ,
268
+ app_publisher => " Teclib'" ,
269
+ url_about => ' https://glpi-project.org/' ,
270
+ url_help => ' https://glpi-project.org/discussions/' ,
271
+ msi_root_dir => ' GLPI-Agent' ,
272
+ msi_main_icon => ' contrib/windows/packaging/glpi-agent.ico' ,
273
+ msi_license_rtf => ' contrib/windows/packaging/gpl-2.0.rtf' ,
274
+ msi_dialog_bmp => ' contrib/windows/packaging/GLPI-Agent_Dialog.bmp' ,
275
+ msi_banner_bmp => ' contrib/windows/packaging/GLPI-Agent_Banner.bmp' ,
276
+ msi_debug => 0,
277
+ }
278
+ ],
279
+ }
229
280
}
230
281
231
282
sub _movebin {
@@ -240,8 +291,8 @@ sub _movebin {
240
291
}
241
292
242
293
sub _movedll {
243
- my ($dll , $to ) = @_ ;
244
- my $file = $dll .(_is64bit()? ' __ ' : ' _ ' ) .' .dll' ;
294
+ my ($dll , $suffix ) = @_ ;
295
+ my $file = $dll .$suffix .' .dll' ;
245
296
return {
246
297
do => ' movefile' ,
247
298
args => [
0 commit comments