Message ID | cover.1643766962.git.pkj@axis.com |
---|---|
State | Not Applicable, archived |
Headers | show |
Sorry Peter, but this still strikes me as rather heavy handed for what is a niche use case. Is it possible to simply do what needs to be done from a ROOTFS_POSTPROCESS hook? Alex On Wed, 2 Feb 2022 at 03:00, Peter Kjellerstedt <peter.kjellerstedt@axis.com> wrote: > This is my third attempt to make it possible for me to hook into the > split_and_strip_files() function. We need this to be able to rename > the debug files for some packages to avoid conflicts when installing > them. > > In this version, the first patch splits out the part of > split_and_strip_files() that is responsible for setting up the > variables used to implement the various debug splitting methods > specified by PACKAGE_DEBUG_SPLIT_STYLE into a new function, > package_debug_vars(). This I believe to be a good thing in itself as > that function is way too long anyway. > > The second and third patch are not needed to allow me to hook into the > split_and_strip_files() function, but they simplify the APIs used for > passing the variables returned by package_debug_vars() around. > > With these patches in place, I can now wrap the package_debug_vars() > function with the following local wrapper package.bbclass: > > require ${COREBASE}/meta/classes/package.bbclass > > PACKAGE_DEBUG_FILE_SUFFIX ??= "" > > # Provide the original package_debug_vars() as org_package_debug_vars(). > org_package_debug_vars := "${@d.getVar('package_debug_vars', > False).replace('package_debug_vars', 'org_package_debug_vars')}" > python () { > bb.methodpool.insert_method("", d.getVar("org_package_debug_vars", > False), "<code>", 0) > } > > # This version of package_debug_vars() wraps the original > package_debug_vars() > # by calling org_package_debug_vars() and then appends > PACKAGE_DEBUG_FILE_SUFFIX > # to dv["append"] and dv["staticappend"]. > def package_debug_vars(d): > dv = org_package_debug_vars(d) > > dv["append"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') > dv["staticappend"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') > > return dv > > The definition of the org_package_debug_vars() function is not very > pretty, but it seems to work, and this solution means a heck of a lot > less maintenance than to try to maintain a backported version of the > over 250 lines long split_and_strip_files() function (as it was before > my changes). > > //Peter > > The following changes since commit > 74a8a74a553a33dc5f41939f8070d75e6d57d3da: > > busybox: Add shell arithmetic to work with poky-tiny (2022-02-01 > 07:32:08 +0000) > > are available in the Git repository at: > > git://git.yoctoproject.org/poky-contrib pkj/package_debug_vars > > http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/package_debug_vars > > Peter Kjellerstedt (3): > package.bbclass: Split out package_debug_vars from > split_and_strip_files > package.bbclass: Make package_debug_vars() return a dict > package.bbclass: Pass dv (debug_vars) around instead of individual > vars > > meta/classes/package.bbclass | 127 +++++++++++++++++++---------------- > 1 file changed, 70 insertions(+), 57 deletions(-) > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#161174): > https://lists.openembedded.org/g/openembedded-core/message/161174 > Mute This Topic: https://lists.openembedded.org/mt/88849297/1686489 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
Why do you consider splitting a huge function heavy? Honestly, I would like to split it even further to make it more manageable.
//Peter
From: Alexander Kanavin <alex.kanavin@gmail.com>
Sent: den 2 februari 2022 09:54
To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Cc: OE-core <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH 0/3] Split split_and_strip_files()
Sorry Peter, but this still strikes me as rather heavy handed for what is a niche use case. Is it possible to simply do what needs to be done from a ROOTFS_POSTPROCESS hook?
Alex
On Wed, 2 Feb 2022 at 03:00, Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> wrote:
This is my third attempt to make it possible for me to hook into the
split_and_strip_files() function. We need this to be able to rename
the debug files for some packages to avoid conflicts when installing
them.
In this version, the first patch splits out the part of
split_and_strip_files() that is responsible for setting up the
variables used to implement the various debug splitting methods
specified by PACKAGE_DEBUG_SPLIT_STYLE into a new function,
package_debug_vars(). This I believe to be a good thing in itself as
that function is way too long anyway.
The second and third patch are not needed to allow me to hook into the
split_and_strip_files() function, but they simplify the APIs used for
passing the variables returned by package_debug_vars() around.
With these patches in place, I can now wrap the package_debug_vars()
function with the following local wrapper package.bbclass:
require ${COREBASE}/meta/classes/package.bbclass
PACKAGE_DEBUG_FILE_SUFFIX ??= ""
# Provide the original package_debug_vars() as org_package_debug_vars().
org_package_debug_vars := "${@d.getVar('package_debug_vars', False).replace('package_debug_vars', 'org_package_debug_vars')}<mailto:$%7b@d.getVar('package_debug_vars',%20False).replace('package_debug_vars',%20'org_package_debug_vars')%7d>"
python () {
bb.methodpool.insert_method("", d.getVar("org_package_debug_vars", False), "<code>", 0)
}
# This version of package_debug_vars() wraps the original package_debug_vars()
# by calling org_package_debug_vars() and then appends PACKAGE_DEBUG_FILE_SUFFIX
# to dv["append"] and dv["staticappend"].
def package_debug_vars(d):
dv = org_package_debug_vars(d)
dv["append"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX')
dv["staticappend"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX')
return dv
The definition of the org_package_debug_vars() function is not very
pretty, but it seems to work, and this solution means a heck of a lot
less maintenance than to try to maintain a backported version of the
over 250 lines long split_and_strip_files() function (as it was before
my changes).
//Peter
The following changes since commit 74a8a74a553a33dc5f41939f8070d75e6d57d3da:
busybox: Add shell arithmetic to work with poky-tiny (2022-02-01 07:32:08 +0000)
are available in the Git repository at:
git://git.yoctoproject.org/poky-contrib<http://git.yoctoproject.org/poky-contrib> pkj/package_debug_vars
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/package_debug_vars
Peter Kjellerstedt (3):
package.bbclass: Split out package_debug_vars from
split_and_strip_files
package.bbclass: Make package_debug_vars() return a dict
package.bbclass: Pass dv (debug_vars) around instead of individual
vars
meta/classes/package.bbclass | 127 +++++++++++++++++++----------------
1 file changed, 70 insertions(+), 57 deletions(-)
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#161174): https://lists.openembedded.org/g/openembedded-core/message/161174
Mute This Topic: https://lists.openembedded.org/mt/88849297/1686489
Group Owner: openembedded-core+owner@lists.openembedded.org<mailto:openembedded-core%2Bowner@lists.openembedded.org>
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com<mailto:alex.kanavin@gmail.com>]
-=-=-=-=-=-=-=-=-=-=-=-
Right, the patchset is good for maintainability, my comment was more about whether it's easier to just package files in a way that doesn't clash in do_rootfs, then rearrange them in rootfs postprocessing. Alex On Wed, 2 Feb 2022 at 12:20, Peter Kjellerstedt <peter.kjellerstedt@axis.com> wrote: > Why do you consider splitting a huge function heavy? Honestly, I would > like to split it even further to make it more manageable. > > > > //Peter > > > > *From:* Alexander Kanavin <alex.kanavin@gmail.com> > *Sent:* den 2 februari 2022 09:54 > *To:* Peter Kjellerstedt <peter.kjellerstedt@axis.com> > *Cc:* OE-core <openembedded-core@lists.openembedded.org> > *Subject:* Re: [OE-core] [PATCH 0/3] Split split_and_strip_files() > > > > Sorry Peter, but this still strikes me as rather heavy handed for what is > a niche use case. Is it possible to simply do what needs to be done from a > ROOTFS_POSTPROCESS hook? > > > > Alex > > > > On Wed, 2 Feb 2022 at 03:00, Peter Kjellerstedt < > peter.kjellerstedt@axis.com> wrote: > > This is my third attempt to make it possible for me to hook into the > split_and_strip_files() function. We need this to be able to rename > the debug files for some packages to avoid conflicts when installing > them. > > In this version, the first patch splits out the part of > split_and_strip_files() that is responsible for setting up the > variables used to implement the various debug splitting methods > specified by PACKAGE_DEBUG_SPLIT_STYLE into a new function, > package_debug_vars(). This I believe to be a good thing in itself as > that function is way too long anyway. > > The second and third patch are not needed to allow me to hook into the > split_and_strip_files() function, but they simplify the APIs used for > passing the variables returned by package_debug_vars() around. > > With these patches in place, I can now wrap the package_debug_vars() > function with the following local wrapper package.bbclass: > > require ${COREBASE}/meta/classes/package.bbclass > > PACKAGE_DEBUG_FILE_SUFFIX ??= "" > > # Provide the original package_debug_vars() as org_package_debug_vars(). > org_package_debug_vars := "${@d.getVar('package_debug_vars', > False).replace('package_debug_vars', 'org_package_debug_vars')}" > python () { > bb.methodpool.insert_method("", d.getVar("org_package_debug_vars", > False), "<code>", 0) > } > > # This version of package_debug_vars() wraps the original > package_debug_vars() > # by calling org_package_debug_vars() and then appends > PACKAGE_DEBUG_FILE_SUFFIX > # to dv["append"] and dv["staticappend"]. > def package_debug_vars(d): > dv = org_package_debug_vars(d) > > dv["append"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') > dv["staticappend"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') > > return dv > > The definition of the org_package_debug_vars() function is not very > pretty, but it seems to work, and this solution means a heck of a lot > less maintenance than to try to maintain a backported version of the > over 250 lines long split_and_strip_files() function (as it was before > my changes). > > //Peter > > The following changes since commit > 74a8a74a553a33dc5f41939f8070d75e6d57d3da: > > busybox: Add shell arithmetic to work with poky-tiny (2022-02-01 > 07:32:08 +0000) > > are available in the Git repository at: > > git://git.yoctoproject.org/poky-contrib pkj/package_debug_vars > > http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/package_debug_vars > > Peter Kjellerstedt (3): > package.bbclass: Split out package_debug_vars from > split_and_strip_files > package.bbclass: Make package_debug_vars() return a dict > package.bbclass: Pass dv (debug_vars) around instead of individual > vars > > meta/classes/package.bbclass | 127 +++++++++++++++++++---------------- > 1 file changed, 70 insertions(+), 57 deletions(-) > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#161174): > https://lists.openembedded.org/g/openembedded-core/message/161174 > Mute This Topic: https://lists.openembedded.org/mt/88849297/1686489 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > alex.kanavin@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
Well, I believe it is better to package the files correctly from the start rather than having to redo the packaging later. The first variant I suggested was two added lines, compared to the ~30 lines we had in a recipe that did it after the fact, which somewhat indicates what it means to do it as part of the packaging process, compared to what it takes to do it later. I still believe it would be better if the -dbg packages are always created in a way that two -dbg packages cannot clash with each other, since we do not split them the same way we do for target packages. That way everyone would benefit from it and it should lead to less problems. However, with the proposed changes I can solve my immediate problem, and we can continue the discussion if we can improve how -dbg packages are created for everyone separately. //Peter From: Alexander Kanavin <alex.kanavin@gmail.com> Sent: den 2 februari 2022 12:33 To: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Cc: OE-core <openembedded-core@lists.openembedded.org> Subject: Re: [OE-core] [PATCH 0/3] Split split_and_strip_files() Right, the patchset is good for maintainability, my comment was more about whether it's easier to just package files in a way that doesn't clash in do_rootfs, then rearrange them in rootfs postprocessing. Alex On Wed, 2 Feb 2022 at 12:20, Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> wrote: Why do you consider splitting a huge function heavy? Honestly, I would like to split it even further to make it more manageable. //Peter From: Alexander Kanavin <alex.kanavin@gmail.com<mailto:alex.kanavin@gmail.com>> Sent: den 2 februari 2022 09:54 To: Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> Cc: OE-core <openembedded-core@lists.openembedded.org<mailto:openembedded-core@lists.openembedded.org>> Subject: Re: [OE-core] [PATCH 0/3] Split split_and_strip_files() Sorry Peter, but this still strikes me as rather heavy handed for what is a niche use case. Is it possible to simply do what needs to be done from a ROOTFS_POSTPROCESS hook? Alex On Wed, 2 Feb 2022 at 03:00, Peter Kjellerstedt <peter.kjellerstedt@axis.com<mailto:peter.kjellerstedt@axis.com>> wrote: This is my third attempt to make it possible for me to hook into the split_and_strip_files() function. We need this to be able to rename the debug files for some packages to avoid conflicts when installing them. In this version, the first patch splits out the part of split_and_strip_files() that is responsible for setting up the variables used to implement the various debug splitting methods specified by PACKAGE_DEBUG_SPLIT_STYLE into a new function, package_debug_vars(). This I believe to be a good thing in itself as that function is way too long anyway. The second and third patch are not needed to allow me to hook into the split_and_strip_files() function, but they simplify the APIs used for passing the variables returned by package_debug_vars() around. With these patches in place, I can now wrap the package_debug_vars() function with the following local wrapper package.bbclass: require ${COREBASE}/meta/classes/package.bbclass PACKAGE_DEBUG_FILE_SUFFIX ??= "" # Provide the original package_debug_vars() as org_package_debug_vars(). org_package_debug_vars := "${@d.getVar('package_debug_vars', False).replace('package_debug_vars', 'org_package_debug_vars')}<mailto:$%7b@d.getVar('package_debug_vars',%20False).replace('package_debug_vars',%20'org_package_debug_vars')%7d>" python () { bb.methodpool.insert_method("", d.getVar("org_package_debug_vars", False), "<code>", 0) } # This version of package_debug_vars() wraps the original package_debug_vars() # by calling org_package_debug_vars() and then appends PACKAGE_DEBUG_FILE_SUFFIX # to dv["append"] and dv["staticappend"]. def package_debug_vars(d): dv = org_package_debug_vars(d) dv["append"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') dv["staticappend"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') return dv The definition of the org_package_debug_vars() function is not very pretty, but it seems to work, and this solution means a heck of a lot less maintenance than to try to maintain a backported version of the over 250 lines long split_and_strip_files() function (as it was before my changes). //Peter The following changes since commit 74a8a74a553a33dc5f41939f8070d75e6d57d3da: busybox: Add shell arithmetic to work with poky-tiny (2022-02-01 07:32:08 +0000) are available in the Git repository at: git://git.yoctoproject.org/poky-contrib<http://git.yoctoproject.org/poky-contrib> pkj/package_debug_vars http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/package_debug_vars Peter Kjellerstedt (3): package.bbclass: Split out package_debug_vars from split_and_strip_files package.bbclass: Make package_debug_vars() return a dict package.bbclass: Pass dv (debug_vars) around instead of individual vars meta/classes/package.bbclass | 127 +++++++++++++++++++---------------- 1 file changed, 70 insertions(+), 57 deletions(-) -=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#161174): https://lists.openembedded.org/g/openembedded-core/message/161174 Mute This Topic: https://lists.openembedded.org/mt/88849297/1686489 Group Owner: openembedded-core+owner@lists.openembedded.org<mailto:openembedded-core%2Bowner@lists.openembedded.org> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com<mailto:alex.kanavin@gmail.com>] -=-=-=-=-=-=-=-=-=-=-=-
On Wed, 2022-02-02 at 02:59 +0100, Peter Kjellerstedt wrote: > This is my third attempt to make it possible for me to hook into the > split_and_strip_files() function. We need this to be able to rename > the debug files for some packages to avoid conflicts when installing > them. > > In this version, the first patch splits out the part of > split_and_strip_files() that is responsible for setting up the > variables used to implement the various debug splitting methods > specified by PACKAGE_DEBUG_SPLIT_STYLE into a new function, > package_debug_vars(). This I believe to be a good thing in itself as > that function is way too long anyway. > > The second and third patch are not needed to allow me to hook into the > split_and_strip_files() function, but they simplify the APIs used for > passing the variables returned by package_debug_vars() around. > > With these patches in place, I can now wrap the package_debug_vars() > function with the following local wrapper package.bbclass: > > require ${COREBASE}/meta/classes/package.bbclass > > PACKAGE_DEBUG_FILE_SUFFIX ??= "" > > # Provide the original package_debug_vars() as org_package_debug_vars(). > org_package_debug_vars := "${@d.getVar('package_debug_vars', False).replace('package_debug_vars', 'org_package_debug_vars')}" > python () { > bb.methodpool.insert_method("", d.getVar("org_package_debug_vars", False), "<code>", 0) > } > > # This version of package_debug_vars() wraps the original package_debug_vars() > # by calling org_package_debug_vars() and then appends PACKAGE_DEBUG_FILE_SUFFIX > # to dv["append"] and dv["staticappend"]. > def package_debug_vars(d): > dv = org_package_debug_vars(d) > > dv["append"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') > dv["staticappend"] += d.getVar('PACKAGE_DEBUG_FILE_SUFFIX') > > return dv > > The definition of the org_package_debug_vars() function is not very > pretty, but it seems to work, and this solution means a heck of a lot > less maintenance than to try to maintain a backported version of the > over 250 lines long split_and_strip_files() function (as it was before > my changes). > > //Peter > > The following changes since commit 74a8a74a553a33dc5f41939f8070d75e6d57d3da: > > busybox: Add shell arithmetic to work with poky-tiny (2022-02-01 07:32:08 +0000) > > are available in the Git repository at: > > git://git.yoctoproject.org/poky-contrib pkj/package_debug_vars > http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/package_debug_vars > > Peter Kjellerstedt (3): > package.bbclass: Split out package_debug_vars from > split_and_strip_files > package.bbclass: Make package_debug_vars() return a dict > package.bbclass: Pass dv (debug_vars) around instead of individual > vars > > meta/classes/package.bbclass | 127 +++++++++++++++++++---------------- > 1 file changed, 70 insertions(+), 57 deletions(-) I know I'm often negative about patches so I just wanted to mention I like this series for a change! :) Definitely better than the other patch with all those variables. Cheers, Richard