Skip to content

Commit

Permalink
Pass shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Oct 25, 2021
1 parent 6dbd5c3 commit d4d56ac
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 36 deletions.
56 changes: 28 additions & 28 deletions packaging/make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,22 @@
set -e # exit on error

# Sets the bash variables:
# MRPT_VERSION_STR, MRPT_VER_MMP, MRPT_VER_MM, MRPT_VERSION_{MAJOR,MINOR,PATCH}
# MRPT_VERSION_STR, MRPT_VER_MMP, MRPT_VERSION_{MAJOR,MINOR,PATCH}
# --------------------------------
if [ -f version_prefix.txt ];
then
MRPT_VERSION_STR=`head -n 1 version_prefix.txt`
MRPT_VERSION_MAJOR=${MRPT_VERSION_STR:0:1}
MRPT_VERSION_STR=$(head -n 1 version_prefix.txt)
MRPT_VERSION_MAJOR=${MRPT_VERSION_STR:0:1}
MRPT_VERSION_MINOR=${MRPT_VERSION_STR:2:1}
MRPT_VERSION_PATCH=${MRPT_VERSION_STR:4:1}
MRPT_VER_MM="${MRPT_VERSION_MAJOR}.${MRPT_VERSION_MINOR}"
MRPT_VER_MMP="${MRPT_VERSION_MAJOR}.${MRPT_VERSION_MINOR}.${MRPT_VERSION_PATCH}"
echo "MRPT version: ${MRPT_VER_MMP}"
echo "MRPT version: ${MRPT_VER_MMP}"
else
echo "Error: cannot find version_prefix.txt!! Invoke scripts from mrpt sources root directory."
exit 1
fi

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

OUT_DIR=$OUT_RELEASES_DIR/mrpt-${MRPT_VERSION_STR}
Expand All @@ -40,74 +39,75 @@ echo "============================================================"
echo

# Prepare output directory:
rm -fR $OUT_RELEASES_DIR || true
mkdir -p ${OUT_DIR}
rm -fR "$OUT_RELEASES_DIR" || true
mkdir -p "${OUT_DIR}"

# Export / copy sources to target dir:
if [ -d "$MRPTSRC/.git" ];
then
echo "> Exporting git source tree to ${OUT_DIR}"
git archive --format=tar HEAD | tar -x -C ${OUT_DIR}
git archive --format=tar HEAD | tar -x -C "${OUT_DIR}"

# Include external submodules:
EXTERNAL_MODS="nanogui nanogui/ext/nanovg googletest libfyaml rplidar_sdk ${MRPT_PKG_EXPORTED_SUBMODULES}"
for MOD in $EXTERNAL_MODS;
do
echo "> Exporting git submodule: ${MRPTSRC}/3rdparty/$MOD"
cd ${MRPTSRC}/3rdparty/$MOD
git archive --format=tar HEAD | tar -x -C ${OUT_DIR}/3rdparty/$MOD
cd "${MRPTSRC}/3rdparty/$MOD"
git archive --format=tar HEAD | tar -x -C "${OUT_DIR}/3rdparty/$MOD"
done

cd ${MRPTSRC}
cd "${MRPTSRC}"

# Remove VCS control files:
find ${OUT_DIR} -name '.git*' | xargs rm -fr
find "${OUT_DIR}" -name '.git*' -delete

# Generate ./SOURCE_DATE_EPOCH with UNIX time_t
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
else
echo "> Copying sources to ${OUT_DIR}"
cp -R . ${OUT_DIR}
cp -R . "${OUT_DIR}"

# Generate ./SOURCE_DATE_EPOCH with UNIX time_t
SOURCE_DATE_EPOCH=$(date +%s)
fi

# See https://reproducible-builds.org/specs/source-date-epoch/
echo $SOURCE_DATE_EPOCH > ${OUT_DIR}/SOURCE_DATE_EPOCH
echo "$SOURCE_DATE_EPOCH" > "${OUT_DIR}/SOURCE_DATE_EPOCH"

# Compile guides now:
LST_GUIDES=`cat $MRPTSRC/doc/guide-list.txt`
LST_GUIDES=$(cat "$MRPTSRC/doc/guide-list.txt")
echo "> Building LaTeX documents..."
for guide in $LST_GUIDES; do
echo "> * Building $guide..."
make -C $MRPTSRC/doc/$guide/ > /tmp/mrpt_build_latex.log 2>&1
cp $MRPTSRC/doc/$guide/$guide.pdf ${OUT_DIR}/doc/
make -C "$MRPTSRC/doc/$guide/" > /tmp/mrpt_build_latex.log 2>&1
cp "$MRPTSRC/doc/$guide/$guide.pdf" "${OUT_DIR}/doc/"
done

cd ${OUT_DIR}

# Orig tarball:
cd ..
cd "${OUT_DIR}/.."

echo "> Creating source tarball: mrpt-${MRPT_VERSION_STR}.tar.gz"
tar czf mrpt-${MRPT_VERSION_STR}.tar.gz mrpt-${MRPT_VERSION_STR}
tar czf "mrpt-${MRPT_VERSION_STR}.tar.gz" "mrpt-${MRPT_VERSION_STR}"

# Create .zip file with DOS line endings
echo "> Creating source zip in DOS format: mrpt-${MRPT_VERSION_STR}.zip"
cd mrpt-${MRPT_VERSION_STR}

cd "${OUT_DIR}"
bash scripts/all_files_change_format.sh todos
cd ..
zip mrpt-${MRPT_VERSION_STR}.zip -q -r mrpt-${MRPT_VERSION_STR}/*

rm -fr mrpt-${MRPT_VERSION_STR}
cd "${OUT_DIR}/.."
zip "mrpt-${MRPT_VERSION_STR}.zip" -q -r "mrpt-${MRPT_VERSION_STR}/*"

rm -fr "mrpt-${MRPT_VERSION_STR}"

# GPG signature:
gpg --armor --detach-sign mrpt-${MRPT_VERSION_STR}.tar.gz
gpg --armor --detach-sign "mrpt-${MRPT_VERSION_STR}.tar.gz"


echo "=================================================================="
echo " Package files generated:"
echo "=================================================================="
find $(pwd)
find "$(pwd)"
echo "=================================================================="
echo "You should also do now: \"git clean -fd\" in the source code root"
9 changes: 4 additions & 5 deletions packaging/parse_mrpt_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,17 @@

if [ -f version_prefix.txt ];
then
if [ -z ${MRPT_VERSION_STR+x} ];
if [ -z "${MRPT_VERSION_STR+x}" ];
then
# MRPT_VERSION_STR is not set by caller: load it
MRPT_VERSION_STR=`head -n 1 version_prefix.txt`
MRPT_VERSION_STR=$(head -n 1 version_prefix.txt)
fi

MRPT_VERSION_MAJOR=${MRPT_VERSION_STR:0:1}
MRPT_VERSION_MAJOR=${MRPT_VERSION_STR:0:1}
MRPT_VERSION_MINOR=${MRPT_VERSION_STR:2:1}
MRPT_VERSION_PATCH=${MRPT_VERSION_STR:4:1}
MRPT_VER_MM="${MRPT_VERSION_MAJOR}.${MRPT_VERSION_MINOR}"
MRPT_VER_MMP="${MRPT_VERSION_MAJOR}.${MRPT_VERSION_MINOR}.${MRPT_VERSION_PATCH}"
echo "MRPT version: ${MRPT_VER_MMP}"
echo "MRPT version: ${MRPT_VER_MMP}"
else
echo "Error: cannot find version_prefix.txt!! Invoke scripts from mrpt sources root directory."
exit 1
Expand Down
6 changes: 3 additions & 3 deletions packaging/ppa_build_and_upload_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ set -e
# Check:
if [ -f version_prefix.txt ];
then
MRPT_VERSION_STR=`head -n 1 version_prefix.txt`
MRPT_VERSION_STR=$(head -n 1 version_prefix.txt)
echo "MRPT version: ${MRPT_VERSION_STR}"
else
echo "ERROR: Run this script from the MRPT root directory."
exit 1
fi

MRPTDIR=`pwd`
MRPTDIR=$(pwd)

# Build PPA packages:
bash packaging/prepare_ubuntu_pkgs_for_ppa.sh
cd $HOME/mrpt_ubuntu
cd "$HOME/mrpt_ubuntu"

# upload:
find . -name '*.changes' | xargs -I FIL dput ppa:joseluisblancoc/mrpt FIL
Expand Down

0 comments on commit d4d56ac

Please sign in to comment.