From 8662abafc050aa2347fdef50d14d5a3e48349ec6 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Sat, 24 Feb 2024 16:33:53 +0100 Subject: [PATCH 01/12] Update submodule --- RCLootCouncil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RCLootCouncil b/RCLootCouncil index fdae092..eb5193d 160000 --- a/RCLootCouncil +++ b/RCLootCouncil @@ -1 +1 @@ -Subproject commit fdae092cc74b6a448c89ea5ccd1f10b467889b48 +Subproject commit eb5193db4375979a0bbd0e08c3c18ac0679f9938 From f5664880188bdded0a752474c74a4387969a9ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20ABABOU?= Date: Sun, 28 Apr 2024 23:49:13 +0200 Subject: [PATCH 02/12] Add Sunken Temple tokens --- Core/Lists.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/Lists.lua b/Core/Lists.lua index a005fef..feffc29 100644 --- a/Core/Lists.lua +++ b/Core/Lists.lua @@ -81,4 +81,8 @@ List.Specials = { -- SoD Gnomeregan RCTokenTable[217007] = "FeetSlot" -- Power Depleted Boots RCTokenTable[217008] = "ChestSlot" -- Power Depleted Chest -RCTokenTable[217009] = "LegsSlot" -- Power Depleted Legs \ No newline at end of file +RCTokenTable[217009] = "LegsSlot" -- Power Depleted Legs + +-- SoD Sunken Temple +RCTokenTable[220636] = "MultiSlots" -- Atal'ai Blood Icon +RCTokenTable[220637] = "MultiSlots" -- Atal'ai Ritual Token \ No newline at end of file From 70630f36a8365c55d792101598263665f0ab8abc Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 14:56:49 +0200 Subject: [PATCH 03/12] Added changelog for #56 --- Changelog.md | 5 +++-- Changelog_Complete.md | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index 241eb9b..989186b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,4 +1,5 @@ ## Changes -Updated toc for patch 1.15.1 SoD Phase 2. -Added support for Gnomeregan tier tokens. \ No newline at end of file +### Season of Discovery + +Added Sunken Temple tokens to the token list (#56 Credit @Klemms). \ No newline at end of file diff --git a/Changelog_Complete.md b/Changelog_Complete.md index 94f6d73..3682ef8 100644 --- a/Changelog_Complete.md +++ b/Changelog_Complete.md @@ -1,3 +1,11 @@ +# 0.22.0 + +## Changes + +### Season of Discovery + +Added Sunken Temple tokens to the token list (#56 Credit @Klemms). + # 0.21.0 ## Changes From 88bed1fb6e52a088921d8525b768c522a5419db1 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 15:06:58 +0200 Subject: [PATCH 04/12] Updated for Cataclysm Classic --- API/RCLootCouncilUpdates.lua | 2 +- Changelog.md | 4 ++++ Changelog_Complete.md | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/API/RCLootCouncilUpdates.lua b/API/RCLootCouncilUpdates.lua index f908ebc..23ad153 100644 --- a/API/RCLootCouncilUpdates.lua +++ b/API/RCLootCouncilUpdates.lua @@ -59,7 +59,7 @@ addon.defaults.profile.ignoredItems[22726] = true -- Splinter of Atiesh addon.defaults.profile.ignoredItems[50274] = true -- Shadowfrost Shard function addon:IsCorrectVersion () - return (WOW_PROJECT_CLASSIC == WOW_PROJECT_ID) or (WOW_PROJECT_WRATH_CLASSIC == WOW_PROJECT_ID) + return (WOW_PROJECT_CLASSIC == WOW_PROJECT_ID) or (WOW_PROJECT_CATACLYSM_CLASSIC == WOW_PROJECT_ID) end function addon:UpdatePlayersData() diff --git a/Changelog.md b/Changelog.md index 989186b..47484af 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ ## Changes +### Cataclysm Classic + +Updated to work with Cataclysm Classic. + ### Season of Discovery Added Sunken Temple tokens to the token list (#56 Credit @Klemms). \ No newline at end of file diff --git a/Changelog_Complete.md b/Changelog_Complete.md index 3682ef8..a566f22 100644 --- a/Changelog_Complete.md +++ b/Changelog_Complete.md @@ -2,6 +2,10 @@ ## Changes +### Cataclysm Classic + +Updated to work with Cataclysm Classic. + ### Season of Discovery Added Sunken Temple tokens to the token list (#56 Credit @Klemms). From 1dc043fa657a4a49f71b50c1fbe0e2a98ad57769 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 15:17:31 +0200 Subject: [PATCH 05/12] Updated toc for Cataclysm Classic --- RCLootCouncil_Classic.toc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/RCLootCouncil_Classic.toc b/RCLootCouncil_Classic.toc index e0f9838..605305a 100644 --- a/RCLootCouncil_Classic.toc +++ b/RCLootCouncil_Classic.toc @@ -1,9 +1,8 @@ ## Author: Potdisc -## Interface: 11501 -## Interface-Wrath: 30403 -## Notes: RCLootCouncil for WoW Classic and Wrath of the Lich King Classic v0.21.0 +## Interface: 11501, 40400 +## Notes: RCLootCouncil for WoW Classic and Cataclysm Classic v0.22.0 ## Title: RCLootCouncil Classic -## Version: 0.21.0 +## Version: 0.22.0 ## X-Curse-Project-ID: 332955 ## SavedVariables: RCLootCouncilDB, RCLootCouncilLootDB ## OptionalDeps: LibStub, CallbackHandler-1.0, Ace3, lib-st, LibWindow-1.1, LibDialog-1.0 From bad219347b4fe5caa2491525b91dbc493e4e68d3 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 15:38:06 +0200 Subject: [PATCH 06/12] Cata: LibDialog fix Temporarily bumped major version until a fix is officially implemented --- API/RCLootCouncilUpdates.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/API/RCLootCouncilUpdates.lua b/API/RCLootCouncilUpdates.lua index 23ad153..285934f 100644 --- a/API/RCLootCouncilUpdates.lua +++ b/API/RCLootCouncilUpdates.lua @@ -4,7 +4,7 @@ local Classic = addon:GetModule("RCClassic") local private = {} local L = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil") local LC = LibStub("AceLocale-3.0"):GetLocale("RCLootCouncil_Classic") -local LibDialog = LibStub("LibDialog-1.0") +local LibDialog = LibStub("LibDialog-1.1") ---------------------------------------------- From 36e199520fe6e8a48a80e643a8786452c889804f Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 16:19:38 +0200 Subject: [PATCH 07/12] `GetIlvlDifference` now allows g1 to be nil --- Changelog.md | 2 ++ Changelog_Complete.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Changelog.md b/Changelog.md index 47484af..f9c5c0c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ ## Changes +No longer breaks when having equipped the second slot (offhand, ring2/trinket2) without the first (mainhand, ring1/trinket1). + ### Cataclysm Classic Updated to work with Cataclysm Classic. diff --git a/Changelog_Complete.md b/Changelog_Complete.md index a566f22..5ab7e4d 100644 --- a/Changelog_Complete.md +++ b/Changelog_Complete.md @@ -2,6 +2,8 @@ ## Changes +No longer breaks when having equipped the second slot (offhand, ring2/trinket2) without the first (mainhand, ring1/trinket1). + ### Cataclysm Classic Updated to work with Cataclysm Classic. From dbb24eb928056acd29241545bc61be53be72111c Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 16:28:14 +0200 Subject: [PATCH 08/12] Revert back to old toc interface format --- RCLootCouncil_Classic.toc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RCLootCouncil_Classic.toc b/RCLootCouncil_Classic.toc index 605305a..44078ab 100644 --- a/RCLootCouncil_Classic.toc +++ b/RCLootCouncil_Classic.toc @@ -1,5 +1,6 @@ ## Author: Potdisc -## Interface: 11501, 40400 +## Interface: 11501 +## Interface-Cata: 40400 ## Notes: RCLootCouncil for WoW Classic and Cataclysm Classic v0.22.0 ## Title: RCLootCouncil Classic ## Version: 0.22.0 From 235efe6ad26738c52d62c2733d138acde9c73229 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 16:33:53 +0200 Subject: [PATCH 09/12] Updated submodule RCLootCouncil2 --- RCLootCouncil | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RCLootCouncil b/RCLootCouncil index eb5193d..7c1af08 160000 --- a/RCLootCouncil +++ b/RCLootCouncil @@ -1 +1 @@ -Subproject commit eb5193db4375979a0bbd0e08c3c18ac0679f9938 +Subproject commit 7c1af08b0850863ffa735965b6a6a67b1405d33b From 30aead87a584cefaa67ff4c6ee3f372d5562e22c Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 16:35:12 +0200 Subject: [PATCH 10/12] Update toc for SoD Phase 3 --- Changelog.md | 2 ++ Changelog_Complete.md | 2 ++ RCLootCouncil_Classic.toc | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index f9c5c0c..116d2fe 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,4 +8,6 @@ Updated to work with Cataclysm Classic. ### Season of Discovery +Updated toc for patch 1.15.2 SoD Phase 3. + Added Sunken Temple tokens to the token list (#56 Credit @Klemms). \ No newline at end of file diff --git a/Changelog_Complete.md b/Changelog_Complete.md index 5ab7e4d..b05841f 100644 --- a/Changelog_Complete.md +++ b/Changelog_Complete.md @@ -10,6 +10,8 @@ Updated to work with Cataclysm Classic. ### Season of Discovery +Updated toc for patch 1.15.2 SoD Phase 3. + Added Sunken Temple tokens to the token list (#56 Credit @Klemms). # 0.21.0 diff --git a/RCLootCouncil_Classic.toc b/RCLootCouncil_Classic.toc index 44078ab..c2ec14c 100644 --- a/RCLootCouncil_Classic.toc +++ b/RCLootCouncil_Classic.toc @@ -1,5 +1,5 @@ ## Author: Potdisc -## Interface: 11501 +## Interface: 11502 ## Interface-Cata: 40400 ## Notes: RCLootCouncil for WoW Classic and Cataclysm Classic v0.22.0 ## Title: RCLootCouncil Classic From 93391994843036416f6f06be5d59e181a59cd924 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 16:46:05 +0200 Subject: [PATCH 11/12] Updated release script for cataclysm --- .scripts/release.sh | 491 ++++++++++++++++++++++++++------------------ 1 file changed, 294 insertions(+), 197 deletions(-) diff --git a/.scripts/release.sh b/.scripts/release.sh index 17d9fcd..7c2aecd 100644 --- a/.scripts/release.sh +++ b/.scripts/release.sh @@ -31,7 +31,8 @@ # SC2295: Expansions inside ${..} need to be quoted separately, otherwise they will match as a pattern. # SC2030: Modification of var is local (to subshell caused by pipeline). # SC2031: var was modified in a subshell. That change might be lost. -# shellcheck disable=SC2295,SC2030,SC2031 +# SC2317: Command appears to be unreachable. +# shellcheck disable=SC2295,SC2030,SC2031,SC2317 ## USER OPTIONS @@ -74,7 +75,7 @@ if [[ ${BASH_VERSINFO[0]} -lt 4 ]] || [[ ${BASH_VERSINFO[0]} -eq 4 && ${BASH_VER fi # Game versions for uploading -declare -A game_flavor=( ["retail"]="retail" ["classic"]="classic" ["bcc"]="bcc" ["mainline"]="retail" ["tbc"]="bcc" ["vanilla"]="classic" ["wrath"]="wrath" ["wotlkc"]="wrath" ) +declare -A game_flavor=( ["retail"]="retail" ["classic"]="classic" ["bcc"]="bcc" ["mainline"]="retail" ["tbc"]="bcc" ["vanilla"]="classic" ["wrath"]="wrath" ["wotlkc"]="wrath" ["cata"]="cata" ) declare -A game_type_version=() # type -> version declare -A game_type_interface=() # type -> toc @@ -100,7 +101,8 @@ retry() { count="$((count + 1))" sleep 3 done - return "$result" + # shellcheck disable=SC2086 + return $result } # Escape a string for use in sed substitutions. @@ -119,7 +121,8 @@ filename_filter() { if [[ -n $game_type ]] && [[ "$game_type" != "retail" ]] && \ [[ "$game_type" != "classic" || "${si_project_version,,}" != *"-classic"* ]] &&\ [[ "$game_type" != "bcc" || "${si_project_version,,}" != *"-bcc"* ]] &&\ - [[ "$game_type" != "wrath" || "${si_project_version,,}" != *"-wrath"* ]] + [[ "$game_type" != "wrath" || "${si_project_version,,}" != *"-wrath"* ]] &&\ + [[ "$game_type" != "cata" || "${si_project_version,,}" != *"-cata"* ]] then # only append the game type if the tag doesn't include it classic="-$game_type" @@ -170,6 +173,7 @@ toc_to_type() { 11???) game_type="classic" ;; 20???) game_type="bcc" ;; 30???) game_type="wrath" ;; + 40???) game_type="cata" ;; *) game_type="retail" esac # return game_type @@ -232,7 +236,7 @@ while getopts ":celLzusSop:dw:a:r:t:g:m:n:" opt; do g) # Set the game type or version OPTARG="${OPTARG,,}" case "$OPTARG" in - retail|classic|bcc|wrath) game_type="$OPTARG" ;; # game_version from toc + retail|classic|bcc|wrath|cata) game_type="$OPTARG" ;; # game_version from toc mainline) game_type="retail" ;; *) # Set game version (x.y.z) @@ -250,12 +254,14 @@ while getopts ":celLzusSop:dw:a:r:t:g:m:n:" opt; do game_type="bcc" elif [[ ${BASH_REMATCH[1]} == "3" ]]; then game_type="wrath" + elif [[ ${BASH_REMATCH[1]} == "4" ]]; then + game_type="cata" else game_type="retail" fi # Only one version per game type is allowed if [ -n "${game_type_version[$game_type]}" ]; then - echo "Invalid argument for option \"-g\" ($i) - Only one version per game type is supported." >&2 + echo "Invalid argument for option \"-g\" (${game_type_version[$game_type]}, $i) - Only one version per game type is supported." >&2 usage exit 1 fi @@ -281,13 +287,13 @@ while getopts ":celLzusSop:dw:a:r:t:g:m:n:" opt; do cat <<-'EOF' >&2 Usage: release.sh [options] Set the package zip file name and upload file label. There are several string - substitutions you can use to include version control and build type infomation in + substitutions you can use to include version control and build type information in the file name and upload label. The default file name is "{package-name}-{project-version}{nolib}{classic}". The default upload label is "{project-version}{classic}{nolib}". - To set both, seperate with a ":", i.e, "{file template}:{label template}". + To set both, separate with a ":", i.e, "{file template}:{label template}". If either side of the ":" is blank, the default will be used.Not including a ":" will set the file name template, leaving upload label as default. @@ -537,20 +543,45 @@ set_info_git() { # Get the tag for the HEAD. si_previous_tag= si_previous_revision= - _si_tag=$( git -C "$si_repo_dir" describe --tags --always --abbrev=7 2>/dev/null ) - si_tag=$( git -C "$si_repo_dir" describe --tags --always --abbrev=0 2>/dev/null ) - # Set $si_project_version to the version number of HEAD. May be empty if there are no commits. - si_project_version=$si_tag + # git describe should use the latest tag if there are multiple, but it doesn't always work that way. + check_tag=() + while IFS='' read -r tag; do check_tag+=( "$tag" ); done < <( git -C "$si_repo_dir" tag --points-at HEAD --sort=-committerdate --sort=-v:refname --sort=-taggerdate ) + if [[ ${#check_tag[@]} -gt 0 ]]; then + # Use the most recent tag + si_tag="${check_tag[0]}" + _si_tag="$si_tag" + + if [[ $GITHUB_REF == "refs/tags/"* && $si_tag != "$GITHUB_REF_NAME" ]]; then + # Git doesn't agree with GitHub Actions, check if there is another local tag that matches + for tag in "${check_tag[@]}"; do + if [[ $tag == "$GITHUB_REF_NAME" ]]; then + si_tag="$GITHUB_REF_NAME" + _si_tag="$si_tag" + break + fi + done + fi + else + _si_tag=$( git -C "$si_repo_dir" describe --tags --always --abbrev=7 2>/dev/null ) + si_tag=$( git -C "$si_repo_dir" describe --tags --always --abbrev=0 2>/dev/null ) + fi + # Set $si_project_version to the version number of HEAD. + si_project_version="$si_tag" # The HEAD is not tagged if the HEAD is several commits past the most recent tag. - if [ "$si_tag" = "$si_project_hash" ]; then + if [[ $si_tag == "$si_project_hash" ]]; then # --abbrev=0 expands out the full sha if there was no previous tag - si_project_version=$_si_tag + si_project_version="$_si_tag" si_previous_tag= si_tag= - elif [ "$_si_tag" != "$si_tag" ]; then + elif [[ $_si_tag != "$si_tag" ]]; then # not on a tag si_project_version=$( git -C "$si_repo_dir" describe --tags --abbrev=7 --exclude="*[Aa][Ll][Pp][Hh][Aa]*" 2>/dev/null ) - si_previous_tag=$( git -C "$si_repo_dir" describe --tags --abbrev=0 --exclude="*[Aa][Ll][Pp][Hh][Aa]*" 2>/dev/null ) + if [[ -n $si_project_version ]]; then + si_previous_tag=$( git -C "$si_repo_dir" describe --tags --abbrev=0 --exclude="*[Aa][Ll][Pp][Hh][Aa]*" 2>/dev/null ) + else # no previous non-alpha tag + si_project_version="$_si_tag" + si_previous_tag= + fi si_tag= else # we're on a tag, just jump back one commit if [[ ${si_tag,,} != *"beta"* && ${si_tag,,} != *"alpha"* ]]; then @@ -588,8 +619,9 @@ set_info_svn() { # Check if the latest tag matches the working copy revision (/trunk checkout instead of /tags) _si_tag_line=$( retry svn log --verbose --limit 1 "$si_repo_url/tags" 2>/dev/null | awk '/^ A/ { print $0; exit }' ) _si_tag=$( echo "$_si_tag_line" | awk '/^ A/ { print $2 }' | awk -F/ '{ print $NF }' ) - # shellcheck disable=SC2001 - _si_tag_from_revision=$( echo "$_si_tag_line" | sed -e 's/^.*:\([0-9]\{1,\}\)).*$/\1/' ) # (from /project/trunk:N) + # (from /project/trunk:REV) + _si_tag_from_revision=${_si_tag_line##*:} + _si_tag_from_revision=${_si_tag_from_revision%)*} if [[ "$_si_tag_from_revision" == "$_si_revision" ]]; then si_tag="$_si_tag" @@ -750,6 +782,16 @@ else file_type="alpha" fi +# Add some GitHub Actions outputs +if [[ -n $GITHUB_ACTIONS ]]; then + # shellcheck disable=SC2129 + echo "project_version=${project_version}" >> "$GITHUB_OUTPUT" + echo "previous_version=${previous_version}" >> "$GITHUB_OUTPUT" + echo "project_hash=${project_hash}" >> "$GITHUB_OUTPUT" + echo "project_timestamp=${project_timestamp}" >> "$GITHUB_OUTPUT" + echo "release_type=${file_type}" >> "$GITHUB_OUTPUT" +fi + # Bare carriage-return character. carriage_return=$( printf "\r" ) @@ -788,6 +830,8 @@ yaml_keyvalue() { yaml_listitem() { yaml_item=${1#-} yaml_item=${yaml_item#"${yaml_item%%[! ]*}"} # trim leading whitespace + yaml_item=${yaml_item#[\'\"]} # trim leading quotes + yaml_item=${yaml_item%[\'\"]} # trim trailing quotes } ### @@ -810,6 +854,7 @@ changelog= changelog_markup="text" enable_nolib_creation= ignore= +license= unchanged= zip_root_dirs=() nolib_exclude= @@ -819,14 +864,19 @@ wowi_convert_changelog="true" declare -A relations=() parse_ignore() { - pkgmeta="$1" + pkgmeta="$1" # full path to .pkgmeta + copy_path="$2" # the post-copy base path to match + sub_path="$3" # only includes matches in this path + [ -f "$pkgmeta" ] || return 1 - checkpath="$topdir" # paths are relative to the topdir - copypath="" - if [ "$2" != "" ]; then - checkpath=$( dirname "$pkgmeta" ) - copypath="$2/" + check_path="$topdir/" # paths are relative to the topdir + if [ -n "$copy_path" ]; then + check_path=$( dirname "$pkgmeta" )"/" + copy_path="$copy_path/" + fi + if [[ -n $sub_path && $sub_path != *"/" ]]; then + sub_path="$sub_path/" fi yaml_eof= @@ -837,28 +887,29 @@ parse_ignore() { continue fi # Strip any trailing CR character. - yaml_line=${yaml_line%$carriage_return} + yaml_line="${yaml_line%"$carriage_return"}" case $yaml_line in [!\ ]*:*) # Split $yaml_line into a $yaml_key, $yaml_value pair. yaml_keyvalue "$yaml_line" # Set the $pkgmeta_phase for stateful processing. - pkgmeta_phase=$yaml_key + pkgmeta_phase="$yaml_key" ;; [\ ]*"- "*) - yaml_line=${yaml_line#"${yaml_line%%[! ]*}"} # trim leading whitespace + yaml_line="${yaml_line#"${yaml_line%%[! ]*}"}" # trim leading whitespace # Get the YAML list item. yaml_listitem "$yaml_line" - if [[ "$pkgmeta_phase" == "ignore" || "$pkgmeta_phase" == "plain-copy" ]]; then - pattern=$yaml_item - if [ -d "$checkpath/$pattern" ]; then - pattern="$copypath$pattern/*" - elif [ ! -f "$checkpath/$pattern" ]; then + if [[ "$pkgmeta_phase" == "ignore" || "$pkgmeta_phase" == "plain-copy" ]] && [[ $yaml_item == "$sub_path"* ]]; then + yaml_item=${yaml_item%"/*"} # trim dir glob + pattern=${yaml_item#$sub_path} # match relative to sub_path + if [ -d "$check_path$yaml_item" ]; then + pattern="$copy_path$pattern/*" + elif [ ! -f "$copy_path$yaml_item" ]; then # doesn't exist so match both a file and a path - pattern="$copypath$pattern:$copypath$pattern/*" + pattern="$copy_path$pattern:$copy_path$pattern/*" else - pattern="$copypath$pattern" + pattern="$copy_path$pattern" fi if [[ "$pkgmeta_phase" == "ignore" ]]; then if [ -z "$ignore" ]; then @@ -895,14 +946,14 @@ if [ -f "$pkgmeta_file" ]; then continue fi # Strip any trailing CR character. - yaml_line=${yaml_line%$carriage_return} + yaml_line="${yaml_line%"$carriage_return"}" case $yaml_line in [!\ ]*:*) # Split $yaml_line into a $yaml_key, $yaml_value pair. yaml_keyvalue "$yaml_line" # Set the $pkgmeta_phase for stateful processing. - pkgmeta_phase=$yaml_key + pkgmeta_phase="$yaml_key" case $yaml_key in enable-nolib-creation) @@ -915,15 +966,18 @@ if [ -f "$pkgmeta_file" ]; then split="true" fi ;; + license-output) + license=$yaml_value + ;; manual-changelog) - changelog=$yaml_value + changelog="$yaml_value" manual_changelog="true" ;; changelog-title) project="$yaml_value" ;; package-as) - package=$yaml_value + package="$yaml_value" ;; wowi-create-changelog) if [ "$yaml_value" = "no" ]; then @@ -949,45 +1003,17 @@ if [ -f "$pkgmeta_file" ]; then # Get the YAML list item. yaml_listitem "$yaml_line" case $pkgmeta_phase in - ignore) - pattern=$yaml_item - if [ -d "$topdir/$pattern" ]; then - pattern="$pattern/*" - elif [ ! -f "$topdir/$pattern" ]; then - # doesn't exist so match both a file and a path - pattern="$pattern:$pattern/*" - fi - if [ -z "$ignore" ]; then - ignore="$pattern" - else - ignore="$ignore:$pattern" - fi - ;; - plain-copy) - pattern=$yaml_item - if [ -d "$topdir/$pattern" ]; then - pattern="$pattern/*" - elif [ ! -f "$topdir/$pattern" ]; then - # doesn't exist so match both a file and a path - pattern="$pattern:$pattern/*" - fi - if [ -z "$unchanged" ]; then - unchanged="$pattern" - else - unchanged="$unchanged:$pattern" - fi - ;; tools-used) - relations["$yaml_item"]="tool" + relations["${yaml_item,,}"]="tool" ;; required-dependencies) - relations["$yaml_item"]="requiredDependency" + relations["${yaml_item,,}"]="requiredDependency" ;; optional-dependencies) - relations["$yaml_item"]="optionalDependency" + relations["${yaml_item,,}"]="optionalDependency" ;; embedded-libraries) - relations["$yaml_item"]="embeddedLibrary" + relations["${yaml_item,,}"]="embeddedLibrary" ;; esac ;; @@ -998,12 +1024,12 @@ if [ -f "$pkgmeta_file" ]; then manual-changelog) case $yaml_key in filename) - changelog=$yaml_value + changelog="$yaml_value" manual_changelog="true" ;; markup-type) if [ "$yaml_value" = "markdown" ] || [ "$yaml_value" = "html" ]; then - changelog_markup=$yaml_value + changelog_markup="$yaml_value" else changelog_markup="text" fi @@ -1026,54 +1052,47 @@ if [ -f "$pkgmeta_file" ]; then fi # Add untracked/ignored files to the ignore list -if [ "$repository_type" = "git" ]; then - OLDIFS=$IFS - IFS=$'\n' - for _vcs_ignore in $( git -C "$topdir" ls-files --others --directory ); do - if [ -d "$topdir/$_vcs_ignore" ]; then - _vcs_ignore="$_vcs_ignore*" - fi - if [ -z "$ignore" ]; then - ignore="$_vcs_ignore" + +vcs_addignore() { + local _ignored_path="$1" + if [[ -d "$topdir/$_ignored_path" ]]; then + _ignored_path="$_ignored_path*" + fi + # Don't ignore a manual changelog generated for the build + if [[ -z $changelog || $_ignored_path != "$changelog" ]]; then + if [[ -z "$ignore" ]]; then + ignore="$_ignored_path" else - ignore="$ignore:$_vcs_ignore" + ignore="$ignore:$_ignored_path" fi + fi +} + +OLDIFS=$IFS +IFS=$'\n' +if [ "$repository_type" = "git" ]; then + for _vcs_ignore in $( git -C "$topdir" ls-files --others --directory ); do + vcs_addignore "$_vcs_ignore" done - IFS=$OLDIFS elif [ "$repository_type" = "svn" ]; then - # svn always being difficult. - OLDIFS=$IFS - IFS=$'\n' - for _vcs_ignore in $( cd "$topdir" && svn status --no-ignore --ignore-externals | awk '/^[?IX]/' | cut -c9- ); do - _vcs_ignore="${_vcs_ignore//\\//}" - if [ -d "$topdir/$_vcs_ignore" ]; then - _vcs_ignore="$_vcs_ignore/*" - fi - if [ -z "$ignore" ]; then - ignore="$_vcs_ignore" - else - ignore="$ignore:$_vcs_ignore" - fi + for _vcs_ignore in $( cd "$topdir" && svn status --no-ignore --ignore-externals | awk '/^[?IX]/ { print $2 }' ); do + vcs_addignore "${_vcs_ignore//\\//}" done - IFS=$OLDIFS elif [ "$repository_type" = "hg" ]; then - _vcs_ignore=$( hg --cwd "$topdir" status --ignored --unknown --no-status --print0 | tr '\0' ':' ) - if [ -n "$_vcs_ignore" ]; then - _vcs_ignore="${_vcs_ignore%:}" - if [ -z "$ignore" ]; then - ignore="$_vcs_ignore" - else - ignore="$ignore:$_vcs_ignore" - fi - fi + for _vcs_ignore in $( hg --cwd "$topdir" status --ignored --unknown --no-status ); do + vcs_addignore "$_vcs_ignore" + done fi +IFS=$OLDIFS + + +# Add .pkgmeta ignored files to the ignore list +parse_ignore "$pkgmeta_file" ### ### Process TOC file ### -fallback_toc_file= - do_toc() { local toc_file toc_version toc_game_type root_toc_version local toc_path="$1" @@ -1086,10 +1105,10 @@ do_toc() { toc_file=$( # remove BOM and CR and apply some non-version related TOC filters [ "$file_type" != "alpha" ] && _tf_alpha="true" - sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | toc_filter alpha ${_tf_alpha} | toc_filter debug true + sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | toc_filter alpha ${_tf_alpha:+true} | toc_filter debug true ) - toc_version=$( awk '/^## Interface:/ { print $NF; exit }' <<< "$toc_file" ) + toc_version=$( awk -F: '/^## Interface:/ { gsub(/[[:blank:]]/, "", $2); print $2; exit }' <<< "$toc_file" ) if [[ -z $toc_version ]]; then toc_game_type= else @@ -1101,7 +1120,7 @@ do_toc() { root_toc_version="$toc_version" - if [[ ${toc_name} =~ "$package_name"[-_](Mainline|Classic|Vanilla|BCC|TBC|Wrath|WOTLKC)\.toc$ ]]; then + if [[ ${toc_name} =~ "$package_name"[-_](Mainline|Classic|Vanilla|BCC|TBC|Wrath|WOTLKC|Cata)\.toc$ ]]; then # Flavored if [[ -z "$toc_version" ]]; then echo "$toc_name is missing an interface version." >&2 @@ -1139,6 +1158,7 @@ do_toc() { classic) toc_version=$( sed -n '/@non-[-a-z]*@/,/@end-non-[-a-z]*@/{//b;p}' <<< "$toc_file" | awk '/#[[:blank:]]*## Interface:[[:blank:]]*(11)/ { print $NF; exit }' ) ;; bcc) toc_version=$( sed -n '/@non-[-a-z]*@/,/@end-non-[-a-z]*@/{//b;p}' <<< "$toc_file" | awk '/#[[:blank:]]*## Interface:[[:blank:]]*(20)/ { print $NF; exit }' ) ;; wrath) toc_version=$( sed -n '/@non-[-a-z]*@/,/@end-non-[-a-z]*@/{//b;p}' <<< "$toc_file" | awk '/#[[:blank:]]*## Interface:[[:blank:]]*(30)/ { print $NF; exit }' ) ;; + cata) toc_version=$( sed -n '/@non-[-a-z]*@/,/@end-non-[-a-z]*@/{//b;p}' <<< "$toc_file" | awk '/#[[:blank:]]*## Interface:[[:blank:]]*(40)/ { print $NF; exit }' ) ;; esac # This becomes the actual interface version after replacements root_toc_version="$toc_version" @@ -1170,13 +1190,13 @@ set_toc_project_info() { fi # Get project IDs for uploading if [ -z "$slug" ]; then - slug=$( sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | awk '/^## X-Curse-Project-ID:/ { print $NF; exit }' ) + slug=$( sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | awk -F: '/^## X-Curse-Project-ID:/ { gsub(/[[:blank:]]/, "", $2); print $2; exit }' ) fi if [ -z "$addonid" ]; then - addonid=$( sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | awk '/^## X-WoWI-ID:/ { print $NF; exit }' ) + addonid=$( sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | awk -F: '/^## X-WoWI-ID:/ { gsub(/[[:blank:]]/, "", $2); print $2; exit }' ) fi if [ -z "$wagoid" ]; then - wagoid=$( sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | awk '/^## X-Wago-ID:/ { print $NF; exit }' ) + wagoid=$( sed -e $'1s/^\xEF\xBB\xBF//' -e $'s/\r//g' "$toc_path" | awk -F: '/^## X-Wago-ID:/ { gsub(/[[:blank:]]/, "", $2); print $2; exit }' ) fi } @@ -1229,14 +1249,14 @@ if [[ -z "$package" ]]; then exit 1 fi package=${package%.toc} - if [[ $package =~ ^(.*)([-_](Mainline|Classic|Vanilla|BCC|TBC|Wrath|WOTLKC))$ ]]; then + if [[ $package =~ ^(.*)([-_](Mainline|Classic|Vanilla|BCC|TBC|Wrath|WOTLKC|Cata))$ ]]; then echo "Ambiguous addon name. No fallback TOC file or addon name includes an expansion suffix (${BASH_REMATCH[2]}). Set 'package-as' in .pkgmeta" >&2 exit 1 fi fi # Parse the project root TOC files for info first -for toc_path in "$topdir/$package"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC,-Wrath,_Wrath,-WOTLKC,_WOTLKC}.toc; do +for toc_path in "$topdir/$package"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC,-Wrath,_Wrath,-WOTLKC,_WOTLKC,-Cata,_Cata}.toc; do if [[ -f "$toc_path" ]]; then set_toc_project_info "$toc_path" toc_paths+=("$toc_path") @@ -1247,13 +1267,12 @@ done for path in "${!toc_root_paths[@]}"; do if [[ -f "$path/$package.toc" ]]; then set_toc_project_info "$path/$package.toc" - fallback_toc_file="$path/$package.toc" fi done # Parse project TOC files for path in "${!toc_root_paths[@]}"; do - for toc_path in "$path/${toc_root_paths[$path]}"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC,-Wrath,_Wrath,-WOTLKC,_WOTLKC}.toc; do + for toc_path in "$path/${toc_root_paths[$path]}"{,-Mainline,_Mainline,-Classic,_Classic,-Vanilla,_Vanilla,-BCC,_BCC,-TBC,_TBC,-Wrath,_Wrath,-WOTLKC,_WOTLKC,-Cata,_Cata}.toc; do if [[ -f "$toc_path" ]]; then set_toc_project_info "$toc_path" do_toc "$toc_path" "${toc_root_paths[$path]}" @@ -1269,12 +1288,6 @@ if [[ ${#toc_interfaces[@]} -eq 0 ]]; then exit 1 fi -# CurseForge still requires a fallback TOC file -if [[ -n "$slug" && "$slug" -gt 0 && -z "$fallback_toc_file" ]]; then - echo "CurseForge still requires a fallback TOC file (\"$package.toc\") when using multiple TOC files." >&2 - exit 1 -fi - if [[ -n "$split" ]]; then if [[ "${toc_interfaces[*]}" != *":"* ]]; then echo "Creating TOC files is enabled but there is only one TOC interface version per file?" >&2 @@ -1661,6 +1674,7 @@ copy_directory_tree() { if [ ! -d "$_cdt_destdir" ]; then mkdir -p "$_cdt_destdir" fi + # Create a "find" command to list all of the files in the current directory, minus any ones we need to prune. _cdt_find_cmd="find ." # Prune everything that begins with a dot except for the current directory ".". @@ -1673,7 +1687,9 @@ copy_directory_tree() { esac # Print the filename, but suppress the current directory ".". _cdt_find_cmd+=" -o \! -name \".\" -print" - ( cd "$_cdt_srcdir" && eval "$_cdt_find_cmd" ) | while read -r file; do + + local file + while read -r file; do # <( cd "$_cdt_srcdir" && eval "$_cdt_find_cmd" ) file=${file#./} _cdt_source_file="$_cdt_srcdir/$file" if [ -f "$_cdt_source_file" ]; then @@ -1697,14 +1713,23 @@ copy_directory_tree() { if [ -n "$_cdt_skip_copy" ]; then echo " Ignoring: $file" else - dir=${file%/*} - if [ "$dir" != "$file" ]; then - mkdir -p "$_cdt_destdir/$dir" + _cdt_subdir=${file%/*} + if [ "$_cdt_subdir" != "$file" ]; then + mkdir -p "$_cdt_destdir/$_cdt_subdir" + fi + # Check for marked hard embedded libraries + _cdt_external_slug= + if [[ $_cdt_source_file == *".lua" ]] && _cdt_external_slug=$( grep -io "@curseforge-project-slug[[:blank:]]*:[[:blank:]]*[^@]\+@" "$_cdt_source_file"); then + _cdt_external_slug="${_cdt_external_slug//[[:blank:]@]/}" + _cdt_external_slug="${_cdt_external_slug##*:}" + if [[ -n $_cdt_external_slug ]]; then + relations["${_cdt_external_slug,,}"]="embeddedLibrary" + fi fi # Check if the file matches a pattern for keyword replacement. if [ -n "$_cdt_only_copy" ] || ! match_pattern "$file" "*.lua:*.md:*.toc:*.txt:*.xml"; then - echo " Copying: $file (unchanged)" - cp "$_cdt_source_file" "$_cdt_destdir/$dir" + echo " Copying: $file (unchanged)${_cdt_external_slug:+(embedded: "$_cdt_external_slug")}" + cp "$_cdt_source_file" "$_cdt_destdir/$_cdt_subdir" else _cdt_file_gametype="$_cdt_gametype" # Set the filters for replacement based on file extension. @@ -1718,6 +1743,7 @@ copy_directory_tree() { [ "$_cdt_file_gametype" != "classic" ] && _cdt_filters+="|lua_filter version-classic" [ "$_cdt_file_gametype" != "bcc" ] && _cdt_filters+="|lua_filter version-bcc" [ "$_cdt_file_gametype" != "wrath" ] && _cdt_filters+="|lua_filter version-wrath" + [ "$_cdt_file_gametype" != "cata" ] && _cdt_filters+="|lua_filter version-cata" [ -n "$_cdt_localization" ] && grep -q "@localization" "$_cdt_source_file" && _cdt_filters+="|localization_filter" ;; *.xml) @@ -1729,6 +1755,7 @@ copy_directory_tree() { [ "$_cdt_file_gametype" != "classic" ] && _cdt_filters+="|xml_filter version-classic" [ "$_cdt_file_gametype" != "bcc" ] && _cdt_filters+="|xml_filter version-bcc" [ "$_cdt_file_gametype" != "wrath" ] && _cdt_filters+="|xml_filter version-wrath" + [ "$_cdt_file_gametype" != "cata" ] && _cdt_filters+="|xml_filter version-cata" ;; *.toc) # We only care about processing project TOC files @@ -1748,6 +1775,7 @@ copy_directory_tree() { _cdt_filters+="|toc_filter version-classic $([[ "$_cdt_file_gametype" != "classic" ]] && echo "true")" _cdt_filters+="|toc_filter version-bcc $([[ "$_cdt_file_gametype" != "bcc" ]] && echo "true")" _cdt_filters+="|toc_filter version-wrath $([[ "$_cdt_file_gametype" != "wrath" ]] && echo "true")" + _cdt_filters+="|toc_filter version-cata $([[ "$_cdt_file_gametype" != "cata" ]] && echo "true")" _cdt_filters+="|toc_interface_filter '${si_game_type_interface_all[${_cdt_file_gametype:- }]}' '${toc_root_interface["$_cdt_source_file"]}'" [ -n "$_cdt_localization" ] && grep -q "@localization" "$_cdt_source_file" && _cdt_filters+="|localization_filter" fi @@ -1760,13 +1788,13 @@ copy_directory_tree() { # Set version control values for the file. set_info_file "$_cdt_source_file" - echo " Copying: $file" + echo " Copying: $file${_cdt_external_slug:+ (embedded: "$_cdt_external_slug")}" # Make sure we're not causing any surprises - if [[ -z $_cdt_file_gametype && ( $file == *".lua" || $file == *".xml" || $file == *".toc" ) ]] && grep -q '@\(non-\)\?version-\(retail\|classic\|bcc\|wrath\)@' "$_cdt_source_file"; then + if [[ -z $_cdt_file_gametype && ( $file == *".lua" || $file == *".xml" || ( -z $_cdt_external && $file == *".toc" ) ) ]] && grep -q '@\(non-\)\?version-\(retail\|classic\|bcc\|wrath\|cata\)@' "$_cdt_source_file"; then echo " Error! Build type version keywords are not allowed in a multi-version build." >&2 echo " These should be replaced with lua conditional statements:" >&2 - grep -n '@\(non-\)\?version-\(retail\|classic\|bcc\|wrath\)@' "$_cdt_source_file" | sed 's/^/ /' >&2 + grep -n '@\(non-\)\?version-\(retail\|classic\|bcc\|wrath\|cata\)@' "$_cdt_source_file" | sed 's/^/ /' >&2 echo " See https://wowpedia.fandom.com/wiki/WOW_PROJECT_ID" >&2 exit 1 fi @@ -1786,6 +1814,7 @@ copy_directory_tree() { classic) new_file+="_Vanilla.toc" ;; bcc) new_file+="_TBC.toc" ;; wrath) new_file+="_Wrath.toc" ;; + cata) new_file+="_Cata.toc" ;; esac echo " Creating $new_file [$toc_version]" @@ -1800,22 +1829,17 @@ copy_directory_tree() { _cdt_filters+="|toc_filter version-classic $([[ "$type" != "classic" ]] && echo "true")" _cdt_filters+="|toc_filter version-bcc $([[ "$type" != "bcc" ]] && echo "true")" _cdt_filters+="|toc_filter version-wrath $([[ "$type" != "wrath" ]] && echo "true")" + _cdt_filters+="|toc_filter version-cata $([[ "$type" != "cata" ]] && echo "true")" _cdt_filters+="|toc_interface_filter '$toc_version' '$root_toc_version'" _cdt_filters+="|line_ending_filter" eval < "$_cdt_source_file" "$_cdt_filters" 3>&1 > "$_cdt_destdir/$new_file" done - - # Remove the fallback TOC file if it doesn't have an interface value or if you a TOC file for each game type - # if [[ -z $root_toc_version || ${#si_game_type_interface[@]} -eq 3 ]]; then - # echo " Removing $file" - # rm -f "$_cdt_destdir/$file" - # fi fi fi fi fi - done || exit 1 # actually exit if we end with an error + done < <( cd "$_cdt_srcdir" && eval "$_cdt_find_cmd" ) if [ -z "$_external_dir" ]; then end_group "copy" fi @@ -1844,15 +1868,20 @@ parse_ignore "$pkgmeta_file" # Checkout the external into a ".checkout" subdirectory of the final directory. checkout_external() { - _external_dir=$1 - _external_uri=$2 - _external_tag=$3 - _external_type=$4 + local _external_dir="$1" + local _external_uri="$2" + local _external_tag="$3" + local _external_type="$4" # shellcheck disable=SC2034 - _external_slug=$5 # unused until we can easily fetch the project id - _external_checkout_type=$6 + local _external_slug="$5" # unused until we can easily fetch the project id + local _external_checkout_type="$6" + local _external_path="$7" _cqe_checkout_dir="$pkgdir/$_external_dir/.checkout" + if [[ -d $_cqe_checkout_dir ]]; then + # cleanup in case there was an aborted attempt to checkout + rm -rf "$_cqe_checkout_dir" + fi mkdir -p "$_cqe_checkout_dir" if [ "$_external_type" = "git" ]; then if [ -z "$_external_tag" ]; then @@ -1952,10 +1981,16 @@ checkout_external() { if [[ "$_external_uri" == *"wowace.com"* || "$_external_uri" == *"curseforge.com"* ]]; then project_site="https://wow.curseforge.com" fi + # If a .pkgmeta file is present, process it for "ignore" and "plain-copy" lists. - parse_ignore "$_cqe_checkout_dir/.pkgmeta" "$_external_dir" + parse_ignore "$_cqe_checkout_dir/.pkgmeta" "$_external_dir" "$_external_path" + if [ -n "$_external_path" ]; then + echo "Changing to /$_external_path" + _cqe_checkout_dir="$_cqe_checkout_dir/$_external_path" + cd "$_cqe_checkout_dir" || return 1 + fi copy_directory_tree -dnpe -i "$ignore" -u "$unchanged" "$_cqe_checkout_dir" "$pkgdir/$_external_dir" - ) + ) || return 1 # Remove the ".checkout" subdirectory containing the full checkout. if [ -d "$_cqe_checkout_dir" ]; then rm -fr "$_cqe_checkout_dir" @@ -1970,8 +2005,13 @@ external_tag= external_type= external_slug= external_checkout_type= +external_path= process_external() { if [ -n "$external_dir" ] && [ -n "$external_uri" ] && [ -z "$skip_externals" ]; then + external_uri=${external_uri%%#*} # strip trailing comment + external_uri=${external_uri% *} # strip trailing space + external_uri=${external_uri%/} # strip trailing slash + # convert old curse repo urls case $external_uri in *git.curseforge.com*|*git.wowace.com*) @@ -2010,7 +2050,7 @@ process_external() { fi # check if the repo is svn - _svn_path=${external_uri#*/wow/$external_slug/} + local _svn_path=${external_uri#*/wow/$external_slug/} if [[ "$_svn_path" == "trunk"* ]]; then external_type="svn" elif [[ "$_svn_path" == "tags/"* ]]; then @@ -2022,12 +2062,25 @@ process_external() { fi fi + if [[ $external_type == "git" ]]; then + # check for subpath in urls we know the structure of + if [[ -n $external_slug && $external_uri == *"$external_slug/"* ]]; then + # CF: https://repos.curseforge.com/wow/libdothings-1-0/LibDoThings-1.0 + external_path=${external_uri#*/wow/$external_slug/} + external_uri=${external_uri%/$external_path*} + elif [[ $external_uri == "https://github.com/"*/*/* ]]; then + # GitHub: https://github.com/nebularg/LibDoThings-1.0.git/LibDoThings-1.0 + external_path=${external_uri#*.com/*/*/} + external_uri=${external_uri%/$external_path*} + fi + fi + if [ -n "$external_slug" ]; then - relations["$external_slug"]="embeddedLibrary" + relations["${external_slug,,}"]="embeddedLibrary" fi echo "Fetching external: $external_dir" - checkout_external "$external_dir" "$external_uri" "$external_tag" "$external_type" "$external_slug" "$external_checkout_type" &> "$releasedir/.$BASHPID.externalout" & + checkout_external "$external_dir" "$external_uri" "$external_tag" "$external_type" "$external_slug" "$external_checkout_type" "$external_path" &> "$releasedir/.$BASHPID.externalout" & external_pids+=($!) fi external_dir= @@ -2036,6 +2089,7 @@ process_external() { external_type= external_slug= external_checkout_type= + external_path= } # Don't leave extra files around if exited early @@ -2054,7 +2108,7 @@ if [ -z "$skip_externals" ] && [ -f "$pkgmeta_file" ]; then continue fi # Strip any trailing CR character. - yaml_line=${yaml_line%$carriage_return} + yaml_line="${yaml_line%"$carriage_return"}" case $yaml_line in [!\ ]*:*) @@ -2063,10 +2117,10 @@ if [ -z "$skip_externals" ] && [ -f "$pkgmeta_file" ]; then # Split $yaml_line into a $yaml_key, $yaml_value pair. yaml_keyvalue "$yaml_line" # Set the $pkgmeta_phase for stateful processing. - pkgmeta_phase=$yaml_key + pkgmeta_phase="$yaml_key" ;; " "*) - yaml_line=${yaml_line#"${yaml_line%%[! ]*}"} # trim leading whitespace + yaml_line="${yaml_line#"${yaml_line%%[! ]*}"}" # trim leading whitespace case $yaml_line in "- "*) ;; @@ -2076,29 +2130,30 @@ if [ -z "$skip_externals" ] && [ -f "$pkgmeta_file" ]; then case $pkgmeta_phase in externals) case $yaml_key in - url) external_uri=$yaml_value ;; + url) external_uri="$yaml_value" ;; tag) - external_tag=$yaml_value - external_checkout_type=$yaml_key + external_tag="$yaml_value" + external_checkout_type="$yaml_key" ;; branch) - external_tag=$yaml_value - external_checkout_type=$yaml_key + external_tag="$yaml_value" + external_checkout_type="$yaml_key" ;; commit) - external_tag=$yaml_value - external_checkout_type=$yaml_key + external_tag="$yaml_value" + external_checkout_type="$yaml_key" ;; - type) external_type=$yaml_value ;; - curse-slug) external_slug=$yaml_value ;; + type) external_type="$yaml_value" ;; + curse-slug) external_slug="$yaml_value" ;; + path) external_path="$yaml_value" ;; *) # Started a new external, so checkout any queued externals. process_external - external_dir=$yaml_key + external_dir="$yaml_key" nolib_exclude="$nolib_exclude $pkgdir/$external_dir/*" if [ -n "$yaml_value" ]; then - external_uri=$yaml_value + external_uri="$yaml_value" # Immediately checkout this fully-specified external. process_external fi @@ -2162,17 +2217,25 @@ fi # Create a changelog in the package directory if the source directory does # not contain a manual changelog. -if [ -n "$manual_changelog" ] && [ -f "$pkgdir/$changelog" ]; then + +changelog_path= +if [[ -n "$manual_changelog" && -f "$topdir/$changelog" ]]; then + if [[ -f "$pkgdir/$changelog" ]]; then + # use the processed copy + changelog_path="$pkgdir/$changelog" + else + changelog_path="$topdir/$changelog" + fi start_group "Using manual changelog $changelog" "changelog" - head -n7 "$pkgdir/$changelog" - [ "$( wc -l < "$pkgdir/$changelog" )" -gt 7 ] && echo "..." + head -n7 "$changelog_path" + [ "$( wc -l < "$changelog_path" )" -gt 7 ] && echo "..." end_group "changelog" # Convert Markdown to BBCode (with HTML as an intermediary) for sending to WoWInterface # Requires pandoc (http://pandoc.org/) - if [ "$changelog_markup" = "markdown" ] && [ -n "$wowi_convert_changelog" ] && hash pandoc &>/dev/null; then + if [ "$changelog_markup" = "markdown" ] && [ -n "$wowi_convert_changelog" ] && command -v pandoc &>/dev/null; then wowi_changelog="$releasedir/WOWI-$project_version-CHANGELOG.txt" - pandoc -f commonmark -t html "$pkgdir/$changelog" | sed \ + pandoc -f commonmark -t html "$changelog_path" | sed \ -e 's/<\(\/\)\?\(b\|i\|u\)>/[\1\2]/g' \ -e 's/<\(\/\)\?em>/[\1i]/g' \ -e 's/<\(\/\)\?strong>/[\1b]/g' \ @@ -2206,6 +2269,7 @@ else fi changelog="CHANGELOG.md" changelog_markup="markdown" + changelog_path="$pkgdir/$changelog" if [ -n "$wowi_gen_changelog" ] && [ -z "$wowi_convert_changelog" ]; then wowi_markup="markdown" @@ -2265,7 +2329,7 @@ else fi changelog_date=$( TZ='' printf "%(%Y-%m-%d)T" "$project_timestamp" ) - cat <<- EOF | line_ending_filter > "$pkgdir/$changelog" + cat <<- EOF | line_ending_filter > "$changelog_path" # $project ## $changelog_version ($changelog_date) @@ -2278,7 +2342,7 @@ else -e 's/\[ci skip\]//g' -e 's/\[skip ci\]//g' \ -e '/git-svn-id:/d' -e '/^[[:space:]]*This reverts commit [0-9a-f]\{40\}\.[[:space:]]*$/d' \ -e '/^[[:space:]]*$/d' \ - | line_ending_filter >> "$pkgdir/$changelog" + | line_ending_filter >> "$changelog_path" # WoWI uses BBCode, generate something usable to post to the site # the file is deleted on successful upload @@ -2307,7 +2371,7 @@ else fi changelog_date=$( TZ='' printf "%(%Y-%m-%d)T" "$project_timestamp" ) - cat <<- EOF | line_ending_filter > "$pkgdir/$changelog" + cat <<- EOF | line_ending_filter > "$changelog_path" # $project ## $project_version ($changelog_date) @@ -2321,7 +2385,7 @@ else -e 's/\([a-zA-Z0-9]\)_\([a-zA-Z0-9]\)/\1\\_\2/g' \ -e 's/\[ci skip\]//g' -e 's/\[skip ci\]//g' \ -e '/^[[:space:]]*$/d' \ - | line_ending_filter >> "$pkgdir/$changelog" + | line_ending_filter >> "$changelog_path" # WoWI uses BBCode, generate something usable to post to the site # the file is deleted on successful upload @@ -2352,13 +2416,13 @@ else fi changelog_date=$( TZ='' printf "%(%Y-%m-%d)T" "$project_timestamp" ) - cat <<- EOF | line_ending_filter > "$pkgdir/$changelog" + cat <<- EOF | line_ending_filter > "$changelog_path" # $project ## $project_version ($changelog_date) EOF - hg --cwd "$topdir" log -r "$_changelog_range" --template '- {fill(desc|strip, 76, "", " ")}\n' | line_ending_filter >> "$pkgdir/$changelog" + hg --cwd "$topdir" log -r "$_changelog_range" --template '- {fill(desc|strip, 76, "", " ")}\n' | line_ending_filter >> "$changelog_path" # WoWI uses BBCode, generate something usable to post to the site # the file is deleted on successful upload @@ -2375,10 +2439,28 @@ else fi fi - echo "$(<"$pkgdir/$changelog")" + echo "$(<"$changelog_path")" end_group "changelog" fi +### +### Create a license if not present and .pkgmeta requests one. +### + +if [[ -n "$license" && ! -f "$topdir/$license" && -n "$slug" ]]; then + start_group "Saving license as $license" "license" + # curseforge.com is protected by cloudflare, but wowace.com isn't? >.> + if license_text=$( curl -sf --retry 3 --retry-delay 10 "https://www.wowace.com/project/$slug/license" 2>/dev/null ); then + # text is wrapped with \n\n
\n\t

\n\t\t ... \n\t

\n
\n + echo "$license_text" | sed -e '1,4d' -e '5s/^\s*//' -e '$d' | sed '$d' > "$pkgdir/$license" + head -n10 "$pkgdir/$license" + [[ "$( wc -l < "$pkgdir/$license" )" -gt 10 ]] && echo "..." + else + echo "There was an error saving the license. ($?)" + fi + end_group "license" +fi + ### ### Process .pkgmeta to perform move-folders actions. ### @@ -2423,6 +2505,10 @@ if [ -f "$pkgmeta_file" ]; then echo "Moving $yaml_key to $yaml_value" mv -f "$srcdir"/* "$destdir" && rm -fr "$srcdir" zip_root_dirs+=("$yaml_value") + # Copy the license into $destdir if one doesn't already exist. + if [[ -n "$license" && -f "$pkgdir/$license" && ! -f "$destdir/$license" ]]; then + cp -f "$pkgdir/$license" "$destdir/$license" + fi # Check to see if the base source directory is empty _mf_basedir="/${yaml_key%/*}" while [[ -n "$_mf_basedir" && -z "$( ls -A "${releasedir}${_mf_basedir}" )" ]]; do @@ -2475,8 +2561,8 @@ if [ -z "$skip_zipfile" ]; then nolib_archive= fi - if [ -n "$GITHUB_ACTIONS" ]; then - echo "::set-output name=archive_path::${archive}" + if [[ -n $GITHUB_ACTIONS ]]; then + echo "archive_path=${archive}" >> "$GITHUB_OUTPUT" fi start_group "Creating archive: $archive_name ($archive_label)" "archive" @@ -2530,23 +2616,24 @@ upload_curseforge() { fi local _cf_game_version_id _cf_game_version _cf_versions - _cf_versions=$( curl -s -H "x-api-token: $cf_token" $project_site/api/game/versions ) + _cf_versions=$( curl -s -H "x-api-token: $cf_token" "$project_site/api/game/versions" ) if [[ -n $_cf_versions && $_cf_versions != *"errorMessage"* ]]; then _cf_game_version_id= _cf_game_version= local version_name version_id game_id - for type in "classic" "bcc" "wrath" "retail"; do # sort order (last id is show as the version on the project's files page apparently) + for type in "classic" "bcc" "wrath" "cata" "retail"; do # sort order (last id is show as the version on the project's files page apparently) version_name="${game_type_version[$type]}" [[ -z $version_name ]] && continue case $type in classic) game_id=67408 ;; bcc) game_id=73246 ;; wrath) game_id=73713 ;; + cata) game_id=77522 ;; *) game_id=517 esac # check the version - if ! jq -e --arg v "$version_name" 'map(select(.name == $v)) | length > 0' <<< "$_cf_versions" &>/dev/null; then + if ! jq -e --arg v "$version_name" --argjson t "$game_id" 'map(select(.gameVersionTypeID == $t and .name == $v)) | length > 0' <<< "$_cf_versions" &>/dev/null; then # no match, so grab the next highest version (try to avoid testing versions) version_name=$( echo "$_cf_versions" | jq -r --arg v "$version_name" --argjson t "$game_id" 'map(select(.gameVersionTypeID == $t and .name < $v)) | max_by(.id) | .name // empty' ) if [[ -z $version_name ]]; then @@ -2582,7 +2669,7 @@ upload_curseforge() { "displayName": "$archive_label", "gameVersions": $_cf_game_version_id, "releaseType": "$file_type", - "changelog": $( jq --slurp --raw-input '.' < "$pkgdir/$changelog" ), + "changelog": $( jq --slurp --raw-input '.' < "$changelog_path" ), "changelogType": "$changelog_markup" } EOF @@ -2596,7 +2683,7 @@ upload_curseforge() { _cf_payload=$( echo "$_cf_payload $_cf_payload_relations" | jq -s -c '.[0] * .[1]' ) fi - echo "Uploading $archive_name ($_cf_game_version $file_type) to $project_site/projects/$slug" + echo "Uploading $archive_name ($_cf_game_version $file_type) to https://www.curseforge.com/projects/$slug" resultfile="$releasedir/cf_result.json" if result=$( echo "$_cf_payload" | curl -sS --retry 3 --retry-delay 10 \ -w "%{http_code}" -o "$resultfile" \ @@ -2631,6 +2718,7 @@ upload_curseforge() { rm -f "$resultfile" 2>/dev/null + # shellcheck disable=SC2086 return $return_code } @@ -2650,6 +2738,7 @@ upload_wowinterface() { classic) wowi_type="Classic" ;; bcc) wowi_type="TBC-Classic" ;; wrath) wowi_type="WOTLK-Classic" ;; + cata) wowi_type="Cata-Classic" ;; *) wowi_type="Retail" esac # check the version @@ -2657,15 +2746,18 @@ upload_wowinterface() { # use the next highest version (try to avoid testing versions) version=$( echo "$_wowi_versions" | jq -r --arg v "$version" --arg t "$wowi_type" 'map(select(.game == $t and .id < $v)) | max_by(.id) | .id // empty' ) if [[ -z $version ]]; then - # now that .game exists, maybe default per type is in the future? - version=$( echo "$_wowi_versions" | jq -r --arg t "$wowi_type" '.[] | select(.game == $t and .default == true ) | .id // empty' ) - if [[ -z $version ]]; then # just grab the highest version - version=$( echo "$_wowi_versions" | jq -r --arg t "$wowi_type" 'map(select(.game == $t)) | max_by(.id) | .id' ) - fi + # just grab the highest version + version=$( echo "$_wowi_versions" | jq -r --arg t "$wowi_type" 'map(select(.game == $t)) | max_by(.id) | .id // empty' ) fi - echo "WARNING: No WoWInterface game version match for \"${game_type_version[$type]}\", using \"$version\"" >&2 + if [[ -z $version ]]; then + echo "WARNING: No WoWInterface game version match for \"${game_type_version[$type]}\", \"$wowi_type\" is not supported" >&2 + else + echo "WARNING: No WoWInterface game version match for \"${game_type_version[$type]}\", using \"$version\"" >&2 + fi + fi + if [[ -n $version ]]; then + _wowi_game_version+=",${version}" fi - _wowi_game_version+=",${version}" done _wowi_game_version="${_wowi_game_version#,}" fi @@ -2685,7 +2777,7 @@ upload_wowinterface() { if [ -f "$wowi_changelog" ]; then _wowi_args+=("-F changelog=<$wowi_changelog") elif [ -n "$manual_changelog" ] || [ "$wowi_markup" = "markdown" ]; then - _wowi_args+=("-F changelog=<$pkgdir/$changelog") + _wowi_args+=("-F changelog=<$changelog_path") fi if [ -z "$wowi_archive" ]; then _wowi_args+=("-F archive=No") @@ -2733,6 +2825,7 @@ upload_wowinterface() { rm -f "$resultfile" 2>/dev/null + # shellcheck disable=SC2086 return $return_code } @@ -2792,12 +2885,12 @@ upload_wago() { "label": "$archive_label", $_wago_support_property "stability": "$_wago_stability", - "changelog": $( jq --slurp --raw-input '.' < "$pkgdir/$changelog" ) + "changelog": $( jq --slurp --raw-input '.' < "$changelog_path" ) } EOF ) - echo "Uploading $archive_name ($_wago_game_version $file_type) to Wago" + echo "Uploading $archive_name ($_wago_game_version $file_type) to https://addons.wago.io/addons/$wagoid" resultfile="$releasedir/wago_result.json" if result=$( echo "$_wago_payload" | curl -sS --retry 3 --retry-delay 10 \ -w "%{http_code}" -o "$resultfile" \ @@ -2833,6 +2926,7 @@ upload_wago() { rm -f "$resultfile" 2>/dev/null + # shellcheck disable=SC2086 return $return_code } @@ -2884,6 +2978,7 @@ upload_github_asset() { rm -f "$_ghf_resultfile" 2>/dev/null + # shellcheck disable=SC2086 return $return_code } @@ -2924,7 +3019,7 @@ upload_github() { { "tag_name": "$tag", "name": "$tag", - "body": $( jq --slurp --raw-input '.' < "$pkgdir/$changelog" ), + "body": $( jq --slurp --raw-input '.' < "$changelog_path" ), "draft": false, "prerelease": $( [[ "$file_type" != "release" ]] && echo true || echo false ) } @@ -3000,12 +3095,13 @@ upload_github() { rm -f "$resultfile" 2>/dev/null [ -z "$CI" ] && rm -f "$versionfile" 2>/dev/null + # shellcheck disable=SC2086 return $return_code } if [[ -z $skip_upload && -n $archive && -s $archive ]]; then - if ! hash jq &>/dev/null; then + if ! command -v jq &>/dev/null; then echo "Skipping upload because \"jq\" was not found." echo exit_code=1 @@ -3023,4 +3119,5 @@ echo echo "Packaging complete." echo -exit $exit_code +# shellcheck disable=SC2086 +exit $exit_code \ No newline at end of file From 205e1d206e5786a18a6417b3ed62f44d16f555a9 Mon Sep 17 00:00:00 2001 From: evil_morfar <10189576+evil-morfar@users.noreply.github.com> Date: Thu, 2 May 2024 16:46:31 +0200 Subject: [PATCH 12/12] Updated build script --- .scripts/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scripts/build.sh b/.scripts/build.sh index a4f76d3..b6c303a 100644 --- a/.scripts/build.sh +++ b/.scripts/build.sh @@ -26,7 +26,7 @@ cp -R "$curDir/RCLootCouncil/Libs/" "$curDir/.tmp/RCLootCouncil_Classic/RCLootCo "$release_script" -do -g classic -r "$curDir/.tmp" -m ".pkgmeta-build" # Build for BBC -"$release_script" -do -g wrath -r "$curDir/.tmp" -m ".pkgmeta-build" +"$release_script" -do -g cata -r "$curDir/.tmp" -m ".pkgmeta-build" # # Move the zip