build_gnv_curl_pcsi_desc.com 15 KB

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