diff options
author | Gerald Combs <gerald@wireshark.org> | 2016-03-04 09:55:40 -0800 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-03-06 01:12:56 +0000 |
commit | 32d60ac2f55f38f2d29a57fea8be008432846367 (patch) | |
tree | ec0ce3b48844179ad5a125c8e2488af2583b0094 | |
parent | e86dd03d3a91b72b7cc0a9eb4a8657839a9505af (diff) |
CMake: Avoid pipes and the `cut` command.
Dump the output of `git shortlog` directly to AUTHORS.git instead of
piping it through `cut`. Depending on our toolchain, cmake COMMANDs might
not support pipes. This appears to be the case for MSBuild. Removing the
`cut` command has the added benefit of reducing our dependency on Cygwin.
Pass HEAD to `git shortlog`, otherwise it doesn't return anything when
run under MSBuild.
Change-Id: I23e9436c007d76a700bbbc45c2772c8aba6d5749
Reviewed-on: https://code.wireshark.org/review/14349
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rwxr-xr-x | tools/generate_authors.pl | 4 |
2 files changed, 12 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e6ad9873d2..0a62cbda39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2699,12 +2699,15 @@ add_custom_target(test-sh DEPENDS ${CMAKE_SOURCE_DIR}/cmake/modules/GenerateTestSh.cmake ) -ADD_CUSTOM_TARGET( - gen-authors - COMMAND git shortlog -sne | cut -c8- > ${CMAKE_SOURCE_DIR}/AUTHORS.git - COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/generate_authors.pl ${CMAKE_SOURCE_DIR}/AUTHORS.src ${CMAKE_SOURCE_DIR}/AUTHORS.git > ${CMAKE_SOURCE_DIR}/AUTHORS - -) +if (GIT_EXECUTABLE) + ADD_CUSTOM_TARGET( + gen-authors + COMMAND ${GIT_EXECUTABLE} --no-pager shortlog -sne HEAD > ${CMAKE_SOURCE_DIR}/AUTHORS.git + COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/generate_authors.pl ${CMAKE_SOURCE_DIR}/AUTHORS.src ${CMAKE_SOURCE_DIR}/AUTHORS.git > ${CMAKE_SOURCE_DIR}/AUTHORS + ) +else (GIT_EXECUTABLE) + ADD_CUSTOM_TARGET( gen-authors COMMAND ${CMAKE_COMMAND} -E echo "Git not found." ) +endif (GIT_EXECUTABLE) set_target_properties(test-sh PROPERTIES FOLDER "Tests") diff --git a/tools/generate_authors.pl b/tools/generate_authors.pl index 2d14c35a2d..8796ecb5ee 100755 --- a/tools/generate_authors.pl +++ b/tools/generate_authors.pl @@ -124,7 +124,8 @@ sub parse_git_name { my $replace = "[AT]"; my $email; - if ($full_name =~ /^([^<]*)\s*<([^>]*)>/) { + # 4321 Navin R. Johnson <nrjohnson@example.com> + if ($full_name =~ /^\s*\d+\s+([^<]*)\s*<([^>]*)>/) { $name = $1; #Convert real email address to "spam proof" one $email = $2; @@ -182,6 +183,7 @@ close $author_fh; $git_log_text =~ s/$crlf_find/$crlf_replace/g; print $git_log_text; +# XXX open "git shortlog ... |" instead? open( my $git_author_fh, '<', $ARGV[1] ) or die "Can't open $ARGV[1]: $!"; while ( my $git_line = <$git_author_fh> ) { |