Skip to content

Commit

Permalink
.......... [ZBXNEXT-826] fixed database/*/Makefile.am to handle multi…
Browse files Browse the repository at this point in the history
…ple templates*.tmpl files

(cherry picked from commit 8ccccfe)
  • Loading branch information
alexv123456 committed Jan 10, 2025
1 parent 8f869fa commit d4acf38
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
14 changes: 1 addition & 13 deletions create/bin/gen_data.pl
Original file line number Diff line number Diff line change
Expand Up @@ -179,26 +179,14 @@ sub main
usage();
}

open(INFO, dirname($0)."/../src/data.tmpl");
my @lines = <INFO>;
close(INFO);

open(INFO, dirname($0)."/../src/templates.tmpl");
push(@lines, <INFO>);
close(INFO);

open(INFO, dirname($0)."/../src/dashboards.tmpl");
push(@lines, <INFO>);
close(INFO);

if ($ARGV[0] eq 'mysql') { %output = %mysql; }
elsif ($ARGV[0] eq 'postgresql') { %output = %postgresql; }
else { usage(); }

print $output{"before"};

my ($line, $type);
foreach $line (@lines)
foreach $line ( <STDIN> )
{
$line =~ tr/\t//d;
chop($line);
Expand Down
2 changes: 1 addition & 1 deletion database/mysql/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if DBSCHEMA
DATABASE = mysql

data.sql: $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates-aa.tmpl $(top_srcdir)/create/src/templates-ab.tmpl $(top_srcdir)/create/src/templates-ac.tmpl $(top_srcdir)/create/src/dashboards.tmpl $(top_srcdir)/create/bin/gen_data.pl
cat $(top_srcdir)/create/src/templates-*.tmpl > $(top_srcdir)/create/src/templates.tmpl && $(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql && rm $(top_srcdir)/create/src/templates.tmpl
cat $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates-*.tmpl $(top_srcdir)/create/src/dashboards.tmpl | $(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql

schema.sql: $(top_srcdir)/create/src/schema.tmpl $(top_srcdir)/create/bin/gen_schema.pl
$(top_srcdir)/create/bin/gen_schema.pl $(DATABASE) > schema.sql || (rm -rf schema.sql && exit 1)
Expand Down
2 changes: 1 addition & 1 deletion database/postgresql/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if DBSCHEMA
DATABASE = postgresql

data.sql: $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates-aa.tmpl $(top_srcdir)/create/src/templates-ab.tmpl $(top_srcdir)/create/src/templates-ac.tmpl $(top_srcdir)/create/src/dashboards.tmpl $(top_srcdir)/create/bin/gen_data.pl
cat $(top_srcdir)/create/src/templates-*.tmpl > $(top_srcdir)/create/src/templates.tmpl && $(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql && rm $(top_srcdir)/create/src/templates.tmpl
cat $(top_srcdir)/create/src/data.tmpl $(top_srcdir)/create/src/templates-*.tmpl $(top_srcdir)/create/src/dashboards.tmpl | $(top_srcdir)/create/bin/gen_data.pl $(DATABASE) > data.sql

schema.sql: $(top_srcdir)/create/src/schema.tmpl $(top_srcdir)/create/bin/gen_schema.pl
$(top_srcdir)/create/bin/gen_schema.pl $(DATABASE) > schema.sql || (rm -rf schema.sql && exit 1)
Expand Down

0 comments on commit d4acf38

Please sign in to comment.