[pacman-dev] [PATCHv3] [makepkg] Print out new version on change

Allan McRae allan at archlinux.org
Thu Dec 13 08:35:46 EST 2012


On 07/12/12 03:21, William Giokas wrote:
> When building sources that have a pkgver() function, makepkg prints:
>   ==> Making package: $pkgname $pkgver-$pkgrel $(date)
> which, normally, works out fine. Only problem is using vcs sources with
> a pkgver() function, it will print out the old version. So, if there is
> an update, the user won't know what version the package changed to till
> after the build. This patch adds in a line that prints out
>   ==> Updated version from $oldversion to $newversion
> if the version has changed.
> Because makepkg now supports not having an initial pkgver if there is a
> pkgver() function, check to see if there is a pkgver set and choose
> between two less awkward ways of saying that the version is updated and
> the pkgrel has been reset to 1.
> 
> Signed-off-by: William Giokas <1007380 at gmail.com>
> ---
>  scripts/makepkg.sh.in | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 2fe6605..d34261b 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -699,6 +699,11 @@ update_pkgver() {
>  		if [[ -f $BUILDFILE && -w $BUILDFILE ]]; then
>  			@SEDINPLACE@ "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "$BUILDFILE"
>  			@SEDINPLACE@ "s/^pkgrel=[^ ]*/pkgrel=1/" "$BUILDFILE"
> +			if [[ -n "$pkgver" ]]; then
> +				msg "$(gettext "Updated version: %s-%s to %s-1")" $pkgver $pkgrel $newpkgver
> +			else
> +				msg "$(gettext "Updated version to %s-1")" $newpkgver
> +			fi

So... this misses the epoch (if there is one) when it prints out the
version.  How about a v4 with.

local fullver=$(get_full_version)
msg "$(gettext "Updated version: %s")" "$pkgbase $fullver"

after the source line below...

If you want to print the old version too (is that needed?), then you
will need to store the version before and after.

>  			source "$BUILDFILE"
>  		else
>  			warning "$(gettext "%s is not writeable -- pkgver will not be updated")" \
> 



More information about the pacman-dev mailing list