@@ -861,14 +861,19 @@ wowi_convert_changelog="true"
861
861
declare -A relations=()
862
862
863
863
parse_ignore () {
864
- pkgmeta=" $1 "
864
+ pkgmeta=" $1 " # full path to .pkgmeta
865
+ copy_path=" $2 " # the post-copy base path to match
866
+ sub_path=" $3 " # only includes matches in this path
867
+
865
868
[ -f " $pkgmeta " ] || return 1
866
869
867
- checkpath=" $topdir " # paths are relative to the topdir
868
- copypath=" "
869
- if [ " $2 " != " " ]; then
870
- checkpath=$( dirname " $pkgmeta " )
871
- copypath=" $2 /"
870
+ check_path=" $topdir /" # paths are relative to the topdir
871
+ if [ -n " $copy_path " ]; then
872
+ check_path=$( dirname " $pkgmeta " ) " /"
873
+ copy_path=" $copy_path /"
874
+ fi
875
+ if [[ -n $sub_path && $sub_path != * " /" ]]; then
876
+ sub_path=" $sub_path /"
872
877
fi
873
878
874
879
yaml_eof=
@@ -892,15 +897,16 @@ parse_ignore() {
892
897
yaml_line=${yaml_line# " ${yaml_line%% [! ]* } " } # trim leading whitespace
893
898
# Get the YAML list item.
894
899
yaml_listitem " $yaml_line "
895
- if [[ " $pkgmeta_phase " == " ignore" || " $pkgmeta_phase " == " plain-copy" ]]; then
896
- pattern=$yaml_item
897
- if [ -d " $checkpath /$pattern " ]; then
898
- pattern=" $copypath$pattern /*"
899
- elif [ ! -f " $checkpath /$pattern " ]; then
900
+ if [[ " $pkgmeta_phase " == " ignore" || " $pkgmeta_phase " == " plain-copy" ]] && [[ $yaml_item == " $sub_path " * ]]; then
901
+ yaml_item=${yaml_item% " /*" } # trim dir glob
902
+ pattern=${yaml_item# $sub_path } # match relative to sub_path
903
+ if [ -d " $check_path$yaml_item " ]; then
904
+ pattern=" $copy_path$pattern /*"
905
+ elif [ ! -f " $copy_path$yaml_item " ]; then
900
906
# doesn't exist so match both a file and a path
901
- pattern=" $copypath $pattern :$copypath $pattern /*"
907
+ pattern=" $copy_path $pattern :$copy_path $pattern /*"
902
908
else
903
- pattern=" $copypath $pattern "
909
+ pattern=" $copy_path $pattern "
904
910
fi
905
911
if [[ " $pkgmeta_phase " == " ignore" ]]; then
906
912
if [ -z " $ignore " ]; then
@@ -1866,6 +1872,7 @@ checkout_external() {
1866
1872
# shellcheck disable=SC2034
1867
1873
_external_slug=$5 # unused until we can easily fetch the project id
1868
1874
_external_checkout_type=$6
1875
+ _external_path=$7
1869
1876
1870
1877
_cqe_checkout_dir=" $pkgdir /$_external_dir /.checkout"
1871
1878
if [[ -d $_cqe_checkout_dir ]]; then
@@ -1971,8 +1978,14 @@ checkout_external() {
1971
1978
if [[ " $_external_uri " == * " wowace.com" * || " $_external_uri " == * " curseforge.com" * ]]; then
1972
1979
project_site=" https://wow.curseforge.com"
1973
1980
fi
1981
+
1974
1982
# If a .pkgmeta file is present, process it for "ignore" and "plain-copy" lists.
1975
- parse_ignore " $_cqe_checkout_dir /.pkgmeta" " $_external_dir "
1983
+ parse_ignore " $_cqe_checkout_dir /.pkgmeta" " $_external_dir " " $_external_path "
1984
+ if [ -n " $_external_path " ]; then
1985
+ echo " Changing to /$_external_path "
1986
+ _cqe_checkout_dir=" $_cqe_checkout_dir /$_external_path "
1987
+ cd " $_cqe_checkout_dir " || return 1
1988
+ fi
1976
1989
copy_directory_tree -dnpe -i " $ignore " -u " $unchanged " " $_cqe_checkout_dir " " $pkgdir /$_external_dir "
1977
1990
) || return 1
1978
1991
# Remove the ".checkout" subdirectory containing the full checkout.
@@ -1989,8 +2002,13 @@ external_tag=
1989
2002
external_type=
1990
2003
external_slug=
1991
2004
external_checkout_type=
2005
+ external_path=
1992
2006
process_external () {
1993
2007
if [ -n " $external_dir " ] && [ -n " $external_uri " ] && [ -z " $skip_externals " ]; then
2008
+ external_uri=${external_uri%%#* } # strip trailing comment
2009
+ external_uri=${external_uri% * } # strip trailing space
2010
+ external_uri=${external_uri%/ } # strip trailing slash
2011
+
1994
2012
# convert old curse repo urls
1995
2013
case $external_uri in
1996
2014
* git.curseforge.com* |* git.wowace.com* )
@@ -2029,7 +2047,7 @@ process_external() {
2029
2047
fi
2030
2048
2031
2049
# check if the repo is svn
2032
- _svn_path=${external_uri#*/ wow/ $external_slug / }
2050
+ local _svn_path=${external_uri#*/ wow/ $external_slug / }
2033
2051
if [[ " $_svn_path " == " trunk" * ]]; then
2034
2052
external_type=" svn"
2035
2053
elif [[ " $_svn_path " == " tags/" * ]]; then
@@ -2041,12 +2059,29 @@ process_external() {
2041
2059
fi
2042
2060
fi
2043
2061
2062
+ if [[ $external_type == " git" ]]; then
2063
+ # check for subpath in short form
2064
+ if [[ -n $external_slug && $external_uri == * " $external_slug /" * ]]; then
2065
+ # CF: `Libs/LibDoThings-1.0: https://repos.curseforge.com/wow/libdothings-1-0/LibDoThings-1.0`
2066
+ external_path=${external_uri#*/ wow/ $external_slug / }
2067
+ external_uri=${external_uri%/ $external_path * }
2068
+ elif [[ $external_uri == * " .git/" * ]]; then
2069
+ # Anything using .git: `Libs/LibDoThings-1.0: https://github.com/nebularg/LibDoThings-1.0.git/LibDoThings-1.0`
2070
+ external_path=${external_uri#* .git/ }
2071
+ external_uri=${external_uri%/ $external_path * }
2072
+ elif [[ $external_uri == " https://github.com/" * /* /* ]]; then
2073
+ # Github without .git: `Libs/LibDoThings-1.0: https://github.com/nebularg/LibDoThings-1.0/LibDoThings-1.0`
2074
+ external_path=${external_uri#* .com/*/*/ }
2075
+ external_uri=${external_uri%/ $external_path * }
2076
+ fi
2077
+ fi
2078
+
2044
2079
if [ -n " $external_slug " ]; then
2045
2080
relations[" ${external_slug,,} " ]=" embeddedLibrary"
2046
2081
fi
2047
2082
2048
2083
echo " Fetching external: $external_dir "
2049
- checkout_external " $external_dir " " $external_uri " " $external_tag " " $external_type " " $external_slug " " $external_checkout_type " & > " $releasedir /.$BASHPID .externalout" &
2084
+ checkout_external " $external_dir " " $external_uri " " $external_tag " " $external_type " " $external_slug " " $external_checkout_type " " $external_path " & > " $releasedir /.$BASHPID .externalout" &
2050
2085
external_pids+=($! )
2051
2086
fi
2052
2087
external_dir=
@@ -2055,6 +2090,7 @@ process_external() {
2055
2090
external_type=
2056
2091
external_slug=
2057
2092
external_checkout_type=
2093
+ external_path=
2058
2094
}
2059
2095
2060
2096
# Don't leave extra files around if exited early
@@ -2110,6 +2146,7 @@ if [ -z "$skip_externals" ] && [ -f "$pkgmeta_file" ]; then
2110
2146
;;
2111
2147
type) external_type=$yaml_value ;;
2112
2148
curse-slug) external_slug=$yaml_value ;;
2149
+ path) external_path=$yaml_value ;;
2113
2150
* )
2114
2151
# Started a new external, so checkout any queued externals.
2115
2152
process_external
0 commit comments