Changeset 608


Ignore:
Timestamp:
Apr 19, 2007, 12:42:21 AM (19 years ago)
Author:
John Small
Message:
  • Changed to support improved WPI build process, including the

new format for BLD_FM2_WPIDIRS.TXT and using the new
BLD_FM2_WPIDIRS.IN file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/warpin/bld_fm2_wpidirs.cmd

    r597 r608  
    55 *
    66 * TODO:
     7 *    -  Support multiple levels of destination directories
    78 *    -  Add logic to read script to determine
    89 *       -  Number of packages
     
    3132WPI. = ''
    3233WPI.retval = 0
    33 WPI.max_package_number = 999
     34WPI.max_package_number_length = 3
    3435
    3536parse arg args
     
    3839call ReadFile
    3940
    40 do p = 1 to WPI.pkg.0
    41    dest_basedir   = 'PACKAGE.' || right(WPI.pkg.p.number, length(WPI.max_package_number), '0')
    42    '@if not exist 'dest_basedir'\. md 'dest_basedir
    43    if WPI.pkg.p.file.0 \= '' then
    44       do f = 1 to WPI.pkg.p.file.0
    45          dest_dir = dest_basedir || '\' || WPI.pkg.p.file.f.dest
    46          '@if not exist 'dest_dir'\. md 'dest_dir
    47          'copy ' || WPI.src_basedir || WPI.pkg.p.file.f.src || '\' || WPI.pkg.p.file.f.name || ' ' || dest_dir
    48       end
     41do f = 1 to WPI.fileline.0
     42   parse var WPI.fileline.f . filename pkgnum src_subdir dest_subdir
     43   if WPI.src_basedir \= '..\' then  /* Ignore src_subdir from file if not using build subtree */
     44      src_subdir = '.'
     45   dest_basedir   = MakePackageDir( pkgnum )
     46   dest_dir = dest_basedir || '\' || strip(dest_subdir)
     47   call SysMkDir dest_dir
     48   'copy ' || WPI.src_basedir || src_subdir || '\' || filename || ' ' || dest_dir
    4949end
    5050
     
    5555   parse arg errorcode
    5656   select
    57       when errorcode = 1 then
    58          say 'Error: More than one PACKAGECOUNT line in 'WPI.infile
    59       when errorcode = 2 then
    60          say 'Error: More than PACKAGECOUNT PACKAGE lines in 'WPI.infile
    6157      when errorcode = 3 then
    6258         do
     
    6561         end
    6662      when errorcode = 4 then
    67          say 'Error: Keyword is not PACKAGECOUNT, PACKAGE or FILE in 'WPI.infile
     63         say 'Error: Keyword is not FILE or NOFILESPACKAGE in 'WPI.infile
    6864      when errorcode = 5 then
    6965novalue:
     
    7268            say '   'sourceline(sigl)
    7369            signal NormalExit
    74          end
    75       when errorcode = 6 then
    76          do
    77             say 'Error: Duplicate PACKAGE line in 'WPI.infile
    78             say 'Line : 'txtline
    79          end
    80       when errorcode = 7 then
    81          do
    82             say 'Error: Invalid package number in 'WPI.infile
    83             say 'Line : 'txtline
    8470         end
    8571      otherwise
     
    9581
    9682ReadFile: procedure expose (globals)
    97    package_number_list = ''
     83   f = 0
    9884   do while lines(WPI.infile) > 0
    9985      txtline = strip(linein(WPI.infile))
     
    10894            txtline = strip(txtline)
    10995         end
    110       word1 = translate(word(txtline, 1))
    111       select
    112          when word1 == 'PACKAGECOUNT:' then
    113             if WPI.pkg.0 == '' then
    114                WPI.pkg.0 = word(txtline, 2)
     96      parse value translate(txtline) with word1 word2 word3 .
     97      if (word1 == 'FILE:') then
     98         do
     99            if words(txtline) \= 5 then
     100               call ErrorExit 3  /* Invalid number of parameters */
    115101            else
    116                call ErrorExit 1           /* More than one PACKAGECOUNT */
    117          when word1 == 'PACKAGE:' then
    118             do
    119                parse var txtline . pkgnum pkgdesc
    120                if wordpos(pkgnum, package_number_list) > 0 then
    121                   call ErrorExit 6         /* Repeated package line */
    122                package_number_list = package_number_list pkgnum
    123                p = words(package_number_list)
    124                if p > WPI.pkg.0 then
    125                   call ErrorExit 2        /*  More packages than PACKAGECOUNT  */
    126                WPI.pkg.p.number = pkgnum
    127                WPI.pkg.p.desc = strip(pkgdesc)
    128             end
    129          when (word1 == 'FILE:') then
    130             do
    131                parse var txtline . filename pkgnum filesrc filedest rest
    132                p = wordpos(pkgnum, package_number_list)
    133                if p = 0 then
    134                   call ErrorExit 7
    135                else
    136                   if strip(rest) \= '' then
    137                      call ErrorExit 3  /* Too many parameters */
    138                   else
    139                      do
    140                         i = WPI.pkg.p.file.0
    141                         if i = '' then
    142                            i = 1
    143                         else
    144                            i = i + 1
    145                         WPI.pkg.p.file.0      = i
    146                         WPI.pkg.p.file.i.name = filename
    147                         if WPI.src_basedir \= '..\' then  /* Ignore src-dir if not using build subtree */
    148                            WPI.pkg.p.file.i.src  = '.'
    149                         else
    150                            WPI.pkg.p.file.i.src  = filesrc
    151                         WPI.pkg.p.file.i.dest = filedest
    152                      end
    153             end
    154          otherwise
     102               do
     103                  f = f + 1
     104                  WPI.fileline.f = strip(txtline)
     105/*
     106                  if word3 > WPI.max_package_number then
     107                      WPI.max_package_number = word3
     108*/
     109               end
     110         end
     111      else
     112         if word1 == 'NOFILESPACKAGE:' then
     113            call MakePackageDir word2
     114         else
    155115            call ErrorExit 4        /* Invalid line/word1 */
    156       end
    157116   end
     117   WPI.fileline.0 = f
    158118   call stream WPI.infile, 'c', 'close'
    159119return
     
    181141      WPI.src_basedir = WPI.src_basedir || '\'
    182142   if args == '' then
     143/*
    183144      WPI.infile = 'BLD_FM2_WPIDIRS.TXT'
     145*/
     146      WPI.infile = 'BLD_FM2_WPIDIRS.IN'
    184147   else
    185148      if left(args, 1) == '"' then
     
    189152return
    190153
     154MakePackageDir: procedure expose (globals)
     155   parse arg pkgnum
     156   full_dirname = 'PACKAGE.' || right(pkgnum, WPI.max_package_number_length, '0')
     157   call SysMkDir full_dirname
     158return full_dirname
     159
Note: See TracChangeset for help on using the changeset viewer.