Skip to content
This repository has been archived by the owner on Feb 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request #275 from jderobot-varribas/feature/incremental-re…
Browse files Browse the repository at this point in the history
…leases

incremental releases
  • Loading branch information
fqez committed Jan 4, 2016
2 parents 5f1918e + bd7fc1b commit 1bccd3d
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 6 deletions.
36 changes: 30 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,16 @@ SET (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
SET (CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")


SET (VERSION 5.3.1-rc1)
# CPack version numbers for release tarball name.
SET (CPACK_PACKAGE_VERSION_MAJOR 5)
SET (CPACK_PACKAGE_VERSION_MINOR 3)
SET (CPACK_PACKAGE_VERSION_PATCH 1)
SET (CPACK_DEBIAN_PACKAGE_VERSION ${VERSION})
SET (CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})

## Inject release roll up (incremental releases)
set(PROJECT_VERSION ${CPACK_DEBIAN_PACKAGE_VERSION})
include(scripts/incremental_releases/incremental-releases.cmake)
set(CPACK_DEBIAN_PACKAGE_VERSION ${PROJECT_VERSION})


SET (CPACK_DEBIAN_PACKAGE_PRIORITY "extra")
Expand Down Expand Up @@ -290,17 +294,37 @@ set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/postinst"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake/postrm")

SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "JdeRobot is a software development suite for robotics applications.")
SET (CPACK_PACKAGE_DESCRIPTION "JdeRobot is a software development suite for robotics applications, written in C++ language. It provides a programming environment where the robot control program is made up of a collection of several concurrent asynchronous threads named schemas. It is based on JDE cognitive architecture for autonomous robots.")

## Include Git HEAD into description (feature: traceback builds)
execute_process(COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_HEAD
)
string(STRIP "${GIT_HEAD}" GIT_HEAD)

SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY
"JdeRobot is a software development suite for robotics applications.")
SET (CPACK_PACKAGE_DESCRIPTION
"JdeRobot is a software development suite for robotics applications,
written in C++ language.
It provides a programming environment where the robot control program is made
up of a collection of several concurrent asynchronous threads named schemas.
It is based on JDE cognitive architecture for autonomous robots.
.
Get source from https://github.com/RoboticsURJC/JdeRobot
Package created with revision ${GIT_HEAD}")

## Patch: CPACK_PACKAGE_DESCRIPTION behavior is broken. Always use SUMMARY
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY ${CPACK_PACKAGE_DESCRIPTION})

SET (CPACK_PACKAGE_CONTACT "Roberto Calvo <rocapal@gsyc.urjc.es>")
SET (CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET (CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")


## Metapackages (at cmake time)
include(scripts/metapackages/FindMetapackages.cmake)

SET (PACKAGE_VERSION ${VERSION})
SET (PACKAGE_VERSION ${CPACK_DEBIAN_PACKAGE_VERSION})
#set(PACKAGE_DEPENDS "${DEPS}")
#configure_file(${MAKE_PACKAGE_CONFIG_DIR}/jderobot-deps.info.in ${CMAKE_BINARY_DIR}/jderobot-deps.info)

Expand Down
31 changes: 31 additions & 0 deletions scripts/incremental_releases/incremental-releases.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## Incremental releases
#
# Copyright (c) 2015
# Author: Victor Arribas <v.arribas.urjc@gmail.com>
# License: GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
#
# Requires:
# * ${PROJECT_NAME}
# * ${PROJECT_VERSION}
# Output:
# * ${PROJECT_VERSION}

cmake_minimum_required(VERSION 2.8)

execute_process(COMMAND "${CMAKE_CURRENT_LIST_DIR}/version-upgrader.sh" ${PROJECT_NAME} ${PROJECT_VERSION}
OUTPUT_VARIABLE out_version
RESULT_VARIABLE status
)
message(STATUS "Incremental Release version=${out_version}")

if (status EQUAL 0)
set(PROJECT_VERSION ${out_version})
else()
message(WARNING "incremental_releases: something went wrong.\n ${status}")
endif()



# cleanup for include() call
unset(out_version)
unset(status)
42 changes: 42 additions & 0 deletions scripts/incremental_releases/version-upgrader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
#
# Copyright (c) 2015
# Author: Victor Arribas <v.arribas.urjc@gmail.com>
# License: GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
#
# Usage:
# version-upgrader.sh <package name|regex> <current version>


# input parameters
pkg=${1}
version=${2}

[ "$pkg" = "" ] && return 2
[ "$version" = "" ] && return 2

status=0

## Gather all possible versions from repository
versions=$(apt-cache show $pkg 2>&1 | grep Version | awk '{print $2}')

echo "$versions" | grep -q "$version"
if [ $? -ne 0 ]
then
## Case 1: this version is not published into repository.
# Just add '-rc1' because is initial release
out_version=${version}-rc1
else
## Case 2: this version is already into repository.
# look for '-rcX' prefix and increment it
versions_rc_numbers=$(echo "$versions" | grep "$version" | grep -- '-rc' | sed "s,$version-rc\([0-9]+\)*,\1,")
number=$(echo "$versions_rc_numbers" | sort -nr | head -n 1)
[ "$number" = "" ] && status=1
number=$((number + 1))
out_version=${version}-rc${number}
fi

[ "$out_version" = "" ] && status=1
echo -n $out_version

return $status

0 comments on commit 1bccd3d

Please sign in to comment.