bin/syncqt
changeset 30 5dc02b23752f
parent 18 2f34d5167611
child 33 3e2da88830cd
--- a/bin/syncqt	Wed Jun 23 19:07:03 2010 +0300
+++ b/bin/syncqt	Tue Jul 06 15:10:48 2010 +0300
@@ -44,7 +44,6 @@
         "Qt3Support" => "$basedir/src/qt3support",
         "ActiveQt" => "$basedir/src/activeqt/container;$basedir/src/activeqt/control;$basedir/src/activeqt/shared",
         "QtTest" => "$basedir/src/testlib",
-        "QtAssistant" => "$basedir/tools/assistant/compat/lib",
         "QtHelp" => "$basedir/tools/assistant/lib",
         "QtDesigner" => "$basedir/tools/designer/src/lib",
         "QtUiTools" => "$basedir/tools/designer/src/uitools",
@@ -63,6 +62,7 @@
 # global variables (modified by options)
 my $module = 0;
 my $showonly = 0;
+my $quiet = 0;
 my $remove_stale = 1;
 my $force_win = 0;
 my $force_relative = 0;
@@ -98,6 +98,7 @@
     print "  -outsubdir <DIR>      Target subdir under outdir         (default: $out_subdir)\n";
     print "  -public               Create only public headers         (default: " . ($create_private_headers ? "no" : "yes") . ")\n";
     print "  -oneway               Don't sync back from outdir        (default: " . ($oneway ? "yes" : "no") . ")\n";
+    print "  -quiet                Only report problems, not activity (default: " . ($quiet ? "yes" : "no") . ")\n";
     print "  -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR> Create headers for <NAME> with original headers in <HEADERDIR> relative to <PROFILEDIR> \n";
     print "  -help                 This help\n";
     exit 0;
@@ -330,7 +331,7 @@
 
     unless(-e "$header") {
         my $header_dir = dirname($header);
-        mkpath $header_dir, 0777;
+        mkpath $header_dir, !$quiet;
 
         #write it
         my $iheader_out = fixPaths($iheader, $header_dir);
@@ -360,12 +361,13 @@
 
     #setup
     my $ret = $file;
+    $ret =~ s,/cygdrive/([a-zA-Z])/,$1:/,g;
     my $file_dir = dirname($file);
     if($file_dir eq ".") {
         $file_dir = getcwd();
         $file_dir =~ s=\\=/=g;
     }
-    $file_dir =~ s,/cygdrive/([a-zA-Z])/,$1:,g;
+    $file_dir =~ s,/cygdrive/([a-zA-Z])/,$1:/,g;
     if($dir eq ".") {
         $dir = getcwd();
         $dir =~ s=\\=/=g;
@@ -470,8 +472,7 @@
     if ( $knowdiff || ($filecontents ne $ifilecontents) ) {
 	if ( $copy > 0 && !$oneway) {
 	    my $file_dir = dirname($file);
-	    mkpath $file_dir, 0777 unless(-e "$file_dir");
-	    print "$file $ifile $copy\n";
+	    mkpath $file_dir, !$quiet unless(-e "$file_dir");
 	    open(O, "> " . $file) || die "Could not open $file for writing (no write permission?)";
 	    local $/;
 	    binmode O;
@@ -480,7 +481,7 @@
 	    return 1;
 	} elsif ( $copy < 0 ) {
 	    my $ifile_dir = dirname($ifile);
-	    mkpath $ifile_dir, 0777 unless(-e "$ifile_dir");
+	    mkpath $ifile_dir, !$quiet unless(-e "$ifile_dir");
 	    open(O, "> " . $ifile) || die "Could not open $ifile for writing (no write permission?)";
 	    local $/;
 	    binmode O;
@@ -506,7 +507,7 @@
     my ($file,$ifile) = @_;
 
     if ($isunix) {
-        print "symlink created for $file ";
+        print "symlink created for $file " unless $quiet;
         if ( $force_relative && ($ifile =~ /^$basedir/)) {
             my $t = getcwd();
             my $c = -1;
@@ -514,9 +515,9 @@
             $t =~ s-^$basedir/--;
             $p .= "../" while( ($c = index( $t, "/", $c + 1)) != -1 );
             $file =~ s-^$basedir/-$p-;
-            print " ($file)\n";
+            print " ($file)\n" unless $quiet;
         }
-        print "\n";
+        print "\n" unless $quiet;
         return symlink($file, $ifile);
     }
     return copyFile($file, $ifile);
@@ -600,22 +601,22 @@
     } elsif("$arg" eq "-show") {
 	$var = "showonly";
 	$val = "yes";
+    } elsif("$arg" eq "-quiet") {
+	$var = "quiet";
+	$val = "yes";
     } elsif("$arg" eq "-base-dir") {
         # skip, it's been dealt with at the top of the file
         shift @ARGV;
         next;
-    } elsif("$arg" eq '*') {
-        # workaround for windows 9x where "%*" expands to "*"
-        $var = 1;
     } elsif("$arg" eq "-outsubdir") {
-	$var = "outsubdir";
-	$val = shift @ARGV;
+        $var = "outsubdir";
+        $val = shift @ARGV;
     } elsif("$arg" eq "-public") {
-	$var = "public";
-	$val = "yes";
+        $var = "public";
+        $val = "yes";
     } elsif("$arg" eq "-oneway") {
-	$var = "oneway";
-	$val = "yes";
+        $var = "oneway";
+        $val = "yes";
     }
 
     #do something
@@ -634,6 +635,12 @@
 	} elsif($showonly) {
 	    $showonly--;
 	}
+    } elsif ("$var" eq "quiet") {
+	if("$val" eq "yes") {
+	    $quiet++;
+	} elsif($quiet) {
+	    $quiet--;
+	}
     } elsif ("$var" eq "check-includes") {
 	if("$val" eq "yes") {
 	    $check_includes++;
@@ -665,7 +672,7 @@
     } elsif ("$var" eq "outsubdir") {
 	$out_subdir = $val;
     } elsif ("$var" eq "module") {
-	print "module :$val:\n";
+	print "module :$val:\n" unless $quiet;
 	die "No such module: $val" unless(defined $modules{$val});
 	push @modules_to_sync, $val;
     } elsif ("$var" eq "separate-module") {
@@ -693,7 +700,7 @@
 $isunix = checkUnix; #cache checkUnix
 
 # create path
-mkpath "$out_basedir/$out_subdir", 0777;
+mkpath "$out_basedir/$out_subdir", !$quiet;
 
 my @ignore_headers = ();
 my $class_lib_map_contents = "";
@@ -701,7 +708,7 @@
 my @ignore_for_include_check = ( "qatomic.h" );
 my @ignore_for_qt_begin_header_check = ( "qiconset.h", "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qt_windows.h" );
 my @ignore_for_qt_begin_namespace_check = ( "qconfig.h", "qconfig-dist.h", "qconfig-large.h", "qconfig-medium.h", "qconfig-minimal.h", "qconfig-small.h", "qfeatures.h", "qatomic_arch.h", "qatomic_windowsce.h", "qt_windows.h", "qatomic_macosx.h" );
-my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtAssistant}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" );
+my @ignore_for_qt_module_check = ( "$modules{QtCore}/arch", "$modules{QtCore}/global", "$modules{QtSql}/drivers", "$modules{QtTest}", "$modules{QtDesigner}", "$modules{QtUiTools}", "$modules{QtDBus}", "$modules{phonon}" );
 
 foreach (@modules_to_sync) {
     #iteration info
@@ -896,7 +903,7 @@
 			    $pri_install_pfiles.= "$pri_install_iheader ";;
 			}
                     }
-		    print "header created for $iheader ($header_copies)\n" if($header_copies > 0);
+		    print "header created for $iheader ($header_copies)\n" if($header_copies > 0 && !$quiet);
                 }
             }
         }
@@ -911,7 +918,8 @@
 	push @master_includes, "$out_basedir/$out_subdir/phonon_compat/Phonon/Phonon" if ($lib eq "phonon");
         foreach my $master_include (@master_includes) {
             #generate the "master" include file
-            $pri_install_files .= fixPaths($master_include, "$modules{$lib}") . " "; #get the master file installed too
+            my @tmp = split(/;/,$modules{$lib});
+            $pri_install_files .= fixPaths($master_include, "$tmp[0]") . " "; #get the master file installed too
             if($master_include && -e "$master_include") {
                 open MASTERINCLUDE, "<$master_include";
                 local $/;
@@ -923,8 +931,8 @@
             }
             if($master_include && $master_contents) {
                 my $master_dir = dirname($master_include);
-                mkpath $master_dir, 0777;
-                print "header (master) created for $lib\n";
+                mkpath $master_dir, !$quiet;
+                print "header (master) created for $lib\n" unless $quiet;
                 open MASTERINCLUDE, ">$master_include";
                 print MASTERINCLUDE "$master_contents";
                 close MASTERINCLUDE;
@@ -948,8 +956,8 @@
         }
         if($headers_pri_file && $master_contents) {
             my $headers_pri_dir = dirname($headers_pri_file);
-            mkpath $headers_pri_dir, 0777;
-            print "headers.pri file created for $lib\n";
+            mkpath $headers_pri_dir, !$quiet;
+            print "headers.pri file created for $lib\n" unless $quiet;
             open HEADERS_PRI_FILE, ">$headers_pri_file";
             print HEADERS_PRI_FILE "$headers_pri_contents";
             close HEADERS_PRI_FILE;
@@ -969,7 +977,7 @@
     }
     if($class_lib_map) {
 	my $class_lib_map_dir = dirname($class_lib_map);
-	mkpath $class_lib_map_dir, 0777;
+	mkpath $class_lib_map_dir, !$quiet;
 	open CLASS_LIB_MAP, ">$class_lib_map";
 	print CLASS_LIB_MAP "$class_lib_map_contents";
 	close CLASS_LIB_MAP;