Add podRemove.pl script

Use this to generate .dbd files from .dbd.pod files
so installed *Record.dbd files don't have the
dbdCommon.dbd file expanded out.

Fixes lp:1417428
This commit is contained in:
Andrew Johnson
2015-04-13 10:36:13 -05:00
parent 09fab352b0
commit 76205e5c58
3 changed files with 55 additions and 4 deletions

View File

@@ -239,8 +239,7 @@ menu%.h$(DEP): ../menu%.dbd
%.dbd$(DEP): %.dbd.pod
@$(RM) $@
@$(DBEXPAND) -D $(DBDFLAGS) -o $(COMMONDEP_TARGET) $< > $@
@echo "$(COMMONDEP_TARGET): ../Makefile" >> $@
@echo "$(COMMONDEP_TARGET): ../Makefile" > $@
%.dbd$(DEP): %Include.dbd
@$(RM) $@
@@ -281,6 +280,8 @@ menu%.h$(DEP): ../menu%.dbd
@$(RM) $@
@$(ACFDEPENDS_CMD)
.PRECIOUS: %$(DEP)
##################################################### CapFast filter
$(COMMON_DIR)/%.edf: ../%.sch $(DEPSCHS)
@@ -370,7 +371,7 @@ $(COMMON_DIR)/bpt%.dbd: bpt%.data
$(COMMON_DIR)/%.dbd: %.dbd.pod
@$(RM) $(notdir $@)
$(DBEXPAND) $(DBDFLAGS) -o $(notdir $@) $<
$(PERL) $(TOOLS)/podRemove.pl -o $(notdir $@) $<
@$(MV) $(notdir $@) $@
$(COMMON_DIR)/%.dbd: %Include.dbd
@@ -422,7 +423,7 @@ $$(INSTALL_DBD)/$$(notdir $(1)) : $(1)
endef
$(foreach file, $(DBD_INSTALLS), $(eval $(call DBD_INSTALLS_template, $(file))))
.PRECIOUS: $(COMMON_DBDS) $(COMMON_DIR)/%Include.dbd
.PRECIOUS: $(COMMON_DBDS) $(COMMON_DIR)/%.dbd
##################################################### HTML files

View File

@@ -51,6 +51,7 @@ PERL_SCRIPTS += dbdToRecordtypeH.pl
PERL_SCRIPTS += dbdExpand.pl
PERL_SCRIPTS += dbdToHtml.pl
PERL_SCRIPTS += podToHtml.pl
PERL_SCRIPTS += podRemove.pl
PERL_SCRIPTS += registerRecordDeviceDriver.pl
HTMLS = style.css

49
src/tools/podRemove.pl Normal file
View File

@@ -0,0 +1,49 @@
#!/usr/bin/env perl
#*************************************************************************
# Copyright (c) 2015 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
# $Id$
use strict;
use warnings;
use Getopt::Std;
our ($opt_o);
$Getopt::Std::OUTPUT_HELP_VERSION = 1;
&HELP_MESSAGE if !getopts('o:') || @ARGV != 1;
my $infile = shift @ARGV;
if (!$opt_o) {
($opt_o = $infile) =~ s/\.pod$//;
$opt_o =~ s/^.*\///;
}
open my $inp, '<', $infile or
die "podRemove.pl: Can't open $infile: $!\n";
open my $out, '>', $opt_o or
die "podRemove.pl: Can't create $opt_o: $!\n";
my $inPod = 0;
while (<$inp>) {
if (m/\A=[a-zA-Z]/) {
$inPod = !m/\A=cut/;
}
else {
print $out $_ unless $inPod;
}
}
close $out;
close $inp;
sub HELP_MESSAGE {
print STDERR "Usage: podRemove.pl [-o file] file.pod\n";
exit 2;
}