@@ -7,37 +7,30 @@ use ToolchainBuildJob;
77
88use constant {
99 PERL_VERSION => " 5.38.2" ,
10- PERL_BUILD_STEPS => 7 ,
10+ PERL_BUILD_STEPS => 9 ,
1111};
1212
1313our @EXPORT = qw( build_job PERL_VERSION PERL_BUILD_STEPS) ;
1414
15- my $ARCH = ' x64' ;
16-
1715sub build_job {
18- my ($arch , $rev ) = @_ ;
16+ my ($arch , $rev , $notest , $dllsuffix ) = @_ ;
1917# ## job description for building GLPI Agent
2018
2119# Available '<..>' macros:
2220# <package_url> is placeholder for https://strawberryperl.com/package
2321# <dist_sharedir> is placeholder for Perl::Dist::Strawberry's distribution sharedir
2422# <image_dir> is placeholder for C:\Strawberry-perl-for-GLPI-Agent
2523
26- $ARCH = $arch ;
24+ my ( $MAJOR , $MINOR ) = PERL_VERSION =~ / ^( \d +) \. ( \d +) \. / ;
2725
2826 return {
2927 app_version => PERL_VERSION.' .' .$rev , # BEWARE: do not use '.0.0' in the last two version digits
3028 bits => $arch eq ' x64' ? 64 : 32,
3129 app_fullname => ' Strawberry Perl' .($arch eq ' x64' ?' (64-bit)' :' ' ),
3230 app_simplename => ' strawberry-perl' ,
3331 maketool => ' gmake' , # 'dmake' or 'gmake'
34- build_job_steps => [ _build_steps() ],
35- }
36- }
32+ build_job_steps => [
3733
38- sub _build_steps {
39- my ($MAJOR , $MINOR ) = PERL_VERSION =~ / ^(\d +)\. (\d +)\. / ;
40- return
4134 # ## FIRST STEP 0 : Binaries donwloads ##################################
4235 {
4336 plugin => ' Perl::Dist::GLPI::Agent::Step::ToolChain' ,
@@ -65,7 +58,7 @@ sub _build_steps {
6558 # ## NEXT STEP 2 Build perl #############################################
6659 {
6760 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 ' ,
6962 cf_email => ' strawberry-perl@project' , # IMPORTANT: keep 'strawberry-perl' before @
7063 perl_debug => 0, # can be overridden by --perl_debug=N option
7164 perl_64bitint => 1, # ignored on 64bit, can be overridden by --perl_64bitint | --noperl_64bitint option
@@ -173,9 +166,14 @@ sub _build_steps {
173166 },
174167 # ## NEXT STEP 7 Install modules for test ###############################
175168 {
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(
179177 HTTP::Proxy HTTP::Server::Simple::Authen IO::Capture::Stderr
180178 Test::Compile Test::Deep Test::MockModule Test::MockObject
181179 Test::NoWarnings
@@ -187,45 +185,98 @@ sub _build_steps {
187185 plugin => ' Perl::Dist::Strawberry::Step::FilesAndDirs' ,
188186 commands => [
189187 { 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' ),
191189 _movebin(' libstdc++-6.dll' ),
192190 _movebin(' libwinpthread-1.dll' ),
193191 _movebin(' perl.exe' ),
194192 _movebin(' perl' .$MAJOR .$MINOR .' .dll' ),
195193 # 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 ),
204202 { do => ' removedir' , args => [ ' <image_dir>/perl/bin' ] },
205203 { do => ' movedir' , args => [ ' <image_dir>/perl/newbin' , ' <image_dir>/perl/bin' ] },
206204 { do => ' movefile' , args => [ ' <image_dir>/c/bin/gmake.exe' , ' <image_dir>/perl/bin/gmake.exe' ] }, # Needed for tests
207205 { do => ' removedir' , args => [ ' <image_dir>/bin' ] },
208206 { 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' ] },
210208 { do => ' removedir' , args => [ ' <image_dir>/include' ] },
211209 { do => ' removedir' , args => [ ' <image_dir>/lib' ] },
212210 { do => ' removedir' , args => [ ' <image_dir>/libexec' ] },
213211 # Other binaries used by agent
214212 { do => ' copyfile' , args => [ ' contrib/windows/packaging/tools/x86/dmidecode.exe' , ' <image_dir>/perl/bin' ] },
215213 { 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' ] },
219217 ],
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+ }
229280}
230281
231282sub _movebin {
@@ -240,8 +291,8 @@ sub _movebin {
240291}
241292
242293sub _movedll {
243- my ($dll , $to ) = @_ ;
244- my $file = $dll .(_is64bit()? ' __ ' : ' _ ' ) .' .dll' ;
294+ my ($dll , $suffix ) = @_ ;
295+ my $file = $dll .$suffix .' .dll' ;
245296 return {
246297 do => ' movefile' ,
247298 args => [
0 commit comments