* [PATCH v2] package.py: New EXTRA_STRIPFLAGS variable
@ 2016-10-25 10:23 Michael Blättler
2016-10-25 11:18 ` Ulf Magnusson
0 siblings, 1 reply; 4+ messages in thread
From: Michael Blättler @ 2016-10-25 10:23 UTC (permalink / raw)
To: openembedded-core
The EXTRA_STRIPFLAGS variable can be used to pass additional parameters to the strip command.
This can be used to remove additional sections or to keep symbols.
The removal of additional sections can be useful to enable reproducible builds.
Sections which contain paths or md5sums of the debug binaries (like gnu_debuglink)
can be eliminated with this flag.
Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
Signed-off-by: Michael Blättler <michael.blaettler@siemens.com>
---
meta/classes/package.bbclass | 5 +++--
meta/lib/oe/package.py | 13 ++++++-------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index a6f0a7a..05b92a8 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1055,14 +1055,15 @@ python split_and_strip_files () {
# Now lets go back over things and strip them
#
if (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
+ extraflags = d.getVar('EXTRA_STRIPFLAGS', False)
strip = d.getVar("STRIP", True)
sfiles = []
for file in elffiles:
elf_file = int(elffiles[file])
#bb.note("Strip %s" % file)
- sfiles.append((file, elf_file, strip))
+ sfiles.append((file, elf_file, strip, extraflags))
for f in kernmods:
- sfiles.append((f, 16, strip))
+ sfiles.append((f, 16, strip, extraflags))
oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 02642f2..757044a 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -10,7 +10,7 @@ def runstrip(arg):
import stat, subprocess
- (file, elftype, strip) = arg
+ (file, elftype, strip, extraflags) = arg
newmode = None
if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
@@ -18,17 +18,16 @@ def runstrip(arg):
newmode = origmode | stat.S_IWRITE | stat.S_IREAD
os.chmod(file, newmode)
- extraflags = ""
-
- # kernel module
+ extraflags += ' '
+ # kernel module
if elftype & 16:
- extraflags = "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
+ extraflags += "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
# .so and shared library
elif ".so" in file and elftype & 8:
- extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
+ extraflags += "--remove-section=.comment --remove-section=.note --strip-unneeded"
# shared or executable:
elif elftype & 8 or elftype & 4:
- extraflags = "--remove-section=.comment --remove-section=.note"
+ extraflags += "--remove-section=.comment --remove-section=.note"
stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
bb.debug(1, "runstrip: %s" % stripcmd)
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] package.py: New EXTRA_STRIPFLAGS variable
2016-10-25 10:23 [PATCH v2] package.py: New EXTRA_STRIPFLAGS variable Michael Blättler
@ 2016-10-25 11:18 ` Ulf Magnusson
2016-10-25 11:29 ` Ulf Magnusson
0 siblings, 1 reply; 4+ messages in thread
From: Ulf Magnusson @ 2016-10-25 11:18 UTC (permalink / raw)
To: Michael Blättler; +Cc: OE-core
On Tue, Oct 25, 2016 at 12:23 PM, Michael Blättler
<michael.blaettler@siemens.com> wrote:
> The EXTRA_STRIPFLAGS variable can be used to pass additional parameters to the strip command.
> This can be used to remove additional sections or to keep symbols.
> The removal of additional sections can be useful to enable reproducible builds.
> Sections which contain paths or md5sums of the debug binaries (like gnu_debuglink)
> can be eliminated with this flag.
>
> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
> Signed-off-by: Michael Blättler <michael.blaettler@siemens.com>
> ---
> meta/classes/package.bbclass | 5 +++--
> meta/lib/oe/package.py | 13 ++++++-------
> 2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index a6f0a7a..05b92a8 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -1055,14 +1055,15 @@ python split_and_strip_files () {
> # Now lets go back over things and strip them
> #
> if (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
> + extraflags = d.getVar('EXTRA_STRIPFLAGS', False)
Why False? That means you can't do e.g.
EXTRA_STRIPFLAGS = "${EXTRA_STRIPSFLAGS_HELPER}"
or
EXTRA_STRIPFLAGS = "${@calculate_extra_stripflags()}"
> strip = d.getVar("STRIP", True)
> sfiles = []
> for file in elffiles:
> elf_file = int(elffiles[file])
> #bb.note("Strip %s" % file)
> - sfiles.append((file, elf_file, strip))
> + sfiles.append((file, elf_file, strip, extraflags))
> for f in kernmods:
> - sfiles.append((f, 16, strip))
> + sfiles.append((f, 16, strip, extraflags))
>
> oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
>
> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> index 02642f2..757044a 100644
> --- a/meta/lib/oe/package.py
> +++ b/meta/lib/oe/package.py
> @@ -10,7 +10,7 @@ def runstrip(arg):
>
> import stat, subprocess
>
> - (file, elftype, strip) = arg
> + (file, elftype, strip, extraflags) = arg
>
> newmode = None
> if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
> @@ -18,17 +18,16 @@ def runstrip(arg):
> newmode = origmode | stat.S_IWRITE | stat.S_IREAD
> os.chmod(file, newmode)
>
> - extraflags = ""
> -
> - # kernel module
> + extraflags += ' '
I'd remove this line and add an extra space to the beginning of the +=
values below, but no biggie.
> + # kernel module
> if elftype & 16:
> - extraflags = "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
> + extraflags += "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
> # .so and shared library
> elif ".so" in file and elftype & 8:
> - extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
> + extraflags += "--remove-section=.comment --remove-section=.note --strip-unneeded"
> # shared or executable:
> elif elftype & 8 or elftype & 4:
> - extraflags = "--remove-section=.comment --remove-section=.note"
> + extraflags += "--remove-section=.comment --remove-section=.note"
>
> stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
> bb.debug(1, "runstrip: %s" % stripcmd)
> --
> 2.1.4
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Cheers,
Ulf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] package.py: New EXTRA_STRIPFLAGS variable
2016-10-25 11:18 ` Ulf Magnusson
@ 2016-10-25 11:29 ` Ulf Magnusson
2016-10-25 11:46 ` Blaettler, Michael
0 siblings, 1 reply; 4+ messages in thread
From: Ulf Magnusson @ 2016-10-25 11:29 UTC (permalink / raw)
To: Michael Blättler; +Cc: OE-core
On Tue, Oct 25, 2016 at 1:18 PM, Ulf Magnusson <ulfalizer@gmail.com> wrote:
> On Tue, Oct 25, 2016 at 12:23 PM, Michael Blättler
> <michael.blaettler@siemens.com> wrote:
>> The EXTRA_STRIPFLAGS variable can be used to pass additional parameters to the strip command.
>> This can be used to remove additional sections or to keep symbols.
>> The removal of additional sections can be useful to enable reproducible builds.
>> Sections which contain paths or md5sums of the debug binaries (like gnu_debuglink)
>> can be eliminated with this flag.
>>
>> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
>> Signed-off-by: Michael Blättler <michael.blaettler@siemens.com>
>> ---
>> meta/classes/package.bbclass | 5 +++--
>> meta/lib/oe/package.py | 13 ++++++-------
>> 2 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
>> index a6f0a7a..05b92a8 100644
>> --- a/meta/classes/package.bbclass
>> +++ b/meta/classes/package.bbclass
>> @@ -1055,14 +1055,15 @@ python split_and_strip_files () {
>> # Now lets go back over things and strip them
>> #
>> if (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
>> + extraflags = d.getVar('EXTRA_STRIPFLAGS', False)
>
> Why False? That means you can't do e.g.
>
> EXTRA_STRIPFLAGS = "${EXTRA_STRIPSFLAGS_HELPER}"
>
> or
>
> EXTRA_STRIPFLAGS = "${@calculate_extra_stripflags()}"
>
>> strip = d.getVar("STRIP", True)
>> sfiles = []
>> for file in elffiles:
>> elf_file = int(elffiles[file])
>> #bb.note("Strip %s" % file)
>> - sfiles.append((file, elf_file, strip))
>> + sfiles.append((file, elf_file, strip, extraflags))
>> for f in kernmods:
>> - sfiles.append((f, 16, strip))
>> + sfiles.append((f, 16, strip, extraflags))
>>
>> oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
>>
>> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
>> index 02642f2..757044a 100644
>> --- a/meta/lib/oe/package.py
>> +++ b/meta/lib/oe/package.py
>> @@ -10,7 +10,7 @@ def runstrip(arg):
>>
>> import stat, subprocess
>>
>> - (file, elftype, strip) = arg
>> + (file, elftype, strip, extraflags) = arg
>>
>> newmode = None
>> if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
>> @@ -18,17 +18,16 @@ def runstrip(arg):
>> newmode = origmode | stat.S_IWRITE | stat.S_IREAD
>> os.chmod(file, newmode)
>>
>> - extraflags = ""
>> -
>> - # kernel module
>> + extraflags += ' '
>
> I'd remove this line and add an extra space to the beginning of the +=
> values below, but no biggie.
>
>> + # kernel module
>> if elftype & 16:
>> - extraflags = "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
>> + extraflags += "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
>> # .so and shared library
>> elif ".so" in file and elftype & 8:
>> - extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
>> + extraflags += "--remove-section=.comment --remove-section=.note --strip-unneeded"
>> # shared or executable:
>> elif elftype & 8 or elftype & 4:
>> - extraflags = "--remove-section=.comment --remove-section=.note"
>> + extraflags += "--remove-section=.comment --remove-section=.note"
>>
>> stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
>> bb.debug(1, "runstrip: %s" % stripcmd)
>> --
>> 2.1.4
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
> Cheers,
> Ulf
This might still have issues if EXTRA_STRIPFLAGS is unset by the way.
Maybe you want the following, to avoid extraflags becoming None:
extraflags = d.getVar('EXTRA_STRIPFLAGS', True) or ""
Cheers,
Ulf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] package.py: New EXTRA_STRIPFLAGS variable
2016-10-25 11:29 ` Ulf Magnusson
@ 2016-10-25 11:46 ` Blaettler, Michael
0 siblings, 0 replies; 4+ messages in thread
From: Blaettler, Michael @ 2016-10-25 11:46 UTC (permalink / raw)
To: Ulf Magnusson; +Cc: OE-core
Hi Ulf
Thanks for your feedback.
I see no problem in using "d.getVar('EXTRA_STRIPFLAGS', True)". I'll apply the changes and send another revision of the patch.
Kind regards
Michael
-----Ursprüngliche Nachricht-----
Von: Ulf Magnusson [mailto:ulfalizer@gmail.com]
Gesendet: Dienstag, 25. Oktober 2016 13:30
An: Blaettler, Michael (BT CPS R&D ZG FW ITW)
Cc: OE-core
Betreff: Re: [OE-core] [PATCH v2] package.py: New EXTRA_STRIPFLAGS variable
On Tue, Oct 25, 2016 at 1:18 PM, Ulf Magnusson <ulfalizer@gmail.com> wrote:
> On Tue, Oct 25, 2016 at 12:23 PM, Michael Blättler
> <michael.blaettler@siemens.com> wrote:
>> The EXTRA_STRIPFLAGS variable can be used to pass additional parameters to the strip command.
>> This can be used to remove additional sections or to keep symbols.
>> The removal of additional sections can be useful to enable reproducible builds.
>> Sections which contain paths or md5sums of the debug binaries (like
>> gnu_debuglink) can be eliminated with this flag.
>>
>> Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
>> Signed-off-by: Michael Blättler <michael.blaettler@siemens.com>
>> ---
>> meta/classes/package.bbclass | 5 +++--
>> meta/lib/oe/package.py | 13 ++++++-------
>> 2 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/meta/classes/package.bbclass
>> b/meta/classes/package.bbclass index a6f0a7a..05b92a8 100644
>> --- a/meta/classes/package.bbclass
>> +++ b/meta/classes/package.bbclass
>> @@ -1055,14 +1055,15 @@ python split_and_strip_files () {
>> # Now lets go back over things and strip them
>> #
>> if (d.getVar('INHIBIT_PACKAGE_STRIP', True) != '1'):
>> + extraflags = d.getVar('EXTRA_STRIPFLAGS', False)
>
> Why False? That means you can't do e.g.
>
> EXTRA_STRIPFLAGS = "${EXTRA_STRIPSFLAGS_HELPER}"
>
> or
>
> EXTRA_STRIPFLAGS = "${@calculate_extra_stripflags()}"
>
>> strip = d.getVar("STRIP", True)
>> sfiles = []
>> for file in elffiles:
>> elf_file = int(elffiles[file])
>> #bb.note("Strip %s" % file)
>> - sfiles.append((file, elf_file, strip))
>> + sfiles.append((file, elf_file, strip, extraflags))
>> for f in kernmods:
>> - sfiles.append((f, 16, strip))
>> + sfiles.append((f, 16, strip, extraflags))
>>
>> oe.utils.multiprocess_exec(sfiles, oe.package.runstrip)
>>
>> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index
>> 02642f2..757044a 100644
>> --- a/meta/lib/oe/package.py
>> +++ b/meta/lib/oe/package.py
>> @@ -10,7 +10,7 @@ def runstrip(arg):
>>
>> import stat, subprocess
>>
>> - (file, elftype, strip) = arg
>> + (file, elftype, strip, extraflags) = arg
>>
>> newmode = None
>> if not os.access(file, os.W_OK) or os.access(file, os.R_OK):
>> @@ -18,17 +18,16 @@ def runstrip(arg):
>> newmode = origmode | stat.S_IWRITE | stat.S_IREAD
>> os.chmod(file, newmode)
>>
>> - extraflags = ""
>> -
>> - # kernel module
>> + extraflags += ' '
>
> I'd remove this line and add an extra space to the beginning of the +=
> values below, but no biggie.
>
>> + # kernel module
>> if elftype & 16:
>> - extraflags = "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
>> + extraflags += "--strip-debug --remove-section=.comment --remove-section=.note --preserve-dates"
>> # .so and shared library
>> elif ".so" in file and elftype & 8:
>> - extraflags = "--remove-section=.comment --remove-section=.note --strip-unneeded"
>> + extraflags += "--remove-section=.comment --remove-section=.note --strip-unneeded"
>> # shared or executable:
>> elif elftype & 8 or elftype & 4:
>> - extraflags = "--remove-section=.comment --remove-section=.note"
>> + extraflags += "--remove-section=.comment --remove-section=.note"
>>
>> stripcmd = "'%s' %s '%s'" % (strip, extraflags, file)
>> bb.debug(1, "runstrip: %s" % stripcmd)
>> --
>> 2.1.4
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
> Cheers,
> Ulf
This might still have issues if EXTRA_STRIPFLAGS is unset by the way.
Maybe you want the following, to avoid extraflags becoming None:
extraflags = d.getVar('EXTRA_STRIPFLAGS', True) or ""
Cheers,
Ulf
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-25 11:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-25 10:23 [PATCH v2] package.py: New EXTRA_STRIPFLAGS variable Michael Blättler
2016-10-25 11:18 ` Ulf Magnusson
2016-10-25 11:29 ` Ulf Magnusson
2016-10-25 11:46 ` Blaettler, Michael
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.