build_gnv_curl_pcsi_desc.com 15 KB

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