Make syncqt output more compact by default, and add verbosity level

By default, syncqt will now compress the console output of what it's
doing. Increasing the verbosity level will make syncqt output the same
as before

Change-Id: I542072504f022f87997b4036eda5747a5da88839
Reviewed-on: http://codereview.qt.nokia.com/1764
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
Marius Storm-Olsen 2011-07-07 18:05:49 +00:00 committed by Qt by Nokia
parent 210211b779
commit e37376dbb4

View File

@ -38,7 +38,7 @@ our (%modules, %moduleheaders, %classnames, %mastercontent, %modulepris);
my $isunix = 0;
my $module = 0;
my $showonly = 0;
my $quiet = 0;
my $verbose_level = 1;
my $remove_stale = 1;
my $force_win = 0;
my $force_relative = 0;
@ -75,7 +75,9 @@ sub showUsage
print " -showonly Show action but not perform (default: " . ($showonly ? "yes" : "no") . ")\n";
print " -outdir <PATH> Specify output directory for sync (default: $out_basedir)\n";
print " -qtdir <PATH> Set the path to QtBase (detected: " . (defined $qtbasedir ? $qtbasedir : "-none-") . ")\n";
print " -quiet Only report problems, not activity (default: " . ($quiet ? "yes" : "no") . ")\n";
print " -quiet Only report problems, not activity (same as -verbose 0)\n";
print " -v, -verbose <level> Sets the verbosity level (max. 4) (default: $verbose_level)\n";
print " The short form increases the level by +1\n";
print " -separate-module <NAME>:<PROFILEDIR>:<HEADERDIR>\n";
print " Create headers for <NAME> with original headers in\n";
print " <HEADERDIR> relative to <PROFILEDIR> \n";
@ -479,9 +481,9 @@ sub symlinkFile
$t =~ s-^$quoted_basedir/--;
$p .= "../" while( ($c = index( $t, "/", $c + 1)) != -1 );
$file =~ s-^$quoted_basedir/-$p-;
print " ($file)\n" unless $quiet;
print " ($file)\n" if($verbose_level);
}
print "\n" unless $quiet;
print "\n" if($verbose_level);
return symlink($file, $ifile);
}
return copyFile($file, $ifile);
@ -534,8 +536,10 @@ sub findFiles {
######################################################################
sub loadSyncProfile {
my ($srcbase, $outbase) = @_;
print("srcbase = $$srcbase \n");
print("outbase = $$outbase \n");
if ($verbose_level) {
print("<srcbase> = $$srcbase \n");
print("<outbase> = $$outbase \n");
}
my $syncprofile = "$$srcbase/sync.profile";
my $result;
@ -627,8 +631,14 @@ while ( @ARGV ) {
$var = "showonly";
$val = "yes";
} elsif($arg eq "-quiet") {
$var = "quiet";
$var = "verbose";
$val = "0";
} elsif($arg eq "-v") {
$var = "verbose";
$val = "yes";
} elsif($arg eq "-verbose") {
$var = "verbose";
$val = shift @ARGV;
} elsif($arg eq "-private") {
$var = "create_private_headers";
$val = "yes";
@ -667,11 +677,13 @@ while ( @ARGV ) {
} elsif($showonly) {
$showonly--;
}
} elsif ($var eq "quiet") {
} elsif ($var eq "verbose") {
if($val eq "yes") {
$quiet++;
} elsif($quiet) {
$quiet--;
$verbose_level++;
} elsif($val eq "no" && $verbose_level) {
$verbose_level--;
} else {
$verbose_level = int($val);
}
} elsif ($var eq "check-includes") {
if($val eq "yes") {
@ -698,7 +710,7 @@ while ( @ARGV ) {
$force_relative--;
}
} elsif ($var eq "module") {
print "module :$val:\n" unless $quiet;
print "module :$val:\n" if($verbose_level);
die "No such module: $val" unless(defined $modules{$val});
push @modules_to_sync, $val;
} elsif ($var eq "separate-module") {
@ -766,9 +778,7 @@ loadSyncProfile(\$basedir, \$out_basedir);
$isunix = checkUnix; #cache checkUnix
# create path
mkpath "$out_basedir/include", !$quiet;
mkpath "$out_basedir/include/Qt", !$quiet;
make_path("$out_basedir/include/Qt", "<outdir>", $verbose_level);
foreach my $lib (@modules_to_sync) {
#iteration info
@ -884,7 +894,8 @@ foreach my $lib (@modules_to_sync) {
print MODULE_VERSION_HEADER_FILE "\n";
print MODULE_VERSION_HEADER_FILE "#endif // QT_". uc($lib) . "_VERSION_H\n";
close MODULE_VERSION_HEADER_FILE;
print "$moduleversionheader created for $lib\n" if(!$quiet);
$moduleversionheader = "<srcbase>" . substr($moduleversionheader, length($basedir)) if ($verbose_level < 2);
print "$moduleversionheader created for $lib\n" if($verbose_level);
} elsif ($modulepri) {
print "WARNING: Module $lib\'s pri file '$modulepri' not found.\nSkipped creating module version header for $lib.\n";
}
@ -916,6 +927,7 @@ foreach my $lib (@modules_to_sync) {
push @headers, "*".$if;
}
}
my $header_dirname = "";
foreach my $header (@headers) {
my $shadow = ($header =~ s/^\*//);
$header = 0 if($header =~ /^ui_.*.h/);
@ -1026,9 +1038,29 @@ foreach my $lib (@modules_to_sync) {
$pri_install_pfiles.= "$pri_install_iheader ";;
}
}
print "header created for $iheader ($header_copies)\n" if($header_copies > 0 && !$quiet);
if ($verbose_level && $header_copies) {
my $new_header_dirname = dirname($iheader);
$new_header_dirname = "<srcbase>" . substr($new_header_dirname, length($basedir)) if ($new_header_dirname && $verbose_level < 2);
my $header_base = basename($iheader);
if ($verbose_level < 3) {
my $line_prefix = ",";
if ($new_header_dirname ne $header_dirname) {
$line_prefix = "created header(s) for $new_header_dirname/ {";
$line_prefix = " }\n".$line_prefix if ($header_dirname);
$header_dirname = $new_header_dirname;
} else {
$line_prefix = ",";
}
print "$line_prefix $header_base ($header_copies)";
} else { # $verbose_level >= 3
$iheader = "<srcbase>" . substr($iheader, length($basedir)) if ($verbose_level == 3);
print "header created for $iheader ($header_copies)\n";
}
}
}
}
print " }\n" if ($header_dirname && $verbose_level > 0 && $verbose_level < 3);
}
}