Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 163262 - java gen-2 eclasses probably could stop relying on phase hooks
Summary: java gen-2 eclasses probably could stop relying on phase hooks
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on: 179036 179788 182704
Blocks: 172589
  Show dependency tree
 
Reported: 2007-01-22 17:00 UTC by David Grant
Modified: 2007-08-05 08:17 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
no-hooks.patch (no-hooks.patch,8.51 KB, patch)
2007-08-02 21:16 UTC, Petteri Räty (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Grant 2007-01-22 17:00:17 UTC
Since the java eclasses use hooks (which paludis doesn't use) the hooks need to be installed into paludis' hooks system, in the java-config ebuild.

This bug was discovered by myself with the help of Betelgeuse and ciaranm and Kugelfang on IRC.

Just wanted to make a tracker here.

Reproducible: Always

Steps to Reproduce:
1. You might have to have 1.4 JDK as your system JDK I'm not sure.
2. Try paludis -i azureus
Actual Results:  
It will fail as the build.xml was not re-written after src_unpack and so the source 1.5 option was not used.

Expected Results:  
It should have built.
Comment 1 Stephen Bennett (RETIRED) gentoo-dev 2007-01-22 17:10:13 UTC
More to the point, defining of pre_* functions in eclasses isn't guaranteed to work, and shouldn't be relied upon by anything in the tree. If you can find a better solution please do, otherwise we'll need to talk about standardising those functions, which at this point I'd prefer not to.
Comment 2 Alec Warner (RETIRED) archtester gentoo-dev Security 2007-01-22 17:39:35 UTC
(In reply to comment #1)
> More to the point, defining of pre_* functions in eclasses isn't guaranteed to
> work, and shouldn't be relied upon by anything in the tree. If you can find a
> better solution please do, otherwise we'll need to talk about standardising
> those functions, which at this point I'd prefer not to.
> 

How are they 'not gauranteed to work' ?

Even if the user over-rides them the eclass is sourced after the bashrc so you'd have to over-ride the function manually in the ebuild to break anything.
Comment 3 Ciaran McCreesh 2007-01-22 17:45:42 UTC
(In reply to comment #1)
> More to the point, defining of pre_* functions in eclasses isn't guaranteed to
> work, and shouldn't be relied upon by anything in the tree. If you can find a
> better solution please do, otherwise we'll need to talk about standardising
> those functions, which at this point I'd prefer not to.

Mmm, we support them in trunk/. They're just really really stupid because they don't stack.
Comment 4 David Grant 2007-01-22 17:54:03 UTC
I put the following in an ebuild_unpack_post hook

#!/bin/bash
java-ant_bsfix
[[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" ]] && java-ant_ignore-system-classes "${S}/build.xml"

and azureus compiled succesfully but with some warnings:

/usr/portage/eclass/java-ant-2.eclass: line 213: vecho: command not found

/usr/libexec/paludis/ebuild.bash@1169488143: [WARNING.EBUILD] Hook '/usr/share/paludis/hooks/ebuild_unpack_post/ant/usr/portage/eclass/java-ant-2.eclass: .bash' returned failure (from /usr/portage/net-p2p/azureus/azureus-2.5.0.2.ebuild)
Comment 5 Stephen Bennett (RETIRED) gentoo-dev 2007-01-22 18:16:44 UTC
(In reply to comment #2)
> How are they 'not gauranteed to work' ?
> 
> Even if the user over-rides them the eclass is sourced after the bashrc so
> you'd have to over-ride the function manually in the ebuild to break anything.
> 

Show me the discussion on -dev that says "these hooks are now available to use".
Comment 6 Petteri Räty (RETIRED) gentoo-dev 2007-01-22 22:48:32 UTC
(In reply to comment #5)
> (In reply to comment #2)
> > How are they 'not gauranteed to work' ?
> > 
> > Even if the user over-rides them the eclass is sourced after the bashrc so
> > you'd have to over-ride the function manually in the ebuild to break anything.
> > 
> 
> Show me the discussion on -dev that says "these hooks are now available to
> use".
> 

How about adding java to CC and we could have explained this once more. The hooks were added because they were a good solution to the problem at hand. This was blessed by the portage team (zmedico?) at that time. I wonder why no-one complained about the hooks when we asked about our eclasses on gentoo-dev... It could be possible to do this thing without the hooks so we can look into that too. I think no-one will take up the task of adding rewriting to all of our src_unpack functions either.
Comment 7 Ciaran McCreesh 2007-01-22 22:52:29 UTC
(In reply to comment #6)
> How about adding java to CC and we could have explained this once more. The
> hooks were added because they were a good solution to the problem at hand. This
> was blessed by the portage team (zmedico?) at that time. I wonder why no-one
> complained about the hooks when we asked about our eclasses on gentoo-dev... It
> could be possible to do this thing without the hooks so we can look into that
> too. I think no-one will take up the task of adding rewriting to all of our
> src_unpack functions either.

They're a horrible solution. They don't stack and they override something that is used by users. What's going to happen if anyone else starts using the same functions?
Comment 8 Petteri Räty (RETIRED) gentoo-dev 2007-01-22 22:59:20 UTC
(In reply to comment #7)
> 
> They're a horrible solution. They don't stack and they override something that
> is used by users. What's going to happen if anyone else starts using the same
> functions?
> 

Yeah I know, that's why we are the only allowed to use them in the eclasses. We can get rid of the hooks when Portage does proper environment saving in stable. I think that is coming with 2.1.2, isn't it?
Comment 9 Petteri Räty (RETIRED) gentoo-dev 2007-01-22 22:59:52 UTC
Reopening for the java team to take care of.
Comment 10 Zac Medico gentoo-dev 2007-01-22 23:06:57 UTC
(In reply to comment #8)
> Yeah I know, that's why we are the only allowed to use them in the eclasses. We
> can get rid of the hooks when Portage does proper environment saving in stable.
> I think that is coming with 2.1.2, isn't it?

I think you're talking about bug 51370 which has been fixed since 2.1.1 and is stable.
Comment 11 Brian Harring (RETIRED) gentoo-dev 2007-01-23 09:17:26 UTC
(In reply to comment #10)
> (In reply to comment #8)
> > Yeah I know, that's why we are the only allowed to use them in the eclasses. We
> > can get rid of the hooks when Portage does proper environment saving in stable.
> > I think that is coming with 2.1.2, isn't it?
> 
> I think you're talking about bug 51370 which has been fixed since 2.1.1 and is
> stable.
Haven't poked at the rev to verify it, but as long as it protects the required java vars, would address it.

(In reply to comment #7)
> (In reply to comment #6)
> They're a horrible solution. They don't stack and they override something that
> is used by users. What's going to happen if anyone else starts using the same
> functions?

It's primarily a user feature, introduced due to the usefulness of /etc/portage/bashrc breaking down with proper env state handling.

Reason for java using it is two fold;
1) java 1.4/1.5 (don't recall which) migration *requires* proper env handling, namely protection of the ebuild env from bug 51370
2) it works in the interim, saving mass ebuild changes for what is fundamentally an env handling issue.

Short version; it's valid- I specifically gave them the go ahead till the underlying issues (not their fault) were fixed.

If paludis doesn't want to support (pre|post)_*, whatever, long term it was only a user feature.

Short term, it's part of the required env support.
Comment 12 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2007-01-25 10:46:50 UTC
Renaming because paludis 0.16.0 supports portage's phase hooks so the idea of java-config installing paludis-specific hooks is moot.

In the longer term, I would still like to stop using them if possible. What it IMHO requires:
* verify that bug 51370 is really fixed in stable portage version and dep on it (or whatever virtual there will be sufficient for this, now there's none)
* ensure that the java-pkg{-opt}_pkg_setup is called wherever overriden in the ebuild (or other inherited eclass, especially for the -opt packages), again like in gen-1
* move build.xml rewriting from post_src_unpack() - eant() looks like the best place and doesn't require us to rewrite all ebuilds

In the end it shouldn't be mass ebuild changes, but we need to be careful.
Comment 13 Petteri Räty (RETIRED) gentoo-dev 2007-03-15 23:36:38 UTC
Seems portage does not handle vars correctly atm:
 * post_pkg_setup
 * GENTOO_VM=sun-jdk-1.4
 * pre_src_unpack
 *

GENTOO_VM gets lost in between. Will see if I can find a Portage bug to reopen.
Comment 14 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2007-03-16 00:17:33 UTC
It's not lost completely, "just" not exported.

diff -u -B -r1.20 java-pkg-2.eclass
--- java-pkg-2.eclass   28 Jan 2007 21:42:24 -0000      1.20
+++ java-pkg-2.eclass   16 Mar 2007 00:11:32 -0000
@@ -102,6 +102,7 @@
 }

 pre_src_unpack() {
+       echo GENTOO_VM=$GENTOO_VM
        java-config -f
        java-pkg-2_pkg_setup
 }

ebuild somejavaebuild.ebuild unpack results in:
GENTOO_VM=sun-jdk-1.4
sun-jdk-1.6.0.1
 * Using: sun-jdk-1.4

That's bad, we need it exported :/
Comment 15 Zac Medico gentoo-dev 2007-03-16 01:32:58 UTC
(In reply to comment #14)
> That's bad, we need it exported :/

Portage is fixed in svn r6213 to preserve the export attribute.  We can have it in the next release of the 2.1.2 branch (too bad this problem wasn't mentioned sooner since 2.1.2.2 was stabled just last week). 
Comment 16 Petteri Räty (RETIRED) gentoo-dev 2007-03-16 10:47:24 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > That's bad, we need it exported :/
> 
> Portage is fixed in svn r6213 to preserve the export attribute.  We can have it
> in the next release of the 2.1.2 branch (too bad this problem wasn't mentioned
> sooner since 2.1.2.2 was stabled just last week). 
> 

It wasn't mentioned because we were assured that it works and only now got the time to start testing removing the hooks. I also didn't find this problem until I tried to emerge something that really needs the switching like dev-java/batik.
Comment 17 Zac Medico gentoo-dev 2007-03-29 22:40:36 UTC
I've just released portage-2.1.2.3 and it has support for preservation of export attributes.
Comment 18 Petteri Räty (RETIRED) gentoo-dev 2007-03-31 10:22:28 UTC
(In reply to comment #17)
> I've just released portage-2.1.2.3 and it has support for preservation of
> export attributes.
> 

Seems to work without the hooks now.
Comment 19 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2007-05-24 15:54:34 UTC
All relevant arches stabilized 2.1.2.7
Comment 20 Petteri Räty (RETIRED) gentoo-dev 2007-08-02 21:16:30 UTC
Created attachment 126747 [details, diff]
no-hooks.patch

Here is the eclass patch for removing the hooks.
Comment 21 Petteri Räty (RETIRED) gentoo-dev 2007-08-02 21:17:15 UTC
(In reply to comment #20)
> Created an attachment (id=126747) [edit]
> no-hooks.patch
> 
> Here is the eclass patch for removing the hooks.
> 

Arches please test this patch before I release it (goes straight to stable users). I have been running my desktop for months with it so should be good to go.
Comment 22 Christian Faulhammer (RETIRED) gentoo-dev 2007-08-03 13:46:38 UTC
I emerged about 50 java packages and tested the ones I could do in a simple way.  So x86 is out of here.
Comment 23 Petteri Räty (RETIRED) gentoo-dev 2007-08-05 08:17:12 UTC
(In reply to comment #22)
> I emerged about 50 java packages and tested the ones I could do in a simple
> way.  So x86 is out of here.
> 

Hooks removed.