make sure that forwards for injected headers are not garbage-collected

qmake-generated version headers don't exist yet at the time syncqt runs,
so the forwarding headers would be deleted - just to be re-created a
moment later, thus changing the timestamp for no good reason.

Change-Id: I1b4c2f05f57c2315adf4b8dd726ea413ede1be5b
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Oswald Buddenhagen 2012-04-11 15:40:37 +02:00
parent 912f7efbd4
commit 94bd205575

View File

@ -597,6 +597,12 @@ sub basePrettify {
$$arg =~ s,^\Q$out_basedir\E,<outbase>,; $$arg =~ s,^\Q$out_basedir\E,<outbase>,;
} }
sub cleanPath {
my ($arg) = @_;
while ($arg =~ s,[^/]+/\.\.(/|$),,) {}
return $arg;
}
sub locateSyncProfile sub locateSyncProfile
{ {
my ($directory) = @_; my ($directory) = @_;
@ -876,6 +882,15 @@ foreach my $lib (@modules_to_sync) {
#remove the old files #remove the old files
if($remove_stale) { if($remove_stale) {
my %injections = ();
for my $p (keys %inject_headers) {
next unless ($p =~ /^\Q$dir\E(\/|$)/);
my $sp = $p;
$sp =~ s,^\Q$basedir\E/,$out_basedir/,;
for my $n (@{$inject_headers{$p}}) {
$injections{$sp."/".$n} = 1;
}
}
my @subdirs = ("$out_basedir/include/$lib"); my @subdirs = ("$out_basedir/include/$lib");
foreach my $subdir (@subdirs) { foreach my $subdir (@subdirs) {
if (opendir DIR, $subdir) { if (opendir DIR, $subdir) {
@ -894,7 +909,7 @@ foreach my $lib (@modules_to_sync) {
if($line =~ /^\#include \"([^\"]*)\"$/) { if($line =~ /^\#include \"([^\"]*)\"$/) {
my $include = $1; my $include = $1;
$include = $subdir . "/" . $include unless(substr($include, 0, 1) eq "/"); $include = $subdir . "/" . $include unless(substr($include, 0, 1) eq "/");
$remove_file = 1 unless(-e $include); $remove_file = 1 unless(-e $include or defined $injections{cleanPath($include)});
} else { } else {
$remove_file = 0; $remove_file = 0;
last; last;