quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

make_pcsi_curl_kit_name.com (6181B)


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