Skip to content

Commit

Permalink
i#2861 cronbuilds: Add control over version and build numbers (#4092)
Browse files Browse the repository at this point in the history
If the build number is 0, we omit it from the package name, rather than appending it.

.travis.yml now takes in VERSION_NUMBER and uses it directly.  There
is no more TAG_SUFFIX: VERSION_NUMBER has to include the build number
if that's desired, and that will be part of the tag as well.
If VERSION_NUMBER is not set it uses the default as before with a cronbuild- prefix for the tag.

runsuite_wrapper.pl parses VERSION_NUMBER and if it has a -NNN it passes that
as the build= arg to package.cmake.  It also passes a version= argument.

Testing:
$ TRAVIS_EVENT_TYPE=cron ~/dr/git/src/suite/runsuite_wrapper.pl travis 64_only
Running ctest -VV -S "/home/bruening/dr/git/src/suite/../make/package.cmake,travis;64_only;build=0;invoke=/home/bruening/dr/git/src/suite/../drmemory/package.cmake;drmem_only"
$ VERSION_NUMBER=8.1.2 TRAVIS_EVENT_TYPE=cron ~/dr/git/src/suite/runsuite_wrapper.pl travis 64_only
Running ctest -VV -S "/home/bruening/dr/git/src/suite/../make/package.cmake,travis;64_only;build=0;version=8.1.2;invoke=/home/bruening/dr/git/src/suite/../drmemory/package.cmake;drmem_only"
$ VERSION_NUMBER=8.21.42-39 TRAVIS_EVENT_TYPE=cron ~/dr/git/src/suite/runsuite_wrapper.pl travis 64_only
Running ctest -VV -S "/home/bruening/dr/git/src/suite/../make/package.cmake,travis;64_only;build=39;version=8.21.42;invoke=/home/bruening/dr/git/src/suite/../drmemory/package.cmake;drmem_only"

Fixes #2861
  • Loading branch information
derekbruening authored Feb 10, 2020
1 parent 3378573 commit 1cfb02a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,16 @@ before_deploy:
- git config --local user.email "dynamorio-devs@googlegroups.com"
# XXX: for now we duplicate this version number here with CMakeLists.txt.
# We should find a way to share (xref i#1565).
# We support setting TAG_SUFFIX on triggered builds so we can have
# multiple unique tags in one day (the patchlevel here is the day number).
- export GIT_TAG="cronbuild-7.91.$((`git log -n 1 --format=%ct` / (60*60*24)))${TAG_SUFFIX}"
# We support setting VERSION_NUMBER for manual builds to override all
# parts of the version. If a build is included (leading dash and number
# at the end), it will be parsed and passed to package.cmake. We only
# use a non-zero build number when making multiple manual builds in one day.
- >
if test -z "${VERSION_NUMBER}"; then
export GIT_TAG="cronbuild-7.91.$((`git log -n 1 --format=%ct` / (60*60*24)))"
else
export GIT_TAG="release_${VERSION_NUMBER}"
fi
# We handle races among our 4 package jobs by ignoring failure here.
# XXX: That could mask a real failure: we could try to distinguish the
# type of error.
Expand Down
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2007,8 +2007,14 @@ string(REGEX REPLACE
# CPACK_TEMPORARY_PACKAGE_FILE_NAME if I hardcode the extension: but maybe
# having the full version in the base dir is a good thing, though I'm not
# sure about the caps.
# We omit the -NN suffix for the build number if it is zero.
if ("${BUILD_NUMBER}" STREQUAL "0")
set(PACKAGE_SUFFIX "")
else ()
set(PACKAGE_SUFFIX "-${BUILD_NUMBER}")
endif ()
set(CPACK_PACKAGE_FILE_NAME
"DynamoRIO-${PACKAGE_PLATFORM}${CPACK_SYSTEM_NAME}${PACKAGE_SUBSYS}-${CPACK_PACKAGE_VERSION}-${BUILD_NUMBER}")
"DynamoRIO-${PACKAGE_PLATFORM}${CPACK_SYSTEM_NAME}${PACKAGE_SUBSYS}-${CPACK_PACKAGE_VERSION}${PACKAGE_SUFFIX}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "dynamorio")
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "DynamoRIO")
set(CPACK_PACKAGE_RELOCATABLE "true")
Expand Down
24 changes: 18 additions & 6 deletions suite/runsuite_wrapper.pl
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,30 @@
} elsif ($ENV{'TRAVIS_EVENT_TYPE'} eq 'cron' ||
$ENV{'APPVEYOR_REPO_TAG'} eq 'true') {
# A package build.
$args =~ s/^,/;/;
# XXX: Should we get rid of the build #? It was useful for manual build
# release candidates but makes less sense for automated builds.
my $def_args = "build=1";
my $build = "0";
if ($ENV{'VERSION_NUMBER'} =~ /-(\d+)$/) {
$build = $1;
}
if ($args eq '') {
$args = ",";
} else {
$args .= ";";
}
$args .= "build=${build}";
if ($ENV{'VERSION_NUMBER'} =~ /^(\d+\.\d+\.\d+)/) {
my $version = $1;
$args .= ";version=${version}";
}
# Include Dr. Memory.
if (($is_aarchxx || $ENV{'DYNAMORIO_CROSS_AARCHXX_LINUX_ONLY'} eq 'yes') &&
$args =~ /64_only/) {
# Dr. Memory is not ported to AArch64 yet.
} else {
$def_args = "${def_args};invoke=${osdir}/../drmemory/package.cmake;drmem_only";
$args .= ";invoke=${osdir}/../drmemory/package.cmake;drmem_only";
}
system("ctest -VV -S \"${osdir}/../make/package.cmake,${def_args}${args}\" 2>&1");
my $cmd = "ctest -VV -S \"${osdir}/../make/package.cmake${args}\"";
print "Running ${cmd}\n";
system("${cmd} 2>&1");
exit 0;
} else {
# We have no way to access the log files, so we can -VV to ensure
Expand Down

0 comments on commit 1cfb02a

Please sign in to comment.