From 63555cd04de69d73119ce34d4a09ccaed4c67745 Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Sat, 12 May 2018 11:37:07 +0100 Subject: [PATCH] [internal] add auto detection of 'git commit --amend' * Finally! * Also improve UPX compression --- .amend.cmd | 2 -- Makefile.am | 2 +- Makefile.in | 2 +- _detect-amend.sh | 20 ++++++++++++++++++++ _post-commit.sh | 2 +- _pre-commit.sh | 6 +++++- src/rufus.rc | 10 +++++----- 7 files changed, 33 insertions(+), 11 deletions(-) delete mode 100644 .amend.cmd create mode 100644 _detect-amend.sh diff --git a/.amend.cmd b/.amend.cmd deleted file mode 100644 index bd37740f..00000000 --- a/.amend.cmd +++ /dev/null @@ -1,2 +0,0 @@ -echo off -echo .>.amend \ No newline at end of file diff --git a/Makefile.am b/Makefile.am index ba7a6f07..8977f1f6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,7 @@ release: all @mv src/$(TARGET)$(EXEEXT) . @sleep 1 @$(STRIP) $(TARGET)$(EXEEXT) - @upx --lzma $(TARGET)$(EXEEXT) + @upx --lzma --best $(TARGET)$(EXEEXT) @mv $(TARGET)$(EXEEXT) $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT) @cmd.exe //c _sign.cmd $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT) diff --git a/Makefile.in b/Makefile.in index e6e50390..e2b0a9bb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -506,7 +506,7 @@ release: all @mv src/$(TARGET)$(EXEEXT) . @sleep 1 @$(STRIP) $(TARGET)$(EXEEXT) - @upx --lzma $(TARGET)$(EXEEXT) + @upx --lzma --best $(TARGET)$(EXEEXT) @mv $(TARGET)$(EXEEXT) $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT) @cmd.exe //c _sign.cmd $(TARGET)-$(VERSION)$(SUFFIX)$(EXEEXT) diff --git a/_detect-amend.sh b/_detect-amend.sh new file mode 100644 index 00000000..97c833ee --- /dev/null +++ b/_detect-amend.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# This script detects whether git commit is being executed in amend or regular mode +# Needed to determine whether the build number should be incremented or not. +# + +# Need to figure out if we are running on Windows or *NIX +if [ "$(uname -o)" = "Msys" ]; then + type -P wmic &>/dev/null || { echo "wmic command not found. Aborting." >&2; exit 1; } + type -P grep &>/dev/null || { echo "grep command not found. Aborting." >&2; exit 1; } + if $(wmic path win32_process get CommandLine | grep git.exe | grep -q -- --amend); then + echo AMEND detected + touch ./.amend + fi +else + if $(ps -fp $PPID | grep -q -- --amend); then + echo AMEND detected + touch ./.amend + fi +fi diff --git a/_post-commit.sh b/_post-commit.sh index a60416e9..05544950 100755 --- a/_post-commit.sh +++ b/_post-commit.sh @@ -6,7 +6,7 @@ # .git/hooks/ with the following content: # #!/bin/sh # if [ -x ./_post-commit.sh ]; then -# source ./_post-commit.sh +# . ./_post-commit.sh # fi type -P git &>/dev/null || { echo "git command not found. Aborting." >&2; exit 1; } diff --git a/_pre-commit.sh b/_pre-commit.sh index daf4fede..53b226b7 100755 --- a/_pre-commit.sh +++ b/_pre-commit.sh @@ -6,12 +6,16 @@ # .git/hooks/ with the following content: # #!/bin/sh # if [ -x ./_pre-commit.sh ]; then -# source ./_pre-commit.sh +# . ./_pre-commit.sh # fi type -P sed &>/dev/null || { echo "sed command not found. Aborting." >&2; exit 1; } type -P git &>/dev/null || { echo "git command not found. Aborting." >&2; exit 1; } +if [ -x ./_detect-amend.sh ]; then + . ./_detect-amend.sh +fi + TAGVER=`git rev-list HEAD --count` # adjust so that we match the github commit count ((TAGVER++)) diff --git a/src/rufus.rc b/src/rufus.rc index e7e98ae5..273016b3 100644 --- a/src/rufus.rc +++ b/src/rufus.rc @@ -33,7 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL IDD_DIALOG DIALOGEX 12, 12, 232, 326 STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_ACCEPTFILES -CAPTION "Rufus 3.0.1276" +CAPTION "Rufus 3.0.1277" FONT 9, "Segoe UI Symbol", 400, 0, 0x0 BEGIN LTEXT "Drive Properties",IDS_DRIVE_PROPERTIES_TXT,8,6,53,12,NOT WS_GROUP @@ -389,8 +389,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,1276,0 - PRODUCTVERSION 3,0,1276,0 + FILEVERSION 3,0,1277,0 + PRODUCTVERSION 3,0,1277,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -407,13 +407,13 @@ BEGIN BEGIN VALUE "CompanyName", "Akeo Consulting (http://akeo.ie)" VALUE "FileDescription", "Rufus" - VALUE "FileVersion", "3.0.1276" + VALUE "FileVersion", "3.0.1277" VALUE "InternalName", "Rufus" VALUE "LegalCopyright", "© 2011-2018 Pete Batard (GPL v3)" VALUE "LegalTrademarks", "http://www.gnu.org/copyleft/gpl.html" VALUE "OriginalFilename", "rufus.exe" VALUE "ProductName", "Rufus" - VALUE "ProductVersion", "3.0.1276" + VALUE "ProductVersion", "3.0.1277" END END BLOCK "VarFileInfo"