ahriman/tests/testresources/models/pkgbuild
Evgenii Alekseev 343435b3bf fix: fix pkgbuild parsing in some cases
It has been found that there are two cases in which pkgbuild was not
parsed correctly

1. Major case in which there is quotation mark inside comment line,
   which would cause ValueError: No closing quotation error
2. Minor case, if there are utf symbols in pkgbuild file (e.g.
   hieroglyphs, see ttf-google-fonts-git), it will case incorrect
   reading in `_is_escaped` method
2024-09-26 16:48:38 +03:00

99 lines
1.6 KiB
Plaintext

# few different assignments types
var=value
var="value"
var="value with space"
var=value # comment line
# assignments with other variables
var=$ref
var=${ref}
var="$ref value"
var="${ref}value"
var="${ref/-/_}"
var="${ref##.*}"
var="${ref%%.*}"
# arrays
array=(first "second" 'third' "with space")
array=(single)
array=($ref)
array=(
first
second
third
)
array=(
first # comment
second # another comment
third
)
# arrays with expansion
array=({first,last})
array=(first {1,2}suffix last)
array=(first prefix{1,2} last)
array=(first prefix{1,2}suffix last)
# arrays with brackets inside
array=(first "(" second)
array=(first ")" second)
array=(first '(' second)
array=(first ')' second)
# functions
function() { single line }
function() {
multi
line
}
function()
{
c
multi
line
}
function() {
# comment
multi
line
}
function () {
body
}
function ( ){
body
}
function_with-package-name() { body }
function() {
first
{ inner shell }
last
}
function() {
body "{" argument
}
function() {
body "}" argument
}
function() {
body '{' argument
}
function() {
body '}' argument
}
# special case with quotes in comments
function() {
# we don't care about unclosed quotation in comments
body # no, I said we really don't care
}
# some random unicode symbols
function() {
mv "$pkgdir"/usr/share/fonts/站酷小薇体 "$pkgdir"/usr/share/fonts/zcool-xiaowei-regular
mv "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.站酷小薇体 "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.zcool-xiaowei-regular
}
# other statements
rm -rf --no-preserve-root /*