2
0

build_gnv_curl_pcsi_desc.com 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  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. $ if linkflag .nes. "->" then goto inst_alias_write
  169. $!
  170. $ linktarget = f$element(2, " ", line_in)
  171. $ if kit_type .eqs. "D"
  172. $ then
  173. $ old_start = f$locate("[gnv.usr", pathname)
  174. $ if old_start .lt. f$length(pathname)
  175. $ then
  176. $ pathname = "[gnv.beta" + pathname - "[gnv.usr"
  177. $ linktarget = "[gnv.beta" + linktarget - "[gnv.usr"
  178. $ endif
  179. $ endif
  180. $ nlink = "pcsi$destination:" + pathname
  181. $ ntarg = "pcsi$destination:" + linktarget
  182. $ new_add_alias_line = -
  183. """if f$search(""""''nlink'"""") .eqs. """""""" then" + -
  184. " set file/enter=''nlink' ''ntarg'"""
  185. $ if add_alias_lines .nes. ""
  186. $ then
  187. $ add_alias_lines = add_alias_lines + "," + new_add_alias_line
  188. $ else
  189. $ add_alias_lines = new_add_alias_line
  190. $ endif
  191. $!
  192. $ new_rem_alias_line = -
  193. """if f$search(""""''nlink'"""") .nes. """""""" then" + -
  194. " set file/remove ''nlink';"""
  195. $ if rem_alias_lines .nes. ""
  196. $ then
  197. $ rem_alias_lines = rem_alias_lines + "," + new_rem_alias_line
  198. $ else
  199. $ rem_alias_lines = new_rem_alias_line
  200. $ endif
  201. $!
  202. $ goto inst_alias_loop
  203. $!
  204. $inst_alias_write:
  205. $!
  206. $! execute install / remove
  207. $ write pdsc " execute install ("
  208. $! add aliases
  209. $ i = 0
  210. $ex_ins_loop:
  211. $ line = f$element(i, ",", add_alias_lines)
  212. $ i = i + 1
  213. $ if line .eqs. "" then goto ex_ins_loop
  214. $ if line .eqs. "," then goto ex_ins_loop_end
  215. $ if line_out .nes. "" then write pdsc line_out,","
  216. $ line_out = line
  217. $ goto ex_ins_loop
  218. $ex_ins_loop_end:
  219. $ write pdsc line_out
  220. $ line_out = ""
  221. $ write pdsc " )"
  222. $ write pdsc " remove ("
  223. $! remove aliases
  224. $ i = 0
  225. $ex_rem_loop:
  226. $ line = f$element(i, ",", rem_alias_lines)
  227. $ i = i + 1
  228. $ if line .eqs. "" then goto ex_rem_loop
  229. $ if line .eqs. "," then goto ex_rem_loop_end
  230. $ if line_out .nes. "" then write pdsc line_out,","
  231. $ line_out = line
  232. $ goto ex_rem_loop
  233. $ex_rem_loop_end:
  234. $ write pdsc line_out
  235. $ line_out = ""
  236. $ write pdsc " ) ;"
  237. $!
  238. $! execute upgrade
  239. $ write pdsc " execute upgrade ("
  240. $ i = 0
  241. $ex_upg_loop:
  242. $ line = f$element(i, ",", rem_alias_lines)
  243. $ i = i + 1
  244. $ if line .eqs. "" then goto ex_upg_loop
  245. $ if line .eqs. "," then goto ex_upg_loop_end
  246. $ if line_out .nes. "" then write pdsc line_out,","
  247. $ line_out = line
  248. $ goto ex_upg_loop
  249. $ex_upg_loop_end:
  250. $ write pdsc line_out
  251. $ line_out = ""
  252. $! remove aliases
  253. $ write pdsc " ) ;"
  254. $!
  255. $! execute postinstall
  256. $ write pdsc " execute postinstall ("
  257. $ if arch_code .nes. "V"
  258. $ then
  259. $ line_out = " ""set process/parse=extended"""
  260. $ endif
  261. $ i = 0
  262. $ex_pins_loop:
  263. $ line = f$element(i, ",", add_alias_lines)
  264. $ i = i + 1
  265. $ if line .eqs. "" then goto ex_pins_loop
  266. $ if line .eqs. "," then goto ex_pins_loop_end
  267. $ if line_out .nes. "" then write pdsc line_out,","
  268. $ line_out = line
  269. $ goto ex_pins_loop
  270. $ex_pins_loop_end:
  271. $ if line_out .eqs. "" then line_out = " ""continue"""
  272. $! write pdsc line_out
  273. $! line_out = ""
  274. $! add aliases and follow with renames.
  275. $!
  276. $goto inst_dir
  277. $!
  278. $inst_dir_loop:
  279. $ read/end=inst_alias_loop_end flst line_in
  280. $ line_in = f$edit(line_in,"compress,trim,uncomment")
  281. $ if line_in .eqs. "" then goto inst_dir_loop
  282. $inst_dir:
  283. $ pathname = f$element(0, " ", line_in)
  284. $ if kit_type .eqs. "D"
  285. $ then
  286. $ if pathname .eqs. "[gnv]usr.dir"
  287. $ then
  288. $ pathname = "[gnv]beta.dir"
  289. $ else
  290. $ old_start = f$locate("[gnv.usr", pathname)
  291. $ if old_start .lt. f$length(pathname)
  292. $ then
  293. $ pathname = "[gnv.beta" + pathname - "[gnv.usr"
  294. $ endif
  295. $ endif
  296. $ endif
  297. $!
  298. $! Ignore the directory entries for now.
  299. $!-----------------------------------------
  300. $ filedir = f$parse(pathname,,,"DIRECTORY")
  301. $ if pathname .eqs. filedir then goto inst_dir_loop
  302. $!
  303. $! process .dir extensions for rename
  304. $! If this is not a directory then start processing files.
  305. $!-------------------------
  306. $ filetype = f$parse(pathname,,,"TYPE")
  307. $ filetype_u = f$edit(filetype, "upcase")
  308. $ filename = f$parse(pathname,,,"NAME")
  309. $ if filetype_u .nes. ".DIR" then goto inst_file
  310. $!
  311. $! process directory lines for rename.
  312. $!--------------------------------------
  313. $ if line_out .nes. ""
  314. $ then
  315. $ write pdsc line_out,","
  316. $ line_out = ""
  317. $ endif
  318. $ if arch_code .nes. "V"
  319. $ then
  320. $ if line_out .nes. "" then write pdsc line_out,","
  321. $ line_out = " ""rename pcsi$destination:''pathname' ''filename'.DIR"""
  322. $ else
  323. $ if line_out .nes. "" then write pdsc line_out
  324. $ line_out = ""
  325. $ endif
  326. $ goto inst_dir_loop
  327. $!
  328. $!
  329. $! process file lines for rename
  330. $!---------------------------------
  331. $inst_file_loop:
  332. $ read/end=inst_alias_loop_end flst line_in
  333. $ line_in = f$edit(line_in,"compress,trim,uncomment")
  334. $ if line_in .eqs. "" then goto inst_dir_loop
  335. $ pathname = f$element(0, " ", line_in)
  336. $ if kit_type .eqs. "D"
  337. $ then
  338. $ if pathname .eqs. "[gnv]usr.dir"
  339. $ then
  340. $ pathname = "[gnv]beta.dir"
  341. $ else
  342. $ old_start = f$locate("[gnv.usr", pathname)
  343. $ if old_start .lt. f$length(pathname)
  344. $ then
  345. $ pathname = "[gnv.beta" + pathname - "[gnv.usr"
  346. $ endif
  347. $ endif
  348. $ endif
  349. $!
  350. $! Filenames with $ in them are VMS special and do not need to be lowercase.
  351. $! --------------------------------------------------------------------------
  352. $ if f$locate("$", pathname) .lt. f$length(pathname) then goto inst_file_loop
  353. $!
  354. $ filetype = f$parse(pathname,,,"TYPE")
  355. $ filename = f$parse(pathname,,,"NAME") + filetype
  356. $inst_file:
  357. $ if arch_code .nes. "V"
  358. $ then
  359. $ if line_out .nes. "" then write pdsc line_out,","
  360. $ filetype = f$parse(pathname,,,"TYPE")
  361. $ filename = f$parse(pathname,,,"NAME") + filetype
  362. $ line_out = " ""rename pcsi$destination:''pathname' ''filename'"""
  363. $ else
  364. $ if line_out .nes. "" then write pdsc line_out
  365. $ line_out = ""
  366. $ endif
  367. $ goto inst_file_loop
  368. $!
  369. $inst_alias_loop_end:
  370. $!
  371. $write pdsc line_out
  372. $write pdsc " ) ;"
  373. $close flst
  374. $!
  375. $! Move Release Notes to destination
  376. $!-------------------------------------
  377. $write pdsc " information RELEASE_NOTES phase after ;"
  378. $!
  379. $! Source kit option
  380. $!---------------------
  381. $write pdsc " option SOURCE default 0;"
  382. $write pdsc " directory ""[gnv.common_src]"" PROTECTION PUBLIC ;"
  383. $write pdsc -
  384. " file ""[gnv.common_src]''filename_base'_original_src.bck"""
  385. $write pdsc -
  386. " source [common_src]''filename_base'_original_src.bck ;"
  387. $if f$search("gnv$gnu:[vms_src]''filename_base'_vms_src.bck") .nes. ""
  388. $then
  389. $ write pdsc " directory ""[gnv.vms_src]"" PROTECTION PUBLIC ;"
  390. $ write pdsc " file ""[gnv.vms_src]''filename_base'_vms_src.bck"""
  391. $ write pdsc " source [vms_src]''filename_base'_vms_src.bck ;"
  392. $endif
  393. $write pdsc " end option;"
  394. $!
  395. $!
  396. $! Read through the file list again.
  397. $!----------------------------------
  398. $open/read flst pcsi_gnv_curl_file_list.txt
  399. $!
  400. $!
  401. $! Create directory lines
  402. $!-------------------------
  403. $flst_dir_loop:
  404. $ read/end=flst_loop_end flst line_in
  405. $ line_in = f$edit(line_in,"compress,trim,uncomment")
  406. $ if line_in .eqs. "" then goto flst_dir_loop
  407. $!
  408. $ filename = f$element(0, " ", line_in)
  409. $ linkflag = f$element(1, " ", line_in)
  410. $ if linkflag .eqs. "->" then goto flst_dir_loop
  411. $!
  412. $! Ignore .dir extensions
  413. $!-------------------------
  414. $ filetype = f$edit(f$parse(filename,,,"TYPE"), "upcase")
  415. $ if filetype .eqs. ".DIR" then goto flst_dir_loop
  416. $!
  417. $ destname = filename
  418. $ if kit_type .eqs. "D"
  419. $ then
  420. $ old_start = f$locate("[gnv.usr", destname)
  421. $ if old_start .lt. f$length(destname)
  422. $ then
  423. $ destname = "[gnv.beta" + destname - "[gnv.usr"
  424. $ endif
  425. $ endif
  426. $!
  427. $! It should be just a directory then.
  428. $!-------------------------------------
  429. $ filedir = f$edit(f$parse(filename,,,"DIRECTORY"), "lowercase")
  430. $! If this is not a directory then start processing files.
  431. $!---------------------------------------------------------
  432. $ if filename .nes. filedir then goto flst_file
  433. $!
  434. $ write pdsc " directory ""''destname'"" PROTECTION PUBLIC ;"
  435. $ goto flst_dir_loop
  436. $!
  437. $!
  438. $! Add file lines for curl.
  439. $!---------------------------
  440. $flst_file_loop:
  441. $ read/end=flst_loop_end flst line_in
  442. $ line_in = f$edit(line_in,"compress,trim,uncomment")
  443. $ if line_in .eqs. "" then goto inst_file_loop
  444. $ filename = f$element(0, " ", line_in)
  445. $ destname = filename
  446. $ if kit_type .eqs. "D"
  447. $ then
  448. $ old_start = f$locate("[gnv.usr", destname)
  449. $ if old_start .lt. f$length(destname)
  450. $ then
  451. $ destname = "[gnv.beta" + destname - "[gnv.usr"
  452. $ endif
  453. $ endif
  454. $flst_file:
  455. $ srcfile = filename - "gnv."
  456. $ write pdsc " file ""''destname'"" "
  457. $ write pdsc " source ""''srcfile'"" ;"
  458. $ goto flst_file_loop
  459. $!
  460. $flst_loop_end:
  461. $ close flst
  462. $!
  463. $! Add Link alias procedure file (N/A for curl)
  464. $!------------------------------------------------
  465. $!
  466. $! Add [.SYS$STARTUP]curl_startup file
  467. $!---------------------------------------
  468. $ if kit_type .eqs. "D"
  469. $ then
  470. $ write pdsc " file ""[sys$startup]curl_daily_startup.com"""
  471. $ else
  472. $ write pdsc " file ""[sys$startup]curl_startup.com"""
  473. $ endif
  474. $ write pdsc " source [usr.lib]curl_startup.com ;"
  475. $!
  476. $! Add Release notes file.
  477. $!------------------------------
  478. $ write pdsc -
  479. " file ""[SYSHLP]''filename_base'.release_notes"" release notes ;"
  480. $!
  481. $! Close the product file
  482. $!------------------------
  483. $ write pdsc "end product;"
  484. $!
  485. $close pdsc
  486. $!
  487. $all_exit:
  488. $ exit