adding specific config files
Hi,
In my project, we have our own rpm repository and we use smartpm on the target.
In order to have the target setup with the repo out of the box, we of course have added "package-management" in IMAGE_FEATURES. Now I'd like the target to have our repo address already configured.
The best way I found was to create a recipe in my overlay and hacking the system a little bit this way :do_install() {
if
${@base_contains('IMAGE_FEATURES','package-management','true','false',d)}; then
install -d ${D}/${sysconfdir}
install -m 644 ${WORKDIR}/config.in ${D}/var/lib/smart/config fi
}
where "config.in" is a simple copy of the non-human readable version of smartpm config file, generated manually on the target.
I was wondering if there would be a better way such as do not test in the do_install, but rather make the recipe dependent on the "package-management" image feature ? (so that do_install wouldn't even be considered if the option is not set), or any other smarter idea.
Thanks a lot,
Regards
Jay
Quoted 9 lines · JC
Hi,
In my project, we have our own rpm repository and we use smartpm on the target.
In order to have the target setup with the repo out of the box, we of course have added "package-management" inIMAGE_FEATURES. Now I'd like the target to have our repo address already configured.The best way I found was to create a recipe in my overlay and hacking the system a little bit this way :
do_install(){
if
${@base_contains('IMAGE_FEATURES','package-management','true','false',d)}; then
Quoted 9 lines
install -d ${D}/${sysconfdir} install -m 644 ${WORKDIR}/config.in ${D}/var/lib/smart/configfi
}where "config.in" is a simple copy of the non-human readable version of smartpm config file, generated manually on the target.
I was wondering if there would be a better way such as do not test in the
do_install, but rather make the recipe dependent on the "package-management" image feature ? (so thatdo_installwouldn't even be considered if the option is not set), or any other smarter idea.
Actually I _need_ a better idea because mine doesn't work: it actually creates what I want (/var/lib/smart/config) but since do_rootfs also uses this directory to install packages, it wipes it out at the end of the process... so my installation is removed :(
I'm sure someone else did something like this (but succeeded) ?
Regards
Jay
Quoted 15 lines · JC
Quoted 14 lines · JC
Hi,
In my project, we have our own rpm repository and we use smartpm on the target.
In order to have the target setup with the repo out of the box, we of course have added "package-management" inIMAGE_FEATURES. Now I'd like the target to have our repo address already configured.The best way I found was to create a recipe in my overlay and hacking the system a little bit this way :
do_install(){
if
${@base_contains('IMAGE_FEATURES','package-management','true','false',d)}; theninstall -d ${D}/${sysconfdir} install -m 644 ${WORKDIR}/config.in ${D}/var/lib/smart/configfi
}
Quoted 9 lines
Quoted 4 lines
where "config.in" is a simple copy of the non-human readable version of smartpm config file, generated manually on the target.
I was wondering if there would be a better way such as do not test in the
do_install, but rather make the recipe dependent on the "package-management" image feature ? (so thatdo_installwouldn't even be considered if the option is not set), or any other smarter idea.Actually I _need_ a better idea because mine doesn't work: it actually creates what I want (
/var/lib/smart/config) but sincedo_rootfsalso uses this directory to install packages, it wipes it out at the end of the process... so my installation is removed :(I'm sure someone else did something like this (but succeeded) ?
The guilty line is in /sources/poky/meta/classes/rootfs_rpm.bbclass
145: rm -rf ${IMAGE_ROOTFS}/var/lib/smart
:(
Whatever I want to do with packages, It'll be removed. There's probably an alternate way :(
Jay
Hi Jay,
Quoted 42 lines · On Wednesday 04 September 2013 22:10:10 JC wrote:
Quoted 34 lines · JC
Quoted 25 lines · JC
Hi,
In my project, we have our own rpm repository and we use smartpm on the target.
In order to have the target setup with the repo out of the box, we of course have added "package-management" inIMAGE_FEATURES. Now I'd like the target to have our repo address already configured.The best way I found was to create a recipe in my overlay and hacking the system a little bit this way :
do_install(){if
${@base_contains('IMAGE_FEATURES','package-management','true','false',d)} ;
theninstall -d ${D}/${sysconfdir} install -m 644 ${WORKDIR}/config.in ${D}/var/lib/smart/configfi
}
Quoted 7 lines
where "config.in" is a simple copy of the non-human readable version of smartpm config file, generated manually on the target.
I was wondering if there would be a better way such as do not test in the
do_install, but rather make the recipe dependent on the "package-management" image feature ? (so thatdo_installwouldn't even be considered if the option is not set), or any other smarter idea.Quoted 6 lines
Actually I _need_ a better idea because mine doesn't work: it actually creates what I want (
/var/lib/smart/config) but sincedo_rootfsalso uses this directory to install packages, it wipes it out at the end of the process... so my installation is removed :(I'm sure someone else did something like this (but succeeded) ?
Quoted 8 lines
The guilty line is in /sources/poky/meta/classes/rootfs_rpm.bbclass
145: rm -rf ${IMAGE_ROOTFS}/var/lib/smart
:(
Whatever I want to do with packages, It'll be removed. There's probably an alternate way :(
Unfortunately we have to have a fixed configuration for smart during do_rootfs, so it has to be written to. I think though that rather than trying to install a configuration file for smart using a separate recipe, I would suggest modifying the smart configuration at the end of do_rootfs to add the configuration elements you need. The way to do this would be to define a shell function that you can add a call to in ROOTFS_POSTPROCESS_COMMAND that will run smart:
add_extra_smart_config() {
smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y
}ROOTFS_POSTPROCESS_COMMAND += "add_extra_smart_config; "
You can put the above in the image recipe itself or in a class that your image recipe inherits.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
Quoted 62 lines · Paul Eggleton
Hi Jay,
Quoted 40 lines · On Wednesday 04 September 2013 22:10:10 JC wrote:
Quoted 33 lines · JC
Quoted 25 lines · JC
Hi,
In my project, we have our own rpm repository and we use smartpm on the target.
In order to have the target setup with the repo out of the box, we of course have added "package-management" inIMAGE_FEATURES. Now I'd like the target to have our repo address already configured.The best way I found was to create a recipe in my overlay and hacking the system a little bit this way :
do_install(){if
${@base_contains('IMAGE_FEATURES','package-management','true','false',d)} ;
theninstall -d ${D}/${sysconfdir} install -m 644 ${WORKDIR}/config.in ${D}/var/lib/smart/config fi}
Quoted 7 lines
where "config.in" is a simple copy of the non-human readable version of smartpm config file, generated manually on the target.
I was wondering if there would be a better way such as do not test in the
do_install, but rather make the recipe dependent on the "package-management" image feature ? (so thatdo_installwouldn't even be considered if the option is not set), or any other smarter idea.Quoted 6 lines
Actually I _need_ a better idea because mine doesn't work: it actually creates what I want (
/var/lib/smart/config) but sincedo_rootfsalso uses this directory to install packages, it wipes it out at the end of the process... so my installation is removed :(I'm sure someone else did something like this (but succeeded) ?
Quoted 8 lines
The guilty line is in /sources/poky/meta/classes/rootfs_rpm.bbclass
145: rm -rf ${IMAGE_ROOTFS}/var/lib/smart
:(
Whatever I want to do with packages, It'll be removed. There's probably an alternate way :(
Unfortunately we have to have a fixed configuration for smart during
do_rootfs, so it has to be written to. I think though that rather than trying to install a configuration file for smart using a separate recipe, I would suggest modifying the smart configuration at the end ofdo_rootfsto add the configuration elements you need. The way to do this would be to define a shell function that you can add a call to inROOTFS_POSTPROCESS_COMMANDthat will run smart:add_extra_smart_config() { smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y }
Quoted 8 lines
ROOTFS_POSTPROCESS_COMMAND+= "add_extra_smart_config; "You can put the above in the image recipe itself or in a class that your image recipe inherits.
Cheers,
Paul
Thanks, I'm going to try it !!
Assuming I don't want to create a new image (i still haven't exactly figured how to do this in a clean way), where should I append this code ? How can I make it dependend on the "package-management" feature?
Thanks again,
Jay
Quoted 19 lines · On Thursday 05 September 2013 11:45:26 JC wrote:
Quoted 18 lines · Paul Eggleton
Unfortunately we have to have a fixed configuration for smart during
do_rootfs, so it has to be written to. I think though that rather than trying to install a configuration file for smart using a separate recipe, I would suggest modifying the smart configuration at the end ofdo_rootfsto add the configuration elements you need. The way to do this would be to define a shell function that you can add a call to inROOTFS_POSTPROCESS_COMMANDthat will run smart:
add_extra_smart_config(){smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y> }
ROOTFS_POSTPROCESS_COMMAND+= "add_extra_smart_config; "You can put the above in the image recipe itself or in a class that your image recipe inherits.
Quoted 7 lines
Quoted 2 lines
Cheers,
PaulThanks, I'm going to try it !!
Assuming I don't want to create a new image (i still haven't exactly figured how to do this in a clean way), where should I append this code ?
To be honest I always recommend people create their own image recipes whatever they are doing since image recipes are usually trivial and almost always need to be customised. The easiest way to do this is to copy an existing image recipe and name it and modify it as you prefer.
Quoted 1 line
How can I make it dependend on the "package-management" feature?
If "package-management" is not in IMAGE_FEATURES the smart config gets deleted anyway so this will have no effect. However, if desired you can use an inline python expression within the shell function to do things conditionally, e.g.
if ${@base_contains("IMAGE_FEATURES", "package-management", "true", "false", d)}; then
...
fi
It's important to realise though that the evaluation of the inline python happens when the expression is parsed, not when the shell function it is executed; by the time the shell function executes the expression will have been converted to its result.
Cheers,
Paul
Signature · 2 lines
Paul Eggleton Intel Open Source Technology Centre
On jeu., sept. 5, 2013 at 12:00 PM, Paul Eggleton <[email protected]="mailto:[email protected]">> wrote:
On Thursday 05 September 2013 11:45:26 JC wrote:
Quoted 44 lines · Paul Eggleton
Quoted 33 lines
Unfortunately we have to have a fixed configuration for smart during
do_rootfs, so it has to be written to. I think though that rather thantrying to install a configuration file for smart using a separate recipe,
I would suggest modifying the smart configuration at the end of
do_rootfsto add the configuration elements you need. The way to do this would be
to define a shell function that you can add a call to in
ROOTFS_POSTPROCESS_COMMANDthat will run smart:
add_extra_smart_config(){smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y>}
ROOTFS_POSTPROCESS_COMMAND+= "add_extra_smart_config; "You can put the above in the image recipe itself or in a class that your
Quoted 7 lines
image recipe inherits.
Cheers,
Paul
Quoted 7 lines
Thanks, I'm going to try it !!
Assuming I don't want to create a new image (i still haven't exactly
figured how to do this in a clean way), where should I append this code ?
To be honest I always recommend people create their own image recipes
whatever they are doing since image recipes are usually trivial and
almost always need to be customised. The easiest way to do this is to
copy an existing image recipe and name it and modify it as you prefer.
Quoted 1 line
How can I make it dependend on the "package-management" feature?
If "package-management" is not in IMAGE_FEATURES the smart config gets deleted
anyway so this will have no effect. However, if desired you can use an inline
python expression within the shell function to do things conditionally, e.g.
if ${@base_contains("IMAGE_FEATURES", "package-management", "true", "false", d)}; then
...
fi
It's important to realise though that the evaluation of the inline
python happens when the expression is parsed, not when the shell
function it is executed; by the time the shell function executes the
expression will have been converted to its result.
Cheers,
Paul
Thanks ! I'm gonna try and let you know !
Jay
(solved) Re: adding specific config files
In reply to Paul EggletonHi Paul
Quoted 36 lines · Paul Eggleton
Quoted 19 lines · On Thursday 05 September 2013 11:45:26 JC wrote:
Quoted 18 lines · Paul Eggleton
Unfortunately we have to have a fixed configuration for smart during
do_rootfs, so it has to be written to. I think though that rather than trying to install a configuration file for smart using a separate recipe, I would suggest modifying the smart configuration at the end ofdo_rootfsto add the configuration elements you need. The way to do this would be to define a shell function that you can add a call to inROOTFS_POSTPROCESS_COMMANDthat will run smart:
add_extra_smart_config(){smart --data-dir=${IMAGE_ROOTFS}/var/lib/smart channel --add rpmsys type=rpm-sys -y> }
ROOTFS_POSTPROCESS_COMMAND+= "add_extra_smart_config; "You can put the above in the image recipe itself or in a class that your image recipe inherits.
Quoted 6 lines
Quoted 2 lines
Cheers,
PaulThanks, I'm going to try it !!
Assuming I don't want to create a new image (i still haven't exactly figured how to do this in a clean way), where should I append this code ?
To be honest I always recommend people create their own image recipes whatever they are doing since image recipes are usually trivial and almost always need to be customised. The easiest way to do this is to copy an existing image recipe and name it and modify it as you prefer.
Quoted 1 line
How can I make it dependend on the "package-management" feature?
If "package-management" is not in
IMAGE_FEATURESthe smart config gets deleted anyway so this will have no effect. However, if desired you can use an inline python expression within the shell function to do things conditionally, e.g.
Quoted 9 lines
if ${@base_contains("IMAGE_FEATURES", "package-management", "true", "false", d)}; then
...
fiIt's important to realise though that the evaluation of the inline python happens when the expression is parsed, not when the shell function it is executed; by the time the shell function executes the expression will have been converted to its result.
This worked perfectly. Just a slight append : your need to "install -d" the /var/lib/smartpm directory, otherwise it seems it's not created. Not a big deal anyway
Thanks again !!
Jay