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  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021 
<== Date ==> <== Thread ==>

Subject: Re: MSI Makefile Madness
From: Benjamin Franksen <benjamin.franksen@helmholtz-berlin.de>
To: Bruce Hill <bhill@slac.stanford.edu>, <core-talk@aps.anl.gov>
Date: Mon, 9 Apr 2018 13:58:48 +0200
On 03/06/2018 11:11 PM, Bruce Hill wrote:
> 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.

Same here. These are the rules we use, including proper generation of
dependencies to be included by the Makefile:

DEPENDS+=$(patsubst %,%$(RAW)$(DEP),$(COMMON_DBS))

$(COMMON_DIR)/%.template$(DEP): %.substitutions
	$(ECHO) "Generating database dependencies from $(<F)"
	$(PERL) -e 'undef $$/; $$_=<>; @d=m/(?:^|})\s*file\s+([^{\s]*)\s*\{/mg;
print "$(COMMON_DIR)/$*.template: @d\n";' $< > $(@F).tmp
	$(MV) $(@F).tmp $@

$(COMMON_DIR)/%.db$(RAW)$(DEP): %.substitutions
	$(ECHO) "Generating database dependencies from $(<F)"
	$(PERL) -e 'undef $$/; $$_=<>; @d=m/(?:^|})\s*file\s+([^{\s]*)\s*\{/mg;
print "$(COMMON_DIR)/$*.db$(RAW): @d\n";' $< > $(@F).tmp
	$(MV) $(@F).tmp $@

$(COMMON_DIR)/%.db$(RAW): %.substitutions
	$(ECHO) "Inflating database from $(<F)"
	$(MSI) $(DBFLAGS) -S$< > $(@F).tmp
	$(MV) $(@F).tmp $@

Cheers
Ben
-- 
"Make it so they have to reboot after every typo." ― Scott Adams

Attachment: signature.asc
Description: OpenPGP digital signature


References:
Re: MSI Makefile Madness Konrad, Martin
Re: MSI Makefile Madness Bruce Hill

Navigate by Date:
Prev: Re: pvaccess and Java 9 Re: PVA Java status Eric Berryman
Next: Re: bundling linenoise with base Benjamin Franksen
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021 
Navigate by Thread:
Prev: Re: MSI Makefile Madness Bruce Hill
Next: Build failed in Jenkins: epics-base-3.15-win64 #340 APS Jenkins
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  <20182019  2020  2021 
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 ·