-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b58e1fc
commit 26b99f6
Showing
3 changed files
with
71 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,50 @@ | ||
#! /usr/bin/env bash | ||
# Creates a "package-version" of Khiops | ||
# - if the commit is tagged: | ||
# - if the tag matches the Khiops version in the sources: | ||
# - package-version = version | ||
# - otherwise: | ||
# - warn | ||
# - package-version = version-SNAPSHOT-$TAG | ||
# - otherwise: | ||
# - package-version = version-SNAPSHOT-$SHORT_COMMIT_HASH | ||
|
||
# Common safeguards | ||
set -euo pipefail | ||
|
||
# Save this script's directory | ||
SCRIPT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" | ||
|
||
main () { | ||
# The ref_name it should be either a hash or a tag | ||
declare ref_name="$1" | ||
|
||
# Whether ref_name is a tag (default false) | ||
declare is_tag="${2:-false}" | ||
|
||
# Obtain the khiops version from the source | ||
local script_dir | ||
local khiops_version | ||
khiops_version="$("$SCRIPT_DIR/khiops-version")" | ||
|
||
# See the header of the script for this part | ||
local khiops_package_version | ||
if [[ "$is_tag" == "true" ]] | ||
then | ||
if [[ "$ref_name" == "v${khiops_version}" ]] | ||
then | ||
khiops_package_version="$khiops_version" | ||
else | ||
khiops_package_version="$khiops_version-SNAPSHOT-$ref_name" | ||
echo "::warning: Tag '$ref_name' doesn't match the khiops source version '$khiops_version'" 1>&2 | ||
echo "::warning: Creating snapshot package $khiops_package_version" 1>&2 | ||
fi | ||
else | ||
short_hash="$(git rev-parse --short --verify "$ref_name" | cut -d' ' -f1)" | ||
khiops_package_version="$khiops_version-SNAPSHOT-$short_hash" | ||
echo "::warning: Creating snapshot package $khiops_package_version" 1>&2 | ||
fi | ||
echo "$khiops_package_version" | ||
} | ||
|
||
main "$@" |
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,17 @@ | ||
#! /usr/bin/env bash | ||
|
||
# Obtains the khiops version stored in the sources | ||
|
||
set -euo pipefail | ||
|
||
# Obtain the khiops repo location | ||
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) | ||
KHIOPS_REPO_DIR=$(dirname "$SCRIPT_DIR") | ||
|
||
# Get the version | ||
# - Get the version definition line in the KWKhiopsVersion.h file | ||
# - Get the third token, it should be something like str(10.1.1) | ||
# - Extract the version | ||
grep "KHIOPS_VERSION" "$KHIOPS_REPO_DIR"/src/Learning/KWUtils/KWKhiopsVersion.h \ | ||
| cut -d' ' -f3 \ | ||
| sed 's/str(\(.*\))/\1/' |