diff mbox series

[RFC] scripts/qemu-version.sh: Always describe tag version

Message ID 20200924163509.142565-1-f4bug@amsat.org
State New
Headers show
Series [RFC] scripts/qemu-version.sh: Always describe tag version | expand

Commit Message

Philippe Mathieu-Daudé Sept. 24, 2020, 4:35 p.m. UTC
I'm not sure why sometime I get this error:

  $ make
  Generating qemu-version.h with a meson_exe.py custom command
  fatal: No tags can describe 'dc9f825f99eb5dc82f127e6c95fbe3a503e11346'.
  Try --always, or create some tags.

While to --always option is not clear in GIT-DESCRIBE(1):

   --always
       Show uniquely abbreviated commit object as fallback.

using it works and fix my builds:

  $ git describe --match 'v*' --dirty --always
  dc9f825f99e-dirty

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 scripts/qemu-version.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

罗勇刚(Yonggang Luo) Oct. 5, 2020, 5:01 p.m. UTC | #1
On windows executing
"pkgversion=$(git describe --match 'v*' --dirty --always | echo "")"
$ bash ./scripts/qemu-version.sh . '' ''
#define QEMU_PKGVERSION ""
#define QEMU_FULL_VERSION ""

The result are empty.

By removing echo ""
        pkgversion=$(git describe --match 'v*' --dirty --always)
the result are
```
$ bash ./scripts/qemu-version.sh . '' ''
#define QEMU_PKGVERSION "v5.1.0-1922-g94f35f943a-dirty"
#define QEMU_FULL_VERSION " (v5.1.0-1922-g94f35f943a-dirty)"
```

What are expected?


On Fri, Sep 25, 2020 at 12:50 AM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:
>
> I'm not sure why sometime I get this error:
>
>   $ make
>   Generating qemu-version.h with a meson_exe.py custom command
>   fatal: No tags can describe 'dc9f825f99eb5dc82f127e6c95fbe3a503e11346'.
>   Try --always, or create some tags.
>
> While to --always option is not clear in GIT-DESCRIBE(1):
>
>    --always
>        Show uniquely abbreviated commit object as fallback.
>
> using it works and fix my builds:
>
>   $ git describe --match 'v*' --dirty --always
>   dc9f825f99e-dirty
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  scripts/qemu-version.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh
> index 03128c56a2c..a7135511588 100755
> --- a/scripts/qemu-version.sh
> +++ b/scripts/qemu-version.sh
> @@ -9,7 +9,7 @@ version="$3"
>  if [ -z "$pkgversion" ]; then
>      cd "$dir"
>      if [ -e .git ]; then
> -        pkgversion=$(git describe --match 'v*' --dirty | echo "")
> +        pkgversion=$(git describe --match 'v*' --dirty --always | echo
"")
>      fi
>  fi
>
> --
> 2.26.2
>
>


--
         此致
礼
罗勇刚
Yours
    sincerely,
Yonggang Luo
<div dir="ltr">On windows executing<div>&quot;pkgversion=$(git describe --match &#39;v*&#39; --dirty --always | echo &quot;&quot;)&quot;</div><div>$ bash ./scripts/qemu-version.sh . &#39;&#39; &#39;&#39;<br>#define QEMU_PKGVERSION &quot;&quot;<br>#define QEMU_FULL_VERSION &quot;&quot;<br><br>The result are empty.<br><br>By removing echo &quot;&quot;<br>        pkgversion=$(git describe --match &#39;v*&#39; --dirty --always)<br>the result are<br>```</div><div>$ bash ./scripts/qemu-version.sh . &#39;&#39; &#39;&#39;<br>#define QEMU_PKGVERSION &quot;v5.1.0-1922-g94f35f943a-dirty&quot;<br>#define QEMU_FULL_VERSION &quot; (v5.1.0-1922-g94f35f943a-dirty)&quot;<br></div><div>```</div><div><br></div><div>What are expected?<br><br><br>On Fri, Sep 25, 2020 at 12:50 AM Philippe Mathieu-Daudé &lt;<a href="mailto:f4bug@amsat.org">f4bug@amsat.org</a>&gt; wrote:<br>&gt;<br>&gt; I&#39;m not sure why sometime I get this error:<br>&gt;<br>&gt;   $ make<br>&gt;   Generating qemu-version.h with a meson_exe.py custom command<br>&gt;   fatal: No tags can describe &#39;dc9f825f99eb5dc82f127e6c95fbe3a503e11346&#39;.<br>&gt;   Try --always, or create some tags.<br>&gt;<br>&gt; While to --always option is not clear in GIT-DESCRIBE(1):<br>&gt;<br>&gt;    --always<br>&gt;        Show uniquely abbreviated commit object as fallback.<br>&gt;<br>&gt; using it works and fix my builds:<br>&gt;<br>&gt;   $ git describe --match &#39;v*&#39; --dirty --always<br>&gt;   dc9f825f99e-dirty<br>&gt;<br>&gt; Signed-off-by: Philippe Mathieu-Daudé &lt;<a href="mailto:f4bug@amsat.org">f4bug@amsat.org</a>&gt;<br>&gt; ---<br>&gt;  scripts/qemu-version.sh | 2 +-<br>&gt;  1 file changed, 1 insertion(+), 1 deletion(-)<br>&gt;<br>&gt; diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh<br>&gt; index 03128c56a2c..a7135511588 100755<br>&gt; --- a/scripts/qemu-version.sh<br>&gt; +++ b/scripts/qemu-version.sh<br>&gt; @@ -9,7 +9,7 @@ version=&quot;$3&quot;<br>&gt;  if [ -z &quot;$pkgversion&quot; ]; then<br>&gt;      cd &quot;$dir&quot;<br>&gt;      if [ -e .git ]; then<br>&gt; -        pkgversion=$(git describe --match &#39;v*&#39; --dirty | echo &quot;&quot;)<br>&gt; +        pkgversion=$(git describe --match &#39;v*&#39; --dirty --always | echo &quot;&quot;)<br>&gt;      fi<br>&gt;  fi<br>&gt;<br>&gt; --<br>&gt; 2.26.2<br>&gt;<br>&gt;<br><br><br>--<br>         此致<br>礼<br>罗勇刚<br>Yours<br>    sincerely,<br>Yonggang Luo<br></div></div>
diff mbox series

Patch

diff --git a/scripts/qemu-version.sh b/scripts/qemu-version.sh
index 03128c56a2c..a7135511588 100755
--- a/scripts/qemu-version.sh
+++ b/scripts/qemu-version.sh
@@ -9,7 +9,7 @@  version="$3"
 if [ -z "$pkgversion" ]; then
     cd "$dir"
     if [ -e .git ]; then
-        pkgversion=$(git describe --match 'v*' --dirty | echo "")
+        pkgversion=$(git describe --match 'v*' --dirty --always | echo "")
     fi
 fi