diff options
author | Wengier <wengierwu@yahoo.com> | 2022-09-11 01:04:16 +0300 |
---|---|---|
committer | Wengier <wengierwu@yahoo.com> | 2022-09-11 22:58:19 +0300 |
commit | 55a72c00ed4744333b70d929bab23e7088dd81be (patch) | |
tree | c7c48da6915b6d19ed1380371af4f59b16933520 | |
parent | 0ed5439425313f9fe6fbcf928fee4751ba856650 (diff) |
Update the create-package script to properly describe packagesww/readme-fix
-rwxr-xr-x | scripts/create-package.sh | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/scripts/create-package.sh b/scripts/create-package.sh index 392ef002a..74f31df37 100755 --- a/scripts/create-package.sh +++ b/scripts/create-package.sh @@ -4,7 +4,7 @@ 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() { @@ -12,12 +12,12 @@ usage() 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 @@ -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 + version_tag=`echo $git_branch | awk '{print substr($0,11);exit}'` + package_information="release $version_tag" + elif [ -n "$git_branch" ] && [ -n "$git_commit" ]; then + package_information="a development branch named $git_branch with commit $git_commit" + else + package_information="a development branch" fi - if [ -n "$git_branch" ]; then - sed -i -e "s|%GIT_BRANCH%|$git_branch|" "$readme_tmpl" + if [ -n "$package_information" ]; then + sed -i -e "s|%PACKAGE_INFORMATION%|$package_information|" "$readme_tmpl" fi if [ -n "$git_repo" ]; then sed -i -e "s|%GITHUB_REPO%|$git_repo|" "$readme_tmpl" @@ -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 @@ -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 |