From 541c2470b8ad8c1c0c925d2474da44384b5d7d66 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Tue, 29 Mar 2011 20:35:48 -0400 Subject: makepkg: avoid usage of tr to sidestep locale issues to quote dan: "turkish will FUCK YOU UP. this is not the first or the last time" Signed-off-by: Dave Reisner Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index eb7c3701..dcc32343 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1039,13 +1039,12 @@ create_package() { local comp_files=".PKGINFO" # check for changelog/install files - for i in 'changelog' 'install'; do - orig=${!i} - dest=$(tr '[:lower:]' '[:upper:]' <<<".$i") + for i in 'changelog/.CHANGELOG' 'install/.INSTALL'; do + IFS='/' read -r orig dest <<< "$i" - if [[ -n $orig ]]; then - msg2 "$(gettext "Adding %s file...")" "$i" - cp "$startdir/$orig" "$dest" + if [[ -n ${!orig} ]]; then + msg2 "$(gettext "Adding %s file...")" "$orig" + cp "$startdir/${!orig}" "$dest" chmod 644 "$dest" comp_files+=" $dest" fi -- cgit v1.2.3-70-g09d2 From a164c8405a0fb08cc7783d51796fbb76d0e4f493 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Thu, 31 Mar 2011 11:12:58 +1000 Subject: makepkg: remove unnecessary tr usage The use of "tr" only leads to trouble. Remove unnecessary usage of it from within makepkg. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index dcc32343..193a1853 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -286,11 +286,10 @@ check_buildenv() { # ? - not found ## in_opt_array() { - local needle=$(tr '[:upper:]' '[:lower:]' <<< $1); shift + local needle=$1; shift local opt for opt in "$@"; do - opt=$(tr '[:upper:]' '[:lower:]' <<< $opt) if [[ $opt = $needle ]]; then echo 'y' # Enabled return @@ -578,7 +577,6 @@ generate_checksums() { local integ for integ in ${integlist[@]}; do - integ=$(tr '[:upper:]' '[:lower:]' <<< "$integ") case "$integ" in md5|sha1|sha256|sha384|sha512) : ;; *) -- cgit v1.2.3-70-g09d2 From 37df0d4f4fb042f8fbb39525d8d338968dd912bb Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Thu, 31 Mar 2011 11:08:55 +1000 Subject: makepkg: improve parsing for sanity checks Trailing backslahses can lead to additional spaces at the front of extracted entries. See FS#23524. Strip these while parsing the PKGBUILD entries. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 193a1853..b55ac427 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1256,7 +1256,7 @@ check_sanity() { local provides_list=() eval $(awk '/^[[:space:]]*provides=/,/\)/' "$BUILDFILE" | \ - sed -e "s/provides=/provides_list+=/" -e "s/#.*//") + sed -e "s/provides=/provides_list+=/" -e "s/#.*//" -e 's/\\$//') for i in ${provides_list[@]}; do if [[ $i != ${i///} ]]; then error "$(gettext "Provides array cannot contain comparison (< or >) operators.")" @@ -1266,7 +1266,7 @@ check_sanity() { local backup_list=() eval $(awk '/^[[:space:]]*backup=/,/\)/' "$BUILDFILE" | \ - sed -e "s/backup=/backup_list+=/" -e "s/#.*//") + sed -e "s/backup=/backup_list+=/" -e "s/#.*//" -e 's/\\$//') for i in "${backup_list[@]}"; do if [[ ${i:0:1} = "/" ]]; then error "$(gettext "Backup entry should not contain leading slash : %s")" "$i" @@ -1276,7 +1276,7 @@ check_sanity() { local optdepends_list=() eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(|#.*)$/' "$BUILDFILE" | \ - sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//") + sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//" -e 's/\\$//') for i in "${optdepends_list[@]}"; do local pkg=${i%%:*} if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]+$ ]]; then @@ -1301,7 +1301,7 @@ check_sanity() { local valid_options=1 local known kopt options_list eval $(awk '/^[[:space:]]*options=/,/\)/' "$BUILDFILE" | \ - sed -e "s/options=/options_list+=/" -e "s/#.*//") + sed -e "s/options=/options_list+=/" -e "s/#.*//" -e 's/\\$//') for i in ${options_list[@]}; do known=0 # check if option matches a known option or its inverse -- cgit v1.2.3-70-g09d2 From 40fd8123a292ad16610367922dbdff66460bc676 Mon Sep 17 00:00:00 2001 From: Rémy Oudompheng Date: Sat, 2 Apr 2011 12:31:19 +0200 Subject: makepkg: fix a GNU-ism in awk usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A non-GNU version of awk may not support the (|...) syntax for an optional group and require '()' to match an empty string. The (...)? syntax is more appropriate for this usage. Signed-off-by: Rémy Oudompheng Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index b55ac427..1c8c50e8 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1275,7 +1275,7 @@ check_sanity() { done local optdepends_list=() - eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(|#.*)$/' "$BUILDFILE" | \ + eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(#.*)?$/' "$BUILDFILE" | \ sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//" -e 's/\\$//') for i in "${optdepends_list[@]}"; do local pkg=${i%%:*} -- cgit v1.2.3-70-g09d2