diff --git a/CMakeLists.txt b/CMakeLists.txt index c06beba29..183bc93f3 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 ) @@ -71,9 +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 # @@ -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" ) 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() diff --git a/ci/RELEASE.sh b/ci/RELEASE.sh new file mode 100644 index 000000000..d3c960fd9 --- /dev/null +++ b/ci/RELEASE.sh @@ -0,0 +1,93 @@ +#! /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. +# +# 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 ; } + +### 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 "$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 <