zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Show patchlevel in version string
@ 2021-09-03 17:38 Wesley Schwengle
  2022-03-31  5:43 ` Lawrence Velázquez
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wesley Schwengle @ 2021-09-03 17:38 UTC (permalink / raw)
  To: zsh-workers

When building zsh with a custom patch level you cannot quickly see which
patchlevel you are on via `zsh --version'. When using zsh on Debian or
in my case, where I run the git version of zsh the patch level is hidden
in an environment variable ZSH_PATCHLEVEL. Git for example shows you the
git revision when issues `git --version' as seen here:

  $ git --version
  git version 2.33.0.113.g6c40894d24

This shows directly what version a user is running without having to
know about ZSH_PATCHLEVEL.

Because I'm not aware how downstream deals with a difference in version
strings I've decided to add it to the vendor/os type bit. Debian for
example uses `debian/5.8-6+b2' as a patch level. This would probably
break scripts which expect `zsh x.y.z' if the patch level replaced the
ZSH_VERSION string.

After this patch is applied, you get to see the following version string
after you configured zsh with `--enable-custom-patchlevel=$(git describe)':

  $ ./Src/zsh --version
  zsh 5.8.0.2-dev (x86_64-pc-linux-gnu/zsh-5.8-481-g64befeb4c)

Signed-off-by: Wesley Schwengle <wesley@opperschaap.net>
---
 Src/init.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Src/init.c b/Src/init.c
index 878a53a37..a04d599c3 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -421,8 +421,14 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
 		/* GNU-style long options */
 		++*argv;
 		if (!strcmp(*argv, "version")) {
+#ifdef CUSTOM_PATCHLEVEL
+		    printf("zsh %s (%s-%s-%s/%s)\n",
+			    ZSH_VERSION, MACHTYPE, VENDOR, OSTYPE, CUSTOM_PATCHLEVEL);
+#else
 		    printf("zsh %s (%s-%s-%s)\n",
 			    ZSH_VERSION, MACHTYPE, VENDOR, OSTYPE);
+#endif
+
 		    LAST_OPTION(0);
 		}
 		if (!strcmp(*argv, "help")) {
-- 
2.33.0.113.g6c40894d24



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Show patchlevel in version string
  2021-09-03 17:38 [PATCH] Show patchlevel in version string Wesley Schwengle
@ 2022-03-31  5:43 ` Lawrence Velázquez
  2022-03-31  7:55 ` Axel Beckert
  2022-04-10 21:35 ` Daniel Shahaf
  2 siblings, 0 replies; 4+ messages in thread
From: Lawrence Velázquez @ 2022-03-31  5:43 UTC (permalink / raw)
  To: zsh-workers; +Cc: wesley

On Fri, Sep 3, 2021, at 1:38 PM, Wesley Schwengle wrote:
> After this patch is applied, you get to see the following version string
> after you configured zsh with `--enable-custom-patchlevel=$(git describe)':
>
>   $ ./Src/zsh --version
>   zsh 5.8.0.2-dev (x86_64-pc-linux-gnu/zsh-5.8-481-g64befeb4c)
>
> Signed-off-by: Wesley Schwengle <wesley@opperschaap.net>
> ---
>  Src/init.c | 6 ++++++
>  1 file changed, 6 insertions(+)

*bump*

(Apologies for the delay, Wesley.)

-- 
vq


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Show patchlevel in version string
  2021-09-03 17:38 [PATCH] Show patchlevel in version string Wesley Schwengle
  2022-03-31  5:43 ` Lawrence Velázquez
@ 2022-03-31  7:55 ` Axel Beckert
  2022-04-10 21:35 ` Daniel Shahaf
  2 siblings, 0 replies; 4+ messages in thread
From: Axel Beckert @ 2022-03-31  7:55 UTC (permalink / raw)
  To: zsh-workers

Hi,

On Fri, Sep 03, 2021 at 01:38:03PM -0400, Wesley Schwengle wrote:
> Debian for example uses `debian/5.8-6+b2' as a patch level.

JFTR: That's not completely correct. Only "5.8-6" is the patch level.
"+b2" is the build counter for binary packages rebuilt from the same
source code against usually newer build-dependencies. (And "debian/"
is just the tag prefix in git, but there are never build counts like
"+b2" present in git tags in Debian.)

		Kind regards, Axel (with his Debian hat on :-)
-- 
PGP: 2FF9CD59612616B5      /~\  Plain Text Ribbon Campaign, http://arc.pasp.de/
Mail: abe@deuxchevaux.org  \ /  Say No to HTML in E-Mail and Usenet
Mail+Jabber: abe@noone.org  X
https://axel.beckert.ch/   / \  I love long mails: https://email.is-not-s.ms/


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Show patchlevel in version string
  2021-09-03 17:38 [PATCH] Show patchlevel in version string Wesley Schwengle
  2022-03-31  5:43 ` Lawrence Velázquez
  2022-03-31  7:55 ` Axel Beckert
@ 2022-04-10 21:35 ` Daniel Shahaf
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2022-04-10 21:35 UTC (permalink / raw)
  To: wesley; +Cc: zsh-workers

Wesley Schwengle wrote on Fri, Sep 03, 2021 at 13:38:03 -0400:
> After this patch is applied, you get to see the following version string
> after you configured zsh with `--enable-custom-patchlevel=$(git describe)':
> 
>   $ ./Src/zsh --version
>   zsh 5.8.0.2-dev (x86_64-pc-linux-gnu/zsh-5.8-481-g64befeb4c)

Adding the git revision there makes sense, I suppose, but why should
this only be done when that configure option is used?  The git revision
is added to ZSH_PATCHLEVEL (which is a shell variable, not an
environment variable) by default, without needing any configure flags.

Or another perspective: CUSTOM_PATCHLEVEL is used to cause
$ZSH_PATCHLEVEL to be set to something other than its default.  So, 
why shouldn't the #else branch emit the default value of $ZSH_PATCHLEVEL?

tl;dr: Why not include the (build's default) value of $ZSH_PATCHLEVEL in
the output?

Cheers,

Daniel


> Signed-off-by: Wesley Schwengle <wesley@opperschaap.net>
> ---
>  Src/init.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/Src/init.c b/Src/init.c
> index 878a53a37..a04d599c3 100644
> --- a/Src/init.c
> +++ b/Src/init.c
> @@ -421,8 +421,14 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp,
>  		/* GNU-style long options */
>  		++*argv;
>  		if (!strcmp(*argv, "version")) {
> +#ifdef CUSTOM_PATCHLEVEL
> +		    printf("zsh %s (%s-%s-%s/%s)\n",
> +			    ZSH_VERSION, MACHTYPE, VENDOR, OSTYPE, CUSTOM_PATCHLEVEL);
> +#else
>  		    printf("zsh %s (%s-%s-%s)\n",
>  			    ZSH_VERSION, MACHTYPE, VENDOR, OSTYPE);
> +#endif
> +
>  		    LAST_OPTION(0);
>  		}
>  		if (!strcmp(*argv, "help")) {
> -- 
> 2.33.0.113.g6c40894d24
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-10 21:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03 17:38 [PATCH] Show patchlevel in version string Wesley Schwengle
2022-03-31  5:43 ` Lawrence Velázquez
2022-03-31  7:55 ` Axel Beckert
2022-04-10 21:35 ` Daniel Shahaf

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).