Implemented Debug Tag functionality
[public/netxms.git] / build / updatetag.pl
CommitLineData
7fabd388
VK
1#!/usr/bin/perl
2
3my $file = shift || die "Usage : updatetag.pl <file>";
4
5my $tag = `git describe`;
6chomp $tag;
7print "Git tag: $tag\n";
8
9my $update = 1;
10
11if (open(IN, "<$file"))
12{
13 while(<IN>)
14 {
15 chomp;
16 my $in = $_;
17 if ($in =~ /\* BUILDTAG:(.*) \*/)
18 {
19 print "Build tag: $1\n";
20 if ($1 eq $tag)
21 {
22 $update = 0;
23 }
24 }
25 }
26 close IN;
27}
28
29if ($update == 1)
30{
31 open(OUT, ">$file") or die "Cannot open output file: $!";
32 print OUT "/* BUILDTAG:$tag */\n";
33 print OUT "#ifndef _build_tag_h_\n";
34 print OUT "#define _build_tag_h_\n";
35 print OUT "#define NETXMS_BUILD_TAG _T(\"$tag\")\n";
edfd6661 36 print OUT "#define NETXMS_BUILD_TAG_A \"$tag\"\n";
7fabd388
VK
37 print OUT "#endif\n";
38 close OUT;
39
40 print "Build tag updated\n";
41}