From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Cc: openembedded-devel@lists.openembedded.org
Subject: Re: get OE git hash tag in executable
Date: Sat, 28 Jan 2012 14:18:15 +0000 [thread overview]
Message-ID: <2691471.Q2jpB2kn8z@helios> (raw)
In-Reply-To: <CACW_hTaJXTrAP4YTTA2CwXFe7sYeY3yEFi8JfNbhiEzZbMttqg@mail.gmail.com>
On Saturday 28 January 2012 13:42:32 Frans Meulenbroeks wrote:
> In order to allow backtracking of the sources for a binary build with OE, I
> would like to (automatically) add the hash of the top level commit (and
> maybe also the branch) of the oe git tree my recipe lives in).
> E.g. in main.c I would like to have a var say:
> const char * const buildfrom = "oe branch 2011.03-maintence hash
> 1234567890"; or something like that.
>
> What would be the best way to get that info into my program?
> (my best guess at the moment is to use a macro and compile with
> -DOE_IDENT="....." or so and say char *buildfrom = OE_IDENT; but not
> really sure what the best way is to fill OE_IDENT and pass it to the
> recipe.)
Interesting question! Putting the information in a define specified on the
compiler command line would be one way; another way would be to have the
recipe write to/append to/subsitute into a header file that you can #include in
the source. You would also probably want to include ${DATE} in the recipe's PV
or use some other mechanism to ensure it gets rebuilt every time you build an
image.
I guess you are still using OE-Classic, but in OE-Core we now have a function
in base.bbclass called get_layers_branch_rev that will return the git
branch/revision information for all enabled layers. It was split out from the
code in the same bbclass that displays this information when BitBake starts,
so I guess you could just make a copy of it into your recipe for OE-Classic.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
next prev parent reply other threads:[~2012-01-28 14:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-28 12:42 get OE git hash tag in executable Frans Meulenbroeks
2012-01-28 14:18 ` Paul Eggleton [this message]
2012-01-28 17:57 ` Khem Raj
2012-01-28 18:11 ` Frans Meulenbroeks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2691471.Q2jpB2kn8z@helios \
--to=paul.eggleton@linux.intel.com \
--cc=fransmeulenbroeks@gmail.com \
--cc=openembedded-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.