View Single Post

   
  #2 (permalink)  
Old 04-15-2008, 08:31 PM
pk
 
Posts: n/a
Default Re: here-documents in ebuild

Nikos Chantziaras wrote:

> I'm writing an ebuild that has a src_test() and one of the tests needs
> to be a here-document (command <<- EOF). But I need to do a 'die
> "Failed"' call if the test fails and I can't get the syntax right.
> Imagine this:
>
> src_test() {
> ./frob <<- EOF || die "frob failed"
> foo
> bar
> EOF
> }
>
> It passes 'ebuild digest' but fails on emerge. What's the right syntax?


Look:

$ grep aaa <<- EOF || echo "not found"
> bbb
> ccc
> EOF

not found
$ grep aaa <<- EOF || echo "not found"
> bbb
> ccc
> EOF
> EOF

not found

Note that the shell ignores the "EOF" if it has leading whitespace.
My guess is that the closing "EOF" should probably go right at the beginning
of the line. See eg app-text/htp/htp-1.15.ebuild, which uses a similar
construct.

Reply With Quote