Skip to content

Commit fafae95

Browse files
committed
Add plain-copy list to .pkgmeta for copying files without processing
1 parent 7957498 commit fafae95

File tree

2 files changed

+49
-18
lines changed

2 files changed

+49
-18
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ for more info.
100100
- *externals* (Git, SVN, and Mercurial) Caveats: An external's .pkgmeta is only
101101
parsed for ignore and externals will not have localization keywords replaced.
102102
- *ignore*
103+
- *plain-copy*
103104
- *changelog-title*
104105
- *manual-changelog*
105106
- *move-folders*

release.sh

+48-18
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ changelog=
759759
changelog_markup="text"
760760
enable_nolib_creation=
761761
ignore=
762+
unchanged=
762763
contents=
763764
nolib_exclude=
764765
wowi_gen_changelog="true"
@@ -798,7 +799,7 @@ parse_ignore() {
798799
yaml_line=${yaml_line#"${yaml_line%%[! ]*}"} # trim leading whitespace
799800
# Get the YAML list item.
800801
yaml_listitem "$yaml_line"
801-
if [ "$pkgmeta_phase" = "ignore" ]; then
802+
if [[ "$pkgmeta_phase" == "ignore" || "$pkgmeta_phase" == "plain-copy" ]]; then
802803
pattern=$yaml_item
803804
if [ -d "$checkpath/$pattern" ]; then
804805
pattern="$copypath$pattern/*"
@@ -808,10 +809,18 @@ parse_ignore() {
808809
else
809810
pattern="$copypath$pattern"
810811
fi
811-
if [ -z "$ignore" ]; then
812-
ignore="$pattern"
813-
else
814-
ignore="$ignore:$pattern"
812+
if [[ "$pkgmeta_phase" == "ignore" ]]; then
813+
if [ -z "$ignore" ]; then
814+
ignore="$pattern"
815+
else
816+
ignore="$ignore:$pattern"
817+
fi
818+
elif [[ "$pkgmeta_phase" == "plain-copy" ]]; then
819+
if [ -z "$unchanged" ]; then
820+
unchanged="$pattern"
821+
else
822+
unchanged="$unchanged:$pattern"
823+
fi
815824
fi
816825
fi
817826
;;
@@ -903,6 +912,20 @@ if [ -f "$pkgmeta_file" ]; then
903912
ignore="$ignore:$pattern"
904913
fi
905914
;;
915+
plain-copy)
916+
pattern=$yaml_item
917+
if [ -d "$topdir/$pattern" ]; then
918+
pattern="$pattern/*"
919+
elif [ ! -f "$topdir/$pattern" ]; then
920+
# doesn't exist so match both a file and a path
921+
pattern="$pattern:$pattern/*"
922+
fi
923+
if [ -z "$unchanged" ]; then
924+
unchanged="$pattern"
925+
else
926+
unchanged="$unchanged:$pattern"
927+
fi
928+
;;
906929
tools-used)
907930
relations["$yaml_item"]="tool"
908931
;;
@@ -1579,33 +1602,32 @@ copy_directory_tree() {
15791602
( cd "$_cdt_srcdir" && eval "$_cdt_find_cmd" ) | while read -r file; do
15801603
file=${file#./}
15811604
if [ -f "$_cdt_srcdir/$file" ]; then
1582-
# Check if the file should be ignored.
1583-
skip_copy=
1605+
_cdt_skip_copy=
1606+
_cdt_only_copy=
15841607
# Prefix external files with the relative pkgdir path
15851608
_cdt_check_file=$file
15861609
if [ -n "${_cdt_destdir#$pkgdir}" ]; then
15871610
_cdt_check_file="${_cdt_destdir#$pkgdir/}/$file"
15881611
fi
15891612
# Skip files matching the colon-separated "ignored" shell wildcard patterns.
1590-
if [ -z "$skip_copy" ] && match_pattern "$_cdt_check_file" "$_cdt_ignored_patterns"; then
1591-
skip_copy="true"
1613+
if match_pattern "$_cdt_check_file" "$_cdt_ignored_patterns"; then
1614+
_cdt_skip_copy="true"
15921615
fi
15931616
# Never skip files that match the colon-separated "unchanged" shell wildcard patterns.
1594-
unchanged=
1595-
if [ -n "$skip_copy" ] && match_pattern "$file" "$_cdt_unchanged_patterns"; then
1596-
skip_copy=
1597-
unchanged="true"
1617+
if match_pattern "$file" "$_cdt_unchanged_patterns"; then
1618+
_cdt_skip_copy=
1619+
_cdt_only_copy="true"
15981620
fi
15991621
# Copy unskipped files into $_cdt_destdir.
1600-
if [ -n "$skip_copy" ]; then
1622+
if [ -n "$_cdt_skip_copy" ]; then
16011623
echo " Ignoring: $file"
16021624
else
16031625
dir=${file%/*}
16041626
if [ "$dir" != "$file" ]; then
16051627
mkdir -p "$_cdt_destdir/$dir"
16061628
fi
16071629
# Check if the file matches a pattern for keyword replacement.
1608-
if [ -n "$unchanged" ] || ! match_pattern "$file" "*.lua:*.md:*.toc:*.txt:*.xml"; then
1630+
if [ -n "$_cdt_only_copy" ] || ! match_pattern "$file" "*.lua:*.md:*.toc:*.txt:*.xml"; then
16091631
echo " Copying: $file (unchanged)"
16101632
cp "$_cdt_srcdir/$file" "$_cdt_destdir/$dir"
16111633
else
@@ -1728,12 +1750,20 @@ if [ -z "$skip_copying" ]; then
17281750
[ -n "$split" ] && cdt_args+="S"
17291751
[ -n "$game_type" ] && cdt_args+=" -g $game_type"
17301752
[ -n "$ignore" ] && cdt_args+=" -i \"$ignore\""
1731-
[ -n "$changelog" ] && cdt_args+=" -u \"$changelog\""
1753+
if [ -n "$changelog" ]; then
1754+
if [ -z "$unchanged" ]; then
1755+
unchanged="$changelog"
1756+
else
1757+
unchanged="$unchanged:$changelog"
1758+
fi
1759+
fi
1760+
[ -n "$unchanged" ] && cdt_args+=" -u \"$unchanged\""
17321761
eval copy_directory_tree "$cdt_args" "\"$topdir\"" "\"$pkgdir\""
17331762
fi
17341763

17351764
# Reset ignore and parse pkgmeta ignores again to handle ignoring external paths
17361765
ignore=
1766+
unchanged=
17371767
parse_ignore "$pkgmeta_file"
17381768

17391769
###
@@ -1864,9 +1894,9 @@ checkout_external() {
18641894
if [[ "$_external_uri" == *"wowace.com"* || "$_external_uri" == *"curseforge.com"* ]]; then
18651895
project_site="https://wow.curseforge.com"
18661896
fi
1867-
# If a .pkgmeta file is present, process it for an "ignore" list.
1897+
# If a .pkgmeta file is present, process it for "ignore" and "plain-copy" lists.
18681898
parse_ignore "$_cqe_checkout_dir/.pkgmeta" "$_external_dir"
1869-
copy_directory_tree -dnpe -i "$ignore" "$_cqe_checkout_dir" "$pkgdir/$_external_dir"
1899+
copy_directory_tree -dnpe -i "$ignore" -u "$unchanged" "$_cqe_checkout_dir" "$pkgdir/$_external_dir"
18701900
)
18711901
# Remove the ".checkout" subdirectory containing the full checkout.
18721902
if [ -d "$_cqe_checkout_dir" ]; then

0 commit comments

Comments
 (0)