From edd83b8be74d55262eead61938328d86e3090047 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 1 Feb 2002 21:04:27 +0000 Subject: [PATCH] Fixed -t option to convertRelease.pl so application settings of IOCS_APPL_TOP work properly. NB: All cdCommands paths will potentially be modified, based on the difference between the left-hand part of the host's path to TOP and the setting of IOCS_APPL_TOP. --- configure/RULES.ioc | 2 +- configure/RULES_ARCHS | 2 +- configure/tools/convertRelease.pl | 40 +++++++++++++++++++------------ 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/configure/RULES.ioc b/configure/RULES.ioc index 03cb87550..f335e9a53 100644 --- a/configure/RULES.ioc +++ b/configure/RULES.ioc @@ -6,7 +6,7 @@ install: buildInstall buildInstall: $(TARGETS) -cdCommands: $(wildcard $(TOP)/config/RELEASE*) +cdCommands: $(wildcard $(TOP)/configure/RELEASE*) $(TOP)/configure/CONFIG ifeq ($(IOCS_APPL_TOP),) $(PERL) $(TOOLS)/convertRelease.pl -a $(ARCH) $@ else diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index 7b1b66a25..6fd8dc043 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -37,7 +37,7 @@ O.Common: $(MKDIR) O.Common checkRelease: $(wildcard $(TOP)/configure/RELEASE*) - $(PERL) $(TOOLS)/convertRelease.pl -h $(EPICS_HOST_ARCH) -t $(TOP) $@ + $(PERL) $(TOOLS)/convertRelease.pl -h $(EPICS_HOST_ARCH) $@ # # special clean rule diff --git a/configure/tools/convertRelease.pl b/configure/tools/convertRelease.pl index c0d582d07..aed58d32c 100755 --- a/configure/tools/convertRelease.pl +++ b/configure/tools/convertRelease.pl @@ -28,16 +28,25 @@ if ($opt_a) { $hostarch = $arch; $hostarch = $opt_h if ($opt_h); +# Find $top from current path; NB only works under iocBoot/* and configure/* +$top = $cwd; +$top =~ s/\/iocBoot.*$//; +$top =~ s/\/configure.*$//; + +# The IOC may need a different path to get to $top if ($opt_t) { - $top = $opt_t; -} else { # Find $top from current path - $top = $cwd; - $top =~ s/\/iocBoot.*//; - $top =~ s/\/configure\/O\..*//; + $iocroot = $ioctop = $opt_t; + $root = $top; + while (substr($iocroot, -1, 1) eq substr($root, -1, 1)) { + chop $iocroot; + chop $root; + } +} else { + $ioctop = $top; } unless (@ARGV == 1) { - print "Usage: convertRelease.pl [-a arch] [-h hostarch] [-t top] outfile\n"; + print "Usage: convertRelease.pl [-a arch] [-h hostarch] [-t ioctop] outfile\n"; print " where outfile is be one of:\n"; print "\tcheckRelease - checks consistency with support apps\n"; print "\tcdCommands - generate cd path strings for IOC use\n"; @@ -185,20 +194,21 @@ sub cdCommands { die "Architecture not set (use -a option)" unless ($arch); @includes = grep !/^TEMPLATE_TOP$/, @apps; - # if -t was given, substitute it in the startup path - $startup = $cwd; - $startup =~ s/.*(\/iocBoot\/.*)/$top$1/ if ($opt_t); - unlink($outfile); open(OUT,">$outfile") or die "$! creating $outfile"; + + $startup = $cwd; + $startup =~ s/^$root/$iocroot/ if ($opt_t); + print OUT "startup = \"$startup\"\n"; - print OUT "appbin = \"$top/bin/$arch\"\n"; # compatibility with R3.13.1 + print OUT "appbin = \"$ioctop/bin/$arch\"\n"; # R3.13.1 compatibility foreach $app (@includes) { - $path = $macros{$app}; - $lcapp = lc($app); - print OUT "$lcapp = \"$path\"\n" if (-d $path); - print OUT "${lcapp}bin = \"$path/bin/$arch\"\n" if (-d "$path/bin/$arch"); + $iocpath = $path = $macros{$app}; + $iocpath =~ s/^$root/$iocroot/ if ($opt_t); + $app_lc = lc($app); + print OUT "$app_lc = \"$iocpath\"\n" if (-d $path); + print OUT "${app_lc}bin = \"$iocpath/bin/$arch\"\n" if (-d "$path/bin/$arch"); } close OUT; }