Debian Codegraph @

vms/make_pcsi_gawk_kit_name.com

raw
1 $! File: MAKE_PCSI_GAWK_KIT_NAME.COM
2 $!
3 $! Calculates the PCSI kit name for use in building an installation kit.
4 $! PCSI is HP's PolyCenter Software Installation Utility.
5 $!
6 $! The results are stored in as logical names so that other procedures
7 $! can use them.
8 $!
9 $! 92-Jan-2014 J. Malmberg Gawk version
10 $!========================================================================
11 $!
12 $! Save default
13 $default_dir = f$environment("DEFAULT")
14 $!
15 $! Put things back on error.
16 $on warning then goto all_exit
17 $!
18 $! The producer is the name or common abbreviation for the entity that is
19 $! making the kit. It must be set as a logical name before running this
20 $! procedure.
21 $!
22 $! HP documents the producer as the legal owner of the software, but for
23 $! open source work, it should document who is creating the package for
24 $! distribution.
25 $!
26 $producer = f$trnlnm("GNV_PCSI_PRODUCER")
27 $if producer .eqs. ""
28 $then
29 $ write sys$output "The logical name GNV_PCSI_PRODUCER needs to be defined."
30 $ write sys$output "This should be set to the common abbreviation or name of"
31 $ write sys$output "the entity creating this kit. If you are an individual"
32 $ write sys$output "then use your initials as long as they do not match"
33 $ write sys$output "a different well known producer prefix."
34 $ goto all_exit
35 $endif
36 $producer_full_name = f$trnlnm("GNV_PCSI_PRODUCER_FULL_NAME")
37 $if producer_full_name .eqs. ""
38 $then
39 $ write sys$output "The logical name GNV_PCSI_PRODUCER_FULL_NAME needs to"
40 $ write sys$output "be defined. This should be set to the full name of"
41 $ write sys$output "the entity creating this kit. If you are an individual"
42 $ write sys$output "then use your name."
43 $ write sys$output "EX: DEFINE GNV_PCSI_PRODUCER_FULL_NAME ""First M. Last"""
44 $ goto all_exit
45 $endif
46 $!
47 $write sys$output "*****"
48 $write sys$output "***** Producer = ''producer'"
49 $write sys$output "*****"
50 $!
51 $!
52 $! Base is one of 'VMS', 'AXPVMS', 'I64VMS', 'VAXVMS' and indicates what
53 $! binaries are in the kit. A kit with just 'VMS' can be installed on all
54 $! architectures.
55 $!
56 $base = "VMS"
57 $arch_type = f$getsyi("ARCH_NAME")
58 $code = f$extract(0, 1, arch_type)
59 $if (code .eqs. "I") then base = "I64VMS"
60 $if (code .eqs. "V") then base = "VAXVMS"
61 $if (code .eqs. "A") then base = "AXPVMS"
62 $if (code .eqs. "x") then base = "X86VMS"
63 $!
64 $!
65 $product = "gawk"
66 $!
67 $!
68 $! We need to get the version from config.h. It will have a lines like
69 $! #define PACKAGE_VERSION "4.1.0a"
70 $!
71 $!
72 $open/read/error=version_loop_end verf config.h
73 $version_loop:
74 $ read/end=version_loop_end verf line_in
75 $ if line_in .eqs. "" then goto version_loop
76 $ if f$locate("#define PACKAGE_VERSION", line_in) .ne. 0
77 $ then
78 $ goto version_loop
79 $ endif
80 $ tag = f$element(1, " ", line_in)
81 $ value = f$element(2, " ", line_in) - """" - """"
82 $ if tag .eqs. "PACKAGE_VERSION"
83 $ then
84 $ distversion = value
85 $ goto version_loop_end
86 $ endif
87 $ goto version_loop
88 $version_loop_end:
89 $close verf
90 $!
91 $!
92 $! Optional ECO file.
93 $ECO_LEVEL = ""
94 $vms_eco_file = "[.vms]vms_eco_level.h"
95 $if f$search(vms_eco_file) .nes. ""
96 $then
97 $ open/read ef 'vms_eco_file'
98 $ecolevel_loop:
99 $ read/end=ecolevel_loop_end ef line_in
100 $ prefix = f$element(0, " ", line_in)
101 $ if prefix .nes. "#define" then goto ecolevel_loop
102 $ key = f$element(1, " ", line_in)
103 $ value = f$element(2, " ", line_in) - """" - """"
104 $ if key .eqs. "VMS_ECO_LEVEL"
105 $ then
106 $ ECO_LEVEL = value
107 $ if ECO_LEVEL .eq. 0
108 $ then
109 $ ECO_LEVEL = ""
110 $ else
111 $ ECO_LEVEL = "E" + ECO_LEVEL
112 $ endif
113 $ goto ecolevel_loop_end
114 $ endif
115 $ goto ecolevel_loop
116 $ecolevel_loop_end:
117 $ close ef
118 $endif
119 $!
120 $raw_version = distversion
121 $!
122 $!
123 $! This translates to V0114-08 or D0115-01
124 $! We can not encode the snapshot date into the version due to the way that
125 $! the Polycenter Software Installation Utility evaluates the name.
126 $!
127 $! version_type = 'V' for a production release, and 'D' for a build from a
128 $! daily repository snapshot, and a code for a build from a pre-release branch
129 $majorver = f$element(0, ".", raw_version)
130 $minorver = f$element(1, ".", raw_version)
131 $update = f$element(2,".", raw_version)
132 $if update .eqs. "." then update = ""
133 $vtype = "V"
134 $if update .nes. ""
135 $then
136 $ update_len = f$length(update)
137 $ code = f$extract(update_len - 1, 1, update)
138 $ code = f$edit(code, "UPCASE")
139 $ if (code .ges. "A") .and. (code .les. "Z")
140 $ then
141 $ update = f$extract(0, update_len - 1, update)
142 $ vtype = code
143 $ endif
144 $endif
145 $if update .eqs. "0" then update = ""
146 $!
147 $!
148 $version_fao = "!2ZB!2ZB"
149 $mmversion = f$fao(version_fao, 'majorver', 'minorver')
150 $version = vtype + "''mmversion'"
151 $if update .nes. "" .or. ECO_LEVEL .nes. ""
152 $then
153 $! The presence of an ECO implies an update
154 $ if update .eqs. "" .and. ECO_LEVEL .nes. "" then update = "0"
155 $ version = version + "-" + update + ECO_LEVEL
156 $ fversion = version
157 $else
158 $ fversion = version
159 $ version = version + "-"
160 $endif
161 $!
162 $! Kit type 1 is complete kit, the only type that this procedure will make.
163 $Kittype = 1
164 $!
165 $! Write out a logical name for the resulting base kit name.
166 $name = "''producer'-''base'-''product'-''version'-''kittype'"
167 $define GNV_PCSI_KITNAME "''name'"
168 $fname = "''product'-''fversion'"
169 $!
170 $! No ECO or Patch level
171 $fname_len = f$length(fname)
172 $if f$extract(fname_len - 1, 1, fname) .eqs. "-"
173 $then
174 $ fname = f$extract(0, fname_len - 1, fname)
175 $ fname_len = fname_len - 1
176 $endif
177 $if f$extract(fname_len - 1, 1, fname) .eqs. "-"
178 $then
179 $ fname = f$extract(0, fname_len - 1, fname)
180 $ fname_len = fname_len - 1
181 $endif
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'