yocto-cooker icon indicating copy to clipboard operation
yocto-cooker copied to clipboard

Add a menu template command

Open adri1mart1 opened this issue 2 years ago • 9 comments

Hello there :)

I am starting a brand new project using cooker. Initial repo README suggest to start with cooker cook MENU or cooker init MENU. I didn't found an easy way to get a menu template. I think at the moment, we need to pick up a random recipe in the sample dir and remove / add what we need ?

2 suggestions to ease starting:

  • A template file commited to the repository.
  • A command such as cooker menutemplate that output to stdout the template

The template I'm expected to get would be:

{
	"sources" : [
		{ "url": "git://git.yoctoproject.org/poky", "branch": "xxx", "rev": "xxx" },
                { "url": "git://git.openembedded.org/meta-openembedded", "branch": "xxx", "rev": "xxx" }
	],

	"layers" : [
		"poky/meta",
		"poky/meta-poky",
		"poky/meta-yocto-bsp",
		"meta-openembedded/meta-oe"
	],

	"builds" : {
		"xxx": {
			"target" : "xxxx",

			"layers" : [],

			"local.conf": [
				"MACHINE = 'xxx' "
			]
		}
	}
}

This template should have basically the minimum required for 90% of menus like the 3 json main nodes (sources / layers / builds), Some common basic layers (poky and openembedded), and a single build target named xxx.

What is your point of view ?

adri1mart1 avatar Jan 23 '23 13:01 adri1mart1

Fun fact, I suggested quite the same feature last week during a meeting with Patrick :-)

cpb- avatar Jan 23 '23 15:01 cpb-

Good idea create empty template, maybe based on supported variants (and branches ?) Maybe using jinja2 for templates? Overkill?

cooker create-menu -b kirkstone -r openembedded/poky <path/to/newly-created-menu-file.json>

pboettch avatar Jan 23 '23 17:01 pboettch

I would say maybe overkill because to me, the point of this command is only to save time from creating the correct json template. Add the -b branch_name just to put the correct branch name in the menu doesn't same much time. I believe once you have a full empty template, it's really easy to find where to fill up things,

adri1mart1 avatar Jan 26 '23 08:01 adri1mart1

I was referring to your prefilled source poky and openembedded. There are other bitbake-based distributions we are supporting which are using other based repositories. We should support them and then user should be able to select them. That's why my complex example.

pboettch avatar Jan 26 '23 10:01 pboettch

Yes I think I understood well what you suggest. I think the functionality "create-menu" is needed but the key is to have an idea of what it does in details. Few questions I'm asking to myself but maybe you can share your point of view ?

  • if we provide a -b arg (I suppose for branch), the next argument is just a string with no constraints ? you can write -b banana ?
  • if we provide a -r arg (I suppose for remote), it means (as per your example) that you provide a key string such as "openembedded" and yocto-cooker internally knows which URL to set. What happens if this URL changes ? yocto-cooker deployed versions needs an update :x You also have multiple variants (ssh / http / https), which one do you choose ?
  • Would it be possible to use -r arg with un full URL ?

adri1mart1 avatar Jan 27 '23 08:01 adri1mart1

No, -r stands for release; maybe it would be better to name it -d for distribution. -b can be any arbitrary.

pboettch avatar Jan 27 '23 17:01 pboettch

Alright, well that was ambiguous this -r. My last 2 interogations above remains unanswered :x

adri1mart1 avatar Jan 30 '23 08:01 adri1mart1

  • I'd used the https one by default, up to you to change.
  • Now that '-r' has no more the meaning of remote but rather -d for distribution your question concerning the usage of an URL can be answered with No.

pboettch avatar Jan 30 '23 13:01 pboettch

Makes sense then ! If you give me some days I can try to add this feature ? or do you want to do it yourself ?

adri1mart1 avatar Jan 30 '23 13:01 adri1mart1