* can pkg_{pre, post}rm functions be run at all for image creation?
@ 2014-08-02 16:34 Robert P. J. Day
2014-08-02 19:40 ` Khem Raj
0 siblings, 1 reply; 10+ messages in thread
From: Robert P. J. Day @ 2014-08-02 16:34 UTC (permalink / raw)
To: OE Core mailing list
followup to earlier note, is it true that the pkg_prerm and
pkg_postrm functions cannot be run at all during image creation, but
only on the actual running target? this would seem reasonable as it
doesn't seem to make sense to be running any sort of removal code
during image creation.
(i'm assuming that it is never the case that any sort of package
removal is done during image creation, and that the creation process
will install *only* those packages that should be part of the final
image, is that correct?)
however, if the above is correct, then it would make sense that all,
say, pkg_prerm() functions would never be written with respect to the
variable ${D}, which would be relevant only during image creation. but
i can see things like this in sysklogd.inc:
pkg_prerm_${PN} () {
if test "x$D" = "x"; then
if test "$1" = "upgrade" -o "$1" = "remove"; then
/etc/init.d/syslog stop
fi
fi
}
so what does that mean?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-02 16:34 can pkg_{pre, post}rm functions be run at all for image creation? Robert P. J. Day @ 2014-08-02 19:40 ` Khem Raj 2014-08-02 19:57 ` Robert P. J. Day 0 siblings, 1 reply; 10+ messages in thread From: Khem Raj @ 2014-08-02 19:40 UTC (permalink / raw) To: Robert P. J. Day; +Cc: OE Core mailing list On Sat, Aug 2, 2014 at 9:34 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: > say, pkg_prerm() functions would never be written with respect to the > variable ${D}, which would be relevant only during image creation. but > i can see things like this in sysklogd.inc: > > pkg_prerm_${PN} () { > if test "x$D" = "x"; then note that its not ${D} (bitbake context) but $D which is evaluated in the context when the script is run. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-02 19:40 ` Khem Raj @ 2014-08-02 19:57 ` Robert P. J. Day 2014-08-02 20:09 ` Khem Raj 0 siblings, 1 reply; 10+ messages in thread From: Robert P. J. Day @ 2014-08-02 19:57 UTC (permalink / raw) To: Khem Raj; +Cc: OE Core mailing list On Sat, 2 Aug 2014, Khem Raj wrote: > On Sat, Aug 2, 2014 at 9:34 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: > > say, pkg_prerm() functions would never be written with respect to the > > variable ${D}, which would be relevant only during image creation. but > > i can see things like this in sysklogd.inc: > > > > pkg_prerm_${PN} () { > > if test "x$D" = "x"; then > > note that its not ${D} (bitbake context) but $D which is evaluated > in the context when the script is run. i still don't understand ... what are the possible values of $D here, and what would they represent? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-02 19:57 ` Robert P. J. Day @ 2014-08-02 20:09 ` Khem Raj 2014-08-03 6:56 ` Robert P. J. Day 0 siblings, 1 reply; 10+ messages in thread From: Khem Raj @ 2014-08-02 20:09 UTC (permalink / raw) To: Robert P. J. Day; +Cc: OE Core mailing list On 14-08-02 15:57:00, Robert P. J. Day wrote: > On Sat, 2 Aug 2014, Khem Raj wrote: > > > On Sat, Aug 2, 2014 at 9:34 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: > > > say, pkg_prerm() functions would never be written with respect to the > > > variable ${D}, which would be relevant only during image creation. but > > > i can see things like this in sysklogd.inc: > > > > > > pkg_prerm_${PN} () { > > > if test "x$D" = "x"; then > > > > note that its not ${D} (bitbake context) but $D which is evaluated > > in the context when the script is run. > > i still don't understand ... what are the possible values of $D > here, and what would they represent? At build time it will not be expanded by bitbake like ${D} is. but during image creation it will be. But when doing on-device install of this package $D will be empty. Its a way to differentiate actions during image creation and on-device install/update/remove -Khem ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-02 20:09 ` Khem Raj @ 2014-08-03 6:56 ` Robert P. J. Day 2014-08-04 12:37 ` Paul Eggleton 0 siblings, 1 reply; 10+ messages in thread From: Robert P. J. Day @ 2014-08-03 6:56 UTC (permalink / raw) To: Khem Raj; +Cc: OE Core mailing list On Sat, 2 Aug 2014, Khem Raj wrote: > On 14-08-02 15:57:00, Robert P. J. Day wrote: > > On Sat, 2 Aug 2014, Khem Raj wrote: > > > > > On Sat, Aug 2, 2014 at 9:34 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: > > > > say, pkg_prerm() functions would never be written with respect to the > > > > variable ${D}, which would be relevant only during image creation. but > > > > i can see things like this in sysklogd.inc: > > > > > > > > pkg_prerm_${PN} () { > > > > if test "x$D" = "x"; then > > > > > > note that its not ${D} (bitbake context) but $D which is evaluated > > > in the context when the script is run. > > > > i still don't understand ... what are the possible values of $D > > here, and what would they represent? > > At build time it will not be expanded by bitbake like ${D} is. but > during image creation it will be. But when doing on-device install > of this package $D will be empty. Its a way to differentiate actions > during image creation and on-device install/update/remove but the yocto dev manual states pretty clearly that pkg_prerm and pkg_postrm functions are *not* used during image creation. so you're saying they are? under what circumstances? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-03 6:56 ` Robert P. J. Day @ 2014-08-04 12:37 ` Paul Eggleton 2014-08-04 13:42 ` Robert P. J. Day 0 siblings, 1 reply; 10+ messages in thread From: Paul Eggleton @ 2014-08-04 12:37 UTC (permalink / raw) To: Robert P. J. Day; +Cc: openembedded-core On Sunday 03 August 2014 02:56:04 Robert P. J. Day wrote: > On Sat, 2 Aug 2014, Khem Raj wrote: > > On 14-08-02 15:57:00, Robert P. J. Day wrote: > > > On Sat, 2 Aug 2014, Khem Raj wrote: > > > > On Sat, Aug 2, 2014 at 9:34 AM, Robert P. J. Day <rpjday@crashcourse.ca> wrote: > > > > > say, pkg_prerm() functions would never be written with respect to > > > > > the > > > > > variable ${D}, which would be relevant only during image creation. > > > > > but > > > > > i can see things like this in sysklogd.inc: > > > > > > > > > > pkg_prerm_${PN} () { > > > > > > > > > > if test "x$D" = "x"; then > > > > > > > > note that its not ${D} (bitbake context) but $D which is evaluated > > > > in the context when the script is run. > > > > > > > i still don't understand ... what are the possible values of $D > > > > > > here, and what would they represent? > > > > At build time it will not be expanded by bitbake like ${D} is. but > > during image creation it will be. But when doing on-device install > > of this package $D will be empty. Its a way to differentiate actions > > during image creation and on-device install/update/remove > > but the yocto dev manual states pretty clearly that pkg_prerm and > pkg_postrm functions are *not* used during image creation. so you're > saying they are? under what circumstances? They wouldn't normally be. You could in theory issue some package removal commands as part of postprocessing on the image but I can't see much use for that given we have things like PACKAGE_EXCLUDE now. Khem was simply correcting your reference to ${D}. I can only imagine the example you gave is just belt-and-braces to make sure it could never be run outside the context of the real target. Cheers, Paul -- Paul Eggleton Intel Open Source Technology Centre ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-04 12:37 ` Paul Eggleton @ 2014-08-04 13:42 ` Robert P. J. Day 2014-08-04 13:51 ` Paul Eggleton 2014-08-04 13:53 ` Richard Purdie 0 siblings, 2 replies; 10+ messages in thread From: Robert P. J. Day @ 2014-08-04 13:42 UTC (permalink / raw) To: Paul Eggleton; +Cc: openembedded-core On Mon, 4 Aug 2014, Paul Eggleton wrote: > On Sunday 03 August 2014 02:56:04 Robert P. J. Day wrote: > > On Sat, 2 Aug 2014, Khem Raj wrote: > > > On 14-08-02 15:57:00, Robert P. J. Day wrote: > > > > On Sat, 2 Aug 2014, Khem Raj wrote: > > > > > On Sat, Aug 2, 2014 at 9:34 AM, Robert P. J. Day > <rpjday@crashcourse.ca> wrote: > > > > > > say, pkg_prerm() functions would never be written with respect to > > > > > > the > > > > > > variable ${D}, which would be relevant only during image creation. > > > > > > but > > > > > > i can see things like this in sysklogd.inc: > > > > > > > > > > > > pkg_prerm_${PN} () { > > > > > > > > > > > > if test "x$D" = "x"; then > > > > > > > > > > note that its not ${D} (bitbake context) but $D which is evaluated > > > > > in the context when the script is run. > > > > > > > > > i still don't understand ... what are the possible values of $D > > > > > > > > here, and what would they represent? > > > > > > At build time it will not be expanded by bitbake like ${D} is. but > > > during image creation it will be. But when doing on-device install > > > of this package $D will be empty. Its a way to differentiate actions > > > during image creation and on-device install/update/remove > > > > but the yocto dev manual states pretty clearly that pkg_prerm and > > pkg_postrm functions are *not* used during image creation. so you're > > saying they are? under what circumstances? > > They wouldn't normally be. You could in theory issue some package > removal commands as part of postprocessing on the image but I can't > see much use for that given we have things like PACKAGE_EXCLUDE now. oooooh ... that's still kind of weaselly terminology. :-) i'm not *trying* to be annoyingly pedantic, but this is just the kind of thing that students tend to ask about, which is why i want to nail the details. the current docs state that pkg_*rm routines are *not* run during image creation, and i'm going to accept that. that means that if a pkg_*rm routine *is* written with reference to ${D}, as long as that's run on the target, it won't make a difference. so the references to ${D} in that context don't *hurt*, they're just unnecessary. and potentially confusing, which is why i'm trying to clarify this. (every pkg_*rm routine i've seen, *if* it tests the value of ${D}, bailed if it was set, which makes sense if they should never, ever be invoked at image creation time.) WRT stuff run at rootfs postprocessing time, sure, you could always run a package removal command, but clarify this for me -- once you're into rootfs postprocessing, you're running in a "pseudo" environment such that you are *effectively* running inside that rootfs, no? so in that case, all filename references would be full names WRT to the root filesystem -- no references to ${D}. is that correct? or am i just confused? > Khem was simply correcting your reference to ${D}. I can only > imagine the example you gave is just belt-and-braces to make sure it > could never be run outside the context of the real target. fair enough. as it is, it's simply overkill. gotcha. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-04 13:42 ` Robert P. J. Day @ 2014-08-04 13:51 ` Paul Eggleton 2014-08-04 13:53 ` Richard Purdie 1 sibling, 0 replies; 10+ messages in thread From: Paul Eggleton @ 2014-08-04 13:51 UTC (permalink / raw) To: Robert P. J. Day; +Cc: openembedded-core On Monday 04 August 2014 09:42:35 Robert P. J. Day wrote: > On Mon, 4 Aug 2014, Paul Eggleton wrote: > > On Sunday 03 August 2014 02:56:04 Robert P. J. Day wrote: > > > On Sat, 2 Aug 2014, Khem Raj wrote: > > > > On 14-08-02 15:57:00, Robert P. J. Day wrote: > > > > > On Sat, 2 Aug 2014, Khem Raj wrote: > > > > > > On Sat, Aug 2, 2014 at 9:34 AM, Robert P. J. Day > > > > <rpjday@crashcourse.ca> wrote: > > > > > > > say, pkg_prerm() functions would never be written with respect > > > > > > > to > > > > > > > the > > > > > > > variable ${D}, which would be relevant only during image > > > > > > > creation. > > > > > > > but > > > > > > > i can see things like this in sysklogd.inc: > > > > > > > > > > > > > > pkg_prerm_${PN} () { > > > > > > > > > > > > > > if test "x$D" = "x"; then > > > > > > > > > > > > note that its not ${D} (bitbake context) but $D which is evaluated > > > > > > in the context when the script is run. > > > > > > > > > > > i still don't understand ... what are the possible values of $D > > > > > > > > > > here, and what would they represent? > > > > > > > > At build time it will not be expanded by bitbake like ${D} is. but > > > > during image creation it will be. But when doing on-device install > > > > of this package $D will be empty. Its a way to differentiate actions > > > > during image creation and on-device install/update/remove > > > > > > > but the yocto dev manual states pretty clearly that pkg_prerm and > > > > > > pkg_postrm functions are *not* used during image creation. so you're > > > saying they are? under what circumstances? > > > > They wouldn't normally be. You could in theory issue some package > > removal commands as part of postprocessing on the image but I can't > > see much use for that given we have things like PACKAGE_EXCLUDE now. > > oooooh ... that's still kind of weaselly terminology. :-) i'm not > *trying* to be annoyingly pedantic, but this is just the kind of thing > that students tend to ask about, which is why i want to nail the > details. Is this pointless right now? Yes. Does it hurt? No. > the current docs state that pkg_*rm routines are *not* run during > image creation, and i'm going to accept that. that means that if a > pkg_*rm routine *is* written with reference to ${D}, as long as that's > run on the target, it won't make a difference. so the references to > ${D} in that context don't *hurt*, they're just unnecessary. and > potentially confusing, which is why i'm trying to clarify this. (every > pkg_*rm routine i've seen, *if* it tests the value of ${D}, bailed if > it was set, which makes sense if they should never, ever be invoked at > image creation time.) Yes, but when we are talking about preinst/postinst/prerm/postrm, as mentioned before it is $D *not* ${D}. If you use ${D} instead there, you will have problems. > WRT stuff run at rootfs postprocessing time, sure, you could always > run a package removal command, but clarify this for me -- once you're > into rootfs postprocessing, you're running in a "pseudo" environment > such that you are *effectively* running inside that rootfs, no? so in > that case, all filename references would be full names WRT to the root > filesystem -- no references to ${D}. is that correct? or am i just > confused? You are a bit confused yes. do_rootfs may be running under pseudo, but it is not chrooted such that / is the root of the image being constructed; hence why you need to use $D in order to be looking in the right place in both contexts (during constructing the rootfs on the build machine where $D is set, and on the target where $D is not set). Cheers, Paul -- Paul Eggleton Intel Open Source Technology Centre ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-04 13:42 ` Robert P. J. Day 2014-08-04 13:51 ` Paul Eggleton @ 2014-08-04 13:53 ` Richard Purdie 2014-08-04 13:56 ` Robert P. J. Day 1 sibling, 1 reply; 10+ messages in thread From: Richard Purdie @ 2014-08-04 13:53 UTC (permalink / raw) To: Robert P. J. Day; +Cc: Paul Eggleton, openembedded-core On Mon, 2014-08-04 at 09:42 -0400, Robert P. J. Day wrote: > oooooh ... that's still kind of weaselly terminology. :-) i'm not > *trying* to be annoyingly pedantic, but this is just the kind of thing > that students tend to ask about, which is why i want to nail the > details. > > the current docs state that pkg_*rm routines are *not* run during > image creation, and i'm going to accept that. that means that if a > pkg_*rm routine *is* written with reference to ${D}, as long as that's > run on the target, it won't make a difference. so the references to > ${D} in that context don't *hurt*, they're just unnecessary. and > potentially confusing, which is why i'm trying to clarify this. (every > pkg_*rm routine i've seen, *if* it tests the value of ${D}, bailed if > it was set, which makes sense if they should never, ever be invoked at > image creation time.) In the interests of being pedantic since I know you value correctness, they test $D. If they used ${D}, it would get expanded by bitbake at build time which is not what you want. > WRT stuff run at rootfs postprocessing time, sure, you could always > run a package removal command, but clarify this for me -- once you're > into rootfs postprocessing, you're running in a "pseudo" environment > such that you are *effectively* running inside that rootfs, no? so in > that case, all filename references would be full names WRT to the root > filesystem -- no references to ${D}. is that correct? or am i just > confused? Pseudo environment means you can perform operations as root, its not a chroot. You could be in a pseudo chroot of course but our image generation isn't. Cheers, Richard ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: can pkg_{pre, post}rm functions be run at all for image creation? 2014-08-04 13:53 ` Richard Purdie @ 2014-08-04 13:56 ` Robert P. J. Day 0 siblings, 0 replies; 10+ messages in thread From: Robert P. J. Day @ 2014-08-04 13:56 UTC (permalink / raw) To: Richard Purdie; +Cc: Paul Eggleton, openembedded-core On Mon, 4 Aug 2014, Richard Purdie wrote: > On Mon, 2014-08-04 at 09:42 -0400, Robert P. J. Day wrote: > > oooooh ... that's still kind of weaselly terminology. :-) i'm not > > *trying* to be annoyingly pedantic, but this is just the kind of thing > > that students tend to ask about, which is why i want to nail the > > details. > > > > the current docs state that pkg_*rm routines are *not* run during > > image creation, and i'm going to accept that. that means that if a > > pkg_*rm routine *is* written with reference to ${D}, as long as that's > > run on the target, it won't make a difference. so the references to > > ${D} in that context don't *hurt*, they're just unnecessary. and > > potentially confusing, which is why i'm trying to clarify this. (every > > pkg_*rm routine i've seen, *if* it tests the value of ${D}, bailed if > > it was set, which makes sense if they should never, ever be invoked at > > image creation time.) > > In the interests of being pedantic since I know you value correctness, > they test $D. If they used ${D}, it would get expanded by bitbake at > build time which is not what you want. > > > WRT stuff run at rootfs postprocessing time, sure, you could always > > run a package removal command, but clarify this for me -- once you're > > into rootfs postprocessing, you're running in a "pseudo" environment > > such that you are *effectively* running inside that rootfs, no? so in > > that case, all filename references would be full names WRT to the root > > filesystem -- no references to ${D}. is that correct? or am i just > > confused? > > Pseudo environment means you can perform operations as root, its not a > chroot. You could be in a pseudo chroot of course but our image > generation isn't. ok, i think i've got it, thanks, both of you. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-08-04 13:56 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-02 16:34 can pkg_{pre, post}rm functions be run at all for image creation? Robert P. J. Day
2014-08-02 19:40 ` Khem Raj
2014-08-02 19:57 ` Robert P. J. Day
2014-08-02 20:09 ` Khem Raj
2014-08-03 6:56 ` Robert P. J. Day
2014-08-04 12:37 ` Paul Eggleton
2014-08-04 13:42 ` Robert P. J. Day
2014-08-04 13:51 ` Paul Eggleton
2014-08-04 13:53 ` Richard Purdie
2014-08-04 13:56 ` Robert P. J. Day
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox