Changeset 1541


Ignore:
Timestamp:
Jul 3, 2010, 3:32:52 AM (15 years ago)
Author:
John Small
Message:

ReleaseTool: Major changes

  • Support for uploading files (if RXFTP.DLL is loadable)
  • Support for sending announcements to newsgroups (if RXSOCK.DLL, which I believe is part of OS/2's standard TCP/IP, is loadable)
  • Use of a new file, ReleaseTool.cfg, to provide flexibility
  • A new task, TestWPI, with a submenu: 1) View WPI 2) De-install FM/2 and delete all files 3) Install FM/2 4) Test the new installation 5) Zip files for analysis of WPI file problems
  • User interface changes

New startup parameters supported
Main menu

Tasks have been reordered, merged and added
"Next" command added to facilitate sequential proceesing thru the menu
Improved prompt when opeing commandline sessions

Improved format and text of messages

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ReleaseTool.cmd

    r1540 r1541  
    22 * $Id$
    33 *
    4  * ReleaseTool: Provides a guide and assitance to the process
    5  *              of building a release version of FM/2.
     4 * ReleaseTool: Provides a guide and assitance to the process of
     5 *              of building, uploading and announcing a release of FM/2.
    66 *
    77 * As a minimum, the menu provides a list of what needs to be done.
     
    1010 *
    1111 * Usage:
    12  *    ReleaseTool [trace=<trace-option>]
     12 *    ReleaseTool [version] [/?] [trace=<trace-option>]
    1313 *
    1414 *    where
     15 *       version is the version for the pending release
     16 *       /? : Causes help/usage screens to be displayed (and exits).
    1517 *       <trace-option> is a valid comnbination of trace options:
    1618 *          '? a c e f i l n o r'. This is an OPTIONAL parameter.
     19 *    All parameters are optional.
    1720 *
    1821 * This program uses the following enviromental variables, if set
    1922 *    SVN_EDITOR or EDITOR to set the text editor that is called
     23 *       If neither is set, then TEDIT is used.
    2024 *    SVN_TESTER to call a cmd file that copies files to your test directory
    2125 *               and changes to that directory
    2226 *    SVN_KILL allows you to set a program to kill any running version of FM/2
    2327 *             killpid is used as default (must be in path)
     28 *    SVN_WPIVIEWER or WPIVIEWER to set the program to view WPI files
     29 *       If neither is set, then WIC is used.
     30 *    PAGER to set the "pager" program (usually MORE or LESS)
     31 *       If PAGER is not set, then LESS if used if it is on the PATH
     32 *       and MORE is used if LESS is not on the PATH.
    2433 *
    2534 * Change log:
     
    4958
    5059signal on Error
    51 signal on FAILURE name Error
    52 signal on Halt
    53 signal on NOTREADY name Error
    54 signal on NOVALUE name Error
     60signal on Failure name Error
     61signal on Notready name Error
     62signal on Novalue name Error
    5563signal on SYNTAX name Error
     64/* JBS: for debugging */
    5665/*
    57 signal on novalue             /* for debugging */
     66signal on Novalue
    5867*/
    5968
    60 
    61 globals = 'ver cmd prompt editor editorcmds killpid tester killtarget version_filelist pager prev_action'
     69globals = 'cfg. ver. mainmenu. cmd. Hobbes. loaded. prev_user_choice'
    6270
    6371parse arg args
     72if wordpos('/?', args) > 0 | ,
     73   wordpos('-?', args) > 0 | ,
     74   wordpos('/H', translate(args)) > 0 | ,
     75   wordpos('-H', args) > 0 then
     76   do
     77      call Usage
     78      exit
     79   end
     80
    6481p = pos('TRACE=', translate(args))
    6582if p > 0 then
     
    84101else
    85102   traceopt = ''
    86 if strip(args) \= '' then  /* trace= is the only supported parameter */
    87    call Usage
    88 
    89 call Init
    90 
    91 do forever
    92    call SysCls
    93    action = DisplayMenu()
    94    if stream(action || '.cmd', 'c', 'query exists') \= '' then
     103
     104call Init strip(args)
     105cfginit_rc = CfgInit()
     106select
     107   when cfginit_rc > 10000 then
    95108      do
     109         say
     110         say 'Syntax error detected in' cfg.file
     111         say
     112         say 'A line that was not:'
     113         say '  - blank'
     114         say '  - a cooment line'
     115         say '  - a section name line (e.g. [FTP])'
     116         say '  - a "key-name = key-value" line'
     117         say 'was found at or around line:' (cfginit_rc - 10000)
     118         say
     119         say 'Correct the error and restart.'
     120         exit
     121      end
     122   when cfginit_rc < -10000 then
     123      do
     124         say
     125         say 'Syntax error detected in' cfg.file
     126         say
     127         say 'An unknown key-name was found at or around line:' (-cfginit_rc - 10000)
     128         say
     129         say 'Correct the error and restart.'
     130         exit
     131      end
     132   otherwise
     133      do forever
     134         user_choice = DisplayMenu()
     135         if datatype(user_choice) = 'NUM' then
     136            call NewScreenWithHeading user_choice
     137         cmdfile_option = ''
     138         if stream(user_choice || '.cmd', 'c', 'query exists') \= '' then
     139            do
     140               say
     141               say 'Found 'user_choice'.cmd.'
     142               say
     143               say 'Do you want to run it...'
     144               say '   I)nstead of the default processing'
     145               say '   B)efore the default processing'
     146               say '   A)fter the default processing'
     147               say '   N)ot at all (Default)'
     148               say
     149               call charout , 'Type the first letter of your choice (I/B/A/N): '
     150               cmdfile_option = translate(SysGetKey())
     151               say
     152               if cmdfile_option = 'I' | cmdfile_option = 'B' then
     153                  do
     154                     call ExecCmd 'call' user_choice || '.cmd.'
     155                     if cmdfile_option = 'I' then
     156                        user_choice = -1             /* Skip SELECT below */
     157                  end
     158               prev_user_choice = user_choice
     159            end
     160         select
     161            when user_choice = 'C' then
     162               do /* Open a command line */
     163                  call Commandline
     164                  prev_user_choice = user_choice
     165               end
     166            when user_choice = mainmenu.Ensure_work_done_num then
     167               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.'
     172                  prev_user_choice = user_choice
     173               end
     174            when user_choice = mainmenu.Verify_tickets_closed_num then
     175               do /* Verify completed tickets are marked closed */
     176                  call NotYet user_choice
     177                  say 'Check for committed work.'
     178                  prev_user_choice = user_choice
     179               end
     180            when user_choice = mainmenu.Local_SVN_update_num then
     181               do /* Ensure all work (by others) is local */
     182                  svn_cmd = 'svn update'
     183                  say
     184                  say 'Online and OK to execute: 'svn_cmd'? (Y/n)'
     185                  if translate(SysGetKey()) \= 'N' then call ExecCmd svn_cmd
     186                  prev_user_choice = user_choice
     187               end
     188            when user_choice = mainmenu.Check_SVN_status_num then
     189               do /* Ensure all local source is up to date */
     190                  if right(translate(cmd.processor), 8) = '4OS2.EXE' then
     191                     svn_cmd = 'svn status -v |&' cmd.pager
     192                  else
     193                     svn_cmd = 'svn status -v |' cmd.pager
     194                  say
     195                  say 'Online and OK to execute: 'svn_cmd'? (Y/n)'
     196                  if translate(SysGetKey()) \= 'N' then call ExecCmd svn_cmd
     197                  prev_user_choice = user_choice
     198               end
     199            when user_choice = mainmenu.Version_number_edits_num then
     200               do /* Edit version #'s and date/time stamps (ReleaseTool) */
     201                  do f = 1 to words(ver.filelist)
     202                     call ReleaseEdit ver.full word(ver.filelist, f) 'trace=' || traceopt
     203                     say
     204                  end
     205                  ver.filelist2 = 'HISTORY README'
     206                  do f = 1 to words(ver.filelist2)
     207                     file = word(ver.filelist2, f)
     208                     call NewScreenWithHeading user_choice
     209                     say
     210                     say 'Next, edit the' file 'file.'
     211                     say
     212                     say 'Include descriptions of salient changes to FM/2.'
     213                     say
     214                     say 'And be sure to update the version number to' ver.full
     215                     say
     216                     '@pause'
     217                     call ExecCmd cmd.editor file cmd.editorcmds
     218                  end
     219                  call BuildHobbesTxt
     220                  prev_user_choice = user_choice
     221               end
     222            when user_choice = mainmenu.WARNALL_build_num then
     223               do /* Ensure the edits build */
     224                  'set WARNALL=1'
     225                  call ExecCmd 'wmake -a all | tee warnall.log |' cmd.pager
     226                  'set WARNALL='
     227                  call ExecCmd 'diff.exe -rub warnall.base warnall.log > warnall.diff'
     228                  call ExecCmd cmd.editor 'warnall.diff'
     229                  prev_user_choice = user_choice
     230               end
     231            when user_choice = mainmenu.Test_WARNALL_build_num then
     232               do /* Test built code */
     233                  if cmd.tester == '' then
     234                     do
     235                        call NotYet user_choice
     236                        say 'Test the built code.'
     237                     end
     238                   else
     239                     call RunTester
     240                  prev_user_choice = user_choice
     241               end
     242            when user_choice = mainmenu.Commit_code_num then
     243               do /* Commit code */
     244                  call CommitifOK
     245                  prev_user_choice = user_choice
     246               end
     247            when user_choice = mainmenu.Build_all_for_release_num then
     248               do /* Build for the release */
     249                  'set WARNALL='
     250                  'set FORTIFY='
     251                  'set DEBUG='
     252                  call ExecCmd 'wmake -a all | tee build.log'
     253                  prev_user_choice = user_choice
     254               end
     255            when user_choice = mainmenu.Test_release_build_num then
     256               do /* Test the binaries */
     257                  if cmd.tester == '' then
     258                     do
     259                        call NotYet user_choice
     260                        say 'Test the binaries.'
     261                        say
     262                        say 'At a minimum you should run all the exes and do some'
     263                        say 'basic file manipulation with each.'
     264                        say
     265                        say 'You should, where possible, also verify that any bugs'
     266                        say 'that were fixed for the release are working as expected.'
     267                     end
     268                  else
     269                     call RunTester
     270                  prev_user_choice = user_choice
     271               end
     272            when user_choice = mainmenu.LXLITE_build_num then
     273               do /* Lxlite */
     274                  'wmake lxlite | tee lxlite.log'
     275                  prev_user_choice = user_choice
     276               end
     277            when user_choice = mainmenu.Test_LXLITE_build_num then
     278               do /* Test the release code */
     279                  if cmd.tester == '' then
     280                     do
     281                        call NotYet user_choice
     282                        say 'Test the (compressed) release code.'
     283                        say
     284                        say 'Verify that all exe''s continue to load and run after being compressed.'
     285                     end
     286                  else
     287                     call RunTester
     288                  prev_user_choice = user_choice
     289               end
     290            when user_choice = mainmenu.Build_WPI_file_num then
     291               do /* Build distro */
     292                  call ExecCmd 'wmake dist | tee dist.log'
     293                  prev_user_choice = user_choice
     294               end
     295            when user_choice = mainmenu.Test_WPI_file_num then
     296               do
     297                  call TestWPI user_choice
     298                  prev_user_choice = user_choice
     299               end
     300            when user_choice = mainmenu.Apply_tag_num then
     301               do /* Apply tag */
     302                  svn_cmd = 'svn copy -m"Tag release FM2-' || ver.tag || '" http://svn.netlabs.org/repos/fm2/trunk http://svn.netlabs.org/repos/fm2/tags/FM2-' || ver.tag
     303                  say;say;say
     304                  say 'Online and OK to execute:'
     305                  call charout , svn_cmd'? (y/N) '
     306                  choice2 = translate(SysGetKey())
     307                  say
     308                  if choice2 = 'Y' then call ExecCmd svn_cmd
     309                  prev_user_choice = user_choice
     310               end
     311            when user_choice = mainmenu.Zip_files_num then
     312               do
     313                  call ZipFiles
     314                  prev_user_choice = user_choice
     315               end
     316            when user_choice = mainmenu.WIKI_updates_num then
     317               do /* Wiki updates */
     318                  call NotYet user_choice
     319                  say '   Update "WikiStart" with the new version:' ver.full
     320                  say
     321                  say '   Update "RBuild" with the new tag: FM2-' || ver.tag
     322                  prev_user_choice = user_choice
     323               end
     324            when user_choice = mainmenu.Upload_num then
     325               do /* Upload to distribution points and announce. */
     326                  say
     327                  call UploadRelease
     328                  say
     329                  say 'Post a note to "Netlabs Community" <community@netlabs.org>'
     330                  say 'requesting that the release be moved to pub/fm2.'
     331                  say
     332                  prev_user_choice = user_choice
     333              end
     334            when user_choice = mainmenu.Announce_num then
     335               do /* Announce the release. */
     336                  if loaded.RXSOCK = 1 then
     337                     call AnnounceToNewsgroups
     338                  else
     339                     do
     340                        say 'Since RXSOCK.DLL failed to load, this will have to be done manually.'
     341                        say
     342                     end
     343                  prev_user_choice = user_choice
     344              end
     345            when user_choice = mainmenu.TRAC_update_and_Next_ver_num then
     346               do /* TRAC updates */
     347                  call TracUpdates
     348                  prev_user_choice = user_choice
     349               end
     350            when user_choice = 'Q' then
     351               leave
     352            otherwise
     353               nop
     354         end
     355         if cmdfile_option = 'A' then
     356            call Commandline
    96357         say;say;say
    97          say 'Found 'action'.cmd.'
    98          say
    99          call charout , 'Do you want to run it instead of the default processing? (Y/n): '
    100          entry = translate(SysGetKey())
    101          say
    102          if entry \= 'N' then
    103             do
    104                signal off Error
    105                '@'cmd '/c 'action
    106                signal on Error
    107                action = -1             /* Skip SELECT below */
    108             end
    109          prev_action = action
    110       end
    111    select
    112       when action = 0 then
    113          do /* Open a command line */
    114             signal off Error
    115             if right(translate(cmd), 8) = '4OS2.EXE' then
    116                '@' || cmd 'prompt [''exit'' to return to ReleaseTool]' || prompt
    117             else
    118                do
    119                   '@set prompt=[''exit'' to return to ReleaseTool]' || prompt
    120                   '@' || cmd
    121                end
    122             signal on Error
    123             prev_action = action
    124          end
    125       when action = 1 then
    126          do /* Ensure all work (by others) is comitted */
    127             call NotYet action
    128             say 'Notify programmers to commit their work for this release.'
    129             say
    130             say 'Use the Netlabs FM/2 Developer''s mailing list and wait 24 hours.'
    131             prev_action = action
    132          end
    133       when action = 2 then
    134          do /* Verify completed tickets are marked closed */
    135             call NotYet action
    136             say 'Check for committed work.'
    137             prev_action = action
    138          end
    139       when action = 3 then
    140          do /* Ensure all work (by others) is local */
    141             svn_cmd = 'svn update'
    142             say;say;say
    143             say 'Online and OK to execute: 'svn_cmd'? (Y/n)'
    144             if translate(SysGetKey()) \= 'N' then svn_cmd
    145             prev_action = action
    146          end
    147       when action = 4 then
    148          do /* Ensure all local source is up to date */
    149             if cmd = '4OS2' then
    150                svn_cmd = 'svn status -v |& less'
    151             else
    152                svn_cmd = 'svn status -v | less'
    153             say;say;say
    154             say 'Online and OK to execute: 'svn_cmd'? (Y/n)'
    155             if translate(SysGetKey()) \= 'N' then svn_cmd
    156             prev_action = action
    157          end
    158       when action = 5 then
    159          do /* Edit version #'s and date/time stamps (ReleaseTool) */
    160             call SysCls
    161             if strip(ver) = '' then
    162                ver = GetVer('the pending release')
    163             do f = 1 to words(version_filelist)
    164                call ReleaseEdit ver word(version_filelist, f) 'trace=' || traceopt
    165                say
    166             end
    167             version_filelist2 = 'HISTORY README'
    168             do f = 1 to words(version_filelist2)
    169                file = word(version_filelist2, f)
    170                call SysCls
    171                say;say;say
    172                say 'Next, edit the' file 'file.'
    173                say
    174                say 'Include descriptions of salient changes to FM/2.'
    175                say
    176                say 'And be sure to update the version number to' ver
    177                say
    178                '@pause'
    179                editor file editorcmds
    180             end
    181             call BuildHobbesTxt(ver)
    182             prev_action = action
    183          end
    184       when action = 6 then
    185          do /* Ensure the edits build */
    186             'set WARNALL=1'
    187             'wmake -a all | tee warnall.log |' pager
    188             'diff -rub warnall.base warnall.log > warnall.diff'
    189             editor 'warnall.diff'
    190             'set WARNALL='
    191             prev_action = action
    192          end
    193       when action = 7 then
    194          do /* Test built code */
    195             if tester == '' then
    196                do
    197                   call NotYet action
    198                   say 'Test the built code.'
    199                end
    200              else
    201                do  /*kills FM/2 using killpid from FM/2 utils (must be in path) and run cmd to copy files
    202                     to test directory and change to that directory must type exit to return here*/
    203                   killpid killtarget
    204                   cmd tester
    205                end
    206             prev_action = action
    207          end
    208       when action = 8 then
    209          do /* Commit code */
    210             call CommitifOK
    211             prev_action = action
    212          end
    213       when action = 9 then
    214          do /* Apply tag */
    215             call SysCls
    216             if strip(ver) = '' then
    217                ver = GetVer('the pending release')
    218             svn_cmd = 'svn copy -m"Tag release FM2-' || Tag_ver(ver) || '" http://svn.netlabs.org/repos/fm2/trunk http://svn.netlabs.org/repos/fm2/tags/FM2-' || Tag_ver(ver)
    219             say;say;say
    220             say 'Online and OK to execute: 'svn_cmd'? (y/N)'
    221             if translate(SysGetKey()) = 'Y' then svn_cmd
    222             prev_action = action
    223          end
    224       when action = 10 then
    225          do /* Build for the release */
    226             'set WARNALL='
    227             'set FORTIFY='
    228             'set DEBUG='
    229             'wmake -a all | tee build.log'
    230             prev_action = action
    231          end
    232       when action = 11 then
    233          do /* Test the binaries */
    234             if tester == '' then
    235                do
    236                   call NotYet action
    237                   say 'Test the binaries.'
    238                   say
    239                   say 'At a minimum you should run all the exes and do some'
    240                   say 'basic file manipulation with each.'
    241                   say
    242                   say 'You should, where possible, also verify that any bugs'
    243                   say 'that were fixed for the release are working as expected.'
    244                end
    245             else
    246                do  /*kills FM/2 using killpid from FM/2 utils (must be in path) and run cmd to copy files
    247                     to test directory and change to that directory must type exit to return here*/
    248                   killpid killtarget
    249                   cmd tester
    250                end
    251             prev_action = action
    252          end
    253       when action = 12 then
    254          do /* Lxlite */
    255             'wmake lxlite | tee lxlite.log'
    256             prev_action = action
    257          end
    258       when action = 13 then
    259          do /* Test the release code */
    260             if tester == '' then
    261                do
    262                   call NotYet action
    263                   say 'Test the (compressed) release code.'
    264                   say
    265                   say 'Verify that all exe''s continue to load and run after being compressed.'
    266                end
    267             else
    268               do  /*kills FM/2 using killpid from FM/2 utils (must be in path) and run cmd to copy files
    269                     to test directory and change to that directory must type exit to return here*/
    270                   killpid killtarget
    271                   cmd tester
    272               end
    273             prev_action = action
    274          end
    275       when action = 14 then
    276          do /* Build distro */
    277             call SysCls
    278             'wmake dist | tee dist.log'
    279             prev_action = action
    280          end
    281       when action = 15 then
    282          do /* Zip distro */
    283             call SysCls
    284             if strip(ver) = '' then
    285                ver = GetVer('the pending release')
    286             zip_ver = translate(ver, '-', '.')
    287             'zip -jX9 .\warpin\fm2-' || zip_ver || ' warpin\fm2-' || zip_ver || '.wpi'
    288             prev_action = action
    289          end
    290       when action = 16 then
    291          do /* Zip FM/2 Utilities' */
    292             call NotYet action
    293             say 'If FM/2 Utilities have been updated, then zip them up.'
    294             prev_action = action
    295          end
    296       when action = 17 then
    297          do /* Wiki updates */
    298             call SysCls
    299             if strip(ver) = '' then
    300                ver = GetVer('the pending release')
    301             call NotYet action
    302             say 'Wiki updates'
    303             say
    304             say '   Update "WikiStart" with the new version:' ver
    305             say
    306             say '   Update "RBuild" with the new tag: FM2-' || translate(ver, '-', '.')
    307             prev_action = action
    308          end
    309       when action = 18 then
    310          do /* TRAC updates */
    311             call NotYet action
    312             say 'TRAC updates'
    313             say
    314             say '   Create a TRAC version for the next version, if needed.'
    315             say
    316             say '   Mark the next version as the default version for new tickets.'
    317             say
    318             say '   Create a TRAC milestone for the next version release, if needed.'
    319             say
    320             say '   Mark the new milestone as the default milestone.'
    321             say
    322             say '   Mark the completed milestone as complete and'
    323             say '   move any residual tickets to a future milestone.'
    324             say '   (TRAC can move the tickets in bulk when you mark'
    325             say '   the version milestone complete.)'
    326             prev_action = action
    327          end
    328       when action = 19 then
    329          do /* Upload to distribution points and announce. */
    330             call NotYet action
    331             say 'Upload WPI file to distribution points.'
    332             say
    333             say 'Announce release to mailing lists, Usenet, etc.'
    334             say
    335             say 'Post a note to "Netlabs Community" <community@netlabs.org>'
    336             say 'requesting that the release be moved to pub/fm2.'
    337             prev_action = action
    338          end
    339       when action = 20 then
    340          do /* Set next version */
    341             next_ver = GetVer('the next release')
    342             do f = 1 to words(version_filelist)
    343                call ReleaseEdit next_ver word(version_filelist, f) 'trace=' || traceopt
    344                say
    345             end
    346             call CommitifOK version_filelist
    347             prev_action = action
    348          end
    349       otherwise
    350          nop
    351    end
    352    say;say;say
    353    if action \= 0 then
    354       '@pause'
     358         if user_choice \= 'Q' & ,
     359            user_choice \= 'C' & ,
     360            user_choice \= mainmenu.Test_WPI_file_num then
     361            '@pause'
     362      end
    355363end
    356364
     
    358366
    359367return
    360 
    361 /*** Error routine ***/
    362 novalue:
    363   say 'Uninitialized value found on line:' sigl
    364   do i = sigl-3 to sigl+3
    365      if i = sigl then
    366         call charout , '--> '
    367      else
    368         call charout , '    '
    369      say sourceline(i)
    370   end
    371 exit
    372 
    373 Usage:
    374    say;say;say
    375    i = 1
    376    do forever
    377       srcline = sourceline(i)
    378       if pos('CHANGE LOG', translate(srcline)) > 0 then
    379          leave
    380       else
    381          say srcline
    382       i = i + 1
    383       if (i // 22) = 0 then
    384          '@pause'
    385    end
    386 exit
    387368
    388369/*** Subroutines ***/
     
    391372   call SysLoadFuncs
    392373
    393    action = 0
    394    ver = ''
    395 
    396    editor = value('SVN_EDITOR',,'OS2ENVIRONMENT')
    397    editorcmds = ""
    398    if editor = '' then
    399       editor = value('EDITOR',,'OS2ENVIRONMENT')
    400    if editor = '' then
    401       editor = 'tedit'
     374   call RxFuncAdd "SockLoadFuncs", "RXSOCK", "SockLoadFuncs"
     375   call SockLoadFuncs 0
     376   loaded.RXSOCK = 1
     377
     378/*
     379   rcx = 0
     380   call RxFuncAdd "SockLoadFuncs", "RXSOCK", "SockLoadFuncs"
     381   signal on syntax name rxsockerr
     382   call SockLoadFuncs 0
     383   rcx = 1
     384rxsockerr:
     385   signal on syntax name Error
     386   rcx = 1
     387   if rcx = 1 then
     388      loaded.RXSOCK = 1
    402389   else
    403390      do
    404          upperwrd1 = translate(word(editor, 1))
     391         loaded.RXSOCK = 0
     392         call RxFuncDrop "SockLoadFuncs", "RXSOCK", "SockLoadFuncs"
     393         say
     394         say 'RXSOCK.DLL load failed.'
     395         say 'Newsgroup announcements will not be possible.'
     396         say
     397         '@pause'
     398      end
     399
     400*/
     401
     402   rcx = 0
     403   call RxFuncAdd "FtpLoadFuncs", "RXFTP", "FTPLOADFUNCS"
     404   signal on syntax name rxftperr
     405   call FtpLoadFuncs 1
     406   rcx = FtpSetBinary("Binary")
     407rxftperr:
     408   signal on syntax name Error
     409   if rcx = 1 then
     410      loaded.RXFTP = 1
     411   else
     412      do
     413         loaded.RXFTP = 0
     414         say
     415         say 'RXFTP.DLL load failed.'
     416         say 'Uploads will not be possible.'
     417         say
     418         '@pause'
     419      end
     420
     421   ver. = ''
     422   parse arg ver.in
     423   call SetVer
     424   ver.filelist = 'av2.def databar.def dirsize.def dll\fm3dll.def dll\fm3res.def'
     425   ver.filelist = ver.filelist 'dll\version.h eas.def fm3.def fm4.def global.def ini.def'
     426   ver.filelist = ver.filelist 'killproc.def sysinfo.def undel.def vcollect.def vdir.def'
     427   ver.filelist = ver.filelist 'viewinfs.def vtree.def file_id.diz'
     428   ver.filelist = ver.filelist 'warpin\makefile dll\copyright.h'
     429
     430   Hobbes.                       = ''
     431   Hobbes.default_name           = 'Gregg Young'
     432   Hobbes.default_email          = 'ygk@qwest.net'
     433   Hobbes.TxtFilename            = '.\warpin\fm2-' || ver.wpi || '.txt'
     434   if stream(Hobbes.TxtFilename, 'c', 'query exists') \= ''then
     435      do
     436         call SysFileSearch 'Email address:', Hobbes.TxtFilename, 'lines.'
     437         if lines.0 = 1 then
     438            Hobbes.uploader_email_address = word(lines.1, 3)
     439         else  /* JBS: Prompt for edit to fix or delete the file here? */
     440            Hobbes.uploader_email_address = 'N/A (' || Hobbes.TxtFilename 'has zero or more than one email addresses!)'
     441      end
     442   else
     443      Hobbes.uploader_email_address = 'N/A (' || Hobbes.TxtFilename 'does not yet exist!)'
     444
     445   cmd.           = ''
     446   cmd.processor  = value('COMSPEC',,'OS2ENVIRONMENT')
     447   userprompt = value('PROMPT',,'OS2ENVIRONMENT')
     448   parse var userprompt . '$e[' colorset 'm' .
     449   if colorset = '' then
     450      colorset = '0'
     451   if pos('$i', userprompt) > 0 then
     452      row = '2'
     453   else
     454      row = '1'
     455   cmd.prompt     = "$e[s$e[" || row || ";1H$e[34;47mType 'exit' to return to ReleaseTool$e[K$e[" || colorset || "m$e[u" || userprompt
     456   cmd.pager      = value('PAGER',,'OS2ENVIRONMENT')
     457   if cmd.pager = '' then
     458      if SysSearchPath( 'PATH', 'less.exe') \= '' then
     459         cmd.pager = 'less'
     460      else
     461         cmd.pager = 'more'
     462
     463   cmd.editor = value('SVN_EDITOR',,'OS2ENVIRONMENT')
     464   cmd.editorparms = ""
     465   if cmd.editor = '' then
     466      cmd.editor = value('EDITOR',,'OS2ENVIRONMENT')
     467   if cmd.editor = '' then
     468      cmd.editor = 'tedit'
     469   else
     470      do
     471         upperwrd1 = translate(word(cmd.editor, 1))
    405472         if upperwrd1 = 'EPM' | upperwrd1 = 'EPM.EXE' then
    406             editorcmds = "'3'"
    407       end
    408    cmd         = value('COMSPEC',,'OS2ENVIRONMENT')
    409    prompt      = value('PROMPT',,'OS2ENVIRONMENT')
    410    tester      = value('SVN_TESTER',,'OS2ENVIRONMENT')
    411    killpid     = value('SVN_KILL',,'OS2ENVIRONMENT')
    412    if killpid == '' then
    413        killpid      = 'killpid'
    414    killtarget  = 'FM/2'
    415 
    416    version_filelist =                  'av2.def databar.def dirsize.def dll\fm3dll.def dll\fm3res.def'
    417    version_filelist = version_filelist 'dll\version.h eas.def fm3.def fm4.def global.def ini.def'
    418    version_filelist = version_filelist 'killproc.def sysinfo.def undel.def vcollect.def vdir.def'
    419    version_filelist = version_filelist 'viewinfs.def vtree.def file_id.diz'
    420    version_filelist = version_filelist 'warpin\makefile'
    421    version_filelist = version_filelist 'dll\copyright.h'
    422 
    423    pager = value('PAGER',,'OS2ENVIRONMENT')
    424    if pager = '' then
    425       if SysSearchPath( 'PATH', 'less.exe') \= '' then
    426          pager = 'less'
     473            cmd.editorparms = "'3'"
     474      end
     475
     476   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'
     481
     482   m = 0
     483
     484   m = m + 1
     485   mainmenu.Ensure_work_done_num       = m
     486   mainmenu.m.text                     = 'Ensure all work for this release is committed.'
     487   m = m + 1
     488   mainmenu.Verify_tickets_closed_num  = m
     489   mainmenu.m.text                     = 'Verify completed tickets are marked closed.'
     490   m = m + 1
     491   mainmenu.Local_SVN_update_num       = m
     492   mainmenu.m.text                     = '(SVN) Update local files.'
     493   m = m + 1
     494   mainmenu.Check_SVN_status_num       = m
     495   mainmenu.m.text                     = 'Check (SVN) status of local files.'
     496   m = m + 1
     497   mainmenu.Version_number_edits_num   = m
     498   mainmenu.m.text                     = 'Edit various files with version #''s and date''s.'
     499   m = m + 1
     500   mainmenu.WARNALL_build_num          = m
     501   mainmenu.m.text                     = 'Ensure the edits build. (WARNALL build)'
     502   m = m + 1
     503   mainmenu.Test_WARNALL_build_num     = m
     504   mainmenu.m.text                     = 'Test built code.'
     505   m = m + 1
     506   mainmenu.Commit_code_num            = m
     507   mainmenu.m.text                     = 'Commit code.'
     508   m = m + 1
     509   mainmenu.Build_all_for_release_num  = m
     510   mainmenu.m.text                     = 'Build (all) for the release.'
     511   m = m + 1
     512   mainmenu.Test_release_build_num     = m
     513   mainmenu.m.text                     = 'Test the release build.'
     514   m = m + 1
     515   mainmenu.LXLITE_build_num           = m
     516   mainmenu.m.text                     = 'Lxlite the build.'
     517   m = m + 1
     518   mainmenu.Test_LXLITE_build_num      = m
     519   mainmenu.m.text                     = 'Re-test the "lxlited" release code.'
     520   m = m + 1
     521   mainmenu.Build_WPI_file_num         = m
     522   mainmenu.m.text                     = 'Build distribution WPI file.'
     523   m = m + 1
     524   mainmenu.Test_WPI_file_num          = m
     525   mainmenu.m.text                     = 'Test WPI file.'
     526   m = m + 1
     527   mainmenu.Apply_tag_num              = m
     528   mainmenu.m.text                     = 'Apply tag.'
     529   m = m + 1
     530   mainmenu.Zip_files_num              = m
     531   mainmenu.m.text                     = 'Zip distribution WPI file(s).'
     532   m = m + 1
     533   mainmenu.WIKI_updates_num           = m
     534   mainmenu.m.text                     = 'Wiki updates.'
     535   m = m + 1
     536   mainmenu.Upload_num                 = m
     537   mainmenu.m.text                     = 'Upload to distribution points.'
     538   m = m + 1
     539   mainmenu.Announce_num               = m
     540   mainmenu.m.text                     = 'Aannounce the release.'
     541   m = m + 1
     542   mainmenu.TRAC_update_and_Next_ver_num  = m
     543   mainmenu.m.text                        = 'TRAC updates and set next version (no HISTORY or README update).'
     544
     545   mainmenu.0 = m
     546
     547   prev_user_choice = 'N/A'
     548return
     549
     550SetVer: procedure expose (globals)
     551   do forever
     552      if ver.in = '' then
     553         do
     554            say
     555            call charout , 'Please enter the version (x.yy.zz) for the pending release: '
     556            ver.in = linein()
     557         end
     558      parse var ver.in num1 '.' num2 '.' num3
     559      if num2    = '' then
     560         num2    = 0
     561      if num3 = '' then
     562         num3 = 0
     563      if datatype(num1) \= 'NUM' | datatype(num2) \= 'NUM' | datatype(num3) \= 'NUM' then
     564         do
     565            say 'Error: Invalid version entered:' ver.in
     566            ver.in = ''
     567         end
    427568      else
    428          pager = 'more'
    429    prev_action = 'N/A'
    430 return
     569         leave
     570   end
     571   /* The following will remove leading zeros */
     572   ver.major      = num1 + 0
     573   ver.minor      = num2 + 0
     574   ver.CSDlevel   = num3 + 0
     575   ver.full       = ver.major || '.' || ver.minor || '.' || ver.CSDlevel
     576   ver.list       = ver.major || '.' || right(ver.minor, 2, '0') || '.' || right(ver.CSDlevel, 2, '0')
     577   ver.wpi        = translate(ver.list, '-', '.')
     578   ver.tag        = translate(ver.list, '_', '.')
     579return
     580
     581CfgInit: procedure expose (globals)
     582   cfg.           = ''
     583   cfg.file       = 'ReleaseTool.cfg'
     584   cfg.crlf       = '0D0A'x
     585   cfg.FTP.0      = 0
     586   cfg.NNTP.0     = 0
     587   cfg.SMTP.0     = 0
     588   cfg.FTP.keys   = 'DESCRIPTIVE_HOSTNAME HOST USERID PASSWORD DIRECTORY FILE'
     589   cfg.NNTP.keys  = 'NEWSGROUPS HOST USERID PASSWORD'
     590   cfg.SMTP.keys  = ''
     591
     592   cfg.NNTP.closing               = cfg.crlf || cfg.crlf || '.' || cfg.crlf
     593   cfg.NNTP.signature_preface     = cfg.crlf || '-- ' || cfg.crlf
     594   cfg.NNTP.mime_version          = '1.0'
     595   cfg.NNTP.content_type          = 'text/plain; charset=US-ASCII'
     596   cfg.NNTP.content_transfer_encoding = '8bit'
     597   cfg.maxNNTPrecvbufsize = 200   /* JBS: Better number? */
     598   /* JBS: Better name? */
     599   cfg.NNTP.user_agent            = 'FM2NNTPPoster'
     600
     601   retval = 0
     602   linenum = 0
     603   node = ''
     604   do while (lines(cfg.file) > 0 & retval = 0)
     605      parse value linein(cfg.file) || ';' with line ';'
     606      linenum = linenum + 1
     607      line = strip(line)
     608      select
     609         when line = '' then
     610            nop      /* Skip blank/empty lines */
     611         when left(line, 1) = ';' then
     612            nop      /* Skip comment lines */
     613         when left(line, 1) = '[' then
     614            do
     615               if node = 'FTP' then
     616                  do
     617                     cfg.node.n.directory.0 = d
     618                     cfg.node.n.directory.d.file.0 = f
     619                  end
     620               parse upper var line '[' node ']'
     621               cfg.node.0 = cfg.node.0 + 1
     622               n = cfg.node.0
     623               d = 0
     624               f = 0
     625            end
     626         when pos('=', line) = 0 then
     627            retval = 10000 + linenum
     628         otherwise
     629            do
     630               parse var line key_name '=' key_value
     631               key_name = translate(strip(key_name))
     632               key_value = strip(key_value)
     633               if left(key_value, 1) = '"' then
     634                  parse var key_value '"' key_value '"'
     635               select
     636                  when wordpos(key_name, cfg.node.keys) = 0 then
     637                     retval = -(10000 + linenum)
     638                  when node = 'FTP' & key_name = 'DIRECTORY' then
     639                     do
     640                        d = d + 1
     641                        cfg.node.n.directory.d = key_value
     642                     end
     643                  when node = 'FTP' & key_name = 'FILE' then
     644                     do
     645                        if d = 0 then
     646                           do
     647                              d = 1
     648                              cfg.node.n.directory.d = ''
     649                           end
     650                        f = f + 1
     651                        cfg.node.n.directory.d.file.f = key_value
     652                     end
     653                  otherwise
     654                     cfg.node.n.key_name = key_value
     655               end
     656            end
     657      end
     658   end
     659   if node = 'FTP' then
     660      do
     661         cfg.node.n.directory.0 = d
     662         cfg.node.n.directory.d.file.0 = f
     663      end
     664   call stream cfg.file, 'c', 'close'
     665return retval
    431666
    432667DisplayMenu: procedure expose (globals)
     
    434669      call SysCls
    435670      say;say;say
    436       say 'Release Tasks' || copies(' ', 35) || 'Previous action:' prev_action
     671      say 'Release Tasks' || copies(' ', 35) || 'Previous action:' prev_user_choice
    437672      say
    438       say '1.  Ensure all work for this release is committed.'
    439       say '2.  Verify completed tickets are marked closed.'
    440       say '3.  (SVN) Update local files.'
    441       say '4.  Check (svn) status of local files.'
    442       say '5.  Edit various files with version #''s and date''s.'
    443       say '6.  Ensure the edits build. (WARNALL build)'
    444       say '7.  Test built code.'
    445       say '8.  Commit code.'
    446       say '9.  Apply tag.'
    447       say '10. Build (all) for the release.'
    448       say '11. Test the release build.'
    449       say '12. Lxlite the build.'
    450       say '13. Re-test the "lxlited" release code.'
    451       say '14. Build distribution WPI file.'
    452       say '15. Zip distribution WPI file.'
    453       say '16. (Optional) Zip FM/2 Utilities.'
    454       say '17. Wiki updates.'
    455       say '18. TRAC updates.'
    456       say '19. Upload to distribution points and announce release.'
    457       say '20. Set next version (no HISTORY or README update).'
     673      do m = 1 to mainmenu.0
     674         say right(m, 2) || '.' mainmenu.m.text
     675      end
    458676      say
    459       call charout , 'Enter the number of your choice (''X'' to exit; ''0'' to open a command line): '
    460       action = strip(translate(linein()))
    461       say
    462       if action = 'X' then
    463          exit
    464       if datatype(action) \= 'NUM' then
    465          iterate
    466       if action \= trunc(action) then
    467          iterate
    468       if action < 0 then
    469          iterate
    470       if action <= 20 then
     677      call charout , 'N)ext C)ommandline Q)uit or mennu item number: '
     678      user_choice = translate(translate(SysGetKey()), 'N', '0d'x)
     679      if user_choice = 'N' | user_choice = 'C' | user_choice = 'Q' then
    471680         leave
     681      if datatype(user_choice) = 'NUM' then
     682         do
     683            user_choice = user_choice || linein()
     684            say
     685            if datatype(user_choice) = 'NUM' then
     686               if user_choice = trunc(user_choice) then
     687                  if user_choice > 0 & user_choice <= mainmenu.0 then
     688                     leave
     689         end
    472690   end
    473 return action
     691   if user_choice = 'N' then
     692      if prev_user_choice = 'N/A' then
     693         user_choice = 1
     694      else
     695         if prev_user_choice < mainmenu.0 then
     696            user_choice = prev_user_choice + 1
     697return user_choice
    474698
    475699NotYet: procedure
    476    parse arg action
    477    call SysCls
    478    say;say;say
    479    say 'This option, ' || action || ', has not yet been (and may never be) automated.'
    480    say
     700   parse arg user_choice
     701   say;say
     702   say 'This option has not yet been (and may never be) automated.'
    481703   say 'You will have to do this manually. See instructions below:'
    482    say;say;say
    483 return
    484 
    485 GetVer: procedure
    486    parse arg ver_text
    487 ver_retry:
    488    say
    489    say 'Please enter the version (x.yy.zz) for' ver_text ':'
    490    ver_value = linein()
    491    parse var ver_value major '.' minor '.' CSDlevel
    492    if minor    = '' then
    493       minor    = 0
    494    if CSDlevel = '' then
    495       CSDlevel = 0
    496    if datatype(major) \= 'NUM' | datatype(minor) \= 'NUM' | datatype(CSDlevel) \= 'NUM' then
    497       do
    498          say 'Error: Invalid version entered:' ver_value
    499          say;
    500          say 'Try again.'
    501          signal ver_retry
    502       end
    503    /* The following will remove leading zeros */
    504    major = major + 0
    505    minor = minor + 0
    506    CSDlevel = CSDlevel + 0
    507 return major || '.' || minor || '.' || CSDlevel
    508 
    509 Tag_ver: procedure
    510    parse arg ver
    511    parse var ver major '.' minor '.' CSDlevel
    512 return major || '_' || right(minor, 2, '0') || '_' || right(CSDlevel, 2, 0)
    513 
    514 WPI_ver: procedure
    515    parse arg ver
    516 return translate(Tag_ver(ver), '-', '_')
     704   say;say
     705return
    517706
    518707BuildHobbesTxt: procedure expose (globals)
    519    parse arg ver
    520    wpi_version = WPI_ver(ver)
    521    HobbesTxtFilename = '.\warpin\FM2-' || wpi_version || '.txt'
    522    if stream(HobbesTxtFilename, 'c', 'query exists') \= '' then
     708   if stream(Hobbes.TxtFilename, 'c', 'query exists') \= '' then
    523709      do
    524710         say;say;say
    525          say HobbesTxtFilename 'already exists!'
     711         say Hobbes.TxtFilename 'already exists!'
    526712         call charout , 'Do you want to replace this file? (y/N) '
    527713         if translate(SysGetKey()) \= 'Y' then
    528714            do
    529715               say;say;
    530                say HobbesTxtFilename 'update aborted.'
     716               say Hobbes.TxtFilename 'update aborted.'
    531717               return
    532718            end
    533          call SysFileDelete HobbesTxtFilename
     719         call SysFileDelete Hobbes.TxtFilename
    534720      end
    535721   /* Prompt for user input (name, email, permission to email, previous version) here? */
    536    default_name            = 'Gregg Young'
    537    default_email           = 'ygk@qwest.net'
    538722   default_OKtoListEmail   = 'yes'
    539723   entry = ''
    540724   do until (entry = 'Y' | entry = '0d'x)
    541725      say;say
    542       say 'You will now be prompted for potentially variable fields within' HobbesTxtFilename
     726      say 'You will now be prompted for potentially variable fields within:'
     727      say '   ' Hobbes.TxtFilename
    543728      say
    544729      say 'A default value will be given for most fields.'
    545730      say 'To accept the default just press the Enter key.'
    546731      say
    547       call charout , 'Name of the relaser (default:' default_name '): '
     732      call charout , 'Name of the releaser (default:' Hobbes.default_name '): '
    548733      entry = strip(linein())
    549734      if entry = '' then
    550          name = default_name
     735         name = Hobbes.default_name
    551736      else
    552737         name = entry
    553738      say;say
    554       call charout , 'Email address of the relaser (default:' default_email '): '
     739      call charout , 'Email address of the releaser (default:' Hobbes.default_email '): '
    555740      entry = strip(linein())
    556741      if entry = '' then
    557          email = default_email
     742         Hobbes.uploader_email_address = default_email
    558743      else
    559          email = entry
     744         Hobbes.uploader_email_address = entry
    560745      say;say
    561       call charout , 'OK to list email address of the relaser (default:' default_OKtoListEmail '): '
     746      call charout , 'OK to list email address of the releaser (default:' default_OKtoListEmail '): '
    562747      entry = strip(linein())
    563748      if entry = '' then
     
    572757               OKtoListEmail = 'yes'
    573758      say;say
    574       replaced_ver = WPI_Ver(GetVer('version to be replaced'))
    575       replaced_ver_wpi = 'fm2-' || replaced_ver || '.wpi'
     759      say 'Please enter the version of the zip file to be replaced:'
     760      replaced_ver_zip = 'fm2-' || translate(linein(), '-', '.') || '.zip'
    576761      say;say
    577762      say 'Data entered:'
    578763      say '  Name of releaser  :' name
    579       say '  Email of releaser :' email
     764      say '  Email of releaser :' Hobbes.uploader_email_address
    580765      say '  OK to list email  :' OKtoListEmail
    581       say '  WPI to be replaced:' replaced_ver_wpi
     766      say '  Zip to be replaced:' replaced_ver_zip
    582767      say;say
    583768      call charout , 'OK to proceed with file write? (Y/n) '
    584769      entry = translate(SysGetKey())
     770      say
    585771   end
    586772
    587773   rm1 = 73
    588774   rm2 = 25
    589    call lineout HobbesTxtFilename, right('Upload Information Template for Hobbes.nmsu.edu', rm1)
    590    call lineout HobbesTxtFilename, right(copies('=', length('Upload Information Template for Hobbes.nmsu.edu')), rm1)
    591    call lineout HobbesTxtFilename, ''
    592    call lineout HobbesTxtFilename, right('Archive Filename:', rm2) || ' fm2-' || wpi_version || '.wpi'
    593    call lineout HobbesTxtFilename, right('Short Description:', rm2) || ' Mark Kimes FM/2 File Manager ' || ver
    594    call lineout HobbesTxtFilename, right('Long Description:', rm2) || ' The package contains a warpin package for installing FM2.'
    595    call lineout HobbesTxtFilename, copies(' ', rm2) || ' The FM2 source code is available on netlabs.'
    596    call lineout HobbesTxtFilename, right('Proposed directory ', rm2)
    597    call lineout HobbesTxtFilename, right('for placement:', rm2) || ' os2/util/browser'
    598    call lineout HobbesTxtFilename, ''
    599    call lineout HobbesTxtFilename, right('Your name:', rm2) name
    600    call lineout HobbesTxtFilename, right('Email address:', rm2) email
    601    call lineout HobbesTxtFilename, right('Program contact name:', rm2) || ' (same)'
    602    call lineout HobbesTxtFilename, right('Program contact email:', rm2) || ' (same)'
    603    call lineout HobbesTxtFilename, right('Program URL:', rm2) || ' http://svn.netlabs.org/fm2'
    604    call lineout HobbesTxtFilename, ''
    605    call lineout HobbesTxtFilename, right('Would you like the ', rm2)
    606    call lineout HobbesTxtFilename, right('contact email address ', rm2)
    607    call lineout HobbesTxtFilename, right('included in listings?', rm2) OKtoListEmail
    608    call lineout HobbesTxtFilename, ''
    609    call lineout HobbesTxtFilename, right('Operating System/Version:', rm2) || ' OS/2 Warp 3.0 and up.'
    610    call lineout HobbesTxtFilename, right('Additional requirements:', rm2)
    611    call lineout HobbesTxtFilename, ''
    612    call lineout HobbesTxtFilename, right('Replaces:', rm2) replaced_ver_wpi
    613    call stream  HobbesTxtFilename, 'c', 'close'
     775   call lineout Hobbes.TxtFilename, right('Upload Information Template for Hobbes.nmsu.edu', rm1)
     776   call lineout Hobbes.TxtFilename, right(copies('=', length('Upload Information Template for Hobbes.nmsu.edu')), rm1)
     777   call lineout Hobbes.TxtFilename, ''
     778   call lineout Hobbes.TxtFilename, right('Archive Filename:', rm2) || ' fm2-' || ver.wpi || '.wpi'
     779   call lineout Hobbes.TxtFilename, right('Short Description:', rm2) || ' Mark Kimes FM/2 File Manager ' || ver.full
     780   call lineout Hobbes.TxtFilename, right('Long Description:', rm2) || ' The package contains a warpin package for installing FM2.'
     781   call lineout Hobbes.TxtFilename, copies(' ', rm2) || ' The FM2 source code is available on netlabs.'
     782   call lineout Hobbes.TxtFilename, right('Proposed directory ', rm2)
     783   call lineout Hobbes.TxtFilename, right('for placement:', rm2) || ' os2/util/browser'
     784   call lineout Hobbes.TxtFilename, ''
     785   call lineout Hobbes.TxtFilename, right('Your name:', rm2) name
     786   call lineout Hobbes.TxtFilename, right('Email address:', rm2) Hobbes.uploader_email_address
     787   call lineout Hobbes.TxtFilename, right('Program contact name:', rm2) || ' (same)'
     788   call lineout Hobbes.TxtFilename, right('Program contact email:', rm2) || ' (same)'
     789   call lineout Hobbes.TxtFilename, right('Program URL:', rm2) || ' http://svn.netlabs.org/fm2'
     790   call lineout Hobbes.TxtFilename, ''
     791   call lineout Hobbes.TxtFilename, right('Would you like the ', rm2)
     792   call lineout Hobbes.TxtFilename, right('contact email address ', rm2)
     793   call lineout Hobbes.TxtFilename, right('included in listings?', rm2) OKtoListEmail
     794   call lineout Hobbes.TxtFilename, ''
     795   call lineout Hobbes.TxtFilename, right('Operating System/Version:', rm2) || ' OS/2 Warp 3.0 and up.'
     796   call lineout Hobbes.TxtFilename, right('Additional requirements:', rm2)
     797   call lineout Hobbes.TxtFilename, ''
     798   call lineout Hobbes.TxtFilename, right('Replaces:', rm2) replaced_ver_zip
     799   call stream  Hobbes.TxtFilename, 'c', 'close'
    614800   say;say;say
    615    say HobbesTxtFilename 'has been written.'
    616 return
     801   say Hobbes.TxtFilename 'has been written.'
     802return
     803
     804Commandline: procedure expose (globals)
     805   signal off Error
     806   if right(translate(cmd.processor), 8) = '4OS2.EXE' then
     807      '@' || cmd.processor "prompt"  cmd.prompt
     808   else
     809      '@' || cmd.processor "/k prompt=" || cmd.prompt
     810   signal on Error
     811return
     812
     813ExecCmd: procedure
     814   parse arg command
     815   signal off Error
     816   command
     817   signal on Error
     818return
     819
     820RunTester: procedure expose (globals)
     821/* kills FM/2 using killpid from FM/2 utils (must be in path) ... */
     822   call ExecCmd cmd.killpid cmd.killtarget
     823/* and run cmd to copy files to test directory and change to that directory must type exit to return here */
     824   call ExecCmd cmd.processor cmd.tester
     825return
     826
     827TestWPI: procedure expose (globals)
     828   parse arg tasknum
     829   if cmd.wic = '' then
     830      do
     831         warpin_path = strip(SysIni('USER', 'WarpIN', 'Path'), 'T', '00'x)
     832         if warpin_path = 'ERROR:' then
     833            do
     834               call NewScreenWithHeading tasknum
     835               say
     836               say
     837               say 'Unable to find Warpin directory in OS2.INI file.'
     838               say
     839               say 'Testing the WPI file is not possible without it.'
     840               say
     841               say 'Please reinstall Warpin and try again.'
     842               say
     843            end
     844         else
     845            do
     846               cmd.wic = warpin_path || '\wic.exe'
     847               cmd.warpin = warpin_path || '\warpin.exe'
     848               beginlibpath = SysQueryExtLibpath('B')
     849               if pos( ';' || translate(warpin_path) || ';', ';' || translate(beginlibpath) || ';') = 0 then
     850                  do
     851                     call SysSetExtLibpath warpin_path || ';' || beginlibpath, 'B'
     852                  end
     853               warpin_ini = warpin_path || '\datbas_' || left(SysBootDrive(), 1) || '.ini'
     854               cmd.wpi_viewer = value('SVN_WPIVIEWER',,'OS2ENVIRONMENT')
     855               if cmd.wpi_viewer = '' then
     856                  do
     857                     cmd.wpi_viewer = value('WPIVIEWER',,'OS2ENVIRONMENT')
     858                     if cmd.wpi_viewer = '' then
     859                        cmd.wpi_viewer = SysSearchPath('PATH', 'wpiview.exe')
     860                  end
     861            end
     862      end
     863   if cmd.wic \= '' then
     864      do
     865         previous_choice = 0
     866         do until choice = 'Q'
     867            call NewScreenWithHeading tasknum
     868            say
     869            say '1. View FM/2 WPI file'
     870            say '2. De-install FM/2 and fully delete FM/2 installation directories.'
     871            say '3. Install FM/2'
     872            say '4. Test the new installation.'
     873            say '5. Create ZIP file for debugging WPI file problems.'
     874            say
     875            call charout , 'N)ext C)ommandline Q)uit (to main menu) or number of choice: '
     876            choice = translate(translate(SysGetKey()), 'N', '0d'x)
     877            say
     878            if choice = 'N' then
     879               if previous_choice = '5' then
     880                  iterate
     881               else
     882                  choice = previous_choice + 1
     883            select
     884               when choice = 'C' then
     885                  call Commandline
     886               when choice = '1' then
     887                  do
     888                     if cmd.wpi_viewer = '' then
     889                        do
     890                           say
     891                           say 'This program has searched for w WPI viewer (in the order listed):'
     892                           say '  1. Environment variable: SVN_WPIVIEWER'
     893                           say '  2. Environment variable: WPIVIEWER'
     894                           say '  3. WPIView.exe on the PATH'
     895                           say
     896                           say 'A viewer was not found. Using wic.exe instead...'
     897                           say
     898                           '@pause'
     899                           call ExecCmd cmd.wic '-l warpin\fm2-' || ver.wpi || '.wpi | rxqueue'
     900                           p = 0
     901                           do while queued() > 0
     902                              parse pull line
     903                              if word(line, 1) = 'Package' then
     904                                 do
     905                                    p = p + 1
     906                                    pkg.p.num = word(line, 2)
     907                                 end
     908                           end
     909                           pkg.0 = p
     910                           do p = 1 to pkg.0
     911                              call ExecCmd cmd.wic '-l warpin\fm2-' || ver.wpi || '.wpi' pkg.p.num '|' cmd.pager
     912                           end
     913                           if pos('less', cmd.page) = 0 then 'pause'
     914                        end
     915                     else
     916                        do
     917                           cmd.wpi_viewer 'warpin\fm2-' || ver.wpi || '.wpi'
     918                        end
     919                  end
     920               when choice = '2' then
     921                  do
     922                     deinstall. = ''
     923                     call SysIni warpin_ini, 'ALL:', 'warpin_apps.'
     924                     do i = 1 to warpin_apps.0
     925                        select
     926                           when left(warpin_apps.i, 17) = 'Netlabs\FM2\Base\'then
     927                              deinstall.base_dir_before  = strip(SysIni( warpin_ini, warpin_apps.i, 'TargetPath' ), 'T', '00'x)
     928                           when left(warpin_apps.i, 31) = 'Netlabs\FM2 Utilities\FM2Utils\'then
     929                              deinstall.utils_dir_before = strip(SysIni( warpin_ini, warpin_apps.i, 'TargetPath' ), 'T', '00'x)
     930                           otherwise
     931                              nop
     932                        end
     933                     end
     934                     drop warpin_apps.
     935                     say
     936                     say 'There are two parts to this process:'
     937                     say '  1. Invoking WarpIN to deinstall FM/2'
     938                     say "  2. Using the DELTREE utility to delete all remaining files and directories."
     939                     say
     940                     say 'Part 1: Warpin de-install. WarpIN is a PM program and the deinstallation will'
     941                     say 'not be automated by this program. Please follow these steps once WarpIN'
     942                     say 'has started:'
     943                     say '  a) It will appear just as a normal installation. Proceed to the window where'
     944                     say '     packages are selected.'
     945                     say '  b) If you want to deinstall ALL packages, use the "Selections" menu and'
     946                     say '     choose "De-install". Otherwise, for each package you want to de-install,'
     947                     say '     double click on its icon until it changes to one with a red "X"'
     948                     say '  c) Once the packages to be de-installed each have an icon with a red "X",'
     949                     say '     click on "Next".'
     950                     say '  d) Then click on "Install" in the next window.'
     951                     say '  e) You should get a message box asking if it is OK to proceed.'
     952                     say '     Click on OK when ready.'
     953                     say
     954                     say 'WarpIN will be started asyncronously. This will allow you to switch back'
     955                     say 'to this window for these instructions, if needed. Once WarpIN has finished,'
     956                     say 'switch back to this window.'
     957                     say
     958                     call charout , 'Press any key when ready to start WarpIN...'
     959                     call SysGetKey
     960                     say
     961                     call ExecCmd 'start' cmd.warpin 'warpin\fm2-' || ver.wpi || '.wpi'
     962                     say
     963                     do until choice2 = 'Y' | choice2 = 'N'
     964                        say
     965                        say 'Part 2: Deleting the remaining files'
     966                        say
     967                        call charout , 'Has WarpIN finshed completely and is it OK to proceed? (y/n): '
     968                        choice2 = translate(SysGetKey())
     969                        say;say
     970                     end
     971                     if choice2 = 'Y' then
     972                        do
     973                           call SysIni warpin_ini, 'ALL:', 'warpin_apps.'
     974                           do i = 1 to warpin_apps.0
     975                              select
     976                                 when left(warpin_apps.i, 17) = 'Netlabs\FM2\Base\'then
     977                                    deinstall.base_dir_after  = strip(SysIni( warpin_ini, warpin_apps.i, 'TargetPath' ), 'T', '00'x)
     978                                 when left(warpin_apps.i, 31) = 'Netlabs\FM2 Utilities\FM2Utils\'then
     979                                    deinstall.utils_dir_after = strip(SysIni( warpin_ini, warpin_apps.i, 'TargetPath' ), 'T', '00'x)
     980                                 otherwise
     981                                    nop
     982                              end
     983                           end
     984                           drop warpin_apps.
     985                           if deinstall.base_dir_after = '' then
     986                              if deinstall.base_dir_before \= '' then
     987                                 do
     988                                    do until (choice2 = 'Y' | choice2 = 'N')
     989                                       say
     990                                       say 'You have de-installed the FM/2 base package.'
     991                                       say
     992                                       say 'Next is the deletion of ALL files and directories in its installation directory:'
     993                                       say '   ' deinstall.base_dir_before
     994                                       call charout , 'Are you sure you want to proceed? (y/N): '
     995                                       choice2 = translate(SysGetKey())
     996                                    end
     997                                    if choice2 = 'Y' then
     998                                       do
     999                                          signal off Error
     1000                                          'warpin\fm2utils\deltree' deinstall.base_dir_before
     1001                                          signal on Error
     1002                                       end
     1003                                 end
     1004                           if deinstall.utils_dir_after = '' then
     1005                              if deinstall.utils_dir_before \= '' then
     1006                                 do
     1007                                    call SysFileTree deinstall.utils_dir_before, 'dirlist.', 'DO'
     1008                                    if dirlist.0 = 1 then
     1009                                       do
     1010                                          do until (choice2 = 'Y' | choice2 = 'N')
     1011                                             say
     1012                                             say 'You have de-installed the FM/2 Utilities package.'
     1013                                             say
     1014                                             say 'Next is the deletion of ALL files and directories in its installation directory:'
     1015                                             say '   ' deinstall.utils_dir_before
     1016                                             call charout , 'Are you sure you want to proceed? (y/N): '
     1017                                             choice2 = translate(SysGetKey())
     1018                                          end
     1019                                          if choice2 = 'Y' then
     1020                                             do
     1021                                                call ExecCmd 'warpin\fm2utils\deltree' deinstall.utils_dir_before
     1022                                             end
     1023                                       end
     1024                                 end
     1025                        end
     1026                  end
     1027               when choice = '3' then
     1028                  do
     1029                     say
     1030                     say 'Opening a commandline session for testing...'
     1031                     say
     1032                     call ExecCmd cmd.warpin 'warpin\fm2-' || ver.wpi || '.wpi'
     1033                  end
     1034               when choice = '4' then
     1035                  do
     1036                     call SysIni warpin_ini, 'ALL:', 'warpin_apps.'
     1037                     do i = 1 to warpin_apps.0
     1038                        if left(warpin_apps.i, 17) = 'Netlabs\FM2\Base\'then
     1039                           do
     1040                              fm2_installation_dir  = SysIni( warpin_ini, warpin_apps.i, 'TargetPath' )
     1041                              leave
     1042                           end
     1043                     end
     1044                     drop warpin_apps.
     1045                     curdir = directory()
     1046                     installation_drive = left(fm2_installation_dir, 2)
     1047                     curdir2 = directory(installation_drive)
     1048                     call directory fm2_installation_dir
     1049                     call Commandline
     1050                     call directory installation_drive
     1051                     call directory curdir2
     1052                     call directory left(curdir, 2)
     1053                     call directory curdir
     1054                  end
     1055               when choice = '5' then
     1056                  do
     1057                     if cmd.zip = '' then
     1058                        cmd.zip = SysSearchPath('PATH', 'zip.exe')
     1059                     if cmd.zip = '' then
     1060                        do
     1061                           say
     1062                           say 'ZIP.EXE was not found on the PATH. Please correct'
     1063                           say 'this ASAP and execute this option again.'
     1064                        end
     1065                     else
     1066                        do
     1067                           tmpzipfile = SysTempFilename('rtdbg???.zip')
     1068                           tmpdirfile = SysTempFilename('rtdbgdir.???')
     1069                           call ExecCmd '@dir * /s >' tmpdirfile
     1070                           call ExecCmd cmd.zip '-9X' tmpzipfile 'warpin\fm2-' || ver.wpi || '.wpi'
     1071                           call ExecCmd cmd.zip '-9X' tmpzipfile 'warpin\bld_fm2_wpidirs.*'
     1072                           call ExecCmd cmd.zip '-9X' tmpzipfile 'warpin\fm2.wis.in'
     1073                           call ExecCmd cmd.zip '-9mX' tmpzipfile tmpdirfile
     1074                           say
     1075                           say 'If the preceding zip commands were successful, please send an email to'
     1076                           say '     jsmall@os2world.net'
     1077                           say 'and attach the file:'
     1078                           say '   ' tmpzipfile
     1079                           say 'as an attachment. In the text of the message, please describe'
     1080                           say 'the errors you detected in detail. Thank you.'
     1081                           say
     1082                           'pause'
     1083                        end
     1084                  end
     1085               otherwise
     1086                  nop
     1087            end
     1088         end
     1089      end
     1090return
     1091
     1092UploadRelease: procedure expose (globals)
     1093   if loaded.RXFTP = 0 then
     1094      do
     1095         say 'Until RXFTP.DLL is placed in a directory on the LIBPATH,'
     1096         say 'manual uploading will be required.'
     1097         say
     1098         call charout , 'Would you like a commandline session to upload? (Y/n) '
     1099         reply = translate(SysGetKey())
     1100         say
     1101         if reply \= 'N' then
     1102            call Commandline
     1103         say
     1104      end
     1105   else
     1106      do
     1107         do u = 1 to cfg.FTP.0
     1108            say 'Uploading to' cfg.FTP.u.descriptive_hostname || '...'
     1109            say '   Setting up logon data...'
     1110            if cfg.FTP.u.password = '[Hobbes-email]' then
     1111               if left(Hobbes.uploader_email_address, 3) = 'N/A' then
     1112                  cfg.FTP.u.password = ''
     1113               else
     1114                  cfg.FTP.u.password = Hobbes.uploader_email_address
     1115            if (cfg.FTP.u.userid = '' | cfg.FTP.u.password = '') then
     1116               do
     1117                  say
     1118                  say '      The userid and/or password were not found in ReleaseTool.cfg.'
     1119                  say '      You will now be prompted for the missing data.'
     1120                  say
     1121                  if cfg.FTP.u.userid = '' then
     1122                     do
     1123                        call charout , '      Please enter the userid for' cfg.FTP.u.descriptive_hostname ||': '
     1124                        cfg.FTP.u.userid = strip(linein())
     1125                        say
     1126                     end
     1127                  if cfg.FTP.u.password = '' then
     1128                     do
     1129                        call charout , '      Please enter the password for' cfg.FTP.u.descriptive_hostname ||': '
     1130                        cfg.FTP.u.password  = strip(linein())
     1131                        say
     1132                     end
     1133                  say '      In order to avoid being prompted in the future, edit the'
     1134                  say '      ReleaseTool.cfg file to include this data.'
     1135                  say
     1136               end
     1137            rcx = FtpSetUser( cfg.FTP.u.host, StripNotNeeded(cfg.FTP.u.userid), StripNotNeeded(cfg.FTP.u.password), '')
     1138            if rcx \= 1 then
     1139               say '      Unable to set user data. Unable to continue.'
     1140            else
     1141               do
     1142                  do d = 1 to cfg.FTP.u.directory.0
     1143                     if cfg.FTP.u.directory.d \= '' then
     1144                        do
     1145                           say '   Changing directory to:' cfg.FTP.u.directory.d
     1146                           rcx = FtpChDir(cfg.FTP.u.directory.d)
     1147                           if rcx \= 0 then
     1148                              do
     1149                                 say '   Unable to change directory. FTP Error:' FTPERRNO
     1150                                 iterate
     1151                              end
     1152                        end
     1153                     do f = 1 to cfg.FTP.u.directory.d.file.0
     1154                        select
     1155                           when translate(cfg.FTP.u.directory.d.file.f) = '[RELEASE-ZIP]' then
     1156                              uploadfile = 'warpin\fm2-' || ver.wpi || '.zip'
     1157                           when translate(cfg.FTP.u.directory.d.file.f) = '[HOBBES-TEXT]' then
     1158                              uploadfile = 'warpin\fm2-' || ver.wpi || '.txt'
     1159                           otherwise
     1160                              uploadfile = cfg.FTP.u.directory.d.file.f
     1161                        end
     1162                        say '   Uploading:' uploadfile
     1163                        rcx = FtpPut(uploadfile, filespec('n', uploadfile), "Binary")
     1164                        if rcx \= 0 then
     1165                           do
     1166                              say '   Unable to upload. FTP Error:' FTPERRNO
     1167                              leave
     1168                           end
     1169                     end
     1170                  end
     1171                  say '   Logging off' cfg.FTP.u.descriptive_hostname || '...'
     1172                  call FtpLogoff
     1173                  say
     1174               end
     1175         end
     1176      end
     1177return
     1178
     1179AnnounceToNewsgroups: procedure expose (globals)
     1180   call NNTPSetup
     1181   do s = 1 to cfg.NNTP.0
     1182      say
     1183      do while cfg.NNTP.s.host = ''
     1184            say 'NNTP: Please provide a news server name for the following newsgroups:'
     1185            say '   ' || cfg.NNTP.s.newsgroups
     1186            cfg.NNTP.s.host = strip(linein())
     1187      end
     1188      if cfg.NNTP.s.userid = '' then
     1189         do
     1190            say 'NNTP: If' cfg.NNTP.s.host 'requires a user name, please provide it.'
     1191            call charout , 'NNTP: (Just press ENTER if no user name is required.): '
     1192            cfg.NNTP.s.userid = strip(linein())
     1193         end
     1194      if cfg.NNTP.s.password = '' then
     1195         do
     1196            say 'NNTP: If' cfg.NNTP.s.host 'requires a password, please provide it.'
     1197            call charout , 'NNTP: (Just press ENTER if no password is required.): '
     1198            cfg.NNTP.s.password = strip(linein())
     1199         end
     1200/*
     1201      say 'NNTP data summary:'
     1202      say
     1203      say 'From:' cfg.NNTP.from
     1204      say 'Subject:' cfg.NNTP.subject
     1205      say 'Server(s):'
     1206      do s = 1 to cfg.NNTP.0
     1207         say '   Name:' cfg.NNTP.s.host
     1208         say '   Newsgroup(s):' cfg.NNTP.s.newsgroups
     1209         if cfg.NNTP.s.userid = '' then
     1210            say '   User: <None>'
     1211         else
     1212            say '   User:' cfg.NNTP.s.userid
     1213         if cfg.NNTP.s.password = '' then
     1214            say '   Password: <None>'
     1215         else
     1216            say '   Password:' cfg.NNTP.s.password
     1217         say
     1218      end
     1219*/
     1220/*
     1221      say 'Body w/ signature:'
     1222      pager = 'less'
     1223      '@echo'  cfg.NNTP.message_body || cfg.NNTP.signature_preface || cfg.NNTP.signature '|' pager
     1224      '@pause'
     1225*/
     1226      call SendNNTP s
     1227   end
     1228return
     1229
     1230NNTPSetup: procedure expose (globals)
     1231   say;say
     1232   say 'NNTP: The Hobbes email address is:' Hobbes.uploader_email_address
     1233   say
     1234   say 'NNTP: Type the desired email address for the newsgroups announcements.'
     1235   say 'NNTP: You may want to disguise the address to avoid spam.'
     1236   call charout , 'NNTP: (Just press ENTER to accept the Hobbes email address): '
     1237   reply = strip(linein())
     1238   if reply \= '' then
     1239      cfg.NNTP.from = reply
     1240   else
     1241      cfg.NNTP.from = Hobbes.uploader_email_address
     1242   say;say
     1243   cfg.NNTP.subject = 'FM/2' ver.full 'has been released.'
     1244   say 'NNTP: The "Subject" for the newsgroup announcements will be:'
     1245   say cfg.NNTP.subject
     1246   say 'NNTP: Just press ENTER to accept. Otherwise type the desired subject:'
     1247   reply = strip(linein())
     1248   if reply \= '' then
     1249      cfg.NNTP.subject = reply
     1250   say;say
     1251   say 'NNTP: The signature on the message will automatically be preceded by the following lines:'
     1252   say
     1253   say '-- '
     1254   say 'NNTP: Please enter the desired signature.'
     1255   cfg.NNTP.signature = strip(linein(), 'T')
     1256
     1257   tempfile = SysTempFilename('RTNNTPBody.???')
     1258   release_file = 'fm2-' || ver.wpi || '.zip'
     1259   call lineout tempfile, 'FM/2' ver.full 'has been released. The file name is' release_file
     1260   call lineout tempfile, ''
     1261   call lineout tempfile, 'It has been uploaded to Netlabs and to Hobbes.'
     1262   call lineout tempfile, ''
     1263   call lineout tempfile, 'Netlabs:'
     1264   call lineout tempfile, '  ftp://ftp.netlabs.org/incoming/' || release_file
     1265   call lineout tempfile, 'which will eventually move to'
     1266   call lineout tempfile, '  ftp://ftp.netlabs.org/pub/' || release_file
     1267   call lineout tempfile, ''
     1268   call lineout tempfile, 'Hobbes:'
     1269   call lineout tempfile, '  http://hobbes.nmsu.edu/h-search.php?sh=1&button=Search&key=' || release_file || '&dir=%2Fpub'
     1270/*
     1271   call lineout tempfile, '  http://hobbes.nmsu.edu/h-search.php?sh=1&button=Search&key=fm2&dir=%2Fpub%2Fincoming'
     1272   call lineout tempfile, 'which will eventually move to'
     1273   call lineout tempfile, '  http://hobbes.nmsu.edu/h-search.php?sh=1&button=Search&key=fm2&dir=%2Fpub%2Fos2%2Futil%2Fbrowser'
     1274*/
     1275   call lineout tempfile, ''
     1276   call lineout tempfile, ver.full 'Changes:'
     1277   history_file = 'history'
     1278   call stream history_file, 'c', 'close'
     1279   do until left(history_line || 'xxx', 3)  = ' o '
     1280      history_line = linein(history_file)
     1281   end
     1282   history_line = strip(history_line, 'T')
     1283   do until left(history_line, 1) > ' '
     1284      if length(history_line) > 3 then
     1285         if left(history_line, 3) = ' o ' then
     1286            history_line = ' * ' || substr(history_line, 4)
     1287      call lineout tempfile, history_line
     1288      history_line = strip(linein(history_file), 'T')
     1289   end
     1290   call stream tempfile, 'c', 'close'
     1291   call stream history_file, 'c', 'close'
     1292   say;say
     1293   say 'NNTP: The proposed body of the newsgroup announcements will now'
     1294   say 'NNTP: be loaded into an editor. Make changes and save.'
     1295   say
     1296   call charout , 'NNTP: Press a key when ready to view/edit the message body.'
     1297   call SysGetKey
     1298   say
     1299   call ExecCmd cmd.editor tempfile
     1300   cfg.NNTP.message_body = ''
     1301   do while lines(tempfile) > 0
     1302      cfg.NNTP.message_body = cfg.NNTP.message_body || linein(tempfile) || cfg.crlf
     1303   end
     1304   call stream tempfile, 'c', 'close'
     1305   call SysFileDelete tempfile
     1306return
     1307
     1308SendNNTP: procedure expose (globals)
     1309   parse arg s
     1310   say
     1311   say 'NNTP: Sending to' cfg.NNTP.s.host '...'
     1312   exit_rc = SockGetHostByName( cfg.NNTP.s.host, 'hostip.' )
     1313   if exit_rc = 0 then
     1314      do
     1315         say 'NNTP: DNS lookup on' cfg.NNTP.s.host 'failed.'
     1316      end
     1317   else
     1318      do
     1319         socket = SockSocket('AF_INET', 'SOCK_STREAM', 'IPPROTO_TCP')
     1320         if socket < 0 then
     1321            do
     1322               say 'NNTP: Unable to create a socket for use with' cfg.NNTP.s.host || '.'
     1323               iterate
     1324            end
     1325         else
     1326            do
     1327               inetaddr.family = 'AF_INET'
     1328               inetaddr.addr   = hostip.addr
     1329               inetaddr.port   = 119
     1330               exit_rc         = SockConnect(socket, 'inetaddr.')
     1331            end
     1332         if exit_rc < 0 then
     1333            do
     1334               say 'NNTP: Unable to connect to' cfg.NNTP.s.host || '.'
     1335            end
     1336         else
     1337            do forever
     1338               parse value NNTPReceive(socket, cfg.maxNNTPrecvbufsize) with rc server_reply
     1339               if rc \= 0 then leave
     1340               say 'NNTP: Sending initial POST...'
     1341               rc = SockSend(socket, 'POST' || cfg.crlf)
     1342               if rc < 0 then
     1343                  do
     1344                     say 'NNTP: Failed on sending initial POST request.'
     1345                     leave
     1346                  end
     1347               say 'NNTP: Receiving response to initial POST...'
     1348               parse value NNTPReceive(socket, cfg.maxNNTPrecvbufsize) with rc server_reply
     1349               if pos('480', server_reply) > 0 then /* authentication required */
     1350                  do
     1351                     say 'NNTP: Sending userid...'
     1352                     rc = SockSend(socket, 'AUTHINFO USER' StripNotNeeded(cfg.NNTP.1.userid) || cfg.crlf)
     1353                     if rc < 0 then
     1354                        do
     1355                           say 'NNTP: Failed on sending userid.'
     1356                           leave
     1357                        end
     1358                     say 'NNTP: Receiving response to userid...'
     1359                     parse value NNTPReceive(socket, cfg.maxNNTPrecvbufsize) with rc server_reply
     1360                     if pos('381', server_reply) > 0 then /* further authentication (password) required */
     1361                        do
     1362                     say 'NNTP: Sending password...'
     1363                           rc = SockSend(socket, 'AUTHINFO PASS' StripNotNeeded(cfg.NNTP.1.password) || cfg.crlf)
     1364                           if rc < 0 then
     1365                              do
     1366                                 say 'NNTP: Failed on sending password.'
     1367                                 leave
     1368                              end
     1369                        end
     1370                     else
     1371                        if pos('501', server_reply) > 0 then
     1372                           do
     1373                              say 'NNTP: Bad authentication'
     1374                              leave
     1375                           end
     1376                     say 'NNTP: Receiving response to password...'
     1377                     parse value NNTPReceive(socket, cfg.maxNNTPrecvbufsize) with rc server_reply
     1378                     if rc \= 0 then leave
     1379                     if pos('281', server_reply) = 0 then
     1380                        do
     1381                           say 'Bad response to password:' server_reply
     1382                           leave
     1383                        end
     1384                     say 'NNTP: Sending POST (After authorization)...'
     1385                     rc = SockSend(socket, 'POST' || cfg.crlf)
     1386                     if rc < 0 then
     1387                        do
     1388                           say 'NNTP: Failed on sending second POST request.'
     1389                           leave
     1390                        end
     1391                     say 'NNTP: Receiving response to POST (After authorization)...'
     1392                     parse value NNTPReceive(socket, cfg.maxNNTPrecvbufsize) with rc server_reply
     1393                     if rc \= 0 then leave
     1394                  end
     1395               if pos('340', server_reply) > 0 then /* OK to send */
     1396                  do
     1397                     say 'NNTP: Sending message...'
     1398                     rc = SockSend(socket, 'From:' cfg.NNTP.from || cfg.crlf || ,
     1399                                           'Newsgroups:' cfg.NNTP.s.newsgroups || cfg.crlf || ,
     1400                                           'Subject:' cfg.NNTP.subject || cfg.crlf || ,
     1401                                           'User-Agent:' cfg.NNTP.user_agent || cfg.crlf || ,
     1402                                           'MIME-version:' cfg.NNTP.mime_version || cfg.crlf || ,
     1403                                           'Content-Type:' cfg.NNTP.content_type || cfg.crlf || ,
     1404                                           'Content-Transfer-Encoding:' cfg.NNTP.content_transfer_encoding || cfg.crlf || ,
     1405                                           cfg.crlf || ,
     1406                                           cfg.NNTP.message_body || ,
     1407                                           cfg.NNTP.signature_preface || ,
     1408                                           cfg.NNTP.signature || ,
     1409                                           cfg.NNTP.closing)
     1410                     if rc < 0 then
     1411                        do
     1412                           say 'NNTP: Send message failed.'
     1413                           leave
     1414                        end
     1415                     say 'NNTP: Receiving response to message send...'
     1416                     parse value NNTPReceive(socket, cfg.maxNNTPrecvbufsize) with rc server_reply
     1417                     if rc \= 0 then leave
     1418                     if pos('240', server_reply) = 0 then
     1419                        do
     1420                           say 'NNTP: Unknown response from server to message send:' server_reply
     1421                        end
     1422                  end
     1423               else
     1424                  say 'NNTP: Failed to get "OK to send" respsonse from server.'
     1425               leave
     1426            end
     1427         call SockSoClose(socket)
     1428      end
     1429return
     1430
     1431NNTPReceive: procedure expose (globals)
     1432   parse arg socket, maxdatasize
     1433   reply = ""
     1434   exit_rc = 10
     1435   do while (exit_rc = 10)
     1436      rc = SockRecv(socket, 'indata', maxdatasize )
     1437      select
     1438         when rc > 0 then
     1439            do
     1440               reply = reply || indata
     1441               if pos(cfg.crlf, reply) > 0 then
     1442                  do
     1443                     exit_rc = 0
     1444                     if rc = maxdatasize then
     1445                        say 'NNTP: Receive buffer size,' masdatasize || ', too small???'
     1446                  end
     1447
     1448            end
     1449         when rc = 0 then /* connection closed */
     1450            do
     1451               say "NNTP: Connection closed prematurely."
     1452               exit_rc = 4
     1453            end
     1454         otherwise /* Error occurred */
     1455            do
     1456               exit_rc = rc
     1457               /* JBS: SockPSock_errno write to STDERR, is this OK? */
     1458               call SockPSock_errno
     1459            end
     1460      end
     1461   end
     1462   if exit_rc \= 0 then
     1463      do
     1464         say 'NNTP: Error on initial response.'
     1465         say 'NNTP: Error code:' rc
     1466         say 'NNTP: Text returned:' server_reply
     1467      end
     1468return exit_rc reply
     1469
     1470ZipFiles: procedure expose (globals)
     1471   release_zipfile = '.\warpin\fm2-' || ver.wpi || '.zip'
     1472   /* Zip distro */
     1473   'zip -jX9' release_zipfile 'warpin\fm2-' || ver.wpi || '.wpi'
     1474
     1475   /* Zip FM/2 Utilities' */
     1476   /* JBS: Following code is temprarily abondoned */
     1477/*
     1478   call SysFileTree 'warpin\fm2utils*.wpi', 'utilswpi.', 'FO'
     1479   utilsmajor = '1'
     1480   utilsminor = '1'
     1481   do u = 1 to utilswpi.0
     1482      parse var utilswpi.u '-' utilsfilemajor '-' utilsfileminor '.'
     1483      utilsfilemajor = utilsfilemajor + 0
     1484      utilsfileminor = utilsfileminor + 0
     1485      if (utilsfilemajor > utilsmajor | ,
     1486          (utilsfilemajor = utilsmajor & ,
     1487           utilsfileminor > utilsminor)) then
     1488         do
     1489            utilsmajor = utilsfilemajor
     1490            utilsminor = utilsfileminor
     1491         end
     1492   end
     1493   utilsver = utilsmajor || '-' || utilsminor
     1494   if utilsver \= '1-1' then
     1495   else
     1496   if stream( 'warpin\fm2utils-' || utilsver || '.zip', 'c', 'query exists') = '' then
     1497      do
     1498         say 'Zipping up (new) FM2Utils...'
     1499         'zip -9jX' release_zipfile  'warpin\fm2utils-' || utilsver || '.wpi'
     1500      end
     1501*/
     1502return
     1503
     1504StripNotNeeded: procedure
     1505   parse arg instring
     1506   if instring = '[NotNeeded]' then
     1507      return ''
     1508   else
     1509      return instring
     1510
     1511TracUpdates: procedure expose (globals)
     1512   nextver.1 = ver.major || '.' || ver.minor + 1 || '.0'
     1513   nextver.2 = ver.major || '.' || ver.minor || '.' || ver.CSDlevel + 1
     1514   nextver.3 = ver.major + 1 || '.0.0'
     1515   nextver.0 = 3
     1516   do until (choice2 = 1 | choice2 = 2 | choice2 = 3)
     1517      say
     1518      say 'Set next version and update TRAC'
     1519      say
     1520      say 'The just-released version of FM/2 is:' ver.full
     1521      say
     1522      say 'Please select the next version:'
     1523      say
     1524      do i = 1 to nextver.0
     1525         say '  ' || i || ')' nextver.i
     1526      end
     1527      say
     1528      call charout , 'Enter the number of your choice: '
     1529      choice2 = SysGetKey()
     1530      say
     1531      say
     1532   end
     1533   say;say
     1534   say '   Create a TRAC version for FM/2' nextver.choice2
     1535   say
     1536   say '   Mark the next version as the default version for new tickets.'
     1537   say
     1538   say '   Create a TRAC milestone for FM/2' nextver.choice2 || ', if needed.'
     1539   say
     1540   say '   Mark the new milestone as the default milestone.'
     1541   say
     1542   say '   Mark the completed milestone as complete and'
     1543   say '   move any residual tickets to a future milestone.'
     1544   say '   (TRAC can move the tickets in bulk when you mark'
     1545   say '   the version milestone complete.)'
     1546   say
     1547/* JBS: Code disabled until its need/usefulness is determined. */
     1548/*
     1549   call charout , 'Press any key when ready to proceed: '
     1550   call SysGetKey
     1551   say
     1552*/
     1553   /* Set next version */
     1554/* JBS: Code disabled until its need/usefulness is determined. */
     1555/*
     1556   do f = 1 to words(ver.filelist)
     1557      call ReleaseEdit nextver.choice2 word(ver.filelist, f) 'trace=' || traceopt
     1558      say
     1559   end
     1560   call CommitifOK ver.filelist
     1561*/
     1562return
     1563
     1564NewScreenWithHeading: procedure expose (globals)
     1565   parse arg tasknum
     1566   call SysCls
     1567   say
     1568   say 'Task:' mainmenu.tasknum.text
     1569return
     1570
     1571CommitIfOK: procedure
     1572   parse arg filelist
     1573   svn_cmd = 'svn commit'
     1574   say;say;say
     1575   say 'Online and OK to execute:' svn_cmd filelist || '? (Y/n)'
     1576   if translate(SysGetKey()) \= 'N' then call ExecCmd svn_cmd filelist
     1577return
     1578
     1579/*** Usage/Error routines ***/
     1580
     1581Usage: procedure
     1582   say;say;say
     1583   i = 1
     1584   parse value SysTextScreenSize() with rows .
     1585   linesperscreen = rows - 2
     1586   do forever
     1587      srcline = sourceline(i)
     1588      if pos('CHANGE LOG', translate(srcline)) > 0 then
     1589         leave
     1590      else
     1591         say srcline
     1592      i = i + 1
     1593      if (i // linesperscreen) = 0 then
     1594         do
     1595            say
     1596            call charout , 'F)orward B)ack Q)uit: '
     1597            reply = translate(SysGetKey())
     1598            say
     1599            select
     1600               when reply = 'B' then
     1601                  i = i - (2 * linesperscreen)
     1602               when reply = 'Q' then
     1603                  leave
     1604               otherwise
     1605                  nop
     1606            end
     1607         end
     1608   end
     1609exit
     1610
     1611Novalue:
     1612  say 'Uninitialized value found on line:' sigl
     1613  say 'Variable:' condition('D')
     1614  say 'Text:'
     1615  do i = sigl-3 to sigl+3
     1616     if i = sigl then
     1617        call charout , '--> '
     1618     else
     1619        call charout , '    '
     1620     say sourceline(i)
     1621  end
     1622exit
    6171623
    6181624/*=== Error() Report ERROR, FAILURE etc. and exit ===*/
    619 
    6201625Error:
    621   say
    622   parse source . . cmd
    623   say 'CONDITION'('C') 'signaled at' cmd 'line' SIGL'.'
     1626  say;say;say
     1627  parse source . . cmdfile
     1628  say 'CONDITION'('C') 'signaled at' cmdfile 'line' SIGL'.'
    6241629  if 'CONDITION'('D') \= '' then
    6251630    say 'REXX reason =' 'CONDITION'('D')'.'
     
    6371642  end
    6381643
    639   return
    640 
    641 novalue:
    642    say 'Uninitialized variable: ' || condition('D') || ' on line: 'sigl
    643    say 'Line text: 'sourceline(sigl)
    644    cfg.errorcode = 3
    645    signal ErrorExit
    646 
    647 CommitIfOK: procedure
    648    parse arg filelist
    649    svn_cmd = 'svn commit'
    650    say;say;say
    651    say 'Online and OK to execute: 'svn_cmd'? (Y/n)'
    652    if translate(SysGetKey()) \= 'N' then svn_cmd filelist
    653 return
     1644return
     1645
     1646Log_Error: procedure expose cfg.
     1647return
     1648
Note: See TracChangeset for help on using the changeset viewer.