Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 299904 - app-portage/eix doesn't behave in Gentoo Prefix env
Summary: app-portage/eix doesn't behave in Gentoo Prefix env
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Martin Väth
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-06 15:48 UTC by Jeremy Olexa (darkside) (RETIRED)
Modified: 2010-01-11 19:28 UTC (History)
1 user (show)

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


Attachments
Patch for debugging (eix-PORTDIR-debug.patch,1.75 KB, patch)
2010-01-06 22:29 UTC, Martin Väth
Details | Diff
Cleaner but slower implementation of APPEND_VALUES (fix_append_values.patch,1.60 KB, patch)
2010-01-07 20:34 UTC, Martin Väth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-06 15:48:56 UTC
Completely misses EPREFIX location. [0] should be $EPREFIX/usr/portage

%% eix-update 
Reading Portage settings ..

Building database (/home/jolexa/portage/linux-64/var/cache/eix) ..
[0] "" /usr/portage/ (cache: metadata-flat)
     Reading category 0|0 (100%) EMPTY!
[1] "overlay" /home/jolexa/portage/global/overlays (cache: parse|ebuild*#metadata-flat#assign)
     Reading category 0|0 (100%) EMPTY!
Applying masks ..
Calculating hash tables ..
Writing database file /home/jolexa/portage/linux-64/var/cache/eix ..
Database contains 0 packages in 0 categories.
Comment 1 Martin Väth 2010-01-06 19:31:13 UTC
EPREFIX was removed as a prefix of PORTDIR already a long time ago
(probably in eix-0.13.4), because genstef reported that EPREFIX
is not added automatically to PORTDIR by prefix-portage, i.e. you had
to specify the correct path (*with* EPREFIX) in the make.conf file of
prefix-portage (and since <eix-0.13.4 has added it, the EPREFIX falsely
appeared twice).

It appears that now you complain that this change was false:
Has this behavior of eprefix-portage changed? (Or maybe only the default
has changed if PORTDIR is not specified in the make.conf file?)

If yes, it would be necessary to change some variable defaults to keep up
with prefix-portage's behavior. There are two natural (mutual disjoint)
possibilities: Either
  EPREFIX_PORTDIR='%{EPREFIX}'
or
  EPREFIX_TREE='%{EPREFIX}'

The former uses EPREFIX only for PORTDIR, the latter also for overlays and
the profile directory. Please test (by adding the corresponding line to
the file eix --print EIXRC) and report back what is the solution which
corresponds to prefix-portage's behavior.
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-06 19:41:11 UTC
Ok. You said alot of stuff that I don't understand ;)

I thought it was a regression because eix use to work fine, now it doesn't, but I just tried eix-0.19.0* and it fails the same way. So, "something" has changed in portage, I guess.

I falsely assumed that eix would use PORTDIR in a similar way that it knows about overlays.

%% portageq envvar PORTDIR
/home/jolexa/portage/linux-64/usr/portage
Comment 3 Martin Väth 2010-01-06 19:54:11 UTC
So where is this PORTDIR defined?
Do you have an entry
  PORTDIR=/usr/portage
in your make.conf (or in your make.global) or instead an entry
  PORTDIR=/home/jolexa/portage/linux-64/usr/portage
?

Oh... another possibility: Maybe you have an entry
  PORTDIR=${EPREFIX}/usr/portage
in one of these files and expect that the ${EPREFIX} will be substituted
automagically (i.e. in a sense EPREFIX should be exported for "sourcing")?
Comment 4 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-06 19:58:48 UTC
I guess it is this one:

%% grep PORTDIR etc/make.globals 
PORTDIR="/home/jolexa/portage/linux-64/usr/portage"

nothing else in my user-config files. Haven't changed anything either myself.
Comment 5 Martin Väth 2010-01-06 20:11:58 UTC
This is very strange: It appears that eix does not read your etc/make.globals.
Just to check: Does
  eix --print PORTDIR
really just output /usr/portage and not the value in etc/make.globals?
Or does 
  echo "${PORTDIR}"
outputs something (i.e. could it be that it is set in your environment)?
Are other values in etc/make.globals also ignored, e.g. what is the output of
  eix --print USE_ORDER
(or some other variable which is set in your etc/make.globals)?
Comment 6 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-06 20:19:27 UTC
(In reply to comment #5)
> This is very strange: It appears that eix does not read your etc/make.globals.
> Just to check: Does
>   eix --print PORTDIR

%% eix --print PORTDIR
/usr/portage/

> really just output /usr/portage and not the value in etc/make.globals?
> Or does 
>   echo "${PORTDIR}"
> outputs something (i.e. could it be that it is set in your environment)?

not in env

> Are other values in etc/make.globals also ignored, e.g. what is the output of
>   eix --print USE_ORDER
> (or some other variable which is set in your etc/make.globals)?

%% eix --print DISTDIR
/home/jolexa/portage/linux-64/usr/portage/distfiles

and DISTDIR is not set anywhere.
Comment 7 Martin Väth 2010-01-06 20:33:28 UTC
This is mysterious. I just summarize to make sure that there is no
misunderstanding: eix --print DISTDIR shows that eix does read etc/make.conf
(because DISTDIR is specified only there), but although PORTDIR is also
only specified only in etc/make.conf, eix reverts to some default...
Is this correct?

If I specify PORTDIR on my system only in /etc/make.conf, it is respected,
so currently I have no idea what might be wrong...
Comment 8 Martin Väth 2010-01-06 20:35:03 UTC
(a typo in my previous comment: I meant everywhere make.globals where I had
written make.conf).
Comment 9 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-06 20:50:25 UTC
(In reply to comment #8)
> (a typo in my previous comment: I meant everywhere make.globals where I had
> written make.conf).
> 

Correct.
Comment 10 Martin Väth 2010-01-06 21:15:44 UTC
Maybe you have two make.globals file with different content?
eix tries first to read the file
  eix --print MAKE_GLOBALS
(defaults to "%{EPREFIX}/usr/share/portage/config/make.globals")
and only if this is not found, it attempts to read
  $PORTAGE_CONFIGROOT/etc/make.conf
(eix --print PORTAGE_CONFIGROOT should show the prefix).
Comment 11 Martin Väth 2010-01-06 22:29:05 UTC
Created attachment 215438 [details, diff]
Patch for debugging

If you find some time, please recompile eix with the attached patch and then
post the output of eix --print PORTDIR
Comment 12 Fabian Groffen gentoo-dev 2010-01-07 08:19:45 UTC
does this indicate trouble?

% eix --print MAKE_GLOBALS
% eix --print PORTAGE_CONFIGROOT
% eix --version
eix 0.19.1 (gcc-4.2.1, powerpc-apple-darwin8)
Comment 13 Martin Väth 2010-01-07 14:18:11 UTC
(In reply to comment #12)
> does this indicate trouble?
> 
> % eix --print MAKE_GLOBALS
> % eix --print PORTAGE_CONFIGROOT

Yes (unless you have changed this in the configuration or environment):
PORTAGE_CONFIGROOT should default to EPREFIX (could have been overridden
by ./configure options), and the MAKE_GLOBALS default should never be empty
(no ./configure option can modify this).
Perhaps --print is broken? What is shown with e.g.
  eix --dump | grep -3 MAKE_GLOBALS
(and does eix --print for other variables in eix --dump also output nothing)?
Comment 14 Fabian Groffen gentoo-dev 2010-01-07 14:23:26 UTC
wait, I think I know what's going wrong.

How do you determine PORTAGE_CONFIGROOT?  This thing should default to $EPREFIX when it is not given, but take the value given otherwise.




% eix --dump | grep -3 MAKE_GLOBALS
# PREFIXSTRING
# This file is used instead of %{PORTAGE_CONFIGROOT}/etc/make.globals
# if it exists. This is reasonable for >=portage-2.2*
MAKE_GLOBALS='%{EPREFIX}/usr/share/portage/config/make.globals'

# PREFIXSTRING
# This variable is only used for delayed substitution.

Comment 15 Martin Väth 2010-01-07 14:53:06 UTC
(In reply to comment #14)
> How do you determine PORTAGE_CONFIGROOT?
> This thing should default to $EPREFIX
> when it is not given, but take the value given otherwise.

This is eix' mechanism of delayed substitution: The default is
  PORTAGE_CONFIGROOT='%{EPREFIX}'
The "%{...}" means that eix shall substitute the corresponding variable value
during eix runtime.

So if you override PORTAGE_CONFIGROOT with some fixed string
(i.e. not containing a %{...} sequence), EPREFIX will be ignored
for PORTAGE_CONFIGROOT and just the fixed string is taken instead.

> % eix --dump | grep -3 MAKE_GLOBALS
> # PREFIXSTRING
> # This file is used instead of %{PORTAGE_CONFIGROOT}/etc/make.globals
> # if it exists. This is reasonable for >=portage-2.2*
> MAKE_GLOBALS='%{EPREFIX}/usr/share/portage/config/make.globals'

This suggests that either --print or the mechanism for delayed substitution
are broken: MAKE_GLOBALS has the default value, and it was not overridden
(otherwise --dump would have reported this).
To determine whether it is --print or the delayed substitution which is
broken, please post the output of e.g.
  eix --print QUICK_MODE    # (a variable containing a fixed string)
  eix --print COLOR_UPGRADE # (a variable containing a string with
                            # a reference via delayed substitution).

> How do you determine PORTAGE_CONFIGROOT?
> This thing should default to $EPREFIX when it is not given,
> but take the value given otherwise.
Comment 16 Fabian Groffen gentoo-dev 2010-01-07 15:06:14 UTC
Ok, the print commands do not return a newline, hence I can't see them as my prompt overwrites the answer again.

% echo `eix --print COLOR_UPGRADE`
cyan,1;inverse
% 

in the same line:

% echo `eix --print PORTAGE_CONFIGROOT`
/Library/Gentoo
% echo `eix --print MAKE_GLOBALS` 
/Library/Gentoo/usr/share/portage/config/make.globals
Comment 17 Martin Väth 2010-01-07 15:25:00 UTC
(In reply to comment #16)
> Ok, the print commands do not return a newline

So your problem seems to be solved, Fabian - everything looks correctly.
The non-printing of newlines is intentional so that less workarounds are
needed in shell-scripts when trailing spaces should not be discarded:
A "simple"
  A="`eix --print MAKE_GLOBALS; echo x`" && A="${A%x}"
will also keep trailing spaces of MAKE_GLOBALS in A.
Comment 18 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-07 17:39:31 UTC
(In reply to comment #11)
> Created an attachment (id=215438) [details]
> Patch for debugging
> 
> If you find some time, please recompile eix with the attached patch and then
> post the output of eix --print PORTDIR
> 

%% eix --print PORTDIR
Trying to parse /home/jolexa/portage/linux-64/etc/eixrc
Parsing result: 
Trying to parse /home/jolexa/.eixrc
Parsing result: 
Trying to parse /home/jolexa/portage/linux-64/usr/share/portage/config/make.globals
PORTDIR="/home/jolexa/portage/linux-64/usr/portage" set in file /home/jolexa/portage/linux-64/usr/share/portage/config/make.globals
Parsing result: /home/jolexa/portage/linux-64/usr/portage
Trying to parse /home/jolexa/portage/linux-64/etc/make.conf
Trying to parse /home/jolexa/portage/global/make.conf
Parsing result: 
Parsing result: 
No PORTDIR specified - using fixed default
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/base/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/default/linux/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/features/multilib/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/arch/amd64/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/releases/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/releases/10.0/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/features/multilib/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/arch/amd64/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/arch/amd64/no-multilib/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/features/64bit-native/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/prefix/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/prefix/linux/make.defaults
Parsing result: /usr/portage/
Trying to parse /home/jolexa/portage/global/portage_tree/profiles/prefix/linux/amd64/make.defaults
Parsing result: /usr/portage/

You see the word 'global' above, that is my shared tree.
%% readlink usr/portage
../../global/portage_tree

But, if I change usr/portage to be not a symlink, it still fails.
Comment 19 Martin Väth 2010-01-07 20:34:08 UTC
Created attachment 215586 [details, diff]
Cleaner but slower implementation of APPEND_VALUES

Does the attached patch fix the problem?
Comment 20 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-07 23:11:42 UTC
(In reply to comment #19)
> Created an attachment (id=215586) [details]
> Cleaner but slower implementation of APPEND_VALUES
> 
> Does the attached patch fix the problem?
> 

Indeed it does! Will it be applied to trunk or make a new release? Any other info needed? Any info on why it started failing? (keep in mind the prefix-portage is just on the tip of the portage trunk, so it may be a good thing that we caught it here)
Comment 21 Martin Väth 2010-01-08 08:05:01 UTC
(In reply to comment #20)
> Will it be applied to trunk or make a new release?

Of course, but I also want to implement something in the release to avoid
that other people run into Fabian's problem.

> Any info on why it started failing?

It is not related at all with prefix-portage:
eix by mistake cleared incremental variables which are accessed but not set
in config files: I suppose that you access ${PORTDIR} in some of your two
make.conf files?
(BTW: --print of the variable where you use it should show that also this
variable has the wrong value because ${PORTDIR} is already empty there -
only later it will be set to the fallback-value "/usr/portage").

Comment 22 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-01-11 19:28:29 UTC
Thanks for the help. 19.2 is in the tree and I have confirmed it works out of the box. :)