Changeset 1542


Ignore:
Timestamp:
Jul 11, 2010, 1:54:17 PM (15 years ago)
Author:
John Small
Message:

ReleaseTool: 1) An initial attempt at support for sending emails, access to SmartSVN, a change to how 4OS2 is detected, new option to copy WARNALL.LOG to WARNALL.BASE, A simulated TEE if needed

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ReleaseTool.cfg

    r1541 r1542  
    112112Password     =
    113113
     114[SMTP]
     115Command      = g:\pmmail\bin\pmmsend -a G:\PMMail\Accounts\ygk_us0.act -t "%%TO%%" -s "%%SUBJECT%%" -m %%MESSAGE_BODY_FILE%%
  • trunk/ReleaseTool.cmd

    r1541 r1542  
    5353 *    31 May 10 JBS Build zip file and Hobbes txt file in Warpin directory
    5454 *
     55 * To Do
     56 *    -  Improve support for external CMD files which perform some or all of a task
     57 *    -  Support sending email via PMMSend?
     58 *    -  Support sending email via REXXMail?
    5559*/
    5660
     
    6771*/
    6872
    69 globals = 'cfg. ver. mainmenu. cmd. Hobbes. loaded. prev_user_choice'
     73globals = 'cfg. ver. mainmenu. cmd. Hobbes. available. prev_user_choice'
    7074
    7175parse arg args
     
    164168                  prev_user_choice = user_choice
    165169               end
     170            when user_choice = 'S' then
     171               do /* Open a command line */
     172                  dirsave = directory()
     173                  svndrive = filespec('D', cmd.smartsvn)
     174                  svndrive_dirsave = directory(svndrive)
     175                  call directory strip(svndrive || filespec('P', cmd.smartsvn), 'T', '\')
     176                  call ExecCmd 'call smartsvn.cmd'
     177                  call directory svndrive_dirsave
     178                  call directory dirsave
     179                  say;say
     180                  say 'If SmartSVN did not run correctly, make sure the default Java'
     181                  say 'is Java 1.4.1 or later before running ReleaseTool.'
     182                  prev_user_choice = user_choice
     183               end
    166184            when user_choice = mainmenu.Ensure_work_done_num then
    167185               do /* Ensure all work (by others) is comitted */
    168                   call NotYet user_choice
    169                   say 'Notify programmers to commit their work for this release.'
    170                   say
    171                   say 'Use the Netlabs FM/2 Developer''s mailing list and wait 24 hours.'
     186                  if cfg.SMTP.1.Command = '' then
     187                     do
     188                        say
     189                        say 'A "send-email" command was not found in' cfg.filename || '.'
     190                        say 'So this will have to be done manually.'
     191                        say
     192                        say 'Notify programmers to commit their work for this release.'
     193                        say
     194                        say 'Use the Netlabs FM/2 Developer''s mailing list and wait 24 hours.'
     195                     end
     196                  else
     197                     do
     198                        say
     199                        say 'Sending a noptification email to FM/2 developers...'
     200                        say
     201                        say 'Proposed subject:'
     202                        subj = 'Commit work for FM/2' ver.full
     203                        say '   ' || subj
     204                        say
     205                        say 'If this subject is acceptable, just press Enter. Otherwise'
     206                        say 'type in the desired subject for the notification email:'
     207                        response = strip(linein())
     208                        if response \= '' then
     209                           subj = response
     210                        SMTPBody_file = SysTempFilename('SMTPBody.???')
     211                        call lineout SMTPBody_file, 'The release of FM/2' ver.full 'is imminent.'
     212                        call lineout SMTPBody_file, ''
     213                        call lineout SMTPBody_file, 'Please commit all work for this release within 24 hours.'
     214                        call lineout SMTPBody_file, ''
     215                        call lineout SMTPBody_file, 'Reply to this email if there are reasons to delay the release.'
     216                        call stream  SMTPBody_file, 'c', 'close'
     217                        say
     218                        say 'The proposed body of the notification email will now be loaded into an editor.'
     219                        say 'Make desired changes, if any, and save the file.'
     220                        say
     221                        call charout, 'Press any key when ready to load the message body into an editor: '
     222                        call SysGetKey
     223                        say
     224                        call ExecCmd cmd.editor SMTPBody_file
     225                        call SendSMTP 'TO=fm2-dev@netlabs.org <fm2-dev@netlabs.org>', ,
     226                                      'SUBJ=' || subj, ,
     227                                      'BODYFILE=' || SMTPBody_file
     228                        call SysFileDelete SMTPBody_file
     229                     end
    172230                  prev_user_choice = user_choice
    173231               end
     
    188246            when user_choice = mainmenu.Check_SVN_status_num then
    189247               do /* Ensure all local source is up to date */
    190                   if right(translate(cmd.processor), 8) = '4OS2.EXE' then
     248                  if cmd.processor_is_4os2 = 1 then
    191249                     svn_cmd = 'svn status -v |&' cmd.pager
    192250                  else
     
    222280            when user_choice = mainmenu.WARNALL_build_num then
    223281               do /* Ensure the edits build */
     282                  say
    224283                  'set WARNALL=1'
    225284                  call ExecCmd 'wmake -a all | tee warnall.log |' cmd.pager
     
    227286                  call ExecCmd 'diff.exe -rub warnall.base warnall.log > warnall.diff'
    228287                  call ExecCmd cmd.editor 'warnall.diff'
     288                  say
     289                  call charout , 'Make WARNALL.LOG the new WARNALL.BASE? (y/N): '
     290                  if translate(SysGetKey()) = 'Y' then
     291                     'copy WARNALL.LOG WARNALL.BASE'
     292                  say
    229293                  prev_user_choice = user_choice
    230294               end
     
    334398            when user_choice = mainmenu.Announce_num then
    335399               do /* Announce the release. */
    336                   if loaded.RXSOCK = 1 then
     400                  if available.RXSOCK = 1 then
    337401                     call AnnounceToNewsgroups
    338402                  else
     
    361425            '@pause'
    362426      end
     427      if available.tee = 0 then
     428         call SysFileDelete 'tee.cmd'
    363429end
    364430
     
    374440   call RxFuncAdd "SockLoadFuncs", "RXSOCK", "SockLoadFuncs"
    375441   call SockLoadFuncs 0
    376    loaded.RXSOCK = 1
     442   available.RXSOCK = 1
    377443
    378444/*
     
    386452   rcx = 1
    387453   if rcx = 1 then
    388       loaded.RXSOCK = 1
     454      available.RXSOCK = 1
    389455   else
    390456      do
    391          loaded.RXSOCK = 0
     457         available.RXSOCK = 0
    392458         call RxFuncDrop "SockLoadFuncs", "RXSOCK", "SockLoadFuncs"
    393459         say
     
    408474   signal on syntax name Error
    409475   if rcx = 1 then
    410       loaded.RXFTP = 1
     476      available.RXFTP = 1
    411477   else
    412478      do
    413          loaded.RXFTP = 0
     479         available.RXFTP = 0
    414480         say
    415481         say 'RXFTP.DLL load failed.'
     
    445511   cmd.           = ''
    446512   cmd.processor  = value('COMSPEC',,'OS2ENVIRONMENT')
     513   cmd.processor_is_4os2 = Is4OS2()
     514   if cmd.processor_is_4os2 = 1 then
     515      available.tee = 1
     516   else
     517      do
     518         if SysSearchPath('PATH', 'tee.exe') \= '' then
     519            available.tee = 1
     520         else
     521            do
     522               available.tee = 0
     523               call SysFileDelete 'tee.cmd'
     524               call lineout 'tee.cmd', '/* */'
     525               call lineout 'tee.cmd', 'parse arg filename'
     526               call lineout 'tee.cmd', 'call SysFileDelete filename'
     527               call lineout 'tee.cmd', 'do while lines() > 0'
     528               call lineout 'tee.cmd', '   parse pull line'
     529               call lineout 'tee.cmd', '   call lineout filename, line'
     530               call lineout 'tee.cmd', '   say line'
     531               call lineout 'tee.cmd', 'end'
     532               call lineout 'tee.cmd', "call stream filename, 'c', 'close'"
     533               call stream  'tee.cmd', 'c', 'close'
     534            end
     535      end
    447536   userprompt = value('PROMPT',,'OS2ENVIRONMENT')
    448537   parse var userprompt . '$e[' colorset 'm' .
     
    474563      end
    475564
     565   cmd.smartsvn   = SysSearchPath('PATH', 'smartsvn.cmd')
    476566   cmd.tester     = value('SVN_TESTER',,'OS2ENVIRONMENT')
    477    cmd.killpid        = value('SVN_KILL',,'OS2ENVIRONMENT')
    478    if cmd.killpid == '' then
    479       cmd.killpid      = 'killpid'
    480    cmd.killtarget  = 'FM/2'
     567   cmd.killpid    = value('SVN_KILL',,'OS2ENVIRONMENT')
     568   if cmd.killpid = '' then
     569      cmd.killpid = 'killpid'
     570   cmd.killtarget = 'FM/2'
    481571
    482572   m = 0
     
    588678   cfg.FTP.keys   = 'DESCRIPTIVE_HOSTNAME HOST USERID PASSWORD DIRECTORY FILE'
    589679   cfg.NNTP.keys  = 'NEWSGROUPS HOST USERID PASSWORD'
    590    cfg.SMTP.keys  = ''
     680   cfg.SMTP.keys  = 'COMMAND'
    591681
    592682   cfg.NNTP.closing               = cfg.crlf || cfg.crlf || '.' || cfg.crlf
     
    675765      end
    676766      say
    677       call charout , 'N)ext C)ommandline Q)uit or mennu item number: '
     767      call charout , 'N)ext C)ommandline '
     768      if cmd.smartsvn \= '' then
     769         call charout , 'S)martSVN '
     770      call charout , 'Q)uit or mennu item number: '
    678771      user_choice = translate(translate(SysGetKey()), 'N', '0d'x)
    679       if user_choice = 'N' | user_choice = 'C' | user_choice = 'Q' then
     772      if user_choice = 'N' | ,
     773         user_choice = 'C' | ,
     774         user_choice = 'Q' | ,
     775         (cmd.smartsvn \= '' & user_choice = 'S') then
    680776         leave
    681777      if datatype(user_choice) = 'NUM' then
     
    689785         end
    690786   end
     787   say
    691788   if user_choice = 'N' then
    692789      if prev_user_choice = 'N/A' then
     
    804901Commandline: procedure expose (globals)
    805902   signal off Error
    806    if right(translate(cmd.processor), 8) = '4OS2.EXE' then
     903   if cmd.processor_is_4os2 = 1 then
    807904      '@' || cmd.processor "prompt"  cmd.prompt
    808905   else
     
    817914   signal on Error
    818915return
     916
     917/*=== Is4OS2() Return true if 4OS2 running ===*/
     918Is4OS2: procedure
     919  call setlocal
     920  '@set X=%@eval[0]'
     921  yes = value('X',, 'OS2ENVIRONMENT') = 0
     922  call endlocal
     923return yes                              /* if running under 4OS2 */
    819924
    820925RunTester: procedure expose (globals)
     
    10781183                           say '   ' tmpzipfile
    10791184                           say 'as an attachment. In the text of the message, please describe'
    1080                            say 'the errors you detected in detail. Thank you.'
     1185                           say 'the errors you detected in detail. After the email has been sent'
     1186                           say 'you may delete:'
     1187                           say '   ' tmpzipfile
    10811188                           say
    10821189                           'pause'
     
    10911198
    10921199UploadRelease: procedure expose (globals)
    1093    if loaded.RXFTP = 0 then
     1200   if available.RXFTP = 0 then
    10941201      do
    10951202         say 'Until RXFTP.DLL is placed in a directory on the LIBPATH,'
     
    15771684return
    15781685
     1686SendSMTP: procedure expose (globals)
     1687   email_command = cfg.SMTP.1.Command
     1688   do i = 1 to arg()
     1689      parse value arg(i) with key '=' key_value
     1690      key = translate(key)
     1691      select
     1692         when (key = 'TO' & pos('%%TO%%', email_command) > 0) then
     1693            do
     1694               parse var email_command part1 '%%TO%%' part2
     1695               email_command = part1 || key_value || part2
     1696            end
     1697         when (key = 'SUBJ' & pos('%%SUBJECT%%', email_command) > 0) then
     1698            do
     1699               parse var email_command part1 '%%SUBJECT%%' part2
     1700               /* JBS: Test code */
     1701               email_command = part1 || '[TEST message. Ignore] ' || key_value || part2
     1702/*
     1703               email_command = part1 || key_value || part2
     1704*/
     1705            end
     1706         when (key = 'BODYFILE' & pos('%%MESSAGE_BODY_FILE%%', email_command) > 0) then
     1707            do
     1708               parse var email_command part1 '%%MESSAGE_BODY_FILE%%' part2
     1709               email_command = part1 || stream(key_value, 'c', 'query exists') || part2
     1710            end
     1711         otherwise
     1712            say 'Program error: Unknown param: "' || arg(i) || '" for SendSMTP function.'
     1713      end
     1714   end
     1715   /* JBS: Test code */
     1716   say
     1717   say 'While the new email code is being tested and debugged:'
     1718   say '1) All subjects will be prefaced by: "[TEST message. Ignore]"'
     1719   say '2) A "preview" of the pending email command will be displayed.'
     1720   say
     1721   say 'If the email command is unsuccessful, please copy and paste it and'
     1722   say 'post it, along with a description of the error(s) and, if possible,'
     1723   say 'a proposed correction to the fm2-dev mailiing list.'
     1724   say
     1725   say 'The pending email command:'
     1726   say '   ' email_command
     1727   say
     1728   call charout , 'Press any key when ready to execute this command...'
     1729   call SysGetKey
     1730   say;say
     1731   call ExecCmd email_command
     1732return
     1733
    15791734/*** Usage/Error routines ***/
    15801735
     
    16441799return
    16451800
    1646 Log_Error: procedure expose cfg.
    1647 return
    1648 
Note: See TracChangeset for help on using the changeset viewer.