From: "Dirk Hörner" <dirker@gmail.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/6] make: use wc -c instead of stat -c%s to get file sizes
Date: Tue, 5 Jun 2012 23:15:15 +0200 [thread overview]
Message-ID: <CAOoHCj9X2Zjmin4q9GeAgGzwrZeZyHMb4BYvXuTfULPujOTMGA@mail.gmail.com> (raw)
In-Reply-To: <20120605024921.GX3377@game.jcrosoft.org>
Hi Jean-Christophe,
On Tue, Jun 5, 2012 at 4:49 AM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
>
> HI,
>
> I don't like this to continue to duplicate code
I agree. Would you rather like a function in common/Kbuild.include and
then $(call) it in appropriate places?
In any case, I guess the code unification should be done in a separate
commit, either before or after my patch.
Ciao,
Dirk
>
> Best Regards,
> J.
> On 22:40 Mon 04 Jun , Dirk Hörner wrote:
> > On OS X, stat does not know about %s. Solaris does not have stat. The
> > drawback to this wc -c solution is that wc reads all the bytes, but we
> > are
> > only dealing with small files here, so that not be much of a problem.
> >
> > Signed-off-by: Dirk Hörner <dirker@gmail.com>
> > ---
> > Makefile | 2 +-
> > common/Makefile | 2 +-
> > scripts/Makefile.lib | 2 +-
> > 3 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/Makefile b/Makefile
> > index bcaae0a..3ac8788 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -536,7 +536,7 @@ quiet_cmd_barebox_version = GEN .version
> > # Check size of a file
> > quiet_cmd_check_file_size = CHKSIZE $@
> > cmd_check_file_size = set -e; \
> > - size=`stat -c%s $@`; \
> > + size=`wc -c < $@`; \
> > max_size=`printf "%d" $2`; \
> > if [ $$size -gt $$max_size ] ; \
> > then \
> > diff --git a/common/Makefile b/common/Makefile
> > index a58aef9..9c14d7b 100644
> > --- a/common/Makefile
> > +++ b/common/Makefile
> > @@ -77,7 +77,7 @@ barebox_default_env.lzo: barebox_default_env
> >
> > include/generated/barebox_default_env.h:
> > barebox_default_env$(barebox_default_env_comp)
> > $(Q)cat $< | $(objtree)/scripts/bin2c default_environment > $@
> > - $(Q)echo "const int default_environment_uncompress_size=`stat -c%s
> > barebox_default_env`;" >> $@
> > + $(Q)echo "const int default_environment_uncompress_size=`wc -c <
> > barebox_default_env`;" >> $@
> >
> > CLEAN_FILES += include/generated/barebox_default_env.h
> > barebox_default_env
> > CLEAN_FILES += barebox_default_env.gz barebox_default_env.bz2
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index b842c48..9b02b1b 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -171,7 +171,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f
> > -9 > $@) || \
> > size_append = printf $(shell \
> > dec_size=0; \
> > for F in $1; do
> > \
> > - fsize=$$(stat -c "%s" $$F); \
> > + fsize=$$(wc -c < $$F); \
> > dec_size=$$(expr $$dec_size + $$fsize); \
> > done;
> > \
> > printf "%08x\n" $$dec_size | \
> > --
> > 1.7.10.3
> >
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-06-05 21:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-04 20:40 [PATCH 0/6] Support cross-compiling on Mac OS X Dirk Hörner
2012-06-04 20:40 ` [PATCH 1/6] kbuild: Use Elfnn_Half as replacement for Elfnn_Section Dirk Hörner
2012-06-04 20:40 ` [PATCH 2/6] make: use wc -c instead of stat -c%s to get file sizes Dirk Hörner
2012-06-05 2:49 ` Jean-Christophe PLAGNIOL-VILLARD
2012-06-05 19:43 ` Sascha Hauer
2012-06-05 21:15 ` Dirk Hörner [this message]
2012-06-04 20:40 ` [PATCH 3/6] make: check for greadlink first, fall back to readlink Dirk Hörner
2012-06-05 8:56 ` Michael Olbrich
2012-06-04 20:40 ` [PATCH 4/6] hostcc tools: include "compiler.h", fix included headers Dirk Hörner
2012-06-04 20:40 ` [PATCH 5/6] scripts/compiler.h: fixup endianess defines on OS X Dirk Hörner
2012-06-04 20:40 ` [PATCH 6/6] scripts/genenv: always pass template to mktemp Dirk Hörner
2012-06-05 19:42 ` [PATCH 0/6] Support cross-compiling on Mac OS X Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOoHCj9X2Zjmin4q9GeAgGzwrZeZyHMb4BYvXuTfULPujOTMGA@mail.gmail.com \
--to=dirker@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=plagnioj@jcrosoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox