All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] How to get the (GIT) Version string into the source code
@ 2019-10-10 13:54 Wolfgang Grandegger
  2019-10-10 16:59 ` Christian Stewart
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Grandegger @ 2019-10-10 13:54 UTC (permalink / raw)
  To: buildroot

Hello,

I'm looking for a simple method to get the package version string used
by buildroot into the source code of that package. Unfortunately, the
GIT version information is stripped off. For the moment, I use the name
of the build directory and pass it to the code via Makefile, but maybe
there is a more elegant version.

Wolfgang

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

* [Buildroot] How to get the (GIT) Version string into the source code
  2019-10-10 13:54 [Buildroot] How to get the (GIT) Version string into the source code Wolfgang Grandegger
@ 2019-10-10 16:59 ` Christian Stewart
  2019-10-11 10:32   ` Wolfgang Grandegger
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Stewart @ 2019-10-10 16:59 UTC (permalink / raw)
  To: buildroot

Hi Wolfgang,


On Thu, Oct 10, 2019, 6:54 AM Wolfgang Grandegger <wg@grandegger.com> wrote:

> I'm looking for a simple method to get the package version string used
> by buildroot into the source code of that package. Unfortunately, the
> GIT version information is stripped off. For the moment, I use the name
> of the build directory and pass it to the code via Makefile, but maybe
> there is a more elegant version.
>

See package/docker-engine/docker-engine.mk for an example. Here is a
permalink;

DOCKER_ENGINE_LDFLAGS = \
-X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
-X main.Version=$(DOCKER_ENGINE_VERSION)

You should use the $(MY_PACKAGE_VERSION) string as your version string.

If you want more details from "git describe" then unfortunately it's not as
easy as code often comes from a tarball exported from the source repo
rather than a full clone.

Best,
Christian Stewart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20191010/3aec3e2b/attachment.html>

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

* [Buildroot] How to get the (GIT) Version string into the source code
  2019-10-10 16:59 ` Christian Stewart
@ 2019-10-11 10:32   ` Wolfgang Grandegger
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Grandegger @ 2019-10-11 10:32 UTC (permalink / raw)
  To: buildroot

Hello Christian,

Am 10.10.19 um 18:59 schrieb Christian Stewart:
> Hi Wolfgang,
> 
> 
> On Thu, Oct 10, 2019, 6:54 AM Wolfgang Grandegger <wg@grandegger.com
> <mailto:wg@grandegger.com>> wrote:
> 
>     I'm looking for a simple method to get the package version string used
>     by buildroot into the source code of that package. Unfortunately, the
>     GIT version information is stripped off. For the moment, I use the name
>     of the build directory and pass it to the code via Makefile, but maybe
>     there is a more elegant version.
> 
> 
> See package/docker-engine/docker-engine.mk <http://docker-engine.mk> for
> an example. Here is a permalink;
> 
> DOCKER_ENGINE_LDFLAGS = \
> -X main.GitCommit=$(DOCKER_ENGINE_VERSION) \
> -X main.Version=$(DOCKER_ENGINE_VERSION)
> 
> You should use the $(MY_PACKAGE_VERSION) string as your version string.?

OK, I see, that's a more robust solution!

> If you want more details from "git describe" then unfortunately it's not
> as easy as code often comes from a tarball exported from the source repo
> rather than a full clone.?

It's mainly for our own code.

Thanks,

Wolfgang

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

end of thread, other threads:[~2019-10-11 10:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 13:54 [Buildroot] How to get the (GIT) Version string into the source code Wolfgang Grandegger
2019-10-10 16:59 ` Christian Stewart
2019-10-11 10:32   ` Wolfgang Grandegger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.