aboutsummaryrefslogtreecommitdiff
path: root/packages/vms/build_gnv_curl_pcsi_desc.com
blob: 941875ab4e0dbff659ea2a5ee7370973324549a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
$! File: Build_GNV_CURL_PCSI_DESC.COM
$!
$! $Id$
$!
$! Build the *.pcsi$text file in the following sections:
$!   Required software dependencies.
$!   install/upgrade/postinstall steps.
$!      1. Duplicate filenames need an alias procedure. (N/A for curl)
$!      2. ODS-5 filenames need an alias procedure. (N/A for curl)
$!      3. Special alias links for executables (curl. -> curl.exe)
$!         if a lot, then an alias procedure is needed.
$!      4. Rename the files to lowercase.
$!   Move Release Notes to destination
$!   Source kit option
$!   Create directory lines
$!   Add file lines for curl.
$!   Add Link alias procedure file (N/A for curl)
$!   Add [.SYS$STARTUP]curl_startup file
$!   Add Release notes file.
$!
$! The file PCSI_GNV_CURL_FILE_LIST.TXT is read in to get the files other
$! than the release notes file and the source backup file.
$!
$! The PCSI system can really only handle ODS-2 format filenames and
$! assumes that there is only one source directory.  It also assumes that
$! all destination files with the same name come from the same source file.
$! Fortunately CURL does not trip most of these issues, so those steps
$! above are marked N/A.
$!
$! A rename action section is needed to make sure that the files are
$! created in the GNV$GNU: in the correct case, and to create the alias
$! link [usr.bin]curl. for [usr.bin]curl.exe.
$!
$! Copyright 2009 - 2020, John Malmberg
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$!
$! 15-Jun-2009  J. Malmberg
$!
$!===========================================================================
$!
$ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
$ if kit_name .eqs. ""
$ then
$   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$   goto all_exit
$ endif
$ producer = f$trnlnm("GNV_PCSI_PRODUCER")
$ if producer .eqs. ""
$ then
$   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$   goto all_exit
$ endif
$ filename_base = f$trnlnm("GNV_PCSI_FILENAME_BASE")
$ if filename_base .eqs. ""
$ then
$   write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
$   goto all_exit
$ endif
$!
$!
$! Parse the kit name into components.
$!---------------------------------------
$ producer = f$element(0, "-", kit_name)
$ base = f$element(1, "-", kit_name)
$ product = f$element(2, "-", kit_name)
$ mmversion = f$element(3, "-", kit_name)
$ majorver = f$extract(0, 3, mmversion)
$ minorver = f$extract(3, 2, mmversion)
$ updatepatch = f$element(4, "-", kit_name)
$ if updatepatch .eqs. "-" then updatepatch = ""
$!
$! kit type of "D" means a daily build
$ kit_type = f$edit(f$extract(0, 1, majorver), "upcase")
$!
$!
$ product_line = "product ''producer' ''base' ''product'"
$ if updatepatch .eqs. ""
$ then
$     product_name = " ''majorver'.''minorver'"
$ else
$     product_name = " ''majorver'.''minorver'-''updatepatch'"
$ endif
$ product_line = product_line + " ''product_name' full;"
$!write sys$output product_line
$!
$!
$!
$! Create the file as a VMS text file.
$!----------------------------------------
$ base_file = kit_name
$ create 'base_file'.pcsi$desc
$!
$!
$! Start building file.
$!----------------------
$ open/append pdsc 'base_file'.pcsi$desc
$!
$ write pdsc product_line
$!
$! Required product dependencies.
$!----------------------------------
$ vmsprd = "DEC"
$ if base .eqs. "I64VMS" then vmsprd = "HP"
$ vsiprd = "VSI"
$!
$ write pdsc "   software ''vmsprd' ''base' VMS ;"
$ arch_type = f$getsyi("ARCH_NAME")
$ node_swvers = f$getsyi("node_swvers")
$ vernum = f$extract(1, f$length(node_swvers), node_swvers)
$ majver = f$element(0, ".", vernum)
$ minverdash = f$element(1, ".", vernum)
$ minver = f$element(0, "-", minverdash)
$ dashver = f$element(1, "-", minverdash)
$ if dashver .eqs. "-" then dashver = ""
$ vmstag = majver + minver + dashver
$ code = f$extract(0, 1, arch_type)
$ arch_code = f$extract(0, 1, arch_type)
$ line_out = -
 "   if ((not <software ''vsiprd' ''base' VMS version minimum" + -
 " ''node_swvers'>) and" + -
 " (not <software ''vmsprd' ''base' VMS version minimum ''node_swvers'>));"
$ write pdsc line_out
$ write pdsc "      error NEED_VMS''vmstag';"
$ write pdsc "   end if;"
$!
$write pdsc "   software VMSPORTS ''base' ZLIB ;"
$write pdsc -
    "   if (not <software VMSPORTS ''base' ZLIB version minimum V1.2-8>) ;"
$write pdsc "      error NEED_ZLIB;"
$write pdsc "   end if;"
$!
$!
$!
$! install/upgrade/postinstall steps.
$!-----------------------------------
$!      1. Duplicate filenames need an alias procedure. (N/A for curl)
$!      2. ODS-5 filenames need an alias procedure. (N/A for curl)
$!      3. Special alias links for executables (curl. -> curl.exe)
$!         if a lot, then an alias procedure is needed.
$!      4. Rename the files to lowercase.
$!
$!
$!   Alias links needed.
$!-------------------------
$ add_alias_lines = ""
$ rem_alias_lines = ""
$ line_out = ""
$!
$!   Read through the file list to set up aliases and rename commands.
$!---------------------------------------------------------------------
$ open/read flst pcsi_gnv_curl_file_list.txt
$!
$inst_alias_loop:
$   read/end=inst_alias_loop_end flst line_in
$   line_in = f$edit(line_in,"compress,trim,uncomment")
$   if line_in .eqs. "" then goto inst_alias_loop
$   pathname = f$element(0, " ", line_in)
$   linkflag = f$element(1, " ", line_in)

$   if linkflag .nes. "->" then goto inst_alias_write
$!
$   linktarget = f$element(2, " ", line_in)
$   if kit_type .eqs. "D"
$   then
$       old_start = f$locate("[gnv.usr", pathname)
$       if old_start .lt. f$length(pathname)
$       then
$           pathname = "[gnv.beta" + pathname - "[gnv.usr"
$           linktarget = "[gnv.beta" + linktarget - "[gnv.usr"
$       endif
$   endif
$   nlink = "pcsi$destination:" + pathname
$   ntarg = "pcsi$destination:" + linktarget
$   new_add_alias_line = -
  """if f$search(""""''nlink'"""") .eqs. """""""" then" + -
  " set file/enter=''nlink' ''ntarg'"""
$   if add_alias_lines .nes. ""
$   then
$       add_alias_lines = add_alias_lines + "," + new_add_alias_line
$   else
$       add_alias_lines = new_add_alias_line
$   endif
$!
$   new_rem_alias_line = -
  """if f$search(""""''nlink'"""") .nes. """""""" then" + -
  " set file/remove ''nlink';"""
$   if rem_alias_lines .nes. ""
$   then
$      rem_alias_lines = rem_alias_lines + "," + new_rem_alias_line
$   else
$      rem_alias_lines = new_rem_alias_line
$   endif
$!
$   goto inst_alias_loop
$!
$inst_alias_write:
$!
$!  execute install / remove
$   write pdsc "   execute install ("
$! add aliases
$   i = 0
$ex_ins_loop:
$       line = f$element(i, ",", add_alias_lines)
$       i = i + 1
$       if line .eqs. "" then goto ex_ins_loop
$       if line .eqs. "," then goto ex_ins_loop_end
$       if line_out .nes. "" then write pdsc line_out,","
$       line_out = line
$       goto ex_ins_loop
$ex_ins_loop_end:
$   write pdsc line_out
$   line_out = ""
$   write pdsc "      )"
$   write pdsc "   remove ("
$! remove aliases
$   i = 0
$ex_rem_loop:
$       line = f$element(i, ",", rem_alias_lines)
$       i = i + 1
$       if line .eqs. "" then goto ex_rem_loop
$       if line .eqs. "," then goto ex_rem_loop_end
$       if line_out .nes. "" then write pdsc line_out,","
$       line_out = line
$       goto ex_rem_loop
$ex_rem_loop_end:
$   write pdsc line_out
$   line_out = ""
$   write pdsc "      ) ;"
$!
$!  execute upgrade
$   write pdsc "   execute upgrade ("
$   i = 0
$ex_upg_loop:
$       line = f$element(i, ",", rem_alias_lines)
$       i = i + 1
$       if line .eqs. "" then goto ex_upg_loop
$       if line .eqs. "," then goto ex_upg_loop_end
$       if line_out .nes. "" then write pdsc line_out,","
$       line_out = line
$       goto ex_upg_loop
$ex_upg_loop_end:
$   write pdsc line_out
$   line_out = ""
$! remove aliases
$   write pdsc "      ) ;"
$!
$!  execute postinstall
$   write pdsc "   execute postinstall ("
$   if arch_code .nes. "V"
$   then
$       line_out = "   ""set process/parse=extended"""
$   endif
$   i = 0
$ex_pins_loop:
$       line = f$element(i, ",", add_alias_lines)
$       i = i + 1
$       if line .eqs. "" then goto ex_pins_loop
$       if line .eqs. "," then goto ex_pins_loop_end
$       if line_out .nes. "" then write pdsc line_out,","
$       line_out = line
$       goto ex_pins_loop
$ex_pins_loop_end:
$   if line_out .eqs. "" then line_out = "   ""continue"""
$!   write pdsc line_out
$!   line_out = ""
$! add aliases and follow with renames.
$!
$goto inst_dir
$!
$inst_dir_loop:
$   read/end=inst_alias_loop_end flst line_in
$   line_in = f$edit(line_in,"compress,trim,uncomment")
$   if line_in .eqs. "" then goto inst_dir_loop
$inst_dir:
$   pathname = f$element(0, " ", line_in)
$   if kit_type .eqs. "D"
$   then
$       if pathname .eqs. "[gnv]usr.dir"
$       then
$           pathname = "[gnv]beta.dir"
$       else
$           old_start = f$locate("[gnv.usr", pathname)
$           if old_start .lt. f$length(pathname)
$           then
$               pathname = "[gnv.beta" + pathname - "[gnv.usr"
$           endif
$       endif
$   endif
$!
$!  Ignore the directory entries for now.
$!-----------------------------------------
$   filedir = f$parse(pathname,,,"DIRECTORY")
$   if pathname .eqs. filedir then goto inst_dir_loop
$!
$!  process .dir extensions for rename
$!  If this is not a directory then start processing files.
$!-------------------------
$   filetype = f$parse(pathname,,,"TYPE")
$   filetype_u = f$edit(filetype, "upcase")
$   filename = f$parse(pathname,,,"NAME")
$   if filetype_u .nes. ".DIR" then goto inst_file
$!
$!  process directory lines for rename.
$!--------------------------------------
$   if line_out .nes. ""
$   then
$       write pdsc line_out,","
$       line_out = ""
$   endif
$   if arch_code .nes. "V"
$   then
$       if line_out .nes. "" then write pdsc line_out,","
$       line_out = "   ""rename pcsi$destination:''pathname' ''filename'.DIR"""
$   else
$       if line_out .nes. "" then write pdsc line_out
$       line_out = ""
$   endif
$   goto inst_dir_loop
$!
$!
$!   process file lines for rename
$!---------------------------------
$inst_file_loop:
$   read/end=inst_alias_loop_end flst line_in
$   line_in = f$edit(line_in,"compress,trim,uncomment")
$   if line_in .eqs. "" then goto inst_dir_loop
$   pathname = f$element(0, " ", line_in)
$   if kit_type .eqs. "D"
$   then
$       if pathname .eqs. "[gnv]usr.dir"
$       then
$           pathname = "[gnv]beta.dir"
$       else
$           old_start = f$locate("[gnv.usr", pathname)
$           if old_start .lt. f$length(pathname)
$           then
$               pathname = "[gnv.beta" + pathname - "[gnv.usr"
$           endif
$       endif
$   endif
$!
$!  Filenames with $ in them are VMS special and do not need to be lowercase.
$!  --------------------------------------------------------------------------
$   if f$locate("$", pathname) .lt. f$length(pathname) then goto inst_file_loop
$!
$   filetype = f$parse(pathname,,,"TYPE")
$   filename = f$parse(pathname,,,"NAME") + filetype
$inst_file:
$   if arch_code .nes. "V"
$   then
$       if line_out .nes. "" then write pdsc line_out,","
$       filetype = f$parse(pathname,,,"TYPE")
$       filename = f$parse(pathname,,,"NAME") + filetype
$       line_out = "   ""rename pcsi$destination:''pathname' ''filename'"""
$   else
$       if line_out .nes. "" then write pdsc line_out
$       line_out = ""
$   endif
$   goto inst_file_loop
$!
$inst_alias_loop_end:
$!
$write pdsc line_out
$write pdsc "        ) ;"
$close flst
$!
$!   Move Release Notes to destination
$!-------------------------------------
$write pdsc "   information RELEASE_NOTES phase after ;"
$!
$!   Source kit option
$!---------------------
$write pdsc "   option SOURCE default 0;"
$write pdsc "   directory ""[gnv.common_src]"" PROTECTION PUBLIC ;"
$write pdsc -
    "        file ""[gnv.common_src]''filename_base'_original_src.bck"""
$write pdsc -
    "          source [common_src]''filename_base'_original_src.bck ;"
$if f$search("gnv$gnu:[vms_src]''filename_base'_vms_src.bck") .nes. ""
$then
$    write pdsc "   directory ""[gnv.vms_src]"" PROTECTION PUBLIC ;"
$    write pdsc "        file ""[gnv.vms_src]''filename_base'_vms_src.bck"""
$    write pdsc "          source [vms_src]''filename_base'_vms_src.bck ;"
$endif
$write pdsc "   end option;"
$!
$!
$! Read through the file list again.
$!----------------------------------
$open/read flst pcsi_gnv_curl_file_list.txt
$!
$!
$!   Create directory lines
$!-------------------------
$flst_dir_loop:
$   read/end=flst_loop_end flst line_in
$   line_in = f$edit(line_in,"compress,trim,uncomment")
$   if line_in .eqs. "" then goto flst_dir_loop
$!
$   filename = f$element(0, " ", line_in)
$   linkflag = f$element(1, " ", line_in)
$   if linkflag .eqs. "->" then goto flst_dir_loop
$!
$!  Ignore .dir extensions
$!-------------------------
$   filetype = f$edit(f$parse(filename,,,"TYPE"), "upcase")
$   if filetype .eqs. ".DIR" then goto flst_dir_loop
$!
$   destname = filename
$   if kit_type .eqs. "D"
$   then
$       old_start = f$locate("[gnv.usr", destname)
$       if old_start .lt. f$length(destname)
$       then
$           destname = "[gnv.beta" + destname - "[gnv.usr"
$       endif
$   endif
$!
$!  It should be just a directory then.
$!-------------------------------------
$   filedir = f$edit(f$parse(filename,,,"DIRECTORY"), "lowercase")
$!  If this is not a directory then start processing files.
$!---------------------------------------------------------
$   if filename .nes. filedir then goto flst_file
$!
$   write pdsc "   directory ""''destname'"" PROTECTION PUBLIC ;"
$   goto flst_dir_loop
$!
$!
$!   Add file lines for curl.
$!---------------------------
$flst_file_loop:
$   read/end=flst_loop_end flst line_in
$   line_in = f$edit(line_in,"compress,trim,uncomment")
$   if line_in .eqs. "" then goto inst_file_loop
$   filename = f$element(0, " ", line_in)
$   destname = filename
$   if kit_type .eqs. "D"
$   then
$       old_start = f$locate("[gnv.usr", destname)
$       if old_start .lt. f$length(destname)
$       then
$           destname = "[gnv.beta" + destname - "[gnv.usr"
$       endif
$   endif
$flst_file:
$   srcfile = filename - "gnv."
$   write pdsc "   file ""''destname'"" "
$   write pdsc "     source ""''srcfile'"" ;"
$   goto flst_file_loop
$!
$flst_loop_end:
$ close flst
$!
$!   Add Link alias procedure file (N/A for curl)
$!------------------------------------------------
$!
$!   Add [.SYS$STARTUP]curl_startup file
$!---------------------------------------
$ if kit_type .eqs. "D"
$ then
$   write pdsc "   file ""[sys$startup]curl_daily_startup.com"""
$ else
$   write pdsc "   file ""[sys$startup]curl_startup.com"""
$ endif
$ write pdsc "     source [usr.lib]curl_startup.com ;"
$!
$!   Add Release notes file.
$!------------------------------
$ write pdsc -
    "   file ""[SYSHLP]''filename_base'.release_notes"" release notes ;"
$!
$! Close the product file
$!------------------------
$ write pdsc "end product;"
$!
$close pdsc
$!
$all_exit:
$ exit