make_pcsi_curl_kit_name.com 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. $! File: MAKE_PCSI_CURL_KIT_NAME.COM
  2. $!
  3. $! $Id$
  4. $!
  5. $! Calculates the PCSI kit name for use in building an installation kit.
  6. $! PCSI is HP's PolyCenter Software Installation Utility.
  7. $!
  8. $! The results are stored in as logical names so that other procedures
  9. $! can use them.
  10. $!
  11. $! Copyright 2009, John Malmberg
  12. $!
  13. $! Permission to use, copy, modify, and/or distribute this software for any
  14. $! purpose with or without fee is hereby granted, provided that the above
  15. $! copyright notice and this permission notice appear in all copies.
  16. $!
  17. $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  18. $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  19. $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  20. $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  21. $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  22. $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  23. $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  24. $!
  25. $! 11-Jun-2009 J. Malmberg
  26. $!
  27. $!========================================================================
  28. $!
  29. $! Save default
  30. $ default_dir = f$environment("DEFAULT")
  31. $!
  32. $! Move to the base directories
  33. $ set def [--]
  34. $!
  35. $! Put things back on error.
  36. $ on warning then goto all_exit
  37. $!
  38. $! The producer is the name or common abbreviation for the entity that is
  39. $! making the kit. It must be set as a logical name before running this
  40. $! procedure.
  41. $!
  42. $! HP documents the producer as the legal owner of the software, but for
  43. $! open source work, it should document who is creating the package for
  44. $! distribution.
  45. $!
  46. $ producer = f$trnlnm("GNV_PCSI_PRODUCER")
  47. $ if producer .eqs. ""
  48. $ then
  49. $ write sys$output "The logical name GNV_PCSI_PRODUCER needs to be defined."
  50. $ write sys$output "This should be set to the common abbreviation or name of"
  51. $ write sys$output "the entity creating this kit. If you are an individual"
  52. $ write sys$output "then use your initials."
  53. $ goto all_exit
  54. $ endif
  55. $ producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME")
  56. $ if producer_full_name .eqs. ""
  57. $ then
  58. $ write sys$output "The logical name GNV_PCSI_PRODUCER_FULL_NAME needs to"
  59. $ write sys$output "be defined. This should be set to the full name of"
  60. $ write sys$output "the entity creating this kit. If you are an individual"
  61. $ write sys$output "then use your name."
  62. $ write sys$output "EX: DEFINE GNV_PCSI_PRODUCER_FULL_NAME ""First M. Last"""
  63. $ goto all_exit
  64. $ endif
  65. $!
  66. $ write sys$output "*****"
  67. $ write sys$output "***** Producer = ''producer'"
  68. $ write sys$output "*****"
  69. $!
  70. $!
  71. $! Base is one of 'VMS', 'AXPVMS', 'I64VMS', 'VAXVMS' and indicates what
  72. $! binaries are in the kit. A kit with just 'VMS' can be installed on all
  73. $! architectures.
  74. $!
  75. $ base = "VMS"
  76. $ arch_type = f$getsyi("ARCH_NAME")
  77. $ code = f$extract(0, 1, arch_type)
  78. $ if (code .eqs. "I") then base = "I64VMS"
  79. $ if (code .eqs. "V") then base = "VAXVMS"
  80. $ if (code .eqs. "A") then base = "AXPVMS"
  81. $!
  82. $!
  83. $ product = "curl"
  84. $!
  85. $!
  86. $! We need to get the version from curlver_h. It will have a line like
  87. $! #define LIBCURL_VERSION "7.31.0"
  88. $! or
  89. $! #define LIBCURL_VERSION "7.32.0-20130731".
  90. $!
  91. $! The dash indicates that this is a daily pre-release.
  92. $!
  93. $!
  94. $ open/read/error=version_loop_end vhf [.include.curl]curlver.h
  95. $ version_loop:
  96. $ read vhf line_in
  97. $ if line_in .eqs. "" then goto version_loop
  98. $ if f$locate("#define LIBCURL_VERSION ", line_in) .ne. 0
  99. $ then
  100. $ goto version_loop
  101. $ endif
  102. $ raw_version = f$element(2," ", line_in) - """" - """"
  103. $ version_loop_end:
  104. $ close vhf
  105. $!
  106. $!
  107. $ eco_level = ""
  108. $ if f$search("''default_dir'vms_eco_level.h") .nes. ""
  109. $ then
  110. $ open/read ef 'default_dir'vms_eco_level.h
  111. $ecolevel_loop:
  112. $ read/end=ecolevel_loop_end ef line_in
  113. $ prefix = f$element(0, " ", line_in)
  114. $ if prefix .nes. "#define" then goto ecolevel_loop
  115. $ key = f$element(1, " ", line_in)
  116. $ value = f$element(2, " ", line_in) - """" - """"
  117. $ if key .eqs. "VMS_ECO_LEVEL"
  118. $ then
  119. $ eco_level = "''value'"
  120. $ if eco_level .eqs. "0"
  121. $ then
  122. $ eco_level = ""
  123. $ else
  124. $ eco_level = "E" + eco_level
  125. $ endif
  126. $ goto ecolevel_loop_end
  127. $ endif
  128. $ goto ecolevel_loop
  129. $ecolevel_loop_end:
  130. $ close ef
  131. $ endif
  132. $!
  133. $!
  134. $! This translates to V0732-0 or D0732-0
  135. $! We encode the snapshot date into the version as an ECO since a daily
  136. $! can never have an ECO.
  137. $!
  138. $! version_type = 'V' for a production release, and 'D' for a build from a
  139. $! daiy snapshot of the curl source.
  140. $ majorver = f$element(0, ".", raw_version)
  141. $ minorver = f$element(1, ".", raw_version)
  142. $ raw_update = f$element(2, ".", raw_version)
  143. $ update = f$element(0, "-", raw_update)
  144. $ if update .eqs. "0" then update = ""
  145. $ daily_tag = f$element(1, "-", raw_update)
  146. $ vtype = "V"
  147. $ patch = ""
  148. $ if daily_tag .nes. "-"
  149. $ then
  150. $ vtype = "D"
  151. $ daily_tag_len = f$length(daily_tag)
  152. $ daily_tag = f$extract(4, daily_tag_len - 4, daily_tag)
  153. $ patch = vtype + daily_tag
  154. $ product = product + "_d"
  155. $ else
  156. $ daily_tag = ""
  157. $ if eco_level .nes. "" then patch = eco_level
  158. $ endif
  159. $!
  160. $!
  161. $ version_fao = "!2ZB!2ZB"
  162. $ mmversion = f$fao(version_fao, 'majorver', 'minorver')
  163. $ version = vtype + "''mmversion'"
  164. $ if update .nes. "" .or. patch .nes. ""
  165. $ then
  166. $! The presence of a patch implies an update
  167. $ if update .eqs. "" .and. patch .nes. "" then update = "0"
  168. $ version = version + "-" + update + patch
  169. $ fversion = version
  170. $ else
  171. $ fversion = version
  172. $ version = version + "-"
  173. $ endif
  174. $!
  175. $! Kit type 1 is complete kit, the only type that this procedure will make.
  176. $ kittype = 1
  177. $!
  178. $! Write out a logical name for the resulting base kit name.
  179. $ name = "''producer'-''base'-''product'-''version'-''kittype'"
  180. $ define GNV_PCSI_KITNAME "''name'"
  181. $ fname = "''product'-''fversion'"
  182. $ define GNV_PCSI_FILENAME_BASE "''fname'"
  183. $ write sys$output "*****"
  184. $ write sys$output "***** GNV_PCSI_KITNAME = ''name'."
  185. $ write sys$output "***** GNV_PCSI_FILENAME_BASE = ''fname'."
  186. $ write sys$output "*****"
  187. $!
  188. $all_exit:
  189. $ set def 'default_dir'
  190. $ exit '$status'