<commit_before>#!/bin/sh
#
# @brief Prepare for release, run tests and generate release artifacts

# quit with error if any command fails
set -ex

BASE_DIR="$(pwd)"
SRC_DIR="$BASE_DIR/libelektra"
SCRIPTS_DIR="$SRC_DIR/scripts"
PACKAGING_DIR="$SCRIPTS_DIR/packaging"
BUILD_DIR="$SRC_DIR/build"

PACKAGE_REVISION=${1:-1}

install_elektra() {
	echo "Installing elektra..."
	rm -rf $BUILD_DIR
	mkdir $BUILD_DIR
	cd $BUILD_DIR
	cmake -DBUILD_SHARED=ON \
		-DBUILD_FULL=ON \
		-DBUILD_STATIC=ON \
		-DKDB_DB_SYSTEM="${WORKSPACE}/config/kdb/system" \
		-DKDB_DB_SPEC="${WORKSPACE}/config/kdb/spec" \
		-DKDB_DB_HOME="${WORKSPACE}/config/kdb/home" \
		-DCMAKE_INSTALL_PREFIX="${WORKSPACE}/system" \
		..
	make
	make install
	export LD_LIBRARY_PATH=${WORKSPACE}/system/lib:$LD_LIBRARY_PATH
	export PATH=${WORKSPACE}/system/bin:$PATH
	export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --fork --print-address) || true
	export LUA_CPATH="${WORKSPACE}/system/lib/lua/5.2/?.so;"
	export VERSION=$(kdb get system:/elektra/version/constants/KDB_VERSION)
	export PVERSION=$VERSION-$PACKAGE_REVISION
}

run_updates() {
	echo "Running updates..."
	mkdir $BASE_DIR/$VERSION

	# regenerate dot of plugins
	$SRC_DIR/scripts/dev/draw-all-plugins 2> $BASE_DIR/$VERSION/draw-all-plugins.error > $BASE_DIR/$VERSION/draw-all-plugins
	git add $SRC_DIR/doc/images/plugins.*
	git commit -a -m "release: regenerate plugins overview picture"

	# update info status
	cd $SRC_DIR
	$SCRIPTS_DIR/dev/update-infos-status 2> $BASE_DIR/$VERSION/update-infos-status.error > $BASE_DIR/$VERSION/update-infos-status
	git commit -a -m "release: update plugin info status"

	# run link checker
	cd $BUILD_DIR
	$SRC_DIR/scripts/link-checker external-links.txt 2> $BASE_DIR/$VERSION/link-checker.error > $BASE_DIR/$VERSION/link-checker
}

git_tag() {
	cd $SRC_DIR<commit_msg>Jenkinsfile: do not fail release if plugin info or plugins picture were not changed<commit_after>#!/bin/sh
#
# @brief Prepare for release, run tests and generate release artifacts

# quit with error if any command fails
set -ex

BASE_DIR="$(pwd)"
SRC_DIR="$BASE_DIR/libelektra"
SCRIPTS_DIR="$SRC_DIR/scripts"
PACKAGING_DIR="$SCRIPTS_DIR/packaging"
BUILD_DIR="$SRC_DIR/build"

PACKAGE_REVISION=${1:-1}

install_elektra() {
	echo "Installing elektra..."
	rm -rf $BUILD_DIR
	mkdir $BUILD_DIR
	cd $BUILD_DIR
	cmake -DBUILD_SHARED=ON \
		-DBUILD_FULL=ON \
		-DBUILD_STATIC=ON \
		-DKDB_DB_SYSTEM="${WORKSPACE}/config/kdb/system" \
		-DKDB_DB_SPEC="${WORKSPACE}/config/kdb/spec" \
		-DKDB_DB_HOME="${WORKSPACE}/config/kdb/home" \
		-DCMAKE_INSTALL_PREFIX="${WORKSPACE}/system" \
		..
	make
	make install
	export LD_LIBRARY_PATH=${WORKSPACE}/system/lib:$LD_LIBRARY_PATH
	export PATH=${WORKSPACE}/system/bin:$PATH
	export DBUS_SESSION_BUS_ADDRESS=$(dbus-daemon --session --fork --print-address) || true
	export LUA_CPATH="${WORKSPACE}/system/lib/lua/5.2/?.so;"
	export VERSION=$(kdb get system:/elektra/version/constants/KDB_VERSION)
	export PVERSION=$VERSION-$PACKAGE_REVISION
}

run_updates() {
	echo "Running updates..."
	mkdir $BASE_DIR/$VERSION

	# regenerate dot of plugins
	$SRC_DIR/scripts/dev/draw-all-plugins 2> $BASE_DIR/$VERSION/draw-all-plugins.error > $BASE_DIR/$VERSION/draw-all-plugins
	git add $SRC_DIR/doc/images/plugins.*
	git commit -a -m "release: regenerate plugins overview picture" || true

	# update info status
	cd $SRC_DIR
	$SCRIPTS_DIR/dev/update-infos-status 2> $BASE_DIR/$VERSION/update-infos-status.error > $BASE_DIR/$VERSION/update-infos-status
	git commit -a -m "release: update plugin info status" || true

	# run link checker
	cd $BUILD_DIR
	$SRC_DIR/scripts/link-checker external-links.txt 2> $BASE_DIR/$VERSION/link-checker.error > $BASE_DIR/$VERSION/link-checker
}

git_tag() {
	cd $SRC_DIR
{'fraction_non_alphanumeric': 0.14304741608950453, 'fraction_numerical': 0.0037293553542887587, 'mean_word_length': 4.922712933753943, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2103167', 'n_tokens_mistral': 1438, 'n_tokens_neox': 1394, 'n_words': 260}