From 8659af3ee4e4d6e8ab9ba1eb101eca594c67ad44 Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Tue, 14 Sep 1999 13:30:24 +0000 Subject: [PATCH] moved to top/configure/tools --- src/tools/Makefile | 14 ----- src/tools/cp.pl | 41 --------------- src/tools/findBase.pl | 13 ----- src/tools/getrel | 64 ---------------------- src/tools/installEpics | 97 ---------------------------------- src/tools/installEpics.pl | 108 -------------------------------------- src/tools/makeMakefile.pl | 31 ----------- src/tools/mkdir.pl | 23 -------- src/tools/mv.pl | 69 ------------------------ src/tools/rm.pl | 32 ----------- src/tools/testmkdir | 15 ------ 11 files changed, 507 deletions(-) delete mode 100644 src/tools/Makefile delete mode 100644 src/tools/cp.pl delete mode 100644 src/tools/findBase.pl delete mode 100755 src/tools/getrel delete mode 100755 src/tools/installEpics delete mode 100644 src/tools/installEpics.pl delete mode 100644 src/tools/makeMakefile.pl delete mode 100644 src/tools/mkdir.pl delete mode 100644 src/tools/mv.pl delete mode 100644 src/tools/rm.pl delete mode 100644 src/tools/testmkdir diff --git a/src/tools/Makefile b/src/tools/Makefile deleted file mode 100644 index 1c8483cb0..000000000 --- a/src/tools/Makefile +++ /dev/null @@ -1,14 +0,0 @@ - -TOP=../.. - -include $(TOP)/configure/CONFIG - -# install these scripts: -# - -SCRIPTS += $(subst ../,,$(wildcard ../*.pl)) -SCRIPTS += installEpics - -include $(TOP)/configure/RULES_BUILD - -# EOF base/src/tools/Makefile.Host diff --git a/src/tools/cp.pl b/src/tools/cp.pl deleted file mode 100644 index 87cdf78ec..000000000 --- a/src/tools/cp.pl +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl -# -# UNIX-cp in Perl - -use File::Copy; -use File::Basename; - -sub Usage -{ - my ($txt) = @_; - - print "Usage:\n"; - print "\tcp file1 file2\n"; - print "\tcp file [ file2 file3 ...] directory\n"; - print "\nError: $txt\n" if $txt; - - exit 2; -} - -# need at least two args: ARGV[0] and ARGV[1] -Usage("need more args") if $#ARGV < 1; - -$target=$ARGV[$#ARGV]; -@sources=@ARGV[0..$#ARGV-1]; - -if (-d $target) -{ - foreach $file ( @sources ) - { - $base=basename($file); - copy ($file, "$target/$base"); - } -} -else -{ - Usage("Cannot copy more than one source into a single target") - if ($#sources != 0); - copy ($sources[0], $target); -} - -# EOF cp.pl diff --git a/src/tools/findBase.pl b/src/tools/findBase.pl deleted file mode 100644 index 1e14af348..000000000 --- a/src/tools/findBase.pl +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl - -use Cwd; - -$dir=cwd(); -# make sure $dir ends with '/' -# -$dir="$dir/" unless ($dir =~ m'/$'); - -if ($dir =~ m'(.*(/|\\)base)(/|\\)') -{ - print "$1"; -} diff --git a/src/tools/getrel b/src/tools/getrel deleted file mode 100755 index 65ee2cfbc..000000000 --- a/src/tools/getrel +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -# -# $Id$ -# -# Author: Matthew Needes -# - -USAGE="Usage: - getrel - -ex: getrel /usr/local/epics/base_R3.13 - --------- OR ----------- - getrel ~/epics/base - -" - -# one arg -if [ $# -lt 1 ]; then - cat < EPICS_BASE - -touch .current_rel_hist -echo ${BASE} - `date` >> .current_rel_hist - -exit 0 diff --git a/src/tools/installEpics b/src/tools/installEpics deleted file mode 100755 index d5472dc6d..000000000 --- a/src/tools/installEpics +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh - -# InstallEpics -# -# InstallEpics is used within makefiles to copy new versions of -# files into a destination directory. -# -########################################################## -TOOL=`basename $0` -MODE=755 -CREATE_DIR=0 -USAGE="Usage: - $TOOL [ -m mode ] file ... directory - - -m mode Set the mode for the installed file (0755 by default) - file Name of file - directory Destination directory -" -# get command line options -while getopts m:g:o:csd OPT -do - - case $OPT in - m) MODE=$OPTARG;; - g | o) echo "$USAGE"; echo "$i $OPTARG not implemented";; - c | s) echo "$USAGE"; echo "$i not implemented";; - d) CREATE_DIR=1;; - --) break;; - esac -done -shift `expr $OPTIND - 1` - -# at least two args required -if [ $# -lt 2 ] -then - echo "Nothing to install" - exit -fi - -INSTALL_DIR= -FILELIST= -for i -do - FILELIST="${FILELIST} ${INSTALL_DIR}"; INSTALL_DIR=$i; shift; -done - -if [ ! -d "${INSTALL_DIR}" ] ;then - if [ ${CREATE_DIR} != "0" ] ;then - OLDIFS=${IFS} - IFS=/ - DIRNAME= - for DIR in ${INSTALL_DIR} - do - if [ "${DIR}" = "." ] || [ "${DIR}" = ".." ] ;then - if [ "${DIRNAME}" = "" ] ;then - DIRNAME=${DIR} - else - DIRNAME=${DIRNAME}/${DIR} - fi - else - DIRNAME=${DIRNAME}/${DIR} - if [ ! -d "${DIRNAME}" ] ;then - mkdir "${DIRNAME}" - fi - fi - done - IFS=${OLDIFS} - else - echo "$USAGE\n Can't find directory '${INSTALL_DIR}'" - exit 1 - fi -fi - -for FILE in ${FILELIST} -do - if [ ! -f ${FILE} ] ;then - echo "$USAGE\n Can't find file '${FILE}'" - exit 1 - fi - - TEST= - FILEBASENAME=`basename ${FILE}` - if [ -f ${INSTALL_DIR}/${FILEBASENAME} ] ; then - #Is ${INSTALL_DIR}/${FILEBASENAME} link timestamp newer than ${FILE} - TEST=`find ${INSTALL_DIR} -name "${FILEBASENAME}" -newer ${FILE} -print` - fi - if [ "${TEST}x" = "x" ] ; then - #echo "Installing ${FILEBASENAME}" - rm -f ${INSTALL_DIR}/${FILEBASENAME} - cp -p ${FILE} ${INSTALL_DIR}/${FILEBASENAME} - chmod ${MODE} ${INSTALL_DIR}/${FILEBASENAME} - else - echo "${INSTALL_DIR}/${FILEBASENAME} is up to date" - fi -done - -exit 0 diff --git a/src/tools/installEpics.pl b/src/tools/installEpics.pl deleted file mode 100644 index 33f44b19e..000000000 --- a/src/tools/installEpics.pl +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/perl -# -# InstallEpics.pl -# -# InstallEpics is used within makefiles to copy new versions of -# files into a destination directory. -# Based on installEpics shell script. -# -# 2-4-97 -kuk- -# -########################################################## - -use Getopt::Std; -use File::Path; -use File::Copy; - -$tool=$0; -$tool=~ s'.*[/\\].+''; # basename -$mode=0755; - -# get command line options -getopt "m"; -$mode = oct ($opt_m) if ($opt_m); - -# Complain about obsolete options: -Usage("unknown option given") if ($opt_g or $opt_o or $opt_c or $opt_s); - -$num_files = $#ARGV; -# at least two args required -Usage ("Nothing to install") if ($num_files < 1); - -# split args in file1 ... fileN target_dir: -@files=@ARGV[0..$num_files-1]; -$install_dir=$ARGV[$num_files]; -$install_dir =~ s[\\][/]g; # maybe fix DOS-style path -$install_dir =~ s[/$][]; # remove trailing '/' - -# Do we have to create the directory? -unless (-d $install_dir) -{ - # Create dir only if -d option given - Usage ("$install_dir does not exist") unless ($opt_d); - - # Create all the subdirs that lead to $install_dir - mkpath ($install_dir, 1, 0777); -} - -foreach $source ( @files ) -{ - Usage ("Can't find file '$source'") unless -f $source; - - $basename=$source; - $basename=~s'.*[/\\]''; - $target = "$install_dir/$basename"; - - # The Win32 filesystem seems to be 'slow', - # i.e. $target may look like 'up to date' - # unless you wait an hour. - # -> skip this test on WIN32 ? - #if (-f $target and $^O ne "MSWin32") - if (-f $target) - { - if (-M $target < -M $source and - -C $target < -C $source) - { - print "$target is up to date\n"; - next; - } - else - { - # remove old target, make sure it is deletable: - chmod 0777, $target; - unlink $target; - } - } - - # print "Installing $source into $install_dir\n"; - copy ($source, $target) or die "Copy failed"; - - # chmod 0555 DOES work on WIN32, but: - # Another chmod 0777 to make it write- and deletable - # will then fail. - # -> you have to use Win32::SetFileAttributes - # to get rid of those files from within Perl. - # Because the chmod is not really needed on WIN32, - # just skip it! - chmod $mode, $target unless ($^O eq "MSWin32"); -} - -sub Usage -{ - my ($txt) = @_; - - print "Usage:\n"; - print "\t$tool [ -m mode ] file ... directory\n"; - print "\n"; - print "\t-d Create non-exising directories\n"; - print "\t-m mode Set the mode for the installed file"; - print " (0755 by default)\n"; - print "\tfile Name of file\n"; - print "\tdirectory Destination directory\n"; - - print "$txt\n" if $txt; - - exit 2; -} - -# EOF installEpics.pl diff --git a/src/tools/makeMakefile.pl b/src/tools/makeMakefile.pl deleted file mode 100644 index ef567a0b7..000000000 --- a/src/tools/makeMakefile.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -# -# makeMakefile.pl -# -# called from RULES_ARCHS -# -# -# Usage: perl makeMakefile.pl O.*-dir Makefile-Type - -$dir = $ARGV[0]; -$type= $ARGV[1]; -$makefile="$dir/Makefile"; - -if ($dir =~ m'O.(.+)') -{ - $t_a = $1; -} -else -{ - die "Cannot extract T_A from $dir"; -} - -mkdir ($dir, 0777) unless -d $dir; - -open OUT, "> $makefile" or die "Cannot create $makefile"; -print OUT "T_A=$t_a\n"; -print OUT "BUILD_TYPE=$type\n"; -print OUT "include ../Makefile.$type\n"; -close OUT; - -# EOF makeMakefile.pl diff --git a/src/tools/mkdir.pl b/src/tools/mkdir.pl deleted file mode 100644 index 2fb4d73a5..000000000 --- a/src/tools/mkdir.pl +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/perl -# -# UNIX-mkdir in Perl -# -# -p option generates full path to given dir - -use File::Path; -use Getopt::Std; -getopt(''); - -foreach $dir ( @ARGV ) -{ - if ($opt_p) - { - mkpath ($dir) or die "Cannot make directory $dir"; - } - else - { - mkdir ($dir, 0777) or die "Cannot make directory $dir"; - } -} - -# EOF mkdir.pl diff --git a/src/tools/mv.pl b/src/tools/mv.pl deleted file mode 100644 index 9ccaae9be..000000000 --- a/src/tools/mv.pl +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/perl -# -# UNIX-mv in Perl - -use File::Copy; - -sub Usage -{ - my ($txt) = @_; - - print "Usage:\n"; - print "\tmv oldname newname\n"; - print "\tmv file [ file2 file3 ...] directory\n"; - print "\nError: $txt\n" if $txt; - - exit 2; -} - -sub Move -{ - my ($src, $dest) = @_; - - print "Move($src, $dest)\n"; - - copy ($src, $dest) or die "Cannot copy $src to $dest"; - unlink ($src) or die "Cannot remove $src"; -} - -# return filename.ext from Drive:/path/a/b/c/filename.ext -sub Filename -{ - my ($file) = @_; - - $file =~ s'.*[/\\]''; - - return $file; -} - -# need at least two args: ARGV[0] and ARGV[1] -Usage("need more args") if $#ARGV < 1; - -$target=$ARGV[$#ARGV]; -@sources=@ARGV[0..$#ARGV-1]; - -print "move @sources into $target\n"; - -# If target is (already existent) directory, -# move files into it: -if (-d $target) -{ - foreach $file ( @sources ) - { - Move ($file, "$target/" . Filename($file)); - } - exit 0; -} - -# Otherwise the target is a filename. -# Now 'mv' may be either a 'move' or a 'rename', -# in any case it requires exactly two args: old and new name. - -Usage("Need exactly one source") if $#sources != 0; -$source = @sources[0]; - -# Move only if a simple rename -# fails (e.g. across file systems): -Move ($source, $target) unless (rename $source, $target); - -# EOF mv.pl diff --git a/src/tools/rm.pl b/src/tools/rm.pl deleted file mode 100644 index a21d2152c..000000000 --- a/src/tools/rm.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl -# -# UNIX-rm in Perl - -use File::Path; -use File::Find; -use Getopt::Std; - -getopt(''); - -foreach $arg ( @ARGV ) -{ - next unless -e $arg; - - if (-d $arg) - { - if ($opt_r and $opt_f) - { - rmtree $arg; - } - else - { - rmdir ($arg) or die "Cannot delete $arg"; - } - } - else - { - unlink ($arg) or die "Cannot delete $arg"; - } -} - -# EOF rm.pl diff --git a/src/tools/testmkdir b/src/tools/testmkdir deleted file mode 100644 index 9e9283236..000000000 --- a/src/tools/testmkdir +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# - -if [ $# -ne 1 ] -then - echo "USAGE:" - echo "$0 dirname" - echo 'Function: if dirname does not exist, create it.' - exit 2 -fi - -DIR=$1 - -test -d ${DIR} || mkdir ${DIR}