mirror of https://github.com/upx/upx.git
Improve gitrev handling.
This commit is contained in:
parent
bd54499537
commit
aee52d3880
|
@ -37,7 +37,10 @@ if test "$TRAVIS_OS_NAME" = "linux"; then
|
|||
cp "$TRAVIS_BUILD_DIR/deps/upx-testsuite/files/packed/amd64-linux.elf/upx-3.91" upx391.out
|
||||
upx_391="$PWD/upx391.out"
|
||||
fi
|
||||
|
||||
$upx --version
|
||||
$upx --help
|
||||
|
||||
cd /; cd "$TRAVIS_BUILD_DIR/deps/upx-testsuite/files" || exit 1
|
||||
ls -l packed/*/upx-3.91*
|
||||
$upx -l packed/*/upx-3.91*
|
||||
|
|
|
@ -47,9 +47,10 @@ upx_SOURCES := $(sort $(wildcard $(srcdir)/*.cpp))
|
|||
upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext)))
|
||||
|
||||
ifneq ($(wildcard $(top_srcdir)/.git/.),)
|
||||
UPX_VERSION_GITREV := $(strip $(shell cd '$(top_srcdir)' && git rev-parse --short=6 HEAD || echo "ERROR"))
|
||||
UPX_VERSION_GITREV := $(strip $(shell cd '$(top_srcdir)' && git rev-parse --short=6 HEAD || echo 'ERROR'))
|
||||
ifneq ($(UPX_VERSION_GITREV),)
|
||||
DEFS += '-DUPX_VERSION_GITREV="$(UPX_VERSION_GITREV)"'
|
||||
x := $(strip $(shell cd '$(top_srcdir)' && git diff --exit-code HEAD >/dev/null && echo '' || echo '+'))
|
||||
DEFS += '-DUPX_VERSION_GITREV="$(UPX_VERSION_GITREV)$(x)"'
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -384,7 +384,11 @@ void show_version(int x)
|
|||
UNUSED(x);
|
||||
UNUSED(v);
|
||||
|
||||
fprintf(fp, "upx %s\n", UPX_VERSION_STRING);
|
||||
fprintf(fp, "upx %s\n", UPX_VERSION_STRING
|
||||
#if defined(UPX_VERSION_GITREV)
|
||||
"-" UPX_VERSION_GITREV
|
||||
#endif
|
||||
);
|
||||
#if (WITH_NRV)
|
||||
v = upx_nrv_version_string();
|
||||
if (v != NULL && v[0])
|
||||
|
|
|
@ -1353,6 +1353,7 @@ __acc_static_noinline void upx_sanity_check(void)
|
|||
assert(memcmp(UPX_VERSION_DATE_ISO, UPX_VERSION_YEAR, 4) == 0);
|
||||
assert(memcmp(&UPX_VERSION_DATE[sizeof(UPX_VERSION_DATE)-1 - 4], UPX_VERSION_YEAR, 4) == 0);
|
||||
#if defined(UPX_VERSION_GITREV)
|
||||
COMPILE_TIME_ASSERT(sizeof(UPX_VERSION_GITREV) <= 7 + 1)
|
||||
assert(strlen(UPX_VERSION_GITREV) >= 5);
|
||||
assert(strlen(UPX_VERSION_GITREV) <= 7);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue