From f6a56a8f19c5d8ee5ff1cc255957dfa98457e63d Mon Sep 17 00:00:00 2001 From: Adam Demasi Date: Sat, 16 Jul 2016 18:32:09 +0930 Subject: [PATCH 1/2] [rules] Move troubleshoot to a shell script with more detailed output. --- bin/get-troubleshoot-info | 42 +++++++++++++++++++++++++++++++++++++++ makefiles/master/rules.mk | 10 ++++++---- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100755 bin/get-troubleshoot-info diff --git a/bin/get-troubleshoot-info b/bin/get-troubleshoot-info new file mode 100755 index 0000000000..08fb3cba13 --- /dev/null +++ b/bin/get-troubleshoot-info @@ -0,0 +1,42 @@ +#!/bin/bash + +# Create Markdown output for sharing as troubleshooting info. + +# Convenience functions +heading() { printf "\n# %s\n" "$1"; } +subheading() { printf "\n## %s\n" "$1"; } +item() { printf "* **%s:** %s\n" "$1" "$2"; } +code() { printf "\`\`\`%s\n%s\n\`\`\`\n" "$1" "$2"; } + +# Gather some preliminary info for the script. +has_xcode="$([[ -x /usr/bin/xcrun ]] && echo 1)" + +# Print OS, tool, etc versions. +heading "Environment" +subheading "Hardware" +item 'Operating System' "$(uname -sm) $([[ -x /usr/bin/sw_vers ]] && sw_vers -productVersion)" +item 'Device' "$(uname -i)" + +subheading "Toolchain" +item 'Theos' "$(cd "$THEOS"; git rev-parse master)" +[[ $has_xcode == 1 ]] && item 'Xcode' "$(xcrun xcodebuild -version)" +item 'Clang' "$(clang --version 2>&1)" +item 'Swift' "$(swift --version 2>&1)" + +subheading "Directories" +item 'Location' "$THEOS" +item 'Toolchains' "$THEOS/toolchains/*" 2>/dev/null +item 'SDKs' "$THEOS/sdks/*" 2>/dev/null +[[ $has_xcode == 1 ]] && item 'Developer Path' "$(xcode-select -print-path)" + +subheading "Current Instance" +item 'Target' "$([[ -z "$TARGET" ]] && echo "$TARGET" || echo Not set)" +item 'System Root' "$([[ -z "$SYSROOT" ]] && echo "$SYSROOT" || echo Not set)" + +# Makefile +heading "Makefile" +code make "$(cat "$MAKEFILE_NAME")" + +# Perform a build. +heading "Build Output" +code ansi "$("$MAKE" -f "$MAKEFILE_NAME" --no-keep-going clean all messages=yes FORCE_COLOR=yes 2>&1)" diff --git a/makefiles/master/rules.mk b/makefiles/master/rules.mk index 63538b126e..93b1d0eecc 100644 --- a/makefiles/master/rules.mk +++ b/makefiles/master/rules.mk @@ -6,7 +6,8 @@ all:: endif .PHONY: all before-all internal-all after-all \ - clean before-clean internal-clean after-clean update-theos + clean before-clean internal-clean after-clean \ + troubleshoot update-theos ifeq ($(THEOS_BUILD_DIR),.) all:: $(_THEOS_BUILD_SESSION_FILE) before-all internal-all after-all else @@ -160,12 +161,13 @@ update-theos:: troubleshoot:: @$(PRINT_FORMAT) "Be sure to check the troubleshooting page at https://github.com/theos/theos/wiki/Troubleshooting first." - @$(PRINT_FORMAT) "For support with build errors, ask on IRC: http://iphonedevwiki.net/index.php/IRC. If you think you've found a bug in Theos, check the issue tracker at https://github.com/theos/theos/issues." + @$(PRINT_FORMAT) "For support with build errors, ask on IRC: http://iphonedevwiki.net/index.php/IRC. If you think you’ve found a bug in Theos, check the issue tracker at https://github.com/theos/theos/issues." @echo ifeq ($(call __executable,ghost),$(_THEOS_TRUE)) - @$(PRINT_FORMAT) "Creating a Ghostbin containing the output of \`make clean all messages=yes\`…" - $(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) --no-print-directory --no-keep-going clean all messages=yes FORCE_COLOR=yes 2>&1 | ghost -x 2w - ansi + @$(PRINT_FORMAT_STAGE) 6 "Gathering troubleshooting information and uploading to Ghostbin" + $(ECHO_NOTHING)MAKE="$(MAKE)" MAKEFILE_NAME="$(_THEOS_PROJECT_MAKEFILE_NAME)" TARGET="$(TARGET)" SYSROOT="$(SYSROOT)" \ + $(THEOS_BIN_PATH)/get-troubleshoot-info | ghost -x 2w - markdown$(ECHO_END) else @$(PRINT_FORMAT_ERROR) "You don't have ghost installed. For more information, refer to https://github.com/theos/theos/wiki/Installation#prerequisites." >&2; exit 1 endif From 6f734a43e69e50995931296f81129b40d4cb68f2 Mon Sep 17 00:00:00 2001 From: Adam Demasi Date: Sat, 16 Jul 2016 19:12:23 +0930 Subject: [PATCH 2/2] [bin] Add make, perl, git, dpkg-deb versions. --- bin/get-troubleshoot-info | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/get-troubleshoot-info b/bin/get-troubleshoot-info index 08fb3cba13..6969053845 100755 --- a/bin/get-troubleshoot-info +++ b/bin/get-troubleshoot-info @@ -19,6 +19,10 @@ item 'Device' "$(uname -i)" subheading "Toolchain" item 'Theos' "$(cd "$THEOS"; git rev-parse master)" +item 'Make' "$("$MAKE" --version | head -1)" +item 'Perl' "$(perl -e 'print $^V')" +item 'Git' "$(git --version)" +item 'Dpkg' "$(dpkg-deb --version | head -1)" [[ $has_xcode == 1 ]] && item 'Xcode' "$(xcrun xcodebuild -version)" item 'Clang' "$(clang --version 2>&1)" item 'Swift' "$(swift --version 2>&1)"