All of lore.kernel.org
 help / color / mirror / Atom feed
* Ad git revision to image name
@ 2017-04-06 16:09 Grueninger, Tobias
  2017-04-07  4:42 ` Paul Eggleton
  0 siblings, 1 reply; 2+ messages in thread
From: Grueninger, Tobias @ 2017-04-06 16:09 UTC (permalink / raw)
  To: yocto

Hi,
I have a question:
I would like to automatically add the git Revison checksum to the generated Yocto image name, e.g. 'core-image-git_bc123456.img'
I fail miserably to add this in my image recipe - any help appreciated
Regards
Tobias



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

* Re: Ad git revision to image name
  2017-04-06 16:09 Ad git revision to image name Grueninger, Tobias
@ 2017-04-07  4:42 ` Paul Eggleton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2017-04-07  4:42 UTC (permalink / raw)
  To: Grueninger, Tobias; +Cc: yocto

Hi Tobias,

On Friday, 7 April 2017 4:09:45 AM NZST Grueninger, Tobias wrote:
> I would like to automatically add the git Revison checksum to the generated
> Yocto image name, e.g. 'core-image-git_bc123456.img'

Well, the immediate question would be which git revision is this? Your custom 
layer? Poky / OE-core? The kernel?

As for the mechanism, assuming you can get the revision at parse time, it's a 
bit crude but you could do something like this:

python() {
    repopath = '/path/to/git/repository'
    gitver = subprocess.check_output('git rev-parse HEAD', cwd=repopath)
    d.appendVar('IMAGE_BASENAME', '-git_%s' % gitver)
}

If parse time is too early you might try doing something at the start of 
do_rootfs, either a do_rootfs_prepend or a prefunc that does something similar 
to the above. In that case I'd be worried that we have other image tasks that 
look at IMAGE_BASENAME (via IMAGE_NAME) though.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

end of thread, other threads:[~2017-04-07  4:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06 16:09 Ad git revision to image name Grueninger, Tobias
2017-04-07  4:42 ` Paul Eggleton

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.