* [PATCH] [RFC] implement size_append in perl
@ 2010-07-14 14:01 Alexander Shishkin
2010-07-14 14:54 ` H. Peter Anvin
2010-07-14 15:23 ` Sam Ravnborg
0 siblings, 2 replies; 8+ messages in thread
From: Alexander Shishkin @ 2010-07-14 14:01 UTC (permalink / raw)
To: linux-kbuild
Cc: Alexander Shishkin, Sebastian Dalfuß, Oliver Hartkopp,
Michael Guntsche, Jonathan Nieder, Michael Tokarev, Alek Du,
Andrew Morton, Michal Marek, Russell King, H. Peter Anvin,
Albin Tonnerre, linux-kernel
The current implementation has been several times fixed to work around
different shells and build environments and it remains a somewhat tricky
shell script. This patch replaces all the dependencies by a single line
of perl. Build dependency on perl is not new, so that shouldn't be a
problem.
The new implementation does exactly what it's supposed to: it outputs
a little-endian 32-bit unsigned integer of a file's length.
This might simplify matters with different build environments and
different shells and is also considerably shorter and hopefully more
readable.
Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Cc: Sebastian Dalfuß <sd@sedf.de>
Cc: Oliver Hartkopp <oliver@hartkopp.net>
Cc: Michael Guntsche <mike@it-loops.com>
Cc: Jonathan Nieder <jrnieder@gmail.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: Alek Du <alek.du@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
scripts/Makefile.lib | 16 +---------------
1 files changed, 1 insertions(+), 15 deletions(-)
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 54fd1b7..5bfd872 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -213,21 +213,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -f -9 > $@) || \
# Bzip2 and LZMA do not include size in file... so we have to fake that;
# append the size as a 32-bit littleendian number as gzip does.
-size_append = printf $(shell \
-dec_size=0; \
-for F in $1; do \
- fsize=$$(stat -c "%s" $$F); \
- dec_size=$$(expr $$dec_size + $$fsize); \
-done; \
-printf "%08x\n" $$dec_size | \
- sed 's/\(..\)/\1 /g' | { \
- read ch0 ch1 ch2 ch3; \
- for ch in $$ch3 $$ch2 $$ch1 $$ch0; do \
- printf '%s%03o' '\\' $$((0x$$ch)); \
- done; \
- } \
-)
-
+size_append = $(PERL) -e 'print pack("V", (stat "$(lastword $1)")[7])'
quiet_cmd_bzip2 = BZIP2 $@
cmd_bzip2 = (cat $(filter-out FORCE,$^) | \
bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
--
1.7.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] [RFC] implement size_append in perl
2010-07-14 14:01 [PATCH] [RFC] implement size_append in perl Alexander Shishkin
@ 2010-07-14 14:54 ` H. Peter Anvin
2010-07-14 16:12 ` Alexander Shishkin
2010-07-14 15:23 ` Sam Ravnborg
1 sibling, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2010-07-14 14:54 UTC (permalink / raw)
To: Alexander Shishkin
Cc: linux-kbuild, Sebastian Dalfuß, Oliver Hartkopp,
Michael Guntsche, Jonathan Nieder, Michael Tokarev, Alek Du,
Andrew Morton, Michal Marek, Russell King, Albin Tonnerre,
linux-kernel
On 07/14/2010 07:01 AM, Alexander Shishkin wrote:
> +size_append = $(PERL) -e 'print pack("V", (stat "$(lastword $1)")[7])'
Why the "lastword"?
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [RFC] implement size_append in perl
2010-07-14 14:01 [PATCH] [RFC] implement size_append in perl Alexander Shishkin
2010-07-14 14:54 ` H. Peter Anvin
@ 2010-07-14 15:23 ` Sam Ravnborg
2010-07-14 16:17 ` Alexander Shishkin
1 sibling, 1 reply; 8+ messages in thread
From: Sam Ravnborg @ 2010-07-14 15:23 UTC (permalink / raw)
To: Alexander Shishkin
Cc: linux-kbuild, Sebastian Dalfu?, Oliver Hartkopp, Michael Guntsche,
Jonathan Nieder, Michael Tokarev, Alek Du, Andrew Morton,
Michal Marek, Russell King, H. Peter Anvin, Albin Tonnerre,
linux-kernel
On Wed, Jul 14, 2010 at 05:01:03PM +0300, Alexander Shishkin wrote:
> The current implementation has been several times fixed to work around
> different shells and build environments and it remains a somewhat tricky
> shell script. This patch replaces all the dependencies by a single line
> of perl. Build dependency on perl is not new, so that shouldn't be a
> problem.
>
> The new implementation does exactly what it's supposed to: it outputs
> a little-endian 32-bit unsigned integer of a file's length.
>
> This might simplify matters with different build environments and
> different shells and is also considerably shorter and hopefully more
> readable.
Reminds me that I had a patch that moved this to mkpiggy.c.
Goggle gave this hit:
http://lists.openwall.net/linux-kernel/2009/12/20/92
I will try to update this to cover arm also and check
if other archs needs this.
In other word - move thes size stuff to mkpiggy so we
skip this extra step.
Sam
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [RFC] implement size_append in perl
2010-07-14 14:54 ` H. Peter Anvin
@ 2010-07-14 16:12 ` Alexander Shishkin
2010-07-14 16:33 ` Michal Marek
0 siblings, 1 reply; 8+ messages in thread
From: Alexander Shishkin @ 2010-07-14 16:12 UTC (permalink / raw)
To: H. Peter Anvin
Cc: linux-kbuild, Sebastian Dalfuß, Oliver Hartkopp,
Michael Guntsche, Jonathan Nieder, Michael Tokarev, Alek Du,
Andrew Morton, Michal Marek, Russell King, Albin Tonnerre,
linux-kernel
On Wed, Jul 14, 2010 at 07:54:43 -0700, H. Peter Anvin wrote:
> On 07/14/2010 07:01 AM, Alexander Shishkin wrote:
> > +size_append = $(PERL) -e 'print pack("V", (stat "$(lastword $1)")[7])'
>
> Why the "lastword"?
There's a whitespace right after it due to it being part of the target
spec "$(obj)/piggy.$(suffix_y) FORCE", where "FORCE" is being filtered
out.
Regards,
--
Alex
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [RFC] implement size_append in perl
2010-07-14 15:23 ` Sam Ravnborg
@ 2010-07-14 16:17 ` Alexander Shishkin
2010-07-14 16:57 ` H. Peter Anvin
0 siblings, 1 reply; 8+ messages in thread
From: Alexander Shishkin @ 2010-07-14 16:17 UTC (permalink / raw)
To: Sam Ravnborg
Cc: linux-kbuild, Sebastian Dalfu?, Oliver Hartkopp, Michael Guntsche,
Jonathan Nieder, Michael Tokarev, Alek Du, Andrew Morton,
Michal Marek, Russell King, H. Peter Anvin, Albin Tonnerre,
linux-kernel
On Wed, Jul 14, 2010 at 05:23:37 +0200, Sam Ravnborg wrote:
> On Wed, Jul 14, 2010 at 05:01:03PM +0300, Alexander Shishkin wrote:
> > The current implementation has been several times fixed to work around
> > different shells and build environments and it remains a somewhat tricky
> > shell script. This patch replaces all the dependencies by a single line
> > of perl. Build dependency on perl is not new, so that shouldn't be a
> > problem.
> >
> > The new implementation does exactly what it's supposed to: it outputs
> > a little-endian 32-bit unsigned integer of a file's length.
> >
> > This might simplify matters with different build environments and
> > different shells and is also considerably shorter and hopefully more
> > readable.
>
> Reminds me that I had a patch that moved this to mkpiggy.c.
> Goggle gave this hit:
>
> http://lists.openwall.net/linux-kernel/2009/12/20/92
Ok, thanks for the reference.
> I will try to update this to cover arm also and check
> if other archs needs this.
>
> In other word - move thes size stuff to mkpiggy so we
> skip this extra step.
Hm, maybe this mkpiggy can be made arch-independent and moved to scripts/
as well?
Regards,
--
Alex
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [RFC] implement size_append in perl
2010-07-14 16:12 ` Alexander Shishkin
@ 2010-07-14 16:33 ` Michal Marek
0 siblings, 0 replies; 8+ messages in thread
From: Michal Marek @ 2010-07-14 16:33 UTC (permalink / raw)
To: Alexander Shishkin
Cc: H. Peter Anvin, linux-kbuild, Sebastian Dalfuß,
Oliver Hartkopp, Michael Guntsche, Jonathan Nieder,
Michael Tokarev, Alek Du, Andrew Morton, Russell King,
Albin Tonnerre, linux-kernel
On 07/14/2010 06:12 PM, Alexander Shishkin wrote:
> On Wed, Jul 14, 2010 at 07:54:43 -0700, H. Peter Anvin wrote:
>> On 07/14/2010 07:01 AM, Alexander Shishkin wrote:
>>> +size_append = $(PERL) -e 'print pack("V", (stat "$(lastword $1)")[7])'
>>
>> Why the "lastword"?
>
> There's a whitespace right after it due to it being part of the target
> spec "$(obj)/piggy.$(suffix_y) FORCE", where "FORCE" is being filtered
> out.
Then you should use $(strip $1), which is more obvious IMO.
Michal
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [RFC] implement size_append in perl
2010-07-14 16:17 ` Alexander Shishkin
@ 2010-07-14 16:57 ` H. Peter Anvin
2010-07-14 20:48 ` Alexander Shishkin
0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2010-07-14 16:57 UTC (permalink / raw)
To: Alexander Shishkin
Cc: Sam Ravnborg, linux-kbuild, Sebastian Dalfu?, Oliver Hartkopp,
Michael Guntsche, Jonathan Nieder, Michael Tokarev, Alek Du,
Andrew Morton, Michal Marek, Russell King, Albin Tonnerre,
linux-kernel
On 07/14/2010 09:17 AM, Alexander Shishkin wrote:
>
> Hm, maybe this mkpiggy can be made arch-independent and moved to scripts/
> as well?
>
It depends on which architectures want this wrapping format.
-hpa
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] [RFC] implement size_append in perl
2010-07-14 16:57 ` H. Peter Anvin
@ 2010-07-14 20:48 ` Alexander Shishkin
0 siblings, 0 replies; 8+ messages in thread
From: Alexander Shishkin @ 2010-07-14 20:48 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Sam Ravnborg, linux-kbuild, Sebastian Dalfu?, Oliver Hartkopp,
Michael Guntsche, Jonathan Nieder, Michael Tokarev, Alek Du,
Andrew Morton, Michal Marek, Russell King, Albin Tonnerre,
linux-kernel
On Wed, Jul 14, 2010 at 09:57:52 -0700, H. Peter Anvin wrote:
> On 07/14/2010 09:17 AM, Alexander Shishkin wrote:
> >
> > Hm, maybe this mkpiggy can be made arch-independent and moved to scripts/
> > as well?
> >
>
> It depends on which architectures want this wrapping format.
Yes, well, when it's more than one, it already kind of makes sense.
Regards,
--
Alex
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-07-14 20:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-14 14:01 [PATCH] [RFC] implement size_append in perl Alexander Shishkin
2010-07-14 14:54 ` H. Peter Anvin
2010-07-14 16:12 ` Alexander Shishkin
2010-07-14 16:33 ` Michal Marek
2010-07-14 15:23 ` Sam Ravnborg
2010-07-14 16:17 ` Alexander Shishkin
2010-07-14 16:57 ` H. Peter Anvin
2010-07-14 20:48 ` Alexander Shishkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox