From: Michael S. Zick <minimod@morethan.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2 of 3 v2] dependencies: build a host-tar if no suitable tar can be found
Date: Thu, 8 Dec 2011 08:13:40 -0600 [thread overview]
Message-ID: <201112080813.43996.minimod@morethan.org> (raw)
In-Reply-To: <CAAXf6LVqXTShGnjV7cDON6jU-yWGi0wrGCaZVHZAFJUystnNQg@mail.gmail.com>
On Thu December 8 2011, Thomas De Schampheleire wrote:
> On Tue, Dec 6, 2011 at 6:07 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
> > On Wednesday 23 November 2011 15:24:40 Thomas Petazzoni wrote:
> >
> >> > TAR is redefined to HOST_TAR, except when extracting host-tar (this
> >
> >> > is a chicken-and-egg problem), so that all packages use the host-tar
> >
> >> > if no suitable tar was found.
> >
> >>
> >
> >> I am still puzzled by the fact that tar is needed to extract this
> >
> >> host-tar, so there's like a chicken-and-egg problem. I understand that
> >
> >> the real host tar is used to extract the host-tar, which is then use to
> >
> >> extract all other packages. But that sounds really nasty to me.
> >
> >
> > It's not so strange, it's like a compiler's canadian build. You need a
> >
> > compiler to compile the compiler, right?
> >
> >
> > The way it is solved for tar is OK for me. I think adding support for
> >
> > cpio archives would just complicate things, because then host-tar
> >
> > can't use GENTARGETS anymore.
>
> I don't think that's true. I started adding cpio support to
> gentargets. Essentially, here is the code that needs modification:
>
> # Define extractors for different archive suffixes
> INFLATE.bz2 = $(BZCAT)
> INFLATE.gz = $(ZCAT)
> INFLATE.tbz = $(BZCAT)
> INFLATE.tbz2 = $(BZCAT)
> INFLATE.tgz = $(ZCAT)
> INFLATE.xz = $(XZCAT)
> INFLATE.tar = cat
>
> $(2)_EXTRACT_CMDS ?= \
> $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE)))
> $(DL_DIR)/$$($(2)_SOURCE) | \
> $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $$($(2)_DIR) $(TAR_OPTIONS) -)
>
>
> Although the inflate step already handles multiple suffices, the
> extract does not yet.
>
> My current approach is this:
> +INFLATE.cpio = cat
> +
> +EXTRACT.tar = $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(1) $(TAR_OPTIONS) -
> +EXTRACT.cpio = ( mkdir -p $(1) && cd $(1) && cpio -i )
>
> $(2)_EXTRACT_CMDS ?= \
> $$(if $$($(2)_SOURCE),$$(INFLATE$$(suffix $$($(2)_SOURCE)))
> $(DL_DIR)/$$($(2)_SOURCE) | \
> - $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $$($(2)_DIR) $(TAR_OPTIONS) -)
> + $$(if $$(EXTRACT$$(suffix $$($(2)_SOURCE))),$$(call
> EXTRACT$$(suffix $$($(2)_SOURCE)),$$($(2)_DIR)),$$(call
> EXTRACT$$(suffix $$(basename $$($(2)_SOURCE))),$$($(2)_DIR))))
>
>
> The only thing I'm struggling with is that cpio does not have a
> --strip-components functionality.
>
Would: "--no-absolute-filenames" help on the cpio command?
If this will become a general purpose extract.cpio command, it
should have that option even if it doesn't help in this case.
Many cpio archives do have absolute paths (like the initramFS
archive) even if the GNU-TAR cpio archive does not.
Mike
> As a result, the package is
> extracted in output/build/host-tar-1.26/tar-1.26 which is not right.
> I don't directly know the name 'tar-1.26', because all I have is the
> string 'host-tar-1.26'. I see two approaches:
> * either try to strip of 'host' from $(2)_DIR
> * or do something like 'mv * .' or 'find -maxdepth 1 -type d | xargs mv {} .'
>
> Suggestions are much appreciated...
>
> Thanks,
> Thomas
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>
>
next prev parent reply other threads:[~2011-12-08 14:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-23 13:59 [Buildroot] [PATCH 0 of 3 v2] dependencies: some improvements Thomas De Schampheleire
2011-11-23 13:59 ` [Buildroot] [PATCH 1 of 3 v2] dependencies: add function suitable-host-package Thomas De Schampheleire
2011-12-06 17:12 ` Arnout Vandecappelle
2011-12-08 9:56 ` Thomas De Schampheleire
2011-11-23 13:59 ` [Buildroot] [PATCH 2 of 3 v2] dependencies: build a host-tar if no suitable tar can be found Thomas De Schampheleire
2011-11-23 14:24 ` Thomas Petazzoni
2011-11-23 15:05 ` Michael S. Zick
2011-11-23 15:09 ` Thomas De Schampheleire
2011-12-06 17:07 ` Arnout Vandecappelle
2011-12-08 10:41 ` Thomas De Schampheleire
2011-12-08 14:13 ` Michael S. Zick [this message]
2011-12-08 15:05 ` Michael S. Zick
2011-12-09 7:00 ` Thomas De Schampheleire
[not found] ` <201112090811.09604.minimod@morethan.org>
2011-12-10 9:06 ` Thomas De Schampheleire
2011-12-06 17:23 ` Arnout Vandecappelle
2011-12-08 10:06 ` Thomas De Schampheleire
2011-12-08 14:19 ` Michael S. Zick
2011-11-23 14:00 ` [Buildroot] [PATCH 3 of 3 v2] Move toolchain/dependencies to support/dependencies Thomas De Schampheleire
2011-11-23 14:25 ` Thomas Petazzoni
2011-12-06 16:59 ` Arnout Vandecappelle
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=201112080813.43996.minimod@morethan.org \
--to=minimod@morethan.org \
--cc=buildroot@busybox.net \
/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