EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: MSI Makefile Madness
From: Bruce Hill <[email protected]>
To: <[email protected]>
Date: Tue, 6 Mar 2018 14:11:12 -0800
We ran into this issue as well.   
It happens when you have both foo.substitutions and foo.template
in your Db directory and want msi to create and install foo.db.

Note that you can't rename foo.template to foo.db as it will just get
installed w/o any msi expansion.

The problem in my view is that msi ignores all filenames specified in the
substitutions file if a template filename is passed as an argument to msi.
This is a deliberate choice in msi as we can see from the documentation.

dbLoadTemplate Format

This format is an extension of the format accepted by the EPICS IOC command dbLoadTemplate, and allows templates to be expanded on the host rather by using dbLoadTemplate at IOC boot time.

global {gbl_var1=gbl_val1, gbl_var2=gbl_val2, ...}
file templatefile {
    pattern format or regular format
}
file "${WHERE}/template2" {
    pattern format or regular format
}

For the dbTemplate format, the template filename does not have to be given on the command line, and is usually specified in the substitutions file instead. If a template filename is given on the command line it will override the filenames listed in the substitutions files.

We fixed this by changing our RULES.Db after verifying that we had no use
cases that relied on the above behavior.    Another possible fix would be to
modify msi to respect filenames specified in the substitutions file and only
use a command line template argument for the pattern and regular formats
which don't specify a filename.

Here's the patch we use for RULES.Db:
% git diff fb5f13f^!
diff --git a/configure/RULES.Db b/configure/RULES.Db
index 7836d28..2d59529 100644
--- a/configure/RULES.Db
+++ b/configure/RULES.Db
@@ -467,13 +467,13 @@ $(COMMON_DIR)/%.db: $(COMMON_DIR)/%.edf
 $(COMMON_DIR)/%.db: %$(SUBST_SUFFIX)
     $(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)"
     @$(RM) $(notdir $@)
-    $(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$< $(TEMPLATE_FILENAME)
+    $(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$<
     @$(MV) $(notdir $@) $@
 
 $(COMMON_DIR)/%.db: ../%$(SUBST_SUFFIX)
     $(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)"
     @$(RM) $(notdir $@)
-    $(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$< $(TEMPLATE_FILENAME)
+    $(MSI3_15) $(DBFLAGS) -o $(notdir $@) -S$<
     @$(MV) $(notdir $@) $@
 
 $(COMMON_DIR)/%.db: %$(TEMPL_SUFFIX)

Cheers,
- Bruce

On 03/02/2018 06:18 AM, Konrad, Martin wrote:
Hi Michael,
You got to be careful with your file names. IIRC the EPICS build system
contains rules that automatically expand templates and substitution
files using MSI as follows:

.substitutions -> .db
.template -> .db

The ".template" extension is only required if your file is using
"substitute" and "include". If your files don't contain these keywords
".db" would probably be a better choice. If you use these keywords you
probably want to refer to "foo.db" in your substitution file to include
the already expanded file.

That being said, the following works as expected:

$ grep DB Makefile
DB += file.db
$ cat file.substitutions
file "other1.db" {
{X=1}
}
file "other2.db" {
{X=2}
}
$ cat other1.db
# from file.template $(X)
$ cat other2.db
# from other.template $(X)
$ make -C ../../ distclean all
$ cat ../../db/file.db
# from file.template 1
# from other.template 2

HTH,

Martin


-- 
Bruce Hill
Member Technical Staff
SLAC National Accelerator Lab
2575 Sand Hill Road M/S 10
Menlo Park, CA  94025

Replies:
Re: MSI Makefile Madness Benjamin Franksen
References:
Re: MSI Makefile Madness Konrad, Martin

Navigate by Date:
Prev: Build failed in Jenkins: epics-base-3.16-win64s-test #165 APS Jenkins
Next: Jenkins build is back to normal : epics-base-3.16-win64s-test #166 APS Jenkins
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: MSI Makefile Madness Konrad, Martin
Next: Re: MSI Makefile Madness Benjamin Franksen
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021  2022  2023  2024 
ANJ, 09 Apr 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·