All of lore.kernel.org
 help / color / mirror / Atom feed
* Setting a custom hostname using git revisions?
@ 2018-04-04 15:48 Giordon Stark
  2018-04-04 16:13 ` Stephano Cetola
  0 siblings, 1 reply; 3+ messages in thread
From: Giordon Stark @ 2018-04-04 15:48 UTC (permalink / raw)
  To: N:

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Hi all,

I looked at the bitbake manual, but if I have a custom layer that's checked
out at a specific revision, how can I access the variable containing the
revision to embed it into the hostname variable?

I would want to append the hostname variable in:
recipes-core/base-files/base-files_%.bbappend which is currently set to
"${MACHINE}".

Instead, I would like something along the lines of
"${MACHINE}-${LAYER_REV}".

Thanks,

Giordon
-- 
Giordon Stark

[-- Attachment #2: Type: text/html, Size: 725 bytes --]

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

* Re: Setting a custom hostname using git revisions?
  2018-04-04 15:48 Setting a custom hostname using git revisions? Giordon Stark
@ 2018-04-04 16:13 ` Stephano Cetola
  2018-04-04 21:58   ` Stephano Cetola
  0 siblings, 1 reply; 3+ messages in thread
From: Stephano Cetola @ 2018-04-04 16:13 UTC (permalink / raw)
  To: Giordon Stark; +Cc: yocto

On 4/4/18 8:48 AM, Giordon Stark wrote:
> Hi all,
> 
> I looked at the bitbake manual, but if I have a custom layer that's
> checked out at a specific revision, how can I access the variable
> containing the revision to embed it into the hostname variable?
> 
> I would want to append the hostname variable in:
> recipes-core/base-files/base-files_%.bbappend which is currently set to
> "${MACHINE}".
> 
> Instead, I would like something along the lines of
> "${MACHINE}-${LAYER_REV}".
> 
> Thanks,
> 
> Giordon
> -- 
> Giordon Stark
> 
> 

This is pretty tricky. I'd use a python function inside your recipe.

You can get the layers like this:

layers = (bb.data.getVar("BBLAYERS", d, 1) or "").split()

Then if you have a look at the metadata_scm.bbclass, you can use some of
the functions in there:

base_get_metadata_git_branch
base_get_metadata_git_revision

Add some logic and you should be able to pull the revision information
you care about out of that data.

Cheers,
Stephano




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

* Re: Setting a custom hostname using git revisions?
  2018-04-04 16:13 ` Stephano Cetola
@ 2018-04-04 21:58   ` Stephano Cetola
  0 siblings, 0 replies; 3+ messages in thread
From: Stephano Cetola @ 2018-04-04 21:58 UTC (permalink / raw)
  To: yocto

On 4/4/18 9:13 AM, Stephano Cetola wrote:
> On 4/4/18 8:48 AM, Giordon Stark wrote:
>> Hi all,
>>
>> I looked at the bitbake manual, but if I have a custom layer that's
>> checked out at a specific revision, how can I access the variable
>> containing the revision to embed it into the hostname variable?
>>
>> I would want to append the hostname variable in:
>> recipes-core/base-files/base-files_%.bbappend which is currently set to
>> "${MACHINE}".
>>
>> Instead, I would like something along the lines of
>> "${MACHINE}-${LAYER_REV}".
>>
>> Thanks,
>>
>> Giordon
>> -- 
>> Giordon Stark
>>
>>
> 
> This is pretty tricky. I'd use a python function inside your recipe.
> 
> You can get the layers like this:
> 
> layers = (bb.data.getVar("BBLAYERS", d, 1) or "").split()
> 
> Then if you have a look at the metadata_scm.bbclass, you can use some of
> the functions in there:
> 
> base_get_metadata_git_branch
> base_get_metadata_git_revision
> 
> Add some logic and you should be able to pull the revision information
> you care about out of that data.
> 
> Cheers,
> Stephano
> 
> 
A rather elaborate example of how to get the revision number can be seen
here:

https://github.com/openembedded/openembedded-core/blob/master/meta/classes/image-buildinfo.bbclass

--S


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

end of thread, other threads:[~2018-04-04 21:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 15:48 Setting a custom hostname using git revisions? Giordon Stark
2018-04-04 16:13 ` Stephano Cetola
2018-04-04 21:58   ` Stephano Cetola

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.