diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-02-20 20:44:09 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-03-04 09:03:14 +0000 |
commit | 8df45087d7b9d67e01de3ff7163acf8bb32e3cb1 (patch) | |
tree | c9a4ec1fcfd0dc880f2d2fb41166a765531d0963 /bin/qt5_tool | |
parent | 7fc65858bf56ba4533ab3ef391adb63334d9dd98 (diff) | |
download | qtrepotools-8df45087d7b9d67e01de3ff7163acf8bb32e3cb1.tar.gz |
qt5_tool: Add options for dry-run and editing of config file
Bring it up to par with the planned qt6_tool and qp5_tool.
Change-Id: Ic6af1839ac4e34bba241dfa7f0ee4ed9eb491cd4
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'bin/qt5_tool')
-rwxr-xr-x | bin/qt5_tool | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/bin/qt5_tool b/bin/qt5_tool index 05dcc9d..ab492aa 100755 --- a/bin/qt5_tool +++ b/bin/qt5_tool @@ -39,6 +39,8 @@ my $BOOTSTRAP=0; my $STATUS=0; my $UPDATE=0; my $TEST=0; +my $optDryRun; +my $optEditConfig; my $optGerritModule; my $optIncredibuild; my $optGitHooks; @@ -57,6 +59,7 @@ Feel free to extend! Options: -d Diff (over all modules, relative to root) + -e Edit config file -s Status -r Reset hard to upstream state -c Clean @@ -70,6 +73,7 @@ Options: -q Quick bootstrap a new checkout under current folder. -g <module> Set up gerrit for the module. -i Use incredibuild + -D Dry run, print commands Example use cases: qt5_tool -c -u -b Clean, update and build for nightly builds @@ -232,7 +236,7 @@ sub execute { my @args = @_; print '### [',basename(getcwd()),'] ', join(' ', @args),"\n"; - return system(@args); + return $optDryRun ? 0 : system(@args); } sub executeCheck @@ -242,6 +246,16 @@ sub executeCheck die ($args[0] . ' failed ' . $rc . ':' . $!) if $rc != 0; } +sub editor +{ + my $editor = $ENV{'EDITOR'}; + if (defined($editor)) { + $editor = substr($editor, 1, length($editor) - 2) if $editor =~ /^".*"$/; + return $editor; + } + return $os == $OS_WINDOWS ? 'notepad' : 'vi'; +} + # --- Prompt for input with a default sub prompt @@ -606,17 +620,25 @@ my $startTime = time(); $Getopt::ignoreCase = 0; if (!GetOptions('clean' => \$CLEAN, - 'pull' => \$PULL, 'Branch=s' => \$optDesiredBranch, 'update' => \$UPDATE, 'reset' => \$RESET, 'diff' => \$DIFF, 's' => \$STATUS, + 'pull' => \$PULL, 'Branch=s' => \$optDesiredBranch, + 'Dry-run' => \$optDryRun, 'edit' => \$optEditConfig, + 'update' => \$UPDATE, 'reset' => \$RESET, + 'diff' => \$DIFF, 's' => \$STATUS, 'build' => \$BUILD, 'make' => \$MAKE, 'test' => \$TEST, 'gerrit=s' => \$optGerritModule, 'hooks' => \$optGitHooks, 'quick-bootstrap' => \$BOOTSTRAP, 'incredibuild' => \$optIncredibuild) - || ($CLEAN + $PULL + $UPDATE + $BUILD + $MAKE + $RESET + $DIFF + $BOOTSTRAP + $STATUS + $TEST == 0 + || ($CLEAN + $PULL + $UPDATE + $BUILD + $MAKE + $RESET + $DIFF + $BOOTSTRAP + $STATUS + $TEST + $optEditConfig == 0 && !defined $optGerritModule && !defined $optGitHooks)) { print $USAGE; exit (1); } +if ($optEditConfig) { + system((editor(), $configFile)); + exit(0); +} + checkMake(); sub defaultConfigureArguments |