EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: EPICS perl tools in 3.14.10-pre1
From: Stefan Heim <[email protected]>
To: EPICS tech-talk <[email protected]>
Date: Tue, 23 Sep 2008 18:18:04 +0200
Hi,

EPICS base release 3.14.10-pre1 added support for the installation of
perl modules to the build system. In an approach to modularize the perl
tools used by the build system (convertRelease.pl et al., formerly
residing under configure/tools, now found in src/tools), some common
functionality has been factored out into modules (Copy.pm, Getopts.pm,
Path.pm and Release.pm so far) and is used in the tools by means of
directives similar to

use lib '@TOP@/lib/perl';
use EPICS::Release;

The first directive is necessary to expand perl's @INC array with the
location where the EPICS perl modules reside; the @TOP@ pattern in that
directive is replaced by the new variable expansion facility during
installation and is set to the value of INSTALL_LOCATION from
CONFIG_SITE via the EXPANDFLAGS in RULES_EXPAND.

Unfortunately, this absolute path breaks builds of EPICS base inside
clean chroot environments (used e.g. when building Debian packages),
because with these kind of builds INSTALL_LOCATION is not a valid path
anymore when the EPICS perl tools are actually run later from a
different path. Similar problems should arise when an EPICS base is NFS
mounted on client machines to a different location than during build.

After spending some time trying to resolve this situation with ugly and
uglier hacks, I've finally found a solution that

1) works during the bootstrapping, i.e. when fullPathName.pl et al. are
   used during the EPICS build itself.

2) works afterwards, i.e. when the tools are used after the installation
   of the EPICS base package, possibly with a different path to
   EPICS_BASE than at build time.

The trick is to rely on the relative location of the perl module
directory with respect to the HOST_BIN directory rather than on absolute
paths. Lines of the form

use lib '@TOP@/lib/perl';

have to be replaced by

use FindBin qw($Bin);
use lib "$Bin/../../lib/perl";

in the *.pl@ tools in order to have the tools work independently of the
absolute path of EPICS_BASE. An analogous modification does the job for
the new CA.pm.

I'd love to see this change (patch attached) checked into CVS before the
3.14.10 release. Any comments?

-Stefan

-- 
Stefan Heim <[email protected]>
X-ray microscopy scientist, BESSY, Berlin
diff -Nur epics-base-3.14.10~pre1.orig/src/cap5/caget.pl@ epics-base-3.14.10~pre1/src/cap5/caget.pl@
--- epics-base-3.14.10~pre1.orig/src/cap5/caget.pl@	2008-06-28 00:19:23.000000000 +0200
+++ epics-base-3.14.10~pre1/src/cap5/caget.pl@	2008-09-23 17:37:07.000000000 +0200
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 
 use strict;
-use lib '@TOP@/lib/perl';
+use FindBin qw($Bin);
+use lib "$Bin/../../lib/perl";
 use Getopt::Std;
 use CA;
 
diff -Nur epics-base-3.14.10~pre1.orig/src/cap5/cainfo.pl@ epics-base-3.14.10~pre1/src/cap5/cainfo.pl@
--- epics-base-3.14.10~pre1.orig/src/cap5/cainfo.pl@	2008-06-28 00:19:24.000000000 +0200
+++ epics-base-3.14.10~pre1/src/cap5/cainfo.pl@	2008-09-23 17:37:07.000000000 +0200
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 
 use strict;
-use lib '@TOP@/lib/perl';
+use FindBin qw($Bin);
+use lib "$Bin/../../lib/perl";
 use Getopt::Std;
 use CA;
 
diff -Nur epics-base-3.14.10~pre1.orig/src/cap5/camonitor.pl@ epics-base-3.14.10~pre1/src/cap5/camonitor.pl@
--- epics-base-3.14.10~pre1.orig/src/cap5/camonitor.pl@	2008-06-28 00:19:24.000000000 +0200
+++ epics-base-3.14.10~pre1/src/cap5/camonitor.pl@	2008-09-23 17:37:07.000000000 +0200
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 
 use strict;
-use lib '@TOP@/lib/perl';
+use FindBin qw($Bin);
+use lib "$Bin/../../lib/perl";
 use Getopt::Std;
 use CA;
 
diff -Nur epics-base-3.14.10~pre1.orig/src/cap5/CA.pm@ epics-base-3.14.10~pre1/src/cap5/CA.pm@
--- epics-base-3.14.10~pre1.orig/src/cap5/CA.pm@	2008-06-28 00:19:21.000000000 +0200
+++ epics-base-3.14.10~pre1/src/cap5/CA.pm@	2008-09-23 17:37:07.000000000 +0200
@@ -29,7 +29,8 @@
 require DynaLoader;
 
 # Add our lib/<arch> directory to the library search path
-push @DynaLoader::dl_library_path, '@TOP@/lib/'.$ENV{EPICS_HOST_ARCH};
+use FindBin qw($Bin);
+push @DynaLoader::dl_library_path, "$Bin/../../lib/".$ENV{EPICS_HOST_ARCH};
 
 bootstrap Cap5 $VERSION;
 
diff -Nur epics-base-3.14.10~pre1.orig/src/cap5/caput.pl@ epics-base-3.14.10~pre1/src/cap5/caput.pl@
--- epics-base-3.14.10~pre1.orig/src/cap5/caput.pl@	2008-06-28 00:19:25.000000000 +0200
+++ epics-base-3.14.10~pre1/src/cap5/caput.pl@	2008-09-23 17:37:07.000000000 +0200
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 
 use strict;
-use lib '@TOP@/lib/perl';
+use FindBin qw($Bin);
+use lib "$Bin/../../lib/perl";
 use Getopt::Std;
 use CA;
 
diff -Nur epics-base-3.14.10~pre1.orig/src/tools/convertRelease.pl@ epics-base-3.14.10~pre1/src/tools/convertRelease.pl@
--- epics-base-3.14.10~pre1.orig/src/tools/convertRelease.pl@	2008-08-30 00:15:00.000000000 +0200
+++ epics-base-3.14.10~pre1/src/tools/convertRelease.pl@	2008-09-23 17:37:07.000000000 +0200
@@ -15,7 +15,8 @@
 #
 
 use strict;
-use lib '@TOP@/lib/perl';
+use FindBin qw($Bin);
+use lib "$Bin/../../lib/perl";
 
 use Cwd qw(cwd abs_path);
 use Getopt::Std;
diff -Nur epics-base-3.14.10~pre1.orig/src/tools/expandVars.pl@ epics-base-3.14.10~pre1/src/tools/expandVars.pl@
--- epics-base-3.14.10~pre1.orig/src/tools/expandVars.pl@	2008-04-03 23:57:10.000000000 +0200
+++ epics-base-3.14.10~pre1/src/tools/expandVars.pl@	2008-09-23 17:40:01.000000000 +0200
@@ -9,11 +9,12 @@
 # expandVars.pl@,v 1.1.2.4 2008/04/03 21:57:10 anj Exp
 #
 
+use FindBin qw($Bin);
 BEGIN {
     # Do not copy this BEGIN code for other tools,
     # it's only needed so expandVars can bootstrap itself.
-    our $libperl = '@TOP@/lib/perl';
-    $libperl = '..' if ($libperl =~ m/^[@]TOP[@]/);
+    our $libperl = "$Bin/../../lib/perl";
+    $libperl = '..' if ($libperl =~ m#/src/tools/\.\./\.\./lib/perl#);
 }
 use lib $libperl;
 
diff -Nur epics-base-3.14.10~pre1.orig/src/tools/fullPathName.pl@ epics-base-3.14.10~pre1/src/tools/fullPathName.pl@
--- epics-base-3.14.10~pre1.orig/src/tools/fullPathName.pl@	2008-04-03 23:57:11.000000000 +0200
+++ epics-base-3.14.10~pre1/src/tools/fullPathName.pl@	2008-09-23 17:37:07.000000000 +0200
@@ -15,7 +15,8 @@
 
 use strict;
 
-use lib '@TOP@/lib/perl';
+use FindBin qw($Bin);
+use lib "$Bin/../../lib/perl";
 use EPICS::Path;
 
 print AbsPath(shift), "\n";

Replies:
Re: EPICS perl tools in 3.14.10-pre1 Andrew Johnson

Navigate by Date:
Prev: Re: StreamDevice 2.4 released Rod Nussbaumer
Next: RE: ASYN R4.10 Release Rees, NP (Nick)
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: CA gateway and CA beacons Dirk Zimoch
Next: Re: EPICS perl tools in 3.14.10-pre1 Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·