[pacman-dev,v2,3/3] makepkg: check_pkgver: Report what the bad pkgver is

Message ID 20180809174114.29405-4-lukeshu@lukeshu.com
State Changes Requested
Headers show
Series makepkg: Improve lint_pkgbuild error messages for epoch/ver/rel | expand

Commit Message

Luke Shumaker Aug. 9, 2018, 5:41 p.m. UTC
From: Luke Shumaker <lukeshu@parabola.nu>

For consistency with check_epoch and check_pkgrel.

I think that this is important because if there are multiple
provides/depends/whatever that include a version, and one of them is
malformed, including the bad version in the error message identified
which one is the problem.
---
 scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Allan McRae Jan. 10, 2019, 6:12 a.m. UTC | #1
On 10/8/18 3:41 am, Luke Shumaker wrote:
> From: Luke Shumaker <lukeshu@parabola.nu>
> 
> For consistency with check_epoch and check_pkgrel.
> 
> I think that this is important because if there are multiple
> provides/depends/whatever that include a version, and one of them is
> malformed, including the bad version in the error message identified
> which one is the problem.
> ---
>  scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
> index c105212b..65216b64 100644
> --- a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
> +++ b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
> @@ -38,7 +38,7 @@ check_pkgver() {
>  	fi
>  
>  	if [[ $ver = *[[:space:]/:-]* ]]; then
> -		error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace.")" "pkgver${type:+ in $type}"
> +		error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace; got %s.")" "pkgver${type:+ in $type}" "$ver"
>  		return 1
>  	fi
>  }

I'm not a fan of the message...  How about:

error "$(gettext "%s (%s) is not allowed to contain colons, forward
slashes, hyphens or whitespace.")" "pkgver${type:+ in $type}" "$ver"

Allan

Patch

diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
index c105212b..65216b64 100644
--- a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
@@ -38,7 +38,7 @@  check_pkgver() {
 	fi
 
 	if [[ $ver = *[[:space:]/:-]* ]]; then
-		error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace.")" "pkgver${type:+ in $type}"
+		error "$(gettext "%s is not allowed to contain colons, forward slashes, hyphens or whitespace; got %s.")" "pkgver${type:+ in $type}" "$ver"
 		return 1
 	fi
 }