Blame vms/stage_gawk_install.com

Packit 575503
$! File: stage_gawk_install.com
Packit 575503
$!
Packit 575503
$! Stages the build products to new_gnu:[...] for testing and for building
Packit 575503
$! a kit.
Packit 575503
$!
Packit 575503
$! If p1 starts with "R" then remove instead of install.
Packit 575503
$!
Packit 575503
$! The file PCSI_GAWK_FILE_LIST.TXT is read in to get the files other
Packit 575503
$! than the release notes file and the source backup file.
Packit 575503
$!
Packit 575503
$! The PCSI system can really only handle ODS-2 format filenames and
Packit 575503
$! assumes that there is only one source directory.  It also assumes that
Packit 575503
$! all destination files with the same name come from the same source file.
Packit 575503
$!
Packit 575503
$!
Packit 575503
$! 29-Sep-2013  J. Malmberg
Packit 575503
$!
Packit 575503
$!===========================================================================
Packit 575503
$!
Packit 575503
$ arch_type = f$getsyi("ARCH_NAME")
Packit 575503
$ arch_code = f$extract(0, 1, arch_type)
Packit 575503
$!
Packit 575503
$ mode = "install"
Packit 575503
$ code = f$extract(0, 1, p1)
Packit 575503
$ if code .eqs. "R" .or. code .eqs. "r" then mode = "remove"
Packit 575503
$!
Packit 575503
$!  First create the directories
Packit 575503
$!--------------------------------
Packit 575503
$ if mode .eqs. "install"
Packit 575503
$ then
Packit 575503
$   create/dir new_gnu:[bin]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[vms_bin]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[vms_help]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[lib]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.bin]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.include]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.lib.gawk]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.share.awk]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.share.doc.gawk]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.share.info]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.src.gawk.extension.vms]/prot=o:rwed
Packit 575503
$   create/dir new_gnu:[usr.share.man.man1]/prot=o:rwed
Packit 575503
$ endif
Packit 575503
$!
Packit 575503
$ if mode .eqs. "install"
Packit 575503
$ then
Packit 575503
$    copy [.vms]gnv_gawk_startup.com -
Packit 575503
         new_gnu:[vms_bin]gnv$gawk_startup.com
Packit 575503
$ else
Packit 575503
$    file = "new_gnu:[vms_bin]gnv$gawk_startup.com"
Packit 575503
$    if f$search(file) .nes. "" then delete 'file';*
Packit 575503
$ endif
Packit 575503
$!
Packit 575503
$!
Packit 575503
$!   Read through the file list to set up aliases and rename commands.
Packit 575503
$!---------------------------------------------------------------------
Packit 575503
$ open/read flst [.vms]pcsi_gawk_file_list.txt
Packit 575503
$!
Packit 575503
$inst_alias_loop:
Packit 575503
$   ! Skip the aliases
Packit 575503
$   read/end=inst_file_loop_end flst line_in
Packit 575503
$   line_in = f$edit(line_in,"compress,trim,uncomment")
Packit 575503
$   if line_in .eqs. "" then goto inst_alias_loop
Packit 575503
$   pathname = f$element(0, " ", line_in)
Packit 575503
$   linkflag = f$element(1, " ", line_in)
Packit 575503
$   if linkflag .nes. "->" then goto inst_alias_done
Packit 575503
$   goto inst_alias_loop
Packit 575503
$!
Packit 575503
$inst_file_loop:
Packit 575503
$!
Packit 575503
$   read/end=inst_file_loop_end flst line_in
Packit 575503
$   line_in = f$edit(line_in,"compress,trim,uncomment")
Packit 575503
$   if line_in .eqs. "" then goto inst_file_loop
Packit 575503
$!
Packit 575503
$inst_alias_done:
Packit 575503
$!
Packit 575503
$!
Packit 575503
$!   Skip the directories as we did them above.
Packit 575503
$!   Just process the files.
Packit 575503
$   tdir = f$parse(line_in,,,"DIRECTORY")
Packit 575503
$   tdir_len = f$length(tdir)
Packit 575503
$   tname = f$parse(line_in,,,"NAME")
Packit 575503
$   lctname = f$edit(tname, "LOWERCASE")
Packit 575503
$   ttype = f$parse(line_in,,,"TYPE")
Packit 575503
$   if arch_code .eqs. "V"
Packit 575503
$   then
Packit 575503
$       tname = lctname
Packit 575503
$       ttype = f$edit(ttype, "LOWERCASE")
Packit 575503
$       tdir = f$edit(tdir, "LOWERCASE")
Packit 575503
$   endif
Packit 575503
$   if tname .eqs. "" then goto inst_file_loop
Packit 575503
$   if ttype .eqs. ".dir" then goto inst_file_loop
Packit 575503
$!
Packit 575503
$!   if p1 starts with "R" then remove instead of install.
Packit 575503
$!
Packit 575503
$!   If gnv$xxx.exe, then:
Packit 575503
$!       Source is []gnv$gawk.exe
Packit 575503
$!       Destination1 is new_gnu:[bin]gnv$gawk.exe
Packit 575503
$!       Destination2 is new_gnu:[bin]xxx.  (alias)
Packit 575503
$!       Destination2 is new_gnu:[bin]xxx.exe  (alias)
Packit 575503
$!       We put all in new_gnu:[bin] instead of some in [usr.bin] because
Packit 575503
$!       older GNV kits incorrectly put some images in [bin] and [bin]
Packit 575503
$!       comes first in the search list.
Packit 575503
$   if f$locate("gnv$", tname) .eq. 0
Packit 575503
$   then
Packit 575503
$       myfile_len = f$length(tname)
Packit 575503
$       myfile = f$extract(4, myfile_len, tname)
Packit 575503
$       source = "[]''myfile'''ttype'"
Packit 575503
$       dest1 = "new_gnu:[bin]''tname'''ttype'"
Packit 575503
$       dest2 = "new_gnu:[bin]''myfile'."
Packit 575503
$       dest3 = "new_gnu:[bin]''myfile'.exe"
Packit 575503
$       if mode .eqs. "install"
Packit 575503
$       then
Packit 575503
$           if f$search(dest1) .eqs. "" then copy 'source' 'dest1'
Packit 575503
$           if f$search(dest2) .eqs. "" then set file/enter='dest2' 'dest1'
Packit 575503
$           if f$search(dest3) .eqs. "" then set file/enter='dest3' 'dest1'
Packit 575503
$       else
Packit 575503
$           if f$search(dest2) .nes. "" then set file/remove 'dest2';*
Packit 575503
$           if f$search(dest3) .nes. "" then set file/remove 'dest3';*
Packit 575503
$           if f$search(dest1) .nes. "" then delete 'dest1';*
Packit 575503
$       endif
Packit 575503
$       goto inst_file_loop
Packit 575503
$   endif
Packit 575503
$!
Packit 575503
$!   If lib.gawk] then
Packit 575503
$!       source is sys$disk:[]
Packit 575503
$!       dest is new_gnu:[usr.lib.gawk]
Packit 575503
$    if f$locate("lib.gawk]", tdir) .lt. tdir_len
Packit 575503
$    then
Packit 575503
$!       ! Not yet available on VAX/VMS
Packit 575503
$        if arch_code .eqs. "V" then goto inst_file_loop
Packit 575503
$!
Packit 575503
$        source = "[]''tname'''ttype'"
Packit 575503
$        dest = "new_gnu:[usr.lib.gawk]''tname'''ttype'"
Packit 575503
$        if mode .eqs. "install"
Packit 575503
$        then
Packit 575503
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$        else
Packit 575503
$            if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$        endif
Packit 575503
$        goto inst_file_loop
Packit 575503
$    endif
Packit 575503
$!
Packit 575503
$!   If .vms_bin] then
Packit 575503
$!       source is sys$disk:[]
Packit 575503
$!       dest is [vms_bin]
Packit 575503
$   if (f$locate("vms_bin]", tdir) .lt. tdir_len)
Packit 575503
$   then
Packit 575503
$       if (ttype .eqs. ".cld")
Packit 575503
$       then
Packit 575503
$           source = "sys$disk:[]''tname'''ttype'"
Packit 575503
$       else
Packit 575503
$           source = "sys$disk:[.vms]''tname'''ttype'"
Packit 575503
$       endif
Packit 575503
$       dest = "new_gnu:[vms_bin]''tname'''ttype'"
Packit 575503
$       if mode .eqs. "install"
Packit 575503
$       then
Packit 575503
$           if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$       else
Packit 575503
$           if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$       endif
Packit 575503
$       goto inst_file_loop
Packit 575503
$   endif
Packit 575503
$!
Packit 575503
$!   If .vms_hlp] then
Packit 575503
$!       source is sys$disk:[.vms]
Packit 575503
$!       dest is [vms_help]
Packit 575503
$   if (f$locate("vms_help]", tdir) .lt. tdir_len) .and. (ttype .eqs. ".hlp")
Packit 575503
$   then
Packit 575503
$       source = "sys$disk:[.vms]''tname'''ttype'"
Packit 575503
$       dest = "new_gnu:[vms_help]''tname'''ttype'"
Packit 575503
$       if mode .eqs. "install"
Packit 575503
$       then
Packit 575503
$           if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$       else
Packit 575503
$           if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$       endif
Packit 575503
$       goto inst_file_loop
Packit 575503
$   endif
Packit 575503
$!
Packit 575503
$!   If doc.gawk] then
Packit 575503
$!       source is sys$disk:[] or [.readme_d]
Packit 575503
$!       dest is [usr.share.doc.gawk]
Packit 575503
$   if f$locate(".doc.gawk]", tdir) .lt. tdir_len
Packit 575503
$   then
Packit 575503
$       if lctname .eqs. "readme" .and. ttype .nes. "."
Packit 575503
$       then
Packit 575503
$           source = "sys$disk:[.README_D]''tname'''ttype'"
Packit 575503
$           if f$search(source) .eqs. ""
Packit 575503
$           then
Packit 575503
$!              ! This may be an NFS mangled name on VAX.
Packit 575503
$               stype = ttype - "."
Packit 575503
$               if stype .nes. "vms" then stype = "$" + stype
Packit 575503
$               source = "sys$disk:[.$README_$D]$README.''stype'"
Packit 575503
$           endif
Packit 575503
$       else
Packit 575503
$           source = "sys$disk:[]''tname'''ttype'"
Packit 575503
$           if f$search(source) .eqs. ""
Packit 575503
$           then
Packit 575503
$               source = "sys$disk:[]$''tname'''ttype'"
Packit 575503
$           endif
Packit 575503
$       endif
Packit 575503
$       dest = "new_gnu:[usr.share.doc.gawk]''tname'''ttype'"
Packit 575503
$       if mode .eqs. "install"
Packit 575503
$       then
Packit 575503
$           if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$       else
Packit 575503
$           if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$       endif
Packit 575503
$       goto inst_file_loop
Packit 575503
$   endif
Packit 575503
$!
Packit 575503
$!   If .awk] then
Packit 575503
$!       source is sys$disk:[.awklib.eg.lib]
Packit 575503
$!       dest is new_gnu:[usr.share.awk]
Packit 575503
$    if f$locate(".awk]", tdir) .lt. tdir_len
Packit 575503
$    then
Packit 575503
$        source = "[.awklib.eg.lib]''tname'''ttype'"
Packit 575503
$        dest = "new_gnu:[usr.share.awk]''tname'''ttype'"
Packit 575503
$        if mode .eqs. "install"
Packit 575503
$        then
Packit 575503
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$        else
Packit 575503
$            if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$        endif
Packit 575503
$        goto inst_file_loop
Packit 575503
$    endif
Packit 575503
$!
Packit 575503
$!   If *.info then
Packit 575503
$!       source is [.doc]gawk.info
Packit 575503
$!       dest is [.usr.share.info]
Packit 575503
$    if ttype .eqs. ".info"
Packit 575503
$    then
Packit 575503
$        source = "[.doc]''tname'''ttype'"
Packit 575503
$        dest = "new_gnu:[usr.share.info]''tname'''ttype'"
Packit 575503
$        if mode .eqs. "install"
Packit 575503
$        then
Packit 575503
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$        else
Packit 575503
$            if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$        endif
Packit 575503
$        goto inst_file_loop
Packit 575503
$    endif
Packit 575503
$!
Packit 575503
$!   If *.h then
Packit 575503
$!       source is []*.h
Packit 575503
$!       dest is [.usr.include]
Packit 575503
$    if ttype .eqs. ".h"
Packit 575503
$    then
Packit 575503
$        source = "[]''tname'''ttype'"
Packit 575503
$        dest = "new_gnu:[usr.include]''tname'''ttype'"
Packit 575503
$        if mode .eqs. "install"
Packit 575503
$        then
Packit 575503
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$        else
Packit 575503
$            if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$        endif
Packit 575503
$        goto inst_file_loop
Packit 575503
$    endif
Packit 575503
$!
Packit 575503
$!   If *.opt then
Packit 575503
$!       source is [.vms]gawk_plugin.opt
Packit 575503
$!       dest is [.usr.src.gawk.extension.vms]
Packit 575503
$    if ttype .eqs. ".opt"
Packit 575503
$    then
Packit 575503
$        source = "[.vms]''tname'''ttype'"
Packit 575503
$        dest = "new_gnu:[usr.src.gawk.extension.vms]''tname'''ttype'"
Packit 575503
$        if mode .eqs. "install"
Packit 575503
$        then
Packit 575503
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$        else
Packit 575503
$            if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$        endif
Packit 575503
$        goto inst_file_loop
Packit 575503
$    endif
Packit 575503
$!
Packit 575503
$!   If xxx.1 then
Packit 575503
$!       source is [.doc]xxx.1
Packit 575503
$!       dest is [usr.share.man.man1]
Packit 575503
$    if ttype .eqs. ".1"
Packit 575503
$    then
Packit 575503
$        source = "[.doc]''tname'''ttype'"
Packit 575503
$        dest = "new_gnu:[usr.share.man.man1]''tname'''ttype'"
Packit 575503
$        if mode .eqs. "install"
Packit 575503
$        then
Packit 575503
$            if f$search(dest) .eqs. "" then copy 'source' 'dest'
Packit 575503
$        else
Packit 575503
$            if f$search(dest) .nes. "" then delete 'dest';*
Packit 575503
$        endif
Packit 575503
$        goto inst_file_loop
Packit 575503
$    endif
Packit 575503
$!
Packit 575503
$    goto inst_file_loop
Packit 575503
$!
Packit 575503
$inst_file_loop_end:
Packit 575503
$!
Packit 575503
$close flst
Packit 575503
$!
Packit 575503
$all_exit:
Packit 575503
$   exit