This repository has been archived by the owner on Feb 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #275 from jderobot-varribas/feature/incremental-re…
…leases incremental releases
- Loading branch information
Showing
3 changed files
with
103 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |