summaryrefslogtreecommitdiffstats
path: root/bin/syncqt
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-11 15:40:37 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-19 16:40:04 +0200
commit94bd205575cc807a9a3559a3fd811e683d07fc2b (patch)
tree54662ae44069778ad027c2029add9f7b240c8c97 /bin/syncqt
parent912f7efbd45ae441dcabb94ec659cd7737ce8af2 (diff)
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>
Diffstat (limited to 'bin/syncqt')
-rwxr-xr-xbin/syncqt17
1 files changed, 16 insertions, 1 deletions
diff --git a/bin/syncqt b/bin/syncqt
index 04d3162f71..6bcaccc1dc 100755
--- a/bin/syncqt
+++ b/bin/syncqt
@@ -597,6 +597,12 @@ sub basePrettify {
$$arg =~ s,^\Q$out_basedir\E,<outbase>,;
}
+sub cleanPath {
+ my ($arg) = @_;
+ while ($arg =~ s,[^/]+/\.\.(/|$),,) {}
+ return $arg;
+}
+
sub locateSyncProfile
{
my ($directory) = @_;
@@ -876,6 +882,15 @@ foreach my $lib (@modules_to_sync) {
#remove the old files
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");
foreach my $subdir (@subdirs) {
if (opendir DIR, $subdir) {
@@ -894,7 +909,7 @@ foreach my $lib (@modules_to_sync) {
if($line =~ /^\#include \"([^\"]*)\"$/) {
my $include = $1;
$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 {
$remove_file = 0;
last;