mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [RFC PATCH] setlocalversion: Also match non-annotated tags
@ 2018-09-06  8:39 Alexander Dahl
  2018-09-07 10:01 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Dahl @ 2018-09-06  8:39 UTC (permalink / raw)
  To: ptxdist

From the Git manual:

       --tags
           Instead of using only the annotated tags, use any tag found
           in refs/tags namespace. This option enables matching a
           lightweight (non-annotated) tag.

This fixes the case for PTXDIST_BSP_AUTOVERSION returning things like
????.??.?-?-gcb7418a2299c-dirty when the last tag in the BSP was only a
lightweight one, no annotated tag.

Signed-off-by: Alexander Dahl <ada@thorsis.com>
---
 scripts/kernel/setlocalversion | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/kernel/setlocalversion b/scripts/kernel/setlocalversion
index 3feb87dce..fd852cb26 100755
--- a/scripts/kernel/setlocalversion
+++ b/scripts/kernel/setlocalversion
@@ -55,12 +55,12 @@ if head=`git ${git_abbrev} rev-parse --verify --short HEAD 2>/dev/null`; then
 
 	# If we are at a tagged commit (like "ptxdist-2010.05.0"), we
 	# print it here
-	if atag="`git describe --exact-match 2>/dev/null`"; then
+	if atag="`git describe --tags --exact-match 2>/dev/null`"; then
 		echo "$atag" | awk -F- '{printf("%s", $(NF))}'
 
 	# If we are past a tagged commit (like "ptxdist-2010.03.0-130-g3c60777"),
 	# we pretty print it.
-	elif atag="`git ${git_abbrev} describe 2>/dev/null`"; then
+	elif atag="`git ${git_abbrev} describe --tags 2>/dev/null`"; then
 		echo "$atag" | awk -F- '{printf("%s-%05d-%s", $(NF-2),$(NF-1),$(NF))}'
 
 	# If we don't have a tag at all we print ????.??.?-?-g{commitish}.
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [RFC PATCH] setlocalversion: Also match non-annotated tags
  2018-09-06  8:39 [ptxdist] [RFC PATCH] setlocalversion: Also match non-annotated tags Alexander Dahl
@ 2018-09-07 10:01 ` Michael Olbrich
  2018-09-07 10:11   ` Alexander Dahl
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2018-09-07 10:01 UTC (permalink / raw)
  To: ptxdist

On Thu, Sep 06, 2018 at 10:39:27AM +0200, Alexander Dahl wrote:
> From the Git manual:
> 
>        --tags
>            Instead of using only the annotated tags, use any tag found
>            in refs/tags namespace. This option enables matching a
>            lightweight (non-annotated) tag.
> 
> This fixes the case for PTXDIST_BSP_AUTOVERSION returning things like
> ????.??.?-?-gcb7418a2299c-dirty when the last tag in the BSP was only a
> lightweight one, no annotated tag.

Nack. Using only annotated tags is a deliberate choice we made. Changing
this would break all kinds of existing use-cases.

I think it would be ok to make this optional (opt-in) in the script. And
then define a custom ptxd_bsp_autoversion() in your BSP to enable this.

Michael

> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> ---
>  scripts/kernel/setlocalversion | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/kernel/setlocalversion b/scripts/kernel/setlocalversion
> index 3feb87dce..fd852cb26 100755
> --- a/scripts/kernel/setlocalversion
> +++ b/scripts/kernel/setlocalversion
> @@ -55,12 +55,12 @@ if head=`git ${git_abbrev} rev-parse --verify --short HEAD 2>/dev/null`; then
>  
>  	# If we are at a tagged commit (like "ptxdist-2010.05.0"), we
>  	# print it here
> -	if atag="`git describe --exact-match 2>/dev/null`"; then
> +	if atag="`git describe --tags --exact-match 2>/dev/null`"; then
>  		echo "$atag" | awk -F- '{printf("%s", $(NF))}'
>  
>  	# If we are past a tagged commit (like "ptxdist-2010.03.0-130-g3c60777"),
>  	# we pretty print it.
> -	elif atag="`git ${git_abbrev} describe 2>/dev/null`"; then
> +	elif atag="`git ${git_abbrev} describe --tags 2>/dev/null`"; then
>  		echo "$atag" | awk -F- '{printf("%s-%05d-%s", $(NF-2),$(NF-1),$(NF))}'
>  
>  	# If we don't have a tag at all we print ????.??.?-?-g{commitish}.
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] [RFC PATCH] setlocalversion: Also match non-annotated tags
  2018-09-07 10:01 ` Michael Olbrich
@ 2018-09-07 10:11   ` Alexander Dahl
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Dahl @ 2018-09-07 10:11 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich

Hello,

Am Freitag, 7. September 2018, 12:01:05 CEST schrieb Michael Olbrich:
> On Thu, Sep 06, 2018 at 10:39:27AM +0200, Alexander Dahl wrote:
> > This fixes the case for PTXDIST_BSP_AUTOVERSION returning things like
> > ????.??.?-?-gcb7418a2299c-dirty when the last tag in the BSP was only a
> > lightweight one, no annotated tag.
> 
> Nack. Using only annotated tags is a deliberate choice we made. Changing
> this would break all kinds of existing use-cases.

Okay, I'm fine with that. I will just have to remember that, when creating 
tags in a BSP. Or maybe I can even make use of it.

> I think it would be ok to make this optional (opt-in) in the script. And
> then define a custom ptxd_bsp_autoversion() in your BSP to enable this.

That's why I tagged this RFC. No need to add additional complexity here.

Thanks for your answer. :-)

Greets
Alex


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2018-09-07 10:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-06  8:39 [ptxdist] [RFC PATCH] setlocalversion: Also match non-annotated tags Alexander Dahl
2018-09-07 10:01 ` Michael Olbrich
2018-09-07 10:11   ` Alexander Dahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox