quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

build_gnv_curl_pcsi_desc.com (15678B)


      1 $! File: Build_GNV_CURL_PCSI_DESC.COM
      2 $!
      3 $! Build the *.pcsi$text file in the following sections:
      4 $!   Required software dependencies.
      5 $!   install/upgrade/postinstall steps.
      6 $!      1. Duplicate filenames need an alias procedure. (N/A for curl)
      7 $!      2. ODS-5 filenames need an alias procedure. (N/A for curl)
      8 $!      3. Special alias links for executables (curl. -> curl.exe)
      9 $!         if a lot, then an alias procedure is needed.
     10 $!      4. Rename the files to lowercase.
     11 $!   Move Release Notes to destination
     12 $!   Source kit option
     13 $!   Create directory lines
     14 $!   Add file lines for curl.
     15 $!   Add Link alias procedure file (N/A for curl)
     16 $!   Add [.SYS$STARTUP]curl_startup file
     17 $!   Add Release notes file.
     18 $!
     19 $! The file PCSI_GNV_CURL_FILE_LIST.TXT is read in to get the files other
     20 $! than the release notes file and the source backup file.
     21 $!
     22 $! The PCSI system can really only handle ODS-2 format filenames and
     23 $! assumes that there is only one source directory.  It also assumes that
     24 $! all destination files with the same name come from the same source file.
     25 $! Fortunately CURL does not trip most of these issues, so those steps
     26 $! above are marked N/A.
     27 $!
     28 $! A rename action section is needed to make sure that the files are
     29 $! created in the GNV$GNU: in the correct case, and to create the alias
     30 $! link [usr.bin]curl. for [usr.bin]curl.exe.
     31 $!
     32 $! Copyright (C) John Malmberg
     33 $!
     34 $! Permission to use, copy, modify, and/or distribute this software for any
     35 $! purpose with or without fee is hereby granted, provided that the above
     36 $! copyright notice and this permission notice appear in all copies.
     37 $!
     38 $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     39 $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     40 $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     41 $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     42 $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     43 $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
     44 $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     45 $!
     46 $! SPDX-License-Identifier: ISC
     47 $!
     48 $!===========================================================================
     49 $!
     50 $ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
     51 $ if kit_name .eqs. ""
     52 $ then
     53 $   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
     54 $   goto all_exit
     55 $ endif
     56 $ producer = f$trnlnm("GNV_PCSI_PRODUCER")
     57 $ if producer .eqs. ""
     58 $ then
     59 $   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
     60 $   goto all_exit
     61 $ endif
     62 $ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE")
     63 $ if filename_base .eqs. ""
     64 $ then
     65 $   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
     66 $   goto all_exit
     67 $ endif
     68 $!
     69 $!
     70 $! Parse the kit name into components.
     71 $!---------------------------------------
     72 $ producer = f$element(0, "-", kit_name)
     73 $ base = f$element(1, "-", kit_name)
     74 $ product = f$element(2, "-", kit_name)
     75 $ mmversion = f$element(3, "-", kit_name)
     76 $ majorver = f$extract(0, 3, mmversion)
     77 $ minorver = f$extract(3, 2, mmversion)
     78 $ updatepatch = f$element(4, "-", kit_name)
     79 $ if updatepatch .eqs. "-" then updatepatch = ""
     80 $!
     81 $! kit type of "D" means a daily build
     82 $ kit_type = f$edit(f$extract(0, 1, majorver), "upcase")
     83 $!
     84 $!
     85 $ product_line = "product ''producer' ''base' ''product'"
     86 $ if updatepatch .eqs. ""
     87 $ then
     88 $     product_name = " ''majorver'.''minorver'"
     89 $ else
     90 $     product_name = " ''majorver'.''minorver'-''updatepatch'"
     91 $ endif
     92 $ product_line = product_line + " ''product_name' full;"
     93 $!write sys$output product_line
     94 $!
     95 $!
     96 $!
     97 $! Create the file as a VMS text file.
     98 $!----------------------------------------
     99 $ base_file = kit_name
    100 $ create 'base_file'.pcsi$desc
    101 $!
    102 $!
    103 $! Start building file.
    104 $!----------------------
    105 $ open/append pdsc 'base_file'.pcsi$desc
    106 $!
    107 $ write pdsc product_line
    108 $!
    109 $! Required product dependencies.
    110 $!----------------------------------
    111 $ vmsprd = "DEC"
    112 $ if base .eqs. "I64VMS" then vmsprd = "HP"
    113 $ vsiprd = "VSI"
    114 $!
    115 $ write pdsc "   software ''vmsprd' ''base' VMS ;"
    116 $ arch_type = f$getsyi("ARCH_NAME")
    117 $ node_swvers = f$getsyi("node_swvers")
    118 $ vernum = f$extract(1, f$length(node_swvers), node_swvers)
    119 $ majver = f$element(0, ".", vernum)
    120 $ minverdash = f$element(1, ".", vernum)
    121 $ minver = f$element(0, "-", minverdash)
    122 $ dashver = f$element(1, "-", minverdash)
    123 $ if dashver .eqs. "-" then dashver = ""
    124 $ vmstag = majver + minver + dashver
    125 $ code = f$extract(0, 1, arch_type)
    126 $ arch_code = f$extract(0, 1, arch_type)
    127 $ line_out = -
    128  "   if ((not <software ''vsiprd' ''base' VMS version minimum" + -
    129  " ''node_swvers'>) and" + -
    130  " (not <software ''vmsprd' ''base' VMS version minimum ''node_swvers'>));"
    131 $ write pdsc line_out
    132 $ write pdsc "      error NEED_VMS''vmstag';"
    133 $ write pdsc "   end if;"
    134 $!
    135 $write pdsc "   software VMSPORTS ''base' ZLIB ;"
    136 $write pdsc -
    137     "   if (not <software VMSPORTS ''base' ZLIB version minimum V1.2-8>) ;"
    138 $write pdsc "      error NEED_ZLIB;"
    139 $write pdsc "   end if;"
    140 $!
    141 $!
    142 $!
    143 $! install/upgrade/postinstall steps.
    144 $!-----------------------------------
    145 $!      1. Duplicate filenames need an alias procedure. (N/A for curl)
    146 $!      2. ODS-5 filenames need an alias procedure. (N/A for curl)
    147 $!      3. Special alias links for executables (curl. -> curl.exe)
    148 $!         if a lot, then an alias procedure is needed.
    149 $!      4. Rename the files to lowercase.
    150 $!
    151 $!
    152 $!   Alias links needed.
    153 $!-------------------------
    154 $ add_alias_lines = ""
    155 $ rem_alias_lines = ""
    156 $ line_out = ""
    157 $!
    158 $!   Read through the file list to set up aliases and rename commands.
    159 $!---------------------------------------------------------------------
    160 $ open/read flst pcsi_gnv_curl_file_list.txt
    161 $!
    162 $inst_alias_loop:
    163 $   read/end=inst_alias_loop_end flst line_in
    164 $   line_in = f$edit(line_in,"compress,trim,uncomment")
    165 $   if line_in .eqs. "" then goto inst_alias_loop
    166 $   pathname = f$element(0, " ", line_in)
    167 $   linkflag = f$element(1, " ", line_in)
    168 
    169 $   if linkflag .nes. "->" then goto inst_alias_write
    170 $!
    171 $   linktarget = f$element(2, " ", line_in)
    172 $   if kit_type .eqs. "D"
    173 $   then
    174 $       old_start = f$locate("[gnv.usr", pathname)
    175 $       if old_start .lt. f$length(pathname)
    176 $       then
    177 $           pathname = "[gnv.beta" + pathname - "[gnv.usr"
    178 $           linktarget = "[gnv.beta" + linktarget - "[gnv.usr"
    179 $       endif
    180 $   endif
    181 $   nlink = "pcsi$destination:" + pathname
    182 $   ntarg = "pcsi$destination:" + linktarget
    183 $   new_add_alias_line = -
    184   """if f$search(""""''nlink'"""") .eqs. """""""" then" + -
    185   " set file/enter=''nlink' ''ntarg'"""
    186 $   if add_alias_lines .nes. ""
    187 $   then
    188 $       add_alias_lines = add_alias_lines + "," + new_add_alias_line
    189 $   else
    190 $       add_alias_lines = new_add_alias_line
    191 $   endif
    192 $!
    193 $   new_rem_alias_line = -
    194   """if f$search(""""''nlink'"""") .nes. """""""" then" + -
    195   " set file/remove ''nlink';"""
    196 $   if rem_alias_lines .nes. ""
    197 $   then
    198 $      rem_alias_lines = rem_alias_lines + "," + new_rem_alias_line
    199 $   else
    200 $      rem_alias_lines = new_rem_alias_line
    201 $   endif
    202 $!
    203 $   goto inst_alias_loop
    204 $!
    205 $inst_alias_write:
    206 $!
    207 $!  execute install / remove
    208 $   write pdsc "   execute install ("
    209 $! add aliases
    210 $   i = 0
    211 $ex_ins_loop:
    212 $       line = f$element(i, ",", add_alias_lines)
    213 $       i = i + 1
    214 $       if line .eqs. "" then goto ex_ins_loop
    215 $       if line .eqs. "," then goto ex_ins_loop_end
    216 $       if line_out .nes. "" then write pdsc line_out,","
    217 $       line_out = line
    218 $       goto ex_ins_loop
    219 $ex_ins_loop_end:
    220 $   write pdsc line_out
    221 $   line_out = ""
    222 $   write pdsc "      )"
    223 $   write pdsc "   remove ("
    224 $! remove aliases
    225 $   i = 0
    226 $ex_rem_loop:
    227 $       line = f$element(i, ",", rem_alias_lines)
    228 $       i = i + 1
    229 $       if line .eqs. "" then goto ex_rem_loop
    230 $       if line .eqs. "," then goto ex_rem_loop_end
    231 $       if line_out .nes. "" then write pdsc line_out,","
    232 $       line_out = line
    233 $       goto ex_rem_loop
    234 $ex_rem_loop_end:
    235 $   write pdsc line_out
    236 $   line_out = ""
    237 $   write pdsc "      ) ;"
    238 $!
    239 $!  execute upgrade
    240 $   write pdsc "   execute upgrade ("
    241 $   i = 0
    242 $ex_upg_loop:
    243 $       line = f$element(i, ",", rem_alias_lines)
    244 $       i = i + 1
    245 $       if line .eqs. "" then goto ex_upg_loop
    246 $       if line .eqs. "," then goto ex_upg_loop_end
    247 $       if line_out .nes. "" then write pdsc line_out,","
    248 $       line_out = line
    249 $       goto ex_upg_loop
    250 $ex_upg_loop_end:
    251 $   write pdsc line_out
    252 $   line_out = ""
    253 $! remove aliases
    254 $   write pdsc "      ) ;"
    255 $!
    256 $!  execute postinstall
    257 $   write pdsc "   execute postinstall ("
    258 $   if arch_code .nes. "V"
    259 $   then
    260 $       line_out = "   ""set process/parse=extended"""
    261 $   endif
    262 $   i = 0
    263 $ex_pins_loop:
    264 $       line = f$element(i, ",", add_alias_lines)
    265 $       i = i + 1
    266 $       if line .eqs. "" then goto ex_pins_loop
    267 $       if line .eqs. "," then goto ex_pins_loop_end
    268 $       if line_out .nes. "" then write pdsc line_out,","
    269 $       line_out = line
    270 $       goto ex_pins_loop
    271 $ex_pins_loop_end:
    272 $   if line_out .eqs. "" then line_out = "   ""continue"""
    273 $!   write pdsc line_out
    274 $!   line_out = ""
    275 $! add aliases and follow with renames.
    276 $!
    277 $goto inst_dir
    278 $!
    279 $inst_dir_loop:
    280 $   read/end=inst_alias_loop_end flst line_in
    281 $   line_in = f$edit(line_in,"compress,trim,uncomment")
    282 $   if line_in .eqs. "" then goto inst_dir_loop
    283 $inst_dir:
    284 $   pathname = f$element(0, " ", line_in)
    285 $   if kit_type .eqs. "D"
    286 $   then
    287 $       if pathname .eqs. "[gnv]usr.dir"
    288 $       then
    289 $           pathname = "[gnv]beta.dir"
    290 $       else
    291 $           old_start = f$locate("[gnv.usr", pathname)
    292 $           if old_start .lt. f$length(pathname)
    293 $           then
    294 $               pathname = "[gnv.beta" + pathname - "[gnv.usr"
    295 $           endif
    296 $       endif
    297 $   endif
    298 $!
    299 $!  Ignore the directory entries for now.
    300 $!-----------------------------------------
    301 $   filedir = f$parse(pathname,,,"DIRECTORY")
    302 $   if pathname .eqs. filedir then goto inst_dir_loop
    303 $!
    304 $!  process .dir extensions for rename
    305 $!  If this is not a directory then start processing files.
    306 $!-------------------------
    307 $   filetype = f$parse(pathname,,,"TYPE")
    308 $   filetype_u = f$edit(filetype, "upcase")
    309 $   filename = f$parse(pathname,,,"NAME")
    310 $   if filetype_u .nes. ".DIR" then goto inst_file
    311 $!
    312 $!  process directory lines for rename.
    313 $!--------------------------------------
    314 $   if line_out .nes. ""
    315 $   then
    316 $       write pdsc line_out,","
    317 $       line_out = ""
    318 $   endif
    319 $   if arch_code .nes. "V"
    320 $   then
    321 $       if line_out .nes. "" then write pdsc line_out,","
    322 $       line_out = "   ""rename pcsi$destination:''pathname' ''filename'.DIR"""
    323 $   else
    324 $       if line_out .nes. "" then write pdsc line_out
    325 $       line_out = ""
    326 $   endif
    327 $   goto inst_dir_loop
    328 $!
    329 $!
    330 $!   process file lines for rename
    331 $!---------------------------------
    332 $inst_file_loop:
    333 $   read/end=inst_alias_loop_end flst line_in
    334 $   line_in = f$edit(line_in,"compress,trim,uncomment")
    335 $   if line_in .eqs. "" then goto inst_dir_loop
    336 $   pathname = f$element(0, " ", line_in)
    337 $   if kit_type .eqs. "D"
    338 $   then
    339 $       if pathname .eqs. "[gnv]usr.dir"
    340 $       then
    341 $           pathname = "[gnv]beta.dir"
    342 $       else
    343 $           old_start = f$locate("[gnv.usr", pathname)
    344 $           if old_start .lt. f$length(pathname)
    345 $           then
    346 $               pathname = "[gnv.beta" + pathname - "[gnv.usr"
    347 $           endif
    348 $       endif
    349 $   endif
    350 $!
    351 $!  Filenames with $ in them are VMS special and do not need to be lowercase.
    352 $!  --------------------------------------------------------------------------
    353 $   if f$locate("$", pathname) .lt. f$length(pathname) then goto inst_file_loop
    354 $!
    355 $   filetype = f$parse(pathname,,,"TYPE")
    356 $   filename = f$parse(pathname,,,"NAME") + filetype
    357 $inst_file:
    358 $   if arch_code .nes. "V"
    359 $   then
    360 $       if line_out .nes. "" then write pdsc line_out,","
    361 $       filetype = f$parse(pathname,,,"TYPE")
    362 $       filename = f$parse(pathname,,,"NAME") + filetype
    363 $       line_out = "   ""rename pcsi$destination:''pathname' ''filename'"""
    364 $   else
    365 $       if line_out .nes. "" then write pdsc line_out
    366 $       line_out = ""
    367 $   endif
    368 $   goto inst_file_loop
    369 $!
    370 $inst_alias_loop_end:
    371 $!
    372 $write pdsc line_out
    373 $write pdsc "        ) ;"
    374 $close flst
    375 $!
    376 $!   Move Release Notes to destination
    377 $!-------------------------------------
    378 $write pdsc "   information RELEASE_NOTES phase after ;"
    379 $!
    380 $!   Source kit option
    381 $!---------------------
    382 $write pdsc "   option SOURCE default 0;"
    383 $write pdsc "   directory ""[gnv.common_src]"" PROTECTION PUBLIC ;"
    384 $write pdsc -
    385     "        file ""[gnv.common_src]''filename_base'_original_src.bck"""
    386 $write pdsc -
    387     "          source [common_src]''filename_base'_original_src.bck ;"
    388 $if f$search("gnv$gnu:[vms_src]''filename_base'_vms_src.bck") .nes. ""
    389 $then
    390 $    write pdsc "   directory ""[gnv.vms_src]"" PROTECTION PUBLIC ;"
    391 $    write pdsc "        file ""[gnv.vms_src]''filename_base'_vms_src.bck"""
    392 $    write pdsc "          source [vms_src]''filename_base'_vms_src.bck ;"
    393 $endif
    394 $write pdsc "   end option;"
    395 $!
    396 $!
    397 $! Read through the file list again.
    398 $!----------------------------------
    399 $open/read flst pcsi_gnv_curl_file_list.txt
    400 $!
    401 $!
    402 $!   Create directory lines
    403 $!-------------------------
    404 $flst_dir_loop:
    405 $   read/end=flst_loop_end flst line_in
    406 $   line_in = f$edit(line_in,"compress,trim,uncomment")
    407 $   if line_in .eqs. "" then goto flst_dir_loop
    408 $!
    409 $   filename = f$element(0, " ", line_in)
    410 $   linkflag = f$element(1, " ", line_in)
    411 $   if linkflag .eqs. "->" then goto flst_dir_loop
    412 $!
    413 $!  Ignore .dir extensions
    414 $!-------------------------
    415 $   filetype = f$edit(f$parse(filename,,,"TYPE"), "upcase")
    416 $   if filetype .eqs. ".DIR" then goto flst_dir_loop
    417 $!
    418 $   destname = filename
    419 $   if kit_type .eqs. "D"
    420 $   then
    421 $       old_start = f$locate("[gnv.usr", destname)
    422 $       if old_start .lt. f$length(destname)
    423 $       then
    424 $           destname = "[gnv.beta" + destname - "[gnv.usr"
    425 $       endif
    426 $   endif
    427 $!
    428 $!  It should be just a directory then.
    429 $!-------------------------------------
    430 $   filedir = f$edit(f$parse(filename,,,"DIRECTORY"), "lowercase")
    431 $!  If this is not a directory then start processing files.
    432 $!---------------------------------------------------------
    433 $   if filename .nes. filedir then goto flst_file
    434 $!
    435 $   write pdsc "   directory ""''destname'"" PROTECTION PUBLIC ;"
    436 $   goto flst_dir_loop
    437 $!
    438 $!
    439 $!   Add file lines for curl.
    440 $!---------------------------
    441 $flst_file_loop:
    442 $   read/end=flst_loop_end flst line_in
    443 $   line_in = f$edit(line_in,"compress,trim,uncomment")
    444 $   if line_in .eqs. "" then goto inst_file_loop
    445 $   filename = f$element(0, " ", line_in)
    446 $   destname = filename
    447 $   if kit_type .eqs. "D"
    448 $   then
    449 $       old_start = f$locate("[gnv.usr", destname)
    450 $       if old_start .lt. f$length(destname)
    451 $       then
    452 $           destname = "[gnv.beta" + destname - "[gnv.usr"
    453 $       endif
    454 $   endif
    455 $flst_file:
    456 $   srcfile = filename - "gnv."
    457 $   write pdsc "   file ""''destname'"" "
    458 $   write pdsc "     source ""''srcfile'"" ;"
    459 $   goto flst_file_loop
    460 $!
    461 $flst_loop_end:
    462 $ close flst
    463 $!
    464 $!   Add Link alias procedure file (N/A for curl)
    465 $!------------------------------------------------
    466 $!
    467 $!   Add [.SYS$STARTUP]curl_startup file
    468 $!---------------------------------------
    469 $ if kit_type .eqs. "D"
    470 $ then
    471 $   write pdsc "   file ""[sys$startup]curl_daily_startup.com"""
    472 $ else
    473 $   write pdsc "   file ""[sys$startup]curl_startup.com"""
    474 $ endif
    475 $ write pdsc "     source [usr.lib]curl_startup.com ;"
    476 $!
    477 $!   Add Release notes file.
    478 $!------------------------------
    479 $ write pdsc -
    480     "   file ""[SYSHLP]''filename_base'.release_notes"" release notes ;"
    481 $!
    482 $! Close the product file
    483 $!------------------------
    484 $ write pdsc "end product;"
    485 $!
    486 $close pdsc
    487 $!
    488 $all_exit:
    489 $ exit