diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-08-26 08:40:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:16:46 -0500 |
commit | a9ac74a98b9de60ee81ecf40037cbd8aabce5957 (patch) | |
tree | f7db9562379d78fc786b17f64b543aad538f3c66 /source4 | |
parent | 88b04ab6e65137079b2dad76d1cea07e7ea9ab80 (diff) | |
download | samba-a9ac74a98b9de60ee81ecf40037cbd8aabce5957.tar.gz samba-a9ac74a98b9de60ee81ecf40037cbd8aabce5957.tar.bz2 samba-a9ac74a98b9de60ee81ecf40037cbd8aabce5957.zip |
r17838: revert rev 17754
readd --always-create option to mkproto.pl
metze
(This used to be commit 1686c69d0e784220aba053e3dd21f6d14cc86929)
Diffstat (limited to 'source4')
-rwxr-xr-x | source4/script/mkproto.pl | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl index 13e5715272..682712b679 100755 --- a/source4/script/mkproto.pl +++ b/source4/script/mkproto.pl @@ -25,6 +25,7 @@ my $public_data = \$_public; my $private_data = \$_private; my $builddir = undef; my $srcdir = undef; +my $always_create = $ENV{MK_PROTO_ALWAYS_CREATE}; sub public($) { @@ -49,6 +50,7 @@ sub usage() print " --private-define=DEF Same as --define, but just for private header\n"; print " --srcdir=path Read files relative to this directory\n"; print " --builddir=path Write file relative to this directory\n"; + print " --always-create Always create new proto headers, even if the content hasn't changed\n"; print " --help Print this help message\n\n"; exit 0; } @@ -65,6 +67,7 @@ GetOptions( 'private-define=s' => \$private_define, 'srcdir=s' => sub { my ($f,$v) = @_; $srcdir = $v; }, 'builddir=s' => sub { my ($f,$v) = @_; $builddir = $v; }, + 'always-create' => \$always_create, 'help' => \&usage ) or exit(1); @@ -238,12 +241,20 @@ if (not defined($private_file) and defined($public_file)) { print STDOUT $$private_data; } -mkpath(dirname($public_file), 0, 0755); -open(PUBLIC, ">$public_file") or die("Can't open `$public_file': $!"); -print PUBLIC "$$public_data"; -close(PUBLIC); +my $old_public_data = file_load($public_file); +my $old_private_data = file_load($private_file); + +if (defined($always_create) or not defined($old_public_data) or ($old_public_data ne $$public_data)) +{ + mkpath(dirname($public_file), 0, 0755); + open(PUBLIC, ">$public_file") or die("Can't open `$public_file': $!"); + print PUBLIC "$$public_data"; + close(PUBLIC); +} + +if (($public_file ne $private_file) and (defined($always_create) or + not defined($old_private_data) or ($old_private_data ne $$private_data))) { -if ($public_file ne $private_file) { mkpath(dirname($private_file), 0, 0755); open(PRIVATE, ">$private_file") or die("Can't open `$private_file': $!"); print PRIVATE "$$private_data"; |