build_gnv_curl_pcsi_desc.com 15 KB

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