Skip to content

Commit

Permalink
Update the create-package script to properly describe packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Wengier committed Sep 10, 2022
1 parent 0ed5439 commit e38259c
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions scripts/create-package.sh
Expand Up @@ -4,20 +4,20 @@ set -e

# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright (C) 2020-2021 Sherman Perry
# Copyright (C) 2020-2022 Sherman Perry and the DOSBox Staging Team

usage()
{
printf "%s\n" "\
Usage: -p <platform> [-h -c <commit> -b <branch> -r <repo> -v <version> -f] BUILD_DIR PACKAGE_DIR
Where:
-h : Show this help message
-p : Buld platform. Can be one of linux, macos, msys2, msvc
-p : Build platform. Can be one of linux, macos, msys2, msvc
-c : Git commit
-b : Git branch
-r : Git repository
-v : dosbox-staging version
-f : force creation if PACKAGE_DIR is not empty
-v : DOSBox Staging version
-f : Force creation if PACKAGE_DIR is not empty
BUILD_DIR : Meson build directory
PACKAGE_DIR : Package directory
Expand Down Expand Up @@ -74,11 +74,16 @@ install_doc()
;;
esac
# Fill template variables in README.template
if [ -n "$git_commit" ]; then
sed -i -e "s|%GIT_COMMIT%|$git_commit|" "$readme_tmpl"
if [[ "$git_branch" == "refs/tags/"* ]] && [[ "$git_branch" != *"-"* ]]; then
export version_tag=`echo $git_branch | awk '{print substr($0,11);exit}'`
export packge_information="release $version_tag"
elif [ -n "$git_branch" ] && [ -n "$git_commit" ]; then
export packge_information="a development branch named $git_branch with commit $git_commit"
else
export packge_information="a development branch"
fi
if [ -n "$git_branch" ]; then
sed -i -e "s|%GIT_BRANCH%|$git_branch|" "$readme_tmpl"
if [ -n "$packge_information" ]; then
sed -i -e "s|%PACKAGE_INFORMATION%|$packge_information|" "$readme_tmpl"
fi
if [ -n "$git_repo" ]; then
sed -i -e "s|%GITHUB_REPO%|$git_repo|" "$readme_tmpl"
Expand Down Expand Up @@ -176,7 +181,7 @@ pkg_msvc()
# Get GitHub CI environment variables if available. The CLI options
# '-c', '-b', '-r' will override these if set.
if [ -n "${GITHUB_REPOSITORY:-}" ]; then
git_commit=${GITHUB_SHA}
git_commit=`echo ${GITHUB_SHA} | awk '{print substr($0,1,9);exit}'`
git_branch=${GITHUB_REF#refs/heads/}
git_repo=${GITHUB_REPOSITORY}
else
Expand Down Expand Up @@ -236,7 +241,7 @@ fi

if [ "$platform" = "macos" ]; then
if [ -z "$dbox_version" ]; then
echo "Dosbox version required on MacOS"
echo "DOSBox Staging version required on macOS"
usage
exit 1
fi
Expand Down

0 comments on commit e38259c

Please sign in to comment.