Ticket #4397: win32-packager.25.patch

File win32-packager.25.patch, 14.9 KB (added by davidbuzz@…, 11 years ago)

patch v25, adds 'always' functionality, converts existing code to use it, a few other minor fixes

  • win32-packager.pl

     
    126126
    127127print "Config:\n\tQT version: $qtver\n\tDLL's will be labeled as: $version\n";
    128128print "\tSVN location is: $svnlocation\n\tSVN revision is: $SVNRELEASE\n\n";
     129print "Press [enter] to continue, or [ctrl]-c to exit now....\n";
    129130
    130131# TODO -  use this list to define the components to build - only the first of these currently works well.
    131132my @components = ( 'mythtv', 'myththemes', 'mythplugins' );
     
    225226#  execute the action only if a file or directory exists             [exists]
    226227#  stop the run, useful for script debugging                         [stop]
    227228#  pause the run, await a enter                                      [pause]
     229#  always execute the action  (try to minimise the use of this!)     [always]
    228230
    229231#build actions (events) are:
    230232#  fetch a file from the web (to a location)                         [fetch]
     
    355357# cp /c/Program\ Files/MySQL/MySQL\ Server\ 5.0/lib/opt/libmysql.lib /c/MinGW/lib
    356358
    357359#
    358 # TIP: we use a special file (with an extra _ ) as a marker to do this
    359 # action every the time, it's harmless to do it more often that required.
    360 # 'nocheck' means continue even if the cause doesn't exist after.
    361 [ file => $mingw.'lib/libmysql.lib__',  shell => ["cd /mingw/lib","reimp -d libmysql.lib","dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a",'nocheck'],comment => ' rebuild libmysql.a' ],
     360# TIP: we use a special file (with two extra _'s ) as a marker to say this acton is already done!
     361[ file => $mingw.'lib/libmysql.lib__',  shell => ["cd /mingw/lib","reimp -d libmysql.lib","dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a","touch ".$unixmingw.'lib/libmysql.lib__'],comment => ' rebuild libmysql.a' ],
    362362
    363363# grep => [pattern,file] , actions/etc
    364364[ file => $mingw.'include/mysql___h.patch', write => [$mingw.'include/mysql___h.patch',
     
    642642 comment => 'rename mingw sh.exe out of the way before building QT! ' ] ,
    643643
    644644# Write a batch script for the QT environment under DOS:
    645 [ file => $msys.'qt-win-opensource-src-4.3.4/qt4_env.bat_',
    646  write => [$msys.'qt-win-opensource-src-4.3.4/qt4_env.bat',
     645[ always => [], write => [$msys.'qt-win-opensource-src-4.3.4/qt4_env.bat',
    647646'rem a batch script for the QT environment under DOS:
    648647set QTDIR='.$dosmsys.'qt-win-opensource-src-4.3.4
    649648set MINGW='.$dosmingw.'
     
    652651cd %QTDIR%
    653652'.$dosmsys.'bin\yes | configure -plugin-sql-mysql -no-sql-sqlite -debug-and-release -fast -no-sql-odbc -no-qdbus
    654653rem mingw32-make
    655 ','nocheck'
     654',
    656655],comment=>'write a batch script for the QT4 environment under DOS'],
    657656
    658657# test if the core .dll is built, and build QT if it isn't!
     
    741740
    742741
    743742# chmod the shell scripts, everytime
    744 [ file => $mythtv.'_' , shell => ["cd $mythtv","chmod 755 *.sh",'nocheck'] ],
     743[ always => [] , shell => ["cd $mythtv","chmod 755 *.sh"] ],
    745744
    746745#----------------------------------------
    747746# now we prep for the build of mythtv!
     
    749748;
    750749if ($makeclean) {
    751750  push @{$expect},
    752   [ file => $mythtv.'make_clean.sh_', shell => ['source '.$unixmythtv.'make_clean.sh','nocheck'], comment => 'cleaning environment'],
     751  [ always => [], shell => ['source '.$unixmythtv.'make_clean.sh'], comment => 'cleaning environment'],
    753752  ;
    754753}
    755754# SVN update every time, before patches
    756755foreach my $comp( @components ) {
    757756  push @{$expect},
    758   [ file => 'always',
    759     exec => [$dosmsys."bin\\svn.exe -r $SVNRELEASE update $dosmythtv$comp",
    760              'nocheck'],
     757  [ always => [],
     758    exec => [$dosmsys."bin\\svn.exe -r $SVNRELEASE update $dosmythtv$comp"],
    761759    comment => "Getting SVN updates for:$comp on $svnlocation" ];
    762760}
    763761push @{$expect},
    764762
    765763# always get svn num
    766 [ file => $mythtv.'_', exec => ['cd '.$dosmythtv.'mythtv && '.$dosmsys.'bin\svn.exe info > '.$dosmythtv.'mythtv\svn_info.new','nocheck'], comment => 'fetching the SVN number to a text file, if we can'],
     764[ always => [], exec => ['cd '.$dosmythtv.'mythtv && '.$dosmsys.'bin\svn.exe info > '.$dosmythtv.'mythtv\svn_info.new'], comment => 'fetching the SVN number to a text file, if we can'],
    767765[ filesame => [$mythtv.'mythtv\svn_info.txt',$mythtv.'mythtv\svn_info.new'], shell => ['touch -r '.$unixmythtv.'mythtv/svn_info.txt '.$unixmythtv.'mythtv/svn_info.new'], comment => 'match the datetime of these files, so that the contents only can be compared next' ],
    768766
    769767# is svn num (ie file contents) changed since last run, if so, do a 'make
     
    865863comment => 'do we already have a Makefile for mythtv?' ],
    866864
    867865# make
     866
     867# fix a bug in Makefile and make COPY_DIR cp -fr instead of cp -f
     868# TODO Check if this is necessary. I suspect it was meant to fix #4949?
     869#
     870[ file => $mythtv.'mythtv/fix_makefile.sh', write => [$mythtv.'mythtv/fix_makefile.sh',
     871'cd '.$unixmythtv.'mythtv
     872cat Makefile | sed  "s/\(^COPY_DIR\W*\=\W*cp\)\(\W\-f\)/\1 -fr/" > Makefile_new
     873cp Makefile_new Makefile
     874'
     875],comment => 'write a script to fix Makefile'],
     876
    868877[ newer => [$mythtv."mythtv/libs/libmyth/libmyth-$version.dll",
    869878            $mythtv.'mythtv/last_build.txt'],
    870879  shell => ['rm '.$unixmythtv."mythtv/libs/libmyth/libmyth-$version.dll",
     
    891900  comment => 'programs/mythbackend/mythbackend.exe - redo make unless all these files exist, and are newer than the last_build.txt identifier' ],
    892901
    893902
    894 # fix a bug in Makefile and make COPY_DIR cp -fr instead of cp -f
    895 # TODO Check if this is necessary. I suspect it was meant to fix #4949?
    896 #
    897 [ file => $mythtv.'mythtv/fix_makefile.sh', write => [$mythtv.'mythtv/fix_makefile.sh',
    898 'cd '.$unixmythtv.'mythtv
    899 cat Makefile | sed  "s/\(^COPY_DIR\W*\=\W*cp\)\(\W\-f\)/\1 -fr/" > Makefile_new
    900 cp Makefile_new Makefile
    901 ', 'nocheck',
    902 ],comment => 'write a script to fix Makefile'],
    903 
    904903# Archive old build before we create a new one with make install:
    905 [ exists  => $mythtv.'build_old',
    906   shell   => ['rm -fr '.$unixmythtv.'build_old'],
     904[ exists  => $build.'_old',
     905  shell   => ['rm -fr '.$unixbuild.'_old'],
    907906  comment => 'Deleting old build backup'],
    908907[ exists  => $build,
    909   shell   => ['mv '.$unixbuild.' '.$unixmythtv.'build_old'],
     908  shell   => ['mv '.$unixbuild.' '.$unixbuild.'_old'],
    910909  comment => 'Renaming build to build_old for backup....'],
    911 
     910 
    912911# re-install to /c/mythtv/build if we have a newer mythtv build
    913912# ready:
    914913[ newer => [$build.'bin/mythfrontend.exe',
     
    925924comment => 'copy the basic themes somewhere that mythtv can get at it.' ],
    926925
    927926# setup_build creates the build area and copies results (apart from themes)
    928 [ file => $mythtv.'setup_build.sh_', write => [$mythtv.'setup_build.sh',
     927[ always => [], write => [$mythtv.'setup_build.sh',
    929928'#!/bin/bash
    930929source '.$unixmythtv.'qt'.$qtver.'_env.sh
    931930cd '.$unixmythtv.'
     
    958957touch '.$unixmythtv.'/build/package_flag
    959958cp '.$unixmythtv.'gdb_*.bat '.$unixmythtv.'build/bin
    960959cp '.$unixmythtv.'mythtv/contrib/Win32/debug/*.cmd '.$unixmythtv.'build/bin
    961 ','nocheck'
     960'
    962961],comment => 'write a script to install mythtv to build folder'],
    963962
    964963
    965964# Create file to install myththemes
    966 [ file => $mythtv.'setup_plugins.sh_', write => [$mythtv.'setup_plugins.sh',
     965[ always => [], write => [$mythtv.'setup_plugins.sh',
    967966'#!/bin/bash
    968967source '.$unixmythtv.'qt'.$qtver.'_env.sh
    969968cd '.$unixmythtv.'
     
    977976echo Copying lib files...
    978977cp -ur /lib/mythtv/* ./build/lib/mythtv
    979978cp -ur /usr/lib/mythtv/* ./build/lib/mythtv
    980 ','nocheck'
     979'
    981980],comment => 'write a script to install plugins to build folder'],
    982981
    983982# Create file to install myththemes
    984 [ file => $mythtv.'setup_themes.sh_', write => [$mythtv.'setup_themes.sh',
     983[ always => [], write => [$mythtv.'setup_themes.sh',
    985984'#!/bin/bash
    986985source '.$unixmythtv.'qt'.$qtver.'_env.sh
    987986cd '.$unixmythtv.'
     
    990989cp /usr/share/mythtv/mythweather/* ./build/share/mythtv/mythweather
    991990echo Copying international files....
    992991cp /usr/share/mythtv/i18n/* ./build/share/mythtv/i18n
    993 ', 'nocheck'
     992'
    994993],comment => 'write a script that will install themes to build folder'],
    995994
    996995# chmod the shell scripts, everytime
    997 [ file => $mythtv.'_' , shell => ["cd $mythtv","chmod 755 *.sh",'nocheck'] ],
     996[ always => [], shell => ["cd $mythtv","chmod 755 *.sh"] ],
    998997
    999998# Change - don't run this until mythplugins are complete - otherwise dll/exe are copied twice
    1000999# Run setup_build.sh which creates the build area and copies executables
    1001 [ file => [$mythtv.'build/package_flag_'], shell => [$unixmythtv.'setup_build.sh', 'nocheck'],
     1000[ always => [], shell => [$unixmythtv.'setup_build.sh' ],
    10021001  comment => 'Copy mythtv into ./build folder' ],
    10031002;
    10041003
     
    10201019# if this is doing an anonymous connection, so the BEST we should expect is
    10211020# an "access denied" message if the server is running properly.
    10221021push @{$expect},
    1023 [file => $mythtv.'testmysqlsrv.bat_', exec => [ 'sc query mysql > '.$mythtv.'testmysqlsrv.bat','nocheck']],
     1022[always => [], exec => [ 'sc query mysql > '.$mythtv.'testmysqlsrv.bat']],
    10241023[grep => ['SERVICE_NAME',$mythtv.'testmysqlsrv.bat'], exec => ['sc start mysql','nocheck']],
    10251024[grep => ['does not exist',$mythtv.'testmysqlsrv.bat'], exec =>['C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQLd-nt.exe --standalone  -console','nocheck']],
    10261025
    10271026 
    1028 [ file => $mythtv.'testmysql.bat_', write => [ $mythtv.'testmysql.bat',
     1027[ always => [], write => [ $mythtv.'testmysql.bat',
    10291028'@echo off
    10301029echo testing connection to a local mysql server...
    10311030sleep 5
     
    10341033type '.$dosmythtv.'_mysqlshow_out.txt >> '.$dosmythtv.'_mysqlshow_err.txt
    10351034del '.$dosmythtv.'_mysqlshow_out.txt
    10361035sleep 1
    1037 ','nocheck']],
     1036']],
    10381037
    10391038# try to connect as mythtv/mythtv first (the best case scenario)
    10401039[ file => $mythtv.'skipping_db_tests.txt', exec => [$mythtv.'testmysql.bat','nocheck'], comment => 'First check - is the local mysql server running, accepting connections, and all that? (follow the bouncing ball on the install, a standard install is OK, remember the root password that you set, start it as a service!)' ],
     
    10491048
    10501049
    10511050#set/reset mythtv/mythtv password!
    1052 [ file => $mythtv.'resetmythtv.bat_', write => [ $mythtv.'resetmythtv.bat',
     1051[ always => [], write => [ $mythtv.'resetmythtv.bat',
    10531052"\@echo off
    10541053echo stopping mysql service:
    10551054net stop MySQL
     
    10721071echo.
    10731072echo Password for user 'mythtv' was reset to 'mythtv'
    10741073echo.
    1075 ",'nocheck'],
     1074"],
    10761075comment => 'writing a script to create the mysql user (mythtv/mythtv) without needing to ask you for the root password ...'],
    10771076
    10781077# reset passwords, this give the myhttv user FULL access to the entire mysql
     
    10911090[ grep => ['mythconverg',$mythtv.'_mysqlshow_err.txt'], exec => [ 'echo create database mythconverg; | "C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe" -u mythtv --password=mythtv','nocheck'], comment => ' does the mythconverg database exist? (and can this user see it?) '],
    10921091
    10931092# Make mysql.txt file required for testing
    1094 [ file => $ENV{APPDATA}.'\.mythtv\mysql.txt', write => [$ENV{APPDATA}.'\.mythtv\mysql.txt',
     1093[ file => $home.'.mythtv\mysql.txt', write => [$home.'.mythtv\mysql.txt',
    10951094'DBHostName=127.0.0.1
    10961095DBHostPing=no
    10971096DBUserName=mythtv
    10981097DBPassword=mythtv
    10991098DBName=mythconverg
    11001099DBType=QMYSQL3
    1101 LocalHostName='.$ENV{COMPUTERNAME}.'
    1102 ','nocheck'],
     1100LocalHostName='.$ENV{COMPUTERNAME}
     1101],
    11031102comment => 'create a mysql.txt file at: %HOMEPATH%\.mythtv\mysql.txt' ],
    11041103
    11051104;
     
    11141113push @{$expect},
    11151114#
    11161115# hack location of //include/mythtv/mythconfig.mak so that configure is successful
    1117 [ file => $msys.'include/mythtv/mythconfig.mak',
     1116[ always => [],
    11181117 shell => ['mkdir /include/mythtv',
    1119            'cp '.$unixmythtv.'build/include/mythtv/mythconfig.mak'.
    1120                ' /include/mythtv/mythconfig.mak', 'nocheck'],
     1118           'cp '.$unixbuild.'include/mythtv/mythconfig.mak'.
     1119               ' /include/mythtv/mythconfig.mak'],
    11211120comment => 'link mythconfig.mak'],
    11221121## config:
    11231122[ file => $mythtv.'mythplugins/Makefile',
     
    12011200[ file => $mythtv.'build/share/mythtv/themes/MePo-wide/ui.xml', shell => ['cp -fr '.$unixsources.'MePo-wide '.$unixmythtv.'build/share/mythtv/themes','nocheck'], comment => 'install MePo-wide'],
    12021201
    12031202# Move ttf fonts to font directory
    1204 [file => $mythtv.'qt'.$qtver.'_env.sh_', shell => ['source '.$unixmythtv.'qt'.$qtver.'_env.sh','cd '.$unixmythtv.'myththemes','find '.$unixmythtv.'build/share/mythtv/themes/ -name "*.ttf" | xargs -n1 -i__ cp __ '.$unixmythtv.'build/share/mythtv', 'nocheck'], comment => 'move ttf files'],
     1203[always => [], shell => ['source '.$unixmythtv.'qt'.$qtver.'_env.sh','cd '.$unixmythtv.'myththemes','find '.$unixmythtv.'build/share/mythtv/themes/ -name "*.ttf" | xargs -n1 -i__ cp __ '.$unixmythtv.'build/share/mythtv'], comment => 'move ttf files'],
    12051204;
    12061205}
    12071206
     
    12681267      write => [$mythtv.'build/isfiles/configuremysql.vbs',
    12691268'WScript.Echo "Currently Unimplemented"
    12701269' ], comment => 'Write a VB script to configure MySQL' ],
    1271     [ file => $mythtv.'build/isfiles/versioninfo.iss',
     1270    [ always => [],
    12721271      write => [$mythtv.'build/isfiles/versioninfo.iss', '
    12731272#define MyAppName      "MythTv"
    12741273#define MyAppVerName   "MythTv '.$version.'(svn_'.$SVNRELEASE .')"
    12751274#define MyAppPublisher "Mythtv"
    12761275#define MyAppURL       "http://www.mythtv.org"
    12771276#define MyAppExeName   "Win32MythTvInstall.exe"
    1278 ','nocheck' ], comment => 'write the version information for the setup'],
     1277' ], comment => 'write the version information for the setup'],
    12791278    [ file => $mythtv.'genfiles.sh', write => [$mythtv.'genfiles.sh','
    12801279cd '.$unixmythtv.'build
    12811280find . -type f -printf "Source: '.$mythtv.'build/%h/%f; Destdir: {app}/%h\n" | sed "s/\.\///" | grep -v ".svn" | grep -v "isfiles" | grep -v "include" > '.$unixmythtv.'/build/isfiles/files.iss
     
    14491448        if ( -e $cause[0] ) {
    14501449            effect($effecttype,@nocheckeffectparams);
    14511450        }
    1452 
     1451    } elsif ( $causetype eq 'always' ) {
     1452                                effect($effecttype,@nocheckeffectparams);
    14531453    } elsif ( $causetype eq 'stop' ){
    14541454        die "Stop found \n";
    14551455    } elsif ( $causetype eq 'pause' ){
     
    15191519        } else {
    15201520            die " unknown effecttype $effecttype from cause 'dir'\n";
    15211521        }
     1522        return; # which ever one we actioned, we don't want to action anything else
    15221523}
    15231524
    15241525#------------------------------------------------------------------------------
     
    16431644        if (! $NOISY )  {
    16441645          # skip known spurious messages from going to the screen unnecessarily
    16451646          next if /redeclared without dllimport attribute after being referenced with dllimpo/;
     1647          next if /declared as dllimport: attribute ignored/;
    16461648          next if /warning: overriding commands for target `\.\'/;
    16471649          next if /warning: ignoring old commands for target `\.\'/;
    16481650          next if /Nothing to be done for `all\'/;