From 37552c184b9509e12393532ad6cc1c7823c32255 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Jun 2018 12:50:20 -0400 Subject: [PATCH 1/6] ci: add a release script This is the start of a release script. The idea is to automate a whole bunch of the steps documented in ci/RELEASE.md, so that a release becomes more straightforward. Assumptions abound: basically this is going to work on my workstation, and not on any other. --- ci/RELEASE.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ci/RELEASE.sh diff --git a/ci/RELEASE.sh b/ci/RELEASE.sh new file mode 100644 index 000000000..51ca42d4f --- /dev/null +++ b/ci/RELEASE.sh @@ -0,0 +1,23 @@ +#! /bin/sh +# +# Release script for Calamares +# +# This attempts to perform the different steps of the RELEASE.md +# document automatically. It's not tested on other machines or +# setups other than [ade]'s development VM. +# +# Assumes that the version in CMakeLists.txt has been bumped, +# and that a release of that version is desired. + +test -d .git || { echo "Not at top-level." ; exit 1 ; } +test -d src/modules || { echo "No src/modules." ; exit 1 ; } + +which cmake > /dev/null 2>&1 || { echo "No cmake(1) available." ; exit 1 ; } + +rm -rf build +mkdir build || { echo "Could not create build directory." ; exit 1 ; } +( cd build && cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } +( cd build && make test ) || { echo "Tests failed." ; exit 1 ; } + + + From cfe92252d289e13eb18b30c83fdb24f337d04f3a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Jun 2018 12:53:45 -0400 Subject: [PATCH 2/6] ci: if clang is available, do that build too --- ci/RELEASE.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/RELEASE.sh b/ci/RELEASE.sh index 51ca42d4f..528735ed9 100644 --- a/ci/RELEASE.sh +++ b/ci/RELEASE.sh @@ -19,5 +19,11 @@ mkdir build || { echo "Could not create build directory." ; exit 1 ; } ( cd build && cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } ( cd build && make test ) || { echo "Tests failed." ; exit 1 ; } - +if which clang++ > /dev/null 2>&1 ; then + # Do build again with clang + rm -rf build + mkdir build || { echo "Could not create build directory." ; exit 1 ; } + ( cd build && CC=clang CXX=clang++ cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } + ( cd build && make test ) || { echo "Tests failed." ; exit 1 ; } +fi From 2f6e80dc428431247a19c16ae0f219044c10b0e2 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 27 Jun 2018 13:20:52 -0400 Subject: [PATCH 3/6] CMake: always copy the config files to the build directory. Switching to INSTALL_CONFIG=OFF breaks tests by not having them in the build directory. Some logic was coupling not-installing to not-using-in-build-dir too closely. --- .../CalamaresAddModuleSubdirectory.cmake | 13 +++++---- CMakeModules/CalamaresAddPlugin.cmake | 28 ++++++++++--------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/CMakeModules/CalamaresAddModuleSubdirectory.cmake b/CMakeModules/CalamaresAddModuleSubdirectory.cmake index af26f5a74..0b417bdf3 100644 --- a/CMakeModules/CalamaresAddModuleSubdirectory.cmake +++ b/CMakeModules/CalamaresAddModuleSubdirectory.cmake @@ -85,9 +85,11 @@ function( calamares_add_module_subdirectory ) configure_file( ${SUBDIRECTORY}/${MODULE_FILE} ${SUBDIRECTORY}/${MODULE_FILE} COPYONLY ) get_filename_component( FLEXT ${MODULE_FILE} EXT ) - if( "${FLEXT}" STREQUAL ".conf" AND INSTALL_CONFIG) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE} - DESTINATION ${MODULE_DATA_DESTINATION} ) + if( "${FLEXT}" STREQUAL ".conf" ) + if( INSTALL_CONFIG ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE} + DESTINATION ${MODULE_DATA_DESTINATION} ) + endif() list( APPEND MODULE_CONFIG_FILES ${MODULE_FILE} ) else() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/${MODULE_FILE} @@ -102,10 +104,11 @@ function( calamares_add_module_subdirectory ) message( " ${Green}MODULE_DESTINATION:${ColorReset} ${MODULE_DESTINATION}" ) if( MODULE_CONFIG_FILES ) if ( INSTALL_CONFIG ) - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${MODULE_DATA_DESTINATION}" ) + set( _destination "${MODULE_DATA_DESTINATION}" ) else() - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => [Skipping installation]" ) + set( _destination "[Build directory only]" ) endif() + message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${MODULE_CONFIG_FILES} => ${_destination}" ) endif() message( "" ) endif() diff --git a/CMakeModules/CalamaresAddPlugin.cmake b/CMakeModules/CalamaresAddPlugin.cmake index d2f878381..1bf20e4ca 100644 --- a/CMakeModules/CalamaresAddPlugin.cmake +++ b/CMakeModules/CalamaresAddPlugin.cmake @@ -66,17 +66,18 @@ function( calamares_add_plugin ) message( " ${Green}TYPE:${ColorReset} ${PLUGIN_TYPE}" ) message( " ${Green}LINK_LIBRARIES:${ColorReset} ${PLUGIN_LINK_LIBRARIES}" ) message( " ${Green}LINK_PRIVATE_LIBRARIES:${ColorReset} ${PLUGIN_LINK_PRIVATE_LIBRARIES}" ) -# message( " ${Green}SOURCES:${ColorReset} ${PLUGIN_SOURCES}" ) -# message( " ${Green}UI:${ColorReset} ${PLUGIN_UI}" ) -# message( " ${Green}EXPORT_MACRO:${ColorReset} ${PLUGIN_EXPORT_MACRO}" ) -# message( " ${Green}NO_INSTALL:${ColorReset} ${PLUGIN_NO_INSTALL}" ) message( " ${Green}PLUGIN_DESTINATION:${ColorReset} ${PLUGIN_DESTINATION}" ) if( PLUGIN_CONFIG_FILES ) + set( _destination "(unknown)" ) if ( INSTALL_CONFIG AND NOT PLUGIN_NO_INSTALL ) - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${PLUGIN_DATA_DESTINATION}" ) + set( _destination "${PLUGIN_DATA_DESTINATION}" ) + elseif( NOT PLUGIN_NO_INSTALL ) + # Not INSTALL_CONFIG + set( _destination "[Build directory only]" ) else() - message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => [Skipping installation]" ) + set( _destination "[Skipping installation]" ) endif() + message( " ${Green}CONFIGURATION_FILES:${ColorReset} ${PLUGIN_CONFIG_FILES} => ${_destination}" ) endif() if( PLUGIN_RESOURCES ) message( " ${Green}RESOURCES:${ColorReset} ${PLUGIN_RESOURCES}" ) @@ -147,12 +148,13 @@ function( calamares_add_plugin ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_DESC_FILE} DESTINATION ${PLUGIN_DESTINATION} ) - if ( INSTALL_CONFIG ) - foreach( PLUGIN_CONFIG_FILE ${PLUGIN_CONFIG_FILES} ) - configure_file( ${PLUGIN_CONFIG_FILE} ${PLUGIN_CONFIG_FILE} COPYONLY ) - install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_CONFIG_FILE} - DESTINATION ${PLUGIN_DATA_DESTINATION} ) - endforeach() - endif() + foreach( PLUGIN_CONFIG_FILE ${PLUGIN_CONFIG_FILES} ) + configure_file( ${PLUGIN_CONFIG_FILE} ${PLUGIN_CONFIG_FILE} COPYONLY ) + if ( INSTALL_CONFIG ) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_CONFIG_FILE} + DESTINATION ${PLUGIN_DATA_DESTINATION} ) + endif() + endforeach() endif() endfunction() From dfb42f2b49a347c4c6020a299f5b3cab96628914 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 28 Jun 2018 05:19:32 -0400 Subject: [PATCH 4/6] CMake: add target show-version to get version information --- CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c06beba29..a46b0d37d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,9 @@ # Example usage: # # cmake . -DSKIP_MODULES="partition luksbootkeycfg" +# +# One special target is "show-version", which can be built +# to obtain the version number from here. project( calamares C CXX ) @@ -74,7 +77,6 @@ set( CALAMARES_VERSION_MINOR 2 ) set( CALAMARES_VERSION_PATCH 1 ) set( CALAMARES_VERSION_RC 0 ) - ### Transifex (languages) info # # complete = 100% translated, @@ -394,6 +396,15 @@ if( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" ) endif() endif() +# Special target for not-RC (e.g. might-be-release) builds. +# This is used by the release script to get the version. +if ( CALAMARES_VERSION_RC EQUAL 0 ) + add_custom_target(show-version + ${CMAKE_COMMAND} -E echo CALAMARES_VERSION=${CALAMARES_VERSION_SHORT} + USES_TERMINAL + ) +endif() + # enforce using constBegin, constEnd for const-iterators add_definitions( "-DQT_STRICT_ITERATORS" ) From 59dd181cfcf248b513e8ecaa01d9b863ab527b53 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 28 Jun 2018 05:48:04 -0400 Subject: [PATCH 5/6] ci: complete release script - Create tag, tarball, and test tarball - Print instructions for completing the release --- ci/RELEASE.sh | 84 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 10 deletions(-) diff --git a/ci/RELEASE.sh b/ci/RELEASE.sh index 528735ed9..d3c960fd9 100644 --- a/ci/RELEASE.sh +++ b/ci/RELEASE.sh @@ -5,25 +5,89 @@ # This attempts to perform the different steps of the RELEASE.md # document automatically. It's not tested on other machines or # setups other than [ade]'s development VM. -# +# # Assumes that the version in CMakeLists.txt has been bumped, # and that a release of that version is desired. +# +# None of the "update stuff" is done by this script; in preparation +# for the release, you should have already done: +# - updating the version +# - pulling translations +# - updating the language list +# - switching to the right branch test -d .git || { echo "Not at top-level." ; exit 1 ; } test -d src/modules || { echo "No src/modules." ; exit 1 ; } which cmake > /dev/null 2>&1 || { echo "No cmake(1) available." ; exit 1 ; } -rm -rf build -mkdir build || { echo "Could not create build directory." ; exit 1 ; } -( cd build && cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } -( cd build && make test ) || { echo "Tests failed." ; exit 1 ; } +### Build with default compiler +# +# +BUILDDIR=$(mktemp -d --suffix=-build --tmpdir=.) +rm -rf "$BUILDDIR" +mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } +( cd "$BUILDDIR" && cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } +( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; exit 1 ; } +### Build with clang +# +# if which clang++ > /dev/null 2>&1 ; then - # Do build again with clang - rm -rf build - mkdir build || { echo "Could not create build directory." ; exit 1 ; } - ( cd build && CC=clang CXX=clang++ cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } - ( cd build && make test ) || { echo "Tests failed." ; exit 1 ; } + # Do build again with clang + rm -rf "$BUILDDIR" + mkdir "$BUILDDIR" || { echo "Could not create build directory." ; exit 1 ; } + ( cd "$BUILDDIR" && CC=clang CXX=clang++ cmake .. && make -j4 ) || { echo "Could not perform test-build." ; exit 1 ; } + ( cd "$BUILDDIR" && make test ) || { echo "Tests failed." ; exit 1 ; } fi +### Get version number for this release +# +# +V=$( cd "$BUILDDIR" && make show-version | grep ^CALAMARES_VERSION | sed s/^[A-Z_]*=// ) +test -n "$V" || { echo "Could not obtain version." ; exit 1 ; } + +### Create signed tag +# +# This is the signing key ID associated with the GitHub account adriaandegroot, +# which is used to create all "verified" tags in the Calamares repo. +KEY_ID="128F00873E05AF1D" +git tag -u "$KEY_ID" "v$V" || { echo "Could not sign tag v$V." ; exit 1 ; } + +### Create the tarball +# +# +TAR_V="calamares-$V" +TAR_FILE="$TAR_V.tar.gz" +git archive -o "$TAR_FILE" --prefix "$TAR_V/" "v$V" || { echo "Could not create tarball." ; exit 1 ; } +test -f "$TAR_FILE" || { echo "Tarball was not created." ; exit 1 ; } +SHA256=$(sha256sum "$TAR_FILE" | cut -d" " -f1) + +### Build the tarball +# +# +D=$(date +%Y%m%d-%H%M%S) +TMPDIR=$(mktemp -d --suffix="-calamares-$D") +test -d "$TMPDIR" || { echo "Could not create tarball-build directory." ; exit 1 ; } +tar xzf "$TAR_FILE" -C "$TMPDIR" || { echo "Could not unpack tarball." ; exit 1 ; } +test -d "$TMPDIR/$TAR_V" || { echo "Tarball did not contain source directory." ; exit 1 ; } +( cd "$TMPDIR/$TAR_V" && cmake . && make -j4 && make test ) || { echo "Tarball build failed." ; exit 1 ; } + +### Cleanup +# +rm -rf "$BUILDDIR" # From test-builds +rm -rf "$TMPDIR" # From tarball + +### Print subsequent instructions +# +# +cat < Date: Thu, 28 Jun 2018 05:51:12 -0400 Subject: [PATCH 6/6] CMake: bump version - Set RC because this isn't near to a release yet --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a46b0d37d..183bc93f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,8 +74,8 @@ set( CALAMARES_DESCRIPTION_SUMMARY set( CALAMARES_VERSION_MAJOR 3 ) set( CALAMARES_VERSION_MINOR 2 ) -set( CALAMARES_VERSION_PATCH 1 ) -set( CALAMARES_VERSION_RC 0 ) +set( CALAMARES_VERSION_PATCH 2 ) +set( CALAMARES_VERSION_RC 1 ) ### Transifex (languages) info #