Minor build script improvements
This commit is contained in:
16
.ci/build.sh
16
.ci/build.sh
@@ -151,18 +151,15 @@ done
|
|||||||
cmake_flags_extra=
|
cmake_flags_extra=
|
||||||
|
|
||||||
# Check if mandatory arguments were specified.
|
# Check if mandatory arguments were specified.
|
||||||
if [ -z "$package_name" -a -z "$tarball_name" ]
|
if [ -z "$package_name" -a -z "$tarball_name" ] || [ ! -z "$package_name" -a -z "$arch" ]
|
||||||
then
|
then
|
||||||
echo '[!] Usage: build.sh -b {package_name} {architecture} [cmake_flags...]'
|
echo '[!] Usage: build.sh -b {package_name} {architecture} [cmake_flags...]'
|
||||||
echo ' build.sh -s {source_tarball_name}'
|
echo ' build.sh -s {source_tarball_name}'
|
||||||
exit 100
|
exit 100
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Switch to the correct directory.
|
# Switch to the repository root directory.
|
||||||
while [ ! -e ".ci/build.sh" ]
|
cd "$(dirname "$0")/.."
|
||||||
do
|
|
||||||
cd ..
|
|
||||||
done
|
|
||||||
|
|
||||||
# Make source tarball if requested.
|
# Make source tarball if requested.
|
||||||
if [ ! -z "$tarball_name" ]
|
if [ ! -z "$tarball_name" ]
|
||||||
@@ -172,26 +169,23 @@ then
|
|||||||
# Clean local tree of gitignored files.
|
# Clean local tree of gitignored files.
|
||||||
git clean -dfX
|
git clean -dfX
|
||||||
|
|
||||||
# Recreate output directory if it was removed by git clean.
|
# Recreate working directory if it was removed by git clean.
|
||||||
[ ! -d "$cwd" ] && mkdir -p "$cwd"
|
[ ! -d "$cwd" ] && mkdir -p "$cwd"
|
||||||
|
|
||||||
# Save current HEAD commit to VERSION.
|
# Save current HEAD commit to VERSION.
|
||||||
git log --stat -1 > VERSION || rm -f VERSION
|
git log --stat -1 > VERSION || rm -f VERSION
|
||||||
|
|
||||||
# Archive source.
|
# Archive source.
|
||||||
rm -f "$tarball_name.tar"*
|
make_tar "$cwd/$tarball_name.tar"
|
||||||
make_tar "$tarball_name.tar"
|
|
||||||
status=$?
|
status=$?
|
||||||
|
|
||||||
# Check if the archival succeeded.
|
# Check if the archival succeeded.
|
||||||
if [ $status -ne 0 ]
|
if [ $status -ne 0 ]
|
||||||
then
|
then
|
||||||
echo [!] Tarball creation failed with status [$status]
|
echo [!] Tarball creation failed with status [$status]
|
||||||
rm -f "$tarball_name.tar"*
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo [-] Source tarball [$tarball_name] created successfully
|
echo [-] Source tarball [$tarball_name] created successfully
|
||||||
mv "$tarball_name.tar"* "$cwd/"
|
|
||||||
[ -z "$package_name" ] && exit 0
|
[ -z "$package_name" ] && exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user