Skip to content

Commit

Permalink
Option to generate releases with snapshot numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Nov 15, 2021
1 parent 0cd5b38 commit c54d05f
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
15 changes: 15 additions & 0 deletions packaging/generate_snapshot_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# See https://reproducible-builds.org/specs/source-date-epoch/
# get SOURCE_DATE_EPOCH with UNIX time_t
if [ -d ".git" ];
then
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
else
echo "Error: intended for use from within a git repository"
exit 1
fi
MRPT_SNAPSHOT_VERSION=$(date -d @$SOURCE_DATE_EPOCH +%Y%m%d-%H%M)

MRPT_SNAPSHOT_VERSION+="-git-"
MRPT_SNAPSHOT_VERSION+=`git rev-parse --short=8 HEAD`
25 changes: 24 additions & 1 deletion packaging/make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@

set -e # exit on error

APPEND_SNAPSHOT_NUM=0

while getopts "s" OPTION
do
case $OPTION in
s)
APPEND_SNAPSHOT_NUM=1
;;
?)
echo "Unknown command line argument!"
exit 1
;;
esac
done

# Sets the bash variables:
# MRPT_VERSION_STR, MRPT_VER_MMP, MRPT_VERSION_{MAJOR,MINOR,PATCH}
# --------------------------------
Expand All @@ -27,6 +42,15 @@ else
exit 1
fi

if [ $APPEND_SNAPSHOT_NUM == "1" ];
then
# Get snapshot version number:
CUR_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CUR_SCRIPT_DIR/generate_snapshot_version.sh # populate MRPT_SNAPSHOT_VERSION

MRPT_VERSION_STR="${MRPT_VERSION_STR}~${MRPT_SNAPSHOT_VERSION}"
fi

MRPTSRC=$(pwd)
OUT_RELEASES_DIR="$HOME/mrpt_release"

Expand Down Expand Up @@ -82,7 +106,6 @@ for guide in $LST_GUIDES; do
done

# Orig tarball:

echo "> Creating source tarball: mrpt-${MRPT_VERSION_STR}.tar.gz"
(cd "${OUT_RELEASES_DIR}" ; tar czf "mrpt-${MRPT_VERSION_STR}.tar.gz" "mrpt-${MRPT_VERSION_STR}" )

Expand Down

0 comments on commit c54d05f

Please sign in to comment.