| 1 |
$! File: Build_GAWK_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. |
| 7 |
$! 2. ODS-5 filenames need an alias procedure. |
| 8 |
$! 3. Special alias links for executables (cp. -> gnv$cp.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 gawk. |
| 15 |
$! Add Link alias procedure file (used for gawk) |
| 16 |
$! Add [.SYS$STARTUP]gawk_startup file |
| 17 |
$! Add Release notes file. |
| 18 |
$! |
| 19 |
$! The file PCSI_GAWK_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 GAWK 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]gawk. for [usr.bin]gawk.exe. |
| 31 |
$! |
| 32 |
$! 02-Jan-2014 J. Malmberg - Gawk version |
| 33 |
$! |
| 34 |
$!=========================================================================== |
| 35 |
$! |
| 36 |
$ kit_name = f$trnlnm("GNV_PCSI_KITNAME") |
| 37 |
$ if kit_name .eqs. "" |
| 38 |
$ then |
| 39 |
$ write sys$output "@[.vms]MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." |
| 40 |
$ goto all_exit |
| 41 |
$ endif |
| 42 |
$ producer = f$trnlnm("GNV_PCSI_PRODUCER") |
| 43 |
$ if producer .eqs. "" |
| 44 |
$ then |
| 45 |
$ write sys$output "@[.vms]MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." |
| 46 |
$ goto all_exit |
| 47 |
$ endif |
| 48 |
$ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE") |
| 49 |
$ if filename_base .eqs. "" |
| 50 |
$ then |
| 51 |
$ write sys$output "@[.vms]MAKE_PCSI_GAWK_KIT_NAME.COM has not been run." |
| 52 |
$ goto all_exit |
| 53 |
$ endif |
| 54 |
$! |
| 55 |
$! |
| 56 |
$! Parse the kit name into components. |
| 57 |
$!--------------------------------------- |
| 58 |
$ producer = f$element(0, "-", kit_name) |
| 59 |
$ base = f$element(1, "-", kit_name) |
| 60 |
$ product = f$element(2, "-", kit_name) |
| 61 |
$ mmversion = f$element(3, "-", kit_name) |
| 62 |
$ majorver = f$extract(0, 3, mmversion) |
| 63 |
$ minorver = f$extract(3, 2, mmversion) |
| 64 |
$ updatepatch = f$element(4, "-", kit_name) |
| 65 |
$ if updatepatch .eqs. "-" then updatepatch = "" |
| 66 |
$! |
| 67 |
$! kit type of "D" means a daily build |
| 68 |
$ kit_type = f$edit(f$extract(0, 1, majorver), "upcase") |
| 69 |
$! |
| 70 |
$! |
| 71 |
$ product_line = "product ''producer' ''base' ''product'" |
| 72 |
$ if updatepatch .eqs. "" |
| 73 |
$ then |
| 74 |
$ product_name = " ''majorver'.''minorver'" |
| 75 |
$ else |
| 76 |
$ product_name = " ''majorver'.''minorver'-''updatepatch'" |
| 77 |
$ endif |
| 78 |
$ product_line = product_line + " ''product_name' full;" |
| 79 |
$!write sys$output product_line |
| 80 |
$! |
| 81 |
$! |
| 82 |
$! |
| 83 |
$! Create the file as a VMS text file. |
| 84 |
$!---------------------------------------- |
| 85 |
$ base_file = kit_name |
| 86 |
$ create 'base_file'.pcsi$desc |
| 87 |
$! |
| 88 |
$! |
| 89 |
$! Start building file. |
| 90 |
$!---------------------- |
| 91 |
$ open/append pdsc 'base_file'.pcsi$desc |
| 92 |
$! |
| 93 |
$ write pdsc product_line |
| 94 |
$! |
| 95 |
$! Required product dependencies. |
| 96 |
$!---------------------------------- |
| 97 |
$ vmsprd = "DEC" |
| 98 |
$ if base .eqs. "I64VMS" then vmsprd = "HP" |
| 99 |
$ vsiprd = "VSI" |
| 100 |
$! |
| 101 |
$ arch_type = f$getsyi("ARCH_NAME") |
| 102 |
$ node_swvers = f$getsyi("node_swvers") |
| 103 |
$ vernum = f$extract(1, f$length(node_swvers), node_swvers) |
| 104 |
$ majver = f$element(0, ".", vernum) |
| 105 |
$ minverdash = f$element(1, ".", vernum) |
| 106 |
$ minver = f$element(0, "-", minverdash) |
| 107 |
$ dashver = f$element(1, "-", minverdash) |
| 108 |
$ if dashver .eqs. "-" then dashver = "" |
| 109 |
$ vmstag = majver + minver + dashver |
| 110 |
$ code = f$extract(0, 1, arch_type) |
| 111 |
$ arch_code = f$extract(0, 1, arch_type) |
| 112 |
$ line_out = - |
| 113 |
" if ((<software ''vmsprd' ''base' VMS> and" |
| 114 |
$ write pdsc line_out |
| 115 |
$ line_out = - |
| 116 |
" (not <software ''vmsprd' ''base' VMS version minimum" + - |
| 117 |
" ''node_swvers'>)) or" |
| 118 |
$ write pdsc line_out |
| 119 |
$ line_out = - |
| 120 |
" (<software ''vsiprd' ''base' VMS>" |
| 121 |
$ write pdsc line_out |
| 122 |
$ line_out = - |
| 123 |
" and (not <software ''vsiprd' ''base' VMS version minimum" + - |
| 124 |
" ''node_swvers'>))) ;" |
| 125 |
$ write pdsc line_out |
| 126 |
$ write pdsc " error NEED_VMS''vmstag';" |
| 127 |
$ write pdsc " end if;" |
| 128 |
$! |
| 129 |
$! |
| 130 |
$! |
| 131 |
$! install/upgrade/postinstall steps. |
| 132 |
$!----------------------------------- |
| 133 |
$! 1. Duplicate filenames need an alias procedure. |
| 134 |
$! 2. ODS-5 filenames need an alias procedure. |
| 135 |
$! 3. Special alias links for executables (gawk. -> gnv$gawk.exe) |
| 136 |
$! if a lot, then an alias procedure is needed. |
| 137 |
$! 4. Rename the files to lowercase. |
| 138 |
$! |
| 139 |
$! |
| 140 |
$! Alias links needed. |
| 141 |
$!------------------------- |
| 142 |
$ add_alias_lines = "" |
| 143 |
$ rem_alias_lines = "" |
| 144 |
$ line_out = "" |
| 145 |
$! |
| 146 |
$! Read through the file list to set up aliases and rename commands. |
| 147 |
$!--------------------------------------------------------------------- |
| 148 |
$ open/read flst [.vms]pcsi_gawk_file_list.txt |
| 149 |
$! |
| 150 |
$inst_alias_loop: |
| 151 |
$ read/end=inst_alias_loop_end flst line_in |
| 152 |
$ line_in = f$edit(line_in,"compress,trim,uncomment") |
| 153 |
$ if line_in .eqs. "" then goto inst_alias_loop |
| 154 |
$ pathname = f$element(0, " ", line_in) |
| 155 |
$ linkflag = f$element(1, " ", line_in) |
| 156 |
|
| 157 |
$ if linkflag .nes. "->" then goto inst_alias_write |
| 158 |
$! |
| 159 |
$ linktarget = f$element(2, " ", line_in) |
| 160 |
$ nlink = "pcsi$destination:" + pathname |
| 161 |
$ ntarg = "pcsi$destination:" + linktarget |
| 162 |
$ new_add_alias_line = - |
| 163 |
"""if f$search(""""''nlink'"""") .eqs. """""""" then" + - |
| 164 |
" set file/enter=''nlink' ''ntarg'""" |
| 165 |
$ if add_alias_lines .nes. "" |
| 166 |
$ then |
| 167 |
$ add_alias_lines = add_alias_lines + "," + new_add_alias_line |
| 168 |
$ else |
| 169 |
$ add_alias_lines = new_add_alias_line |
| 170 |
$ endif |
| 171 |
$! |
| 172 |
$ new_rem_alias_line = - |
| 173 |
"""if f$search(""""''nlink'"""") .nes. """""""" then" + - |
| 174 |
" set file/remove ''nlink';""" |
| 175 |
$ if rem_alias_lines .nes. "" |
| 176 |
$ then |
| 177 |
$ rem_alias_lines = rem_alias_lines + "," + new_rem_alias_line |
| 178 |
$ else |
| 179 |
$ rem_alias_lines = new_rem_alias_line |
| 180 |
$ endif |
| 181 |
$! |
| 182 |
$ goto inst_alias_loop |
| 183 |
$! |
| 184 |
$inst_alias_write: |
| 185 |
$! |
| 186 |
$! execute install / remove |
| 187 |
$ write pdsc " execute install (" |
| 188 |
$! add aliases |
| 189 |
$ i = 0 |
| 190 |
$ex_ins_loop: |
| 191 |
$ line = f$element(i, ",", add_alias_lines) |
| 192 |
$ i = i + 1 |
| 193 |
$ if line .eqs. "" then goto ex_ins_loop |
| 194 |
$ if line .eqs. "," then goto ex_ins_loop_end |
| 195 |
$ if line_out .nes. "" then write pdsc line_out,"," |
| 196 |
$ line_out = line |
| 197 |
$ goto ex_ins_loop |
| 198 |
$ex_ins_loop_end: |
| 199 |
$ if line_out .eqs. "" then line_out = " ""continue""" |
| 200 |
$ write pdsc line_out |
| 201 |
$ line_out = "" |
| 202 |
$ write pdsc " )" |
| 203 |
$ write pdsc " remove (" |
| 204 |
$! remove aliases |
| 205 |
$ line_out = - |
| 206 |
" ""@pcsi$destination:[gnv.vms_bin]gawk_alias_setup.com remove""" |
| 207 |
$ i = 0 |
| 208 |
$ex_rem_loop: |
| 209 |
$ line = f$element(i, ",", rem_alias_lines) |
| 210 |
$ i = i + 1 |
| 211 |
$ if line .eqs. "" then goto ex_rem_loop |
| 212 |
$ if line .eqs. "," then goto ex_rem_loop_end |
| 213 |
$ if line_out .nes. "" then write pdsc line_out,"," |
| 214 |
$ line_out = line |
| 215 |
$ goto ex_rem_loop |
| 216 |
$ex_rem_loop_end: |
| 217 |
$ if line_out .eqs. "" then line_out = " ""continue""" |
| 218 |
$ write pdsc line_out |
| 219 |
$ line_out = "" |
| 220 |
$ write pdsc " ) ;" |
| 221 |
$! |
| 222 |
$! execute upgrade |
| 223 |
$ write pdsc " execute upgrade (" |
| 224 |
$ line_out = - |
| 225 |
" ""@pcsi$destination:[gnv.vms_bin]gawk_alias_setup.com remove""" |
| 226 |
$ i = 0 |
| 227 |
$ex_upg_loop: |
| 228 |
$ line = f$element(i, ",", rem_alias_lines) |
| 229 |
$ i = i + 1 |
| 230 |
$ if line .eqs. "" then goto ex_upg_loop |
| 231 |
$ if line .eqs. "," then goto ex_upg_loop_end |
| 232 |
$ if line_out .nes. "" then write pdsc line_out,"," |
| 233 |
$ line_out = line |
| 234 |
$ goto ex_upg_loop |
| 235 |
$ex_upg_loop_end: |
| 236 |
$ if line_out .eqs. "" then line_out = " ""continue""" |
| 237 |
$ write pdsc line_out |
| 238 |
$ line_out = "" |
| 239 |
$! remove aliases |
| 240 |
$ write pdsc " ) ;" |
| 241 |
$! |
| 242 |
$! execute postinstall |
| 243 |
$ write pdsc " execute postinstall (" |
| 244 |
$ if arch_code .nes. "V" |
| 245 |
$ then |
| 246 |
$ line_out = " ""set process/parse=extended""," |
| 247 |
$ write pdsc line_out |
| 248 |
$ endif |
| 249 |
$ line_out = " ""@pcsi$destination:[gnv.vms_bin]remove_old_gawk.com""," |
| 250 |
$ write pdsc line_out |
| 251 |
$ line_out = " ""@pcsi$destination:[gnv.vms_bin]gawk_alias_setup.com""" |
| 252 |
$ i = 0 |
| 253 |
$ex_pins_loop: |
| 254 |
$ line = f$element(i, ",", add_alias_lines) |
| 255 |
$ i = i + 1 |
| 256 |
$ if line .eqs. "" then goto ex_pins_loop |
| 257 |
$ if line .eqs. "," then goto ex_pins_loop_end |
| 258 |
$ if line_out .nes. "" then write pdsc line_out,"," |
| 259 |
$ line_out = line |
| 260 |
$ goto ex_pins_loop |
| 261 |
$ex_pins_loop_end: |
| 262 |
$ if line_out .eqs. "" then line_out = " ""continue""" |
| 263 |
$! write pdsc line_out |
| 264 |
$! line_out = "" |
| 265 |
$! add aliases and follow with renames. |
| 266 |
$! |
| 267 |
$goto inst_dir |
| 268 |
$! |
| 269 |
$inst_dir_loop: |
| 270 |
$ read/end=inst_alias_loop_end flst line_in |
| 271 |
$ line_in = f$edit(line_in,"compress,trim,uncomment") |
| 272 |
$ if line_in .eqs. "" then goto inst_dir_loop |
| 273 |
$inst_dir: |
| 274 |
$ pathname = f$element(0, " ", line_in) |
| 275 |
$! |
| 276 |
$! Ignore the directory entries for now. |
| 277 |
$!----------------------------------------- |
| 278 |
$ filedir = f$parse(pathname,,,"DIRECTORY") |
| 279 |
$ if pathname .eqs. filedir then goto inst_dir_loop |
| 280 |
$! |
| 281 |
$! process .dir extensions for rename |
| 282 |
$! If this is not a directory then start processing files. |
| 283 |
$!------------------------- |
| 284 |
$ filetype = f$parse(pathname,,,"TYPE") |
| 285 |
$ filetype_u = f$edit(filetype, "upcase") |
| 286 |
$ filename = f$parse(pathname,,,"NAME") |
| 287 |
$ if filetype_u .nes. ".DIR" then goto inst_file |
| 288 |
$! |
| 289 |
$! process directory lines for rename. |
| 290 |
$!-------------------------------------- |
| 291 |
$ if line_out .nes. "" |
| 292 |
$ then |
| 293 |
$ write pdsc line_out,"," |
| 294 |
$ line_out = "" |
| 295 |
$ endif |
| 296 |
$ if arch_code .nes. "V" |
| 297 |
$ then |
| 298 |
$ if line_out .nes. "" then write pdsc line_out,"," |
| 299 |
$ line_out = " ""rename pcsi$destination:''pathname' ''filename'.DIR""" |
| 300 |
$ else |
| 301 |
$ if line_out .nes. "" then write pdsc line_out |
| 302 |
$ line_out = "" |
| 303 |
$ endif |
| 304 |
$ goto inst_dir_loop |
| 305 |
$! |
| 306 |
$! |
| 307 |
$! process file lines for rename |
| 308 |
$!--------------------------------- |
| 309 |
$inst_file_loop: |
| 310 |
$ read/end=inst_alias_loop_end flst line_in |
| 311 |
$ line_in = f$edit(line_in,"compress,trim,uncomment") |
| 312 |
$ if line_in .eqs. "" then goto inst_dir_loop |
| 313 |
$ pathname = f$element(0, " ", line_in) |
| 314 |
$! |
| 315 |
$! Filenames with $ in them are VMS special and do not need to be lowercased. |
| 316 |
$! -------------------------------------------------------------------------- |
| 317 |
$ if f$locate("$", pathname) .lt. f$length(pathname) then goto inst_file_loop |
| 318 |
$! |
| 319 |
$ filetype = f$parse(pathname,,,"TYPE") |
| 320 |
$ filename = f$parse(pathname,,,"NAME") + filetype |
| 321 |
$inst_file: |
| 322 |
$ if arch_code .nes. "V" |
| 323 |
$ then |
| 324 |
$ if line_out .nes. "" then write pdsc line_out,"," |
| 325 |
$ filetype = f$parse(pathname,,,"TYPE") |
| 326 |
$ filename = f$parse(pathname,,,"NAME") + filetype |
| 327 |
$ line_out = " ""rename pcsi$destination:''pathname' ''filename'""" |
| 328 |
$ else |
| 329 |
$ if line_out .nes. "" then write pdsc line_out |
| 330 |
$ line_out = "" |
| 331 |
$ endif |
| 332 |
$ goto inst_file_loop |
| 333 |
$! |
| 334 |
$inst_alias_loop_end: |
| 335 |
$! |
| 336 |
$write pdsc line_out |
| 337 |
$write pdsc " ) ;" |
| 338 |
$close flst |
| 339 |
$! |
| 340 |
$! Move Release Notes to destination |
| 341 |
$!------------------------------------- |
| 342 |
$write pdsc " information RELEASE_NOTES phase after ;" |
| 343 |
$! |
| 344 |
$! Source kit option |
| 345 |
$!--------------------- |
| 346 |
$write pdsc " option SOURCE default 0;" |
| 347 |
$write pdsc " directory ""[gnv.common_src]"" PROTECTION PUBLIC ;" |
| 348 |
$write pdsc - |
| 349 |
" file ""[gnv.common_src]''filename_base'_original_src.bck""" |
| 350 |
$write pdsc - |
| 351 |
" source [common_src]''filename_base'_original_src.bck ;" |
| 352 |
$if f$search("sys$disk:''filename_base'_vms_src.bck") .nes. "" |
| 353 |
$then |
| 354 |
$ write pdsc " directory ""[gnv.vms_src]"" PROTECTION PUBLIC ;" |
| 355 |
$ write pdsc " file ""[gnv.vms_src]''filename_base'_vms_src.bck""" |
| 356 |
$ write pdsc " source [vms_src]''filename_base'_vms_src.bck ;" |
| 357 |
$endif |
| 358 |
$write pdsc " end option;" |
| 359 |
$! |
| 360 |
$! |
| 361 |
$! Read through the file list again. |
| 362 |
$!---------------------------------- |
| 363 |
$open/read flst [.vms]pcsi_gawk_file_list.txt |
| 364 |
$! |
| 365 |
$! |
| 366 |
$! Create directory lines |
| 367 |
$!------------------------- |
| 368 |
$flst_dir_loop: |
| 369 |
$ read/end=flst_loop_end flst line_in |
| 370 |
$ line_in = f$edit(line_in,"compress,trim,uncomment") |
| 371 |
$ if line_in .eqs. "" then goto flst_dir_loop |
| 372 |
$! |
| 373 |
$ filename = f$element(0, " ", line_in) |
| 374 |
$ linkflag = f$element(1, " ", line_in) |
| 375 |
$ if linkflag .eqs. "->" then goto flst_dir_loop |
| 376 |
$! |
| 377 |
$! Ignore .dir extensions |
| 378 |
$!------------------------- |
| 379 |
$ filetype = f$edit(f$parse(filename,,,"TYPE"), "upcase") |
| 380 |
$ if filetype .eqs. ".DIR" then goto flst_dir_loop |
| 381 |
$! |
| 382 |
$ destname = filename |
| 383 |
$! |
| 384 |
$! It should be just a directory then. |
| 385 |
$!------------------------------------- |
| 386 |
$ filedir = f$edit(f$parse(filename,,,"DIRECTORY"), "lowercase") |
| 387 |
$! If this is not a directory then start processing files. |
| 388 |
$!--------------------------------------------------------- |
| 389 |
$ if filename .nes. filedir then goto flst_file |
| 390 |
$! |
| 391 |
$ write pdsc " directory ""''destname'"" PROTECTION PUBLIC ;" |
| 392 |
$ goto flst_dir_loop |
| 393 |
$! |
| 394 |
$! |
| 395 |
$! Add file lines for gawk. |
| 396 |
$!--------------------------- |
| 397 |
$flst_file_loop: |
| 398 |
$ read/end=flst_loop_end flst line_in |
| 399 |
$ line_in = f$edit(line_in,"compress,trim,uncomment") |
| 400 |
$ if line_in .eqs. "" then goto flst_file_loop |
| 401 |
$ filename = f$element(0, " ", line_in) |
| 402 |
$ destname = filename |
| 403 |
$flst_file: |
| 404 |
$ if arch_code .eqs. "V" |
| 405 |
$ then |
| 406 |
$! ! These files not available on VAX. |
| 407 |
$ src_dir = f$parse(destname,,,"DIRECTORY") |
| 408 |
$ if src_dir .eqs. "[GNV.USR.LIB.GAWK]" then goto flst_file_loop |
| 409 |
$ endif |
| 410 |
$ srcfile = filename - "gnv." |
| 411 |
$ write pdsc " file ""''destname'"" " |
| 412 |
$ write pdsc " source ""''srcfile'"" ;" |
| 413 |
$ goto flst_file_loop |
| 414 |
$! |
| 415 |
$flst_loop_end: |
| 416 |
$ close flst |
| 417 |
$! |
| 418 |
$! Add [.SYS$STARTUP]gawk_startup file |
| 419 |
$!--------------------------------------- |
| 420 |
$ write pdsc " file ""[sys$startup]gnv$gawk_startup.com""" |
| 421 |
$ write pdsc " source [vms_bin]gnv$gawk_startup.com ;" |
| 422 |
$! |
| 423 |
$! Add Release notes file. |
| 424 |
$!------------------------------ |
| 425 |
$ write pdsc - |
| 426 |
" file ""[SYSHLP]''filename_base'.release_notes"" release notes ;" |
| 427 |
$! |
| 428 |
$! Close the product file |
| 429 |
$!------------------------ |
| 430 |
$ write pdsc "end product;" |
| 431 |
$! |
| 432 |
$close pdsc |
| 433 |
$! |
| 434 |
$all_exit: |
| 435 |
$ exit |