Changeset 1294


Ignore:
Timestamp:
Nov 23, 2008, 2:08:17 AM (17 years ago)
Author:
John Small
Message:

Ticket 297: ReleaseTool/Edit 1) Fix bugs in version edits;
2) Support for an optional trace parameter; 3) Support for EDITOR env var
(ReleaseTool); 4) Improved "usage" routine

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ReleaseEdit.cmd

    r1293 r1294  
    22 * $Id$
    33 *
    4  * ReleaseEdit: a program which will set the version number
    5  *    and the date and time of a FM/2 release
     4 * ReleaseEdit: a program which will edit a file and set the version
     5 *    number and the date of an FM/2 release as appropriate for that file.
     6 *    This program operates non-interactively.
    67 *
    78 * Usage:
    8  *    ReleaseEdit <version> <relative-filename>
    9  *
    10  *    where <version> is x.y.z
    11  *
    12  *    and <relative-filename> is ONE of the files (i.e. no wildcards)
    13  *    which need a version number and/or date/time:
    14  *       *.def, file_id.diz, dll\version.h, warpin\fm2.wis
     9 *    ReleaseEdit <version> <relative-filename> [trace=<trace-option>]
     10 *
     11 *    where
     12 *       <version> is in the form x.y.z or x.y (where x, y and z are numbers)
     13 *       <relative-filename> is ONE of the files (i.e. no wildcards)
     14 *          which need a version number and/or date set. For example:
     15 *             *.def, file_id.diz, dll\version.h, warpin\fm2.wis
     16 *       <trace-option> is a valid comnbination of trace options:
     17 *          '? a c e f i l n o r'. This is an OPTIONAL parameter.
     18 *
     19 * Examples:
     20 *    ReleaseEdit 3.15.0 av2.def
     21 *    ReleaseEdit 3.15.0 fm3.def trace=i
    1522 *
    1623 * Change log:
     
    3037 *       - improved error handling: tmp file renamed back to deleted file
    3138 *       - improved "usage" routine
     39 *    22 Nov 08 JBS Ticket 297
     40 *       - Fix bugs in version edits and added
     41 *       - Support for an optional trace parameter.
     42 *       - Improved "usage" routine
     43 *       - Suppressed output of 'del' commands
    3244 *
    3345*/
    3446
    3547n = setlocal()
     48
     49parse arg args
     50p = pos('TRACE=', translate(args))
     51if p > 0 then
     52   do
     53      args = args || ' ' /* make sure there's a space at the end */
     54      traceopt = substr(args, p+6, pos(' ', args, p+5) - (p+6))
     55      args = delstr(args, p, 6+length(traceopt))
     56      if traceopt \= '' then
     57         if verify(translate(traceopt), '?ACEFILNOR') = 0 & length(traceopt) < 3 then
     58            trace value traceopt
     59   end
    3660
    3761signal on Error
     
    4468signal on novalue             /* for debugging */
    4569*/
    46 
    4770/*
    4871   sed_separator:
     
    5982
    6083/* Process parameters */
    61 parse arg ver file .
     84parse var args ver file .
    6285if ver = '' | file = '' then
    6386   call Usage           /* and exit */
     
    153176            do
    154177               say 'Processing file:' file
    155                'grep -E "^#define.*COPYRIGHT_YEAR.*' || year || '" ' || file || ' >nul || del ' || file || ' && sed -r -e "/#define.*COPYRIGHT_YEAR/s/[0-9]+/' || year || '/" ' || tmpfile || ' >' file
     178               'grep -E "^#define.*COPYRIGHT_YEAR.*' || year || '" ' || file || ' >nul || del ' || file || '>nul 2>nul && sed -r -e "/#define.*COPYRIGHT_YEAR/s/[0-9]+/' || year || '/" ' || tmpfile || ' >' file
    156179            end
    157180         else
     
    183206end
    184207exit_routine:
    185 '@if exist' tmpfile 'del' tmpfile
     208'@if exist' tmpfile 'del' tmpfile '>nul 2>nul'
    186209n = endlocal()
    187210return
     
    239262      say srcline
    240263      i = i + 1
     264      if (i // 22) = 0 then
     265         '@pause'
    241266   end
    242267
  • trunk/ReleaseTool.cmd

    r1293 r1294  
    1010 *
    1111 * Usage:
    12  *    ReleaseTool [<this-version-number>] [<next-version-number>]
     12 *    ReleaseTool [trace=<trace-option>]
    1313 *
    14  *    where the version number(s) are optional and of the form x.y.z
    15  *
    16  * This program will reformat the version numbers to suit their use:
    17  *    tag names
    18  *    wpi filenames
    19  *    warpin packageid/database version number(s)
     14 *    where
     15 *       <trace-option> is a valid comnbination of trace options:
     16 *          '? a c e f i l n o r'. This is an OPTIONAL parameter.
    2017 *
    2118 * This program uses the following enviromental variables, if set
    22  *    SVN_EDITOR to set the text editor that is called
     19 *    SVN_EDITOR or EDITOR to set the text editor that is called
    2320 *    SVN_TESTER to call a cmd file that copies files to your test directory
    2421 *               and changes to that directory
     
    3431 *       - Removed extraneous 'pause' in option 20
    3532 *       - Fixed a bug in option 0 (run a command shell)
     33 *    22 Nov 08 JBS Ticket 297
     34 *       - Fix bugs in version edits
     35 *       - Support for an optional trace parameter.
     36 *       - Support for EDITOR env var
     37 *       - Improved "usage" routine
    3638 *
    3739*/
     
    5052
    5153
    52 globals = 'cmd prompt editor editorcmds killpid tester killtarget version_filelist pager prev_action'
    53 
    54 parse arg ver next_ver
    55 if (pos('?', ver) > 0 | pos('h', ver) > 0) then
    56    signal Usage      /* and exit */
     54globals = 'ver cmd prompt editor editorcmds killpid tester killtarget version_filelist pager prev_action'
     55
     56parse arg args
     57p = pos('TRACE=', translate(args))
     58if p > 0 then
     59   do
     60      args = args || ' ' /* make sure there's a space at the end */
     61      traceopt = substr(args, p+6, pos(' ', args, p+5) - (p+6))
     62      args = delstr(args, p, 6+length(traceopt))
     63      if traceopt \= '' then
     64         if verify(translate(traceopt), '?ACEFILNOR') = 0 & length(traceopt) < 3 then
     65            trace value traceopt
     66   end
     67else
     68   traceopt = ''
     69if strip(args) \= '' then  /* trace= is the only supported parameter */
     70   call Usage
    5771
    5872call Init
     
    131145               ver = GetVer('the pending release')
    132146            do f = 1 to words(version_filelist)
    133                call ReleaseEdit ver word(version_filelist, f)
     147               call ReleaseEdit ver word(version_filelist, f) 'trace=' || traceopt
    134148               say
    135149            end
     
    307321            next_ver = GetVer('the next release')
    308322            do f = 1 to words(version_filelist)
    309                call ReleaseEdit next_ver word(version_filelist, f)
     323               call ReleaseEdit next_ver word(version_filelist, f) 'trace=' || traceopt
    310324               say
    311325            end
     
    339353Usage:
    340354   say;say;say
    341    lastline = sigl - 10
    342    do i = 1 to lastline
    343       say sourceline(i)
     355   i = 1
     356   do forever
     357      srcline = sourceline(i)
     358      if pos('CHANGE LOG', translate(srcline)) > 0 then
     359         leave
     360      else
     361         say srcline
     362      i = i + 1
     363      if (i // 22) = 0 then
     364         '@pause'
    344365   end
    345366exit
     
    351372
    352373   action = 0
     374   ver = ''
    353375
    354376   editor = value('SVN_EDITOR',,'OS2ENVIRONMENT')
    355    cmd      = value('COMSPEC',,'OS2ENVIRONMENT')
    356    prompt   = value('PROMPT',,'OS2ENVIRONMENT')
    357    tester       = value('SVN_TESTER',,'OS2ENVIRONMENT')
    358    killpid      = value('SVN_KILL',,'OS2ENVIRONMENT')
    359 
    360377   editorcmds = ""
    361    if editor == '' then
     378   if editor = '' then
     379      editor = value('EDITOR',,'OS2ENVIRONMENT')
     380   if editor = '' then
    362381      editor = 'tedit'
    363382   else
     
    367386            editorcmds = "'3'"
    368387      end
     388   cmd      = value('COMSPEC',,'OS2ENVIRONMENT')
     389   prompt   = value('PROMPT',,'OS2ENVIRONMENT')
     390   tester       = value('SVN_TESTER',,'OS2ENVIRONMENT')
     391   killpid      = value('SVN_KILL',,'OS2ENVIRONMENT')
    369392   if killpid == '' then
    370393       killpid      = 'killpid'
    371394   killtarget  = ' FM/2'
     395
    372396   version_filelist = 'av2.def databar.def dirsize.def dll\fm3dll.def dll\fm3res.def'
    373397   version_filelist = version_filelist 'dll\version.h eas.def fm3.def fm4.def global.def ini.def'
     
    443467   say 'Please enter the version (x.yy.zz) for' ver_text ':'
    444468   ver_value = linein()
    445    parse var major '.' minor '.' CSDlevel
     469   parse var ver_value major '.' minor '.' CSDlevel
    446470   if minor    = '' then
    447471      minor    = 0
    448472   if CSDlevel = '' then
    449473      CSDlevel = 0
    450    if datatype(major) \= 'NUM' | datatype(minor \= 'NUM') | datatype(CSDlevel) \= 'NUM' then
     474   if datatype(major) \= 'NUM' | datatype(minor) \= 'NUM' | datatype(CSDlevel) \= 'NUM' then
    451475      do
    452476         say 'Error: Invalid version entered:' ver_value
     
    537561      call charout , 'OK to proceed with file write? (Y/n) '
    538562      entry = translate(SysGetKey())
    539       say;say 'Hex(key):' c2x(entry)
    540563   end
    541564
Note: See TracChangeset for help on using the changeset viewer.