public inbox for gentoo-devhelp@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-devhelp] Trouble with package.env files
@ 2012-05-27 20:21 Nikos Chantziaras
  2012-05-27 20:33 ` [gentoo-devhelp] " Nikos Chantziaras
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nikos Chantziaras @ 2012-05-27 20:21 UTC (permalink / raw
  To: gentoo-devhelp

I have this in /etc/portage/package.env:

   app-emulation/emul-linux-x86-soundlibs soundlibs-delete-jack.conf

and this in /etc/portage/env/soundlibs-delete-jack.conf:

   if [ "${EBUILD_PHASE}" == "src_prepare"] ;
   then
       rm -rf "${S}"/usr/lib32/jack
       rm -f $(find "${S}" -name 'libjack*')
   fi

As per documentation:

http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=3&chap=6#doc_chap3

However, it doesn't work.  What do I do?

!!! Problem in 'app-emulation/emul-linux-x86-soundlibs' dependencies.
!!! "/etc/portage/env/soundlibs-delete-jack.conf", line 1: Invalid token 
'[' (not '=') portage.exception
... done!
"/etc/portage/env/soundlibs-delete-jack.conf", line 1: Invalid token '[' 
(not '=')


PS:
What I'd really want is to define my own custom post_src_prepare() 
function.  Possible?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [gentoo-devhelp] Re: Trouble with package.env files
  2012-05-27 20:21 [gentoo-devhelp] Trouble with package.env files Nikos Chantziaras
@ 2012-05-27 20:33 ` Nikos Chantziaras
  2012-05-27 20:46 ` [gentoo-devhelp] " Dan Douglas
  2012-05-28 16:25 ` Michael Orlitzky
  2 siblings, 0 replies; 4+ messages in thread
From: Nikos Chantziaras @ 2012-05-27 20:33 UTC (permalink / raw
  To: gentoo-devhelp

As always, I found the answer 5 minutes after hitting the "send" button :-P

It turns out the Gentoo docs are wrong.  You can't do this with 
package.env.  The solution is something not mentioned in the docs. 
Putting this:

   post_src_prepare()
   {
       rm -rf "${S}"/usr/lib32/jack || die
       rm -f $(find "${S}" -name 'libjack*') || die
   }

in "/etc/portage/env/app-emulation/emul-linux-x86-soundlibs" works.


On 27/05/12 23:21, Nikos Chantziaras wrote:
> I have this in /etc/portage/package.env:
>
> app-emulation/emul-linux-x86-soundlibs soundlibs-delete-jack.conf
>
> and this in /etc/portage/env/soundlibs-delete-jack.conf:
>
> if [ "${EBUILD_PHASE}" == "src_prepare"] ;
> then
> rm -rf "${S}"/usr/lib32/jack
> rm -f $(find "${S}" -name 'libjack*')
> fi
>
> As per documentation:
>
> http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=3&chap=6#doc_chap3
>
>
> However, it doesn't work. What do I do?
>
> !!! Problem in 'app-emulation/emul-linux-x86-soundlibs' dependencies.
> !!! "/etc/portage/env/soundlibs-delete-jack.conf", line 1: Invalid token
> '[' (not '=') portage.exception
> ... done!
> "/etc/portage/env/soundlibs-delete-jack.conf", line 1: Invalid token '['
> (not '=')
>
>
> PS:
> What I'd really want is to define my own custom post_src_prepare()
> function. Possible?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-devhelp] Trouble with package.env files
  2012-05-27 20:21 [gentoo-devhelp] Trouble with package.env files Nikos Chantziaras
  2012-05-27 20:33 ` [gentoo-devhelp] " Nikos Chantziaras
@ 2012-05-27 20:46 ` Dan Douglas
  2012-05-28 16:25 ` Michael Orlitzky
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Douglas @ 2012-05-27 20:46 UTC (permalink / raw
  To: gentoo-devhelp

[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]

On Sunday, May 27, 2012 11:21:31 PM Nikos Chantziaras wrote:
> I have this in /etc/portage/package.env:
> 
>    app-emulation/emul-linux-x86-soundlibs soundlibs-delete-jack.conf
> 
> and this in /etc/portage/env/soundlibs-delete-jack.conf:
> 
>    if [ "${EBUILD_PHASE}" == "src_prepare"] ;
>    then
>        rm -rf "${S}"/usr/lib32/jack
>        rm -f $(find "${S}" -name 'libjack*')
>    fi

The env/!(bashrc) files are parsed using Python shlex at the time emerge is 
run, accepting essentially the same types of expressions that are valid in 
/etc/make.conf. It never goes through a shell. The reason this is "preferred" 
is certainly for performance, and due to certain things not being possible in 
abashrc such as setting FEATURES.

The two options for defining phase hooks are the portage/bashrc file, and 
portage/env/CATEGORY/PKG. The bashrc file is global and if present always runs, 
while the package-specific ones are of course package-specific.

Personally, I just use the global bashrc and handle the logic for selecting 
packages internally. I find it a bit easier to manage than many separate files.
 
setupHookPtrs() {
    set -- "$@" 'categoryPtrs["$1"]' "$1"'["$2"]'
    local -A categoryPtrs=(
        [app-shells]='(
            [bash]=doBash
            [ksh]=doKsh
            )'
        [media-gfx]='(
            [digikam]=dgKamFix
            )'
        [sys-devel]='(
            [binutils]=doBinutils
            )'
        [www-client]='(
            [chromium]=chromiumHack
            )'
        ) \
        ${categoryPtrs["$1"]+"$1"="${!3}"}
        ${categoryPtrs["$1"]+"${!4-:}"}          # Call whatever function.
}

setupHookPtrs "$CATEGORY" "$PN"

-- 
Dan Douglas

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-devhelp] Trouble with package.env files
  2012-05-27 20:21 [gentoo-devhelp] Trouble with package.env files Nikos Chantziaras
  2012-05-27 20:33 ` [gentoo-devhelp] " Nikos Chantziaras
  2012-05-27 20:46 ` [gentoo-devhelp] " Dan Douglas
@ 2012-05-28 16:25 ` Michael Orlitzky
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Orlitzky @ 2012-05-28 16:25 UTC (permalink / raw
  To: gentoo-devhelp

On 05/27/2012 04:21 PM, Nikos Chantziaras wrote:
> I have this in /etc/portage/package.env:
> 
>    app-emulation/emul-linux-x86-soundlibs soundlibs-delete-jack.conf
> 
> and this in /etc/portage/env/soundlibs-delete-jack.conf:
> 
>    if [ "${EBUILD_PHASE}" == "src_prepare"] ;
>    then
>        rm -rf "${S}"/usr/lib32/jack
>        rm -f $(find "${S}" -name 'libjack*')
>    fi
> 

You already figured out how to get it working, but for posterity, this
is a stupid shell relic:

  if [ 1 == 1 ]; then
      # Works
  fi

  if [ 1 == 1]; then
      # Crashes
  fi



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-28 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 20:21 [gentoo-devhelp] Trouble with package.env files Nikos Chantziaras
2012-05-27 20:33 ` [gentoo-devhelp] " Nikos Chantziaras
2012-05-27 20:46 ` [gentoo-devhelp] " Dan Douglas
2012-05-28 16:25 ` Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox