Skip to content

Commit

Permalink
Adding a pumpup script
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Jul 19, 2024
1 parent 19ed605 commit 30bc002
Showing 1 changed file with 158 additions and 0 deletions.
158 changes: 158 additions & 0 deletions tools/developer/pumpup_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#!/bin/bash

# ------------------------------------------------------------------------------
# pgRouting Scripts
# Copyright(c) pgRouting Contributors
#
# Pump up version
# ------------------------------------------------------------------------------
# shellcheck disable=SC2016
WHAT_NEXT=$1

# Script to pump up branch to next development
# Usage:
# bash tools/developer/pumpup_version.sh minor


OLD_VERSION=$(grep -Po '(?<=project\(VRPROUTING VERSION )[^;]+' CMakeLists.txt)
KIND=$(grep -Po '(?<=set\(PROJECT_VERSION_DEV )[^;]+\"\)' CMakeLists.txt)
echo "KIND=${KIND}"
KIND=$(echo "${KIND}" | awk -F'"' '{print $2}')
echo "OLD_VERSION=${OLD_VERSION}"
echo "KIND=${KIND}"

IFS='\. ' read -r -a a <<< "${OLD_VERSION}"

MAYOR="${a[0]}"
MINOR="${a[1]}"

function pumpup_mayor {
((a[0]++))
NEW_MAYOR="${a[0]}"
NEW_MINOR="0"
NEW_MICRO="0"
NEW_KIND="-dev"
}

function pumpup_minor {
((a[1]++))
NEW_MAYOR="${a[0]}"
NEW_MINOR="${a[1]}"
NEW_MICRO="0"
NEW_KIND="-dev"
}

function pumpup_micro {
((a[2]++))
NEW_MAYOR="${a[0]}"
NEW_MINOR="${a[1]}"
NEW_MICRO="${a[2]}"
NEW_KIND="${KIND}"
}


if [ "${WHAT_NEXT}" == "mayor" ]
then
pumpup_mayor
elif [ "${WHAT_NEXT}" == "micro" ]
then
pumpup_micro
elif [ "${WHAT_NEXT}" == "minor" ]
then
pumpup_minor
fi


NEW_VERSION="${NEW_MAYOR}.${NEW_MINOR}.${NEW_MICRO}"
echo "pumpup from ${OLD_VERSION}${KIND} to ${NEW_VERSION}${NEW_KIND}"


# --------------------------------------------
# --------------------------------------------
# Modifications to CMakeLists
# --------------------------------------------
# --------------------------------------------

# set version to new version
perl -pi -e 's/project\(VRPROUTING VERSION (.*)$/project\(VRPROUTING VERSION '"${NEW_VERSION}"'/g' CMakeLists.txt
perl -pi -e 's/set\(PROJECT_VERSION_DEV(.*)$/set\(PROJECT_VERSION_DEV "'"${NEW_KIND}"'"\)/g' CMakeLists.txt
perl -pi -e 's/OLD_SIGNATURES$/OLD_SIGNATURES\n '"${OLD_VERSION}"'/g' CMakeLists.txt
if [ "${WHAT_NEXT}" != "micro" ]
then
perl -pi -e 's/set\(MINORS(.*)$/set\(MINORS '"${NEW_MAYOR}"'.'"${NEW_MINOR}"'$1/g' CMakeLists.txt
fi
# --------------------------------------------
# --------------------------------------------
# sql directory
# --------------------------------------------
# --------------------------------------------

# --------------------------------------------
# Copy last signature file
# --------------------------------------------

if [ "${WHAT_NEXT}" != "micro" ]
then
cp -f "sql/sigs/vrprouting--${MAYOR}.${MINOR}.sig" "sql/sigs/vrprouting--${NEW_MAYOR}.${NEW_MINOR}.sig"
git add "sql/sigs/vrprouting--${MAYOR}.${NEW_MINOR}.sig"
fi

# --------------------------------------------
# Adding section in release notes & news
# --------------------------------------------
perl -pi -e 's/('v"${OLD_VERSION}"' Release Notes)/
'"v${NEW_VERSION}"' Release Notes
-------------------------------------------------------------------------------
No Changes Yet
$1/g' doc/general/release_notes.rst

# adding to news
tools/scripts/notes2news.pl

# --------------------------------------------
# tests are done to new version
# --------------------------------------------

perl -pi -e 's/'"${OLD_VERSION}"'/'"${NEW_VERSION}"'/g' tools/testers/pg_prove_tests.sh

# --------------------------------------------
# Change return values of version
# --------------------------------------------

perl -pi -e 's/'"${OLD_VERSION}${KIND}"'/'"${NEW_VERSION}${NEW_KIND}"'/' docqueries/version/*.result
if [ "${WHAT_NEXT}" == "minor" ]
then
perl -pi -e 's/^---------/-----------/' docqueries/version/doc-full_version.result
fi
perl -pi -e 's/'"${OLD_VERSION}"'/'"${NEW_VERSION}"'/' docqueries/version/*.result

# --------------------------------------------
# Update action to include old version
# --------------------------------------------

#perl -pi -e 's/'"${OLD_VERSION}"'/'"${NEW_VERSION}"'/g' .github/workflows/update.yml
#perl -pi -e 's/old_pgr: \[/old_pgr: \['"${OLD_VERSION}"', /g' .github/workflows/update.yml
#perl -pi -e 's/'"${OLD_VERSION}"'/'"${NEW_VERSION}"'/g' .github/workflows/boost_version.yml

# --------------------------------------------
# Include file in CMakeLists.txt
# --------------------------------------------

if [ "${WHAT_NEXT}" != "micro" ]
then
perl -pi -e 's/# add minor here/my \$version_'"${NEW_MAYOR}"'_'"${NEW_MINOR}"' = qr\/\('"${NEW_MAYOR}"'\.'"${NEW_MINOR}"'\.\[\\d\+\]\)\/;\n# add minor here/g' sql/scripts/build-extension-update-files.pl
perl -pi -e 's/my \$current = (.*)$/my \$current = \$version_'"${NEW_MAYOR}"'\_'"${NEW_MINOR}"';/g' sql/scripts/build-extension-update-files.pl
perl -pi -e 's/unless \$old_version =~ (.*)\/;$/unless \$old_version =~ $1|\$version_'"${NEW_MAYOR}"'_'"${NEW_MINOR}"'\/;/g' sql/scripts/build-extension-update-files.pl
fi


# ------
# Documentation related
# ------
perl -pi -e 's/# Copyright(.*) v(.*)$/# Copyright$1 v'"${NEW_VERSION}${NEW_KIND}"'/' locale/pot/*.pot
perl -pi -e 's/# Copyright(.*) v(.*)$/# Copyright$1 v'"${NEW_VERSION}${NEW_KIND}"'/' locale/*/*/*.po
#perl -pi -e 's/('"${MAYOR}.${MINOR}"')/'"${NEW_MAYOR}.${NEW_MINOR}\', \'${MAYOR}.${MINOR}"'/g' doc/_static/page_history.js
#bash tools/transifex/locale.sh

0 comments on commit 30bc002

Please sign in to comment.