Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 476398 - "use prefix" does not work in =app-admin/eselect-python-20111108.ebuild
Summary: "use prefix" does not work in =app-admin/eselect-python-20111108.ebuild
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: ARM Linux
: Normal minor (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-10 14:05 UTC by Daa Jaa
Modified: 2014-02-02 16:49 UTC (History)
3 users (show)

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


Attachments
patch to =app-admin/eselect-python-20111108.ebuild (file_476398.txt,630 bytes, patch)
2013-07-10 14:07 UTC, Daa Jaa
Details | Diff
emerge --info '=app-admin/eselect-python-20111108' on the raspberry powered by gentoo (file_476398.txt,5.51 KB, text/plain)
2013-07-10 14:16 UTC, Daa Jaa
Details
emerge --info on another system (gentoo on android) where I had to correct the same bug. (file_476398.txt,5.21 KB, text/plain)
2013-07-10 14:19 UTC, Daa Jaa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daa Jaa 2013-07-10 14:05:05 UTC
I have bootstraped an EPREFIX installation on the system described at http://wiki.gentoo.org/wiki/Raspberry_Pi_Quick_Install_Guide

During the bootstrap, `use prefix` returns false; and IUSE is empty.

I have patched =app-admin/eselect-python-20111108.ebuild (and also portage*.ebuild) to work around this problem. The patch is attached.

My $EPREFIX/etc/make.conf contains only one line, which is LDFLAGS="-Wl,-dynamic-linker=$EPREFIX/lib/ld-linux-armhf.so.3,-O1,--as-needed"

The exact line running emerge is:
  CONFIG_SHELL=/data/data/com.spartacusrex.spartacuside/gentoo_armv6l/bin/sh FEATURES=-sandbox emerge -v eselect-python
 
Please tell me if this patch is the correct way to go (which I doubt), or not.

Reproducible: Always

Steps to Reproduce:
1. Prepare the system described at http://wiki.gentoo.org/wiki/Raspberry_Pi_Quick_Install_Guide
2. bootstrap a EPREFIX installation following http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt
3. the condition "use prefix" is false when building =app-admin/eselect-python-20111108
Actual Results:  
`use prefix` returns false.

Expected Results:  
use prefix should return true.

Context:
I am developping a working portage installation on unrooted Android jelly bean (see gentooandroid.sourceforge.net for an early version) in alpha stage.
Comment 1 Daa Jaa 2013-07-10 14:07:06 UTC
Created attachment 353010 [details, diff]
patch to =app-admin/eselect-python-20111108.ebuild

The variable EPREFIX is set so I test it.
Comment 2 Daa Jaa 2013-07-10 14:16:42 UTC
Created attachment 353012 [details]
emerge --info '=app-admin/eselect-python-20111108' on the raspberry powered by gentoo

This emerge --invo is abount one installation on which I had to correct this bug.
Comment 3 Daa Jaa 2013-07-10 14:19:24 UTC
Created attachment 353014 [details]
emerge --info on another system (gentoo on android) where I had to correct the same bug.
Comment 4 Daa Jaa 2013-07-10 14:41:32 UTC
If the EPREFIX has exactly 110 characters, eselect-python will miss the "O" in "-O" and will result in the following bug:

ebuild app-admin/eselect-python/eselect-python-20111108.ebuild manifest                         
Python 2.7.3 (default, May 29 2013, 04:51:33) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
KeyboardInterrupt
(reverse-i-search)`': 
KeyboardInterrupt
>>> 
>>> quit()

This is how I stumbled on the bug reported here.

Would it be good to add a warning in the .ebuild about the length of $EPREFIX ?
Comment 5 Fabian Groffen gentoo-dev 2013-07-10 18:57:40 UTC
prefix should be set in the profiles

I don't understand your comment about -O being ignored.  Can you show what exactly you're doing that causes the misbehaviour?
Comment 6 Benda Xu gentoo-dev 2013-07-11 06:28:52 UTC
What do you have in your "prefix-with-glibc" overlay? Does it have a profile?
Comment 7 Daa Jaa 2013-07-11 08:39:07 UTC
Fabian@ https://bugs.gentoo.org/show_bug.cgid=476398#c5 "I don't understand your comment about -O being ignored.  Can you show what exactly you're doing that causes the misbehaviour"

Assume the string $EPREFIX is 110 bytes long.

As the first line of `which ebuild` is '#!$EPREFIX/usr/bin/python -O', the command
 ebuild app-admin/eselect-python/eselect-python-20111108.ebuild manifest
calls [see note 1 below]
 $EPREFIX/usr/bin/python - $EPREFIX/usr/bin/ebuild app-admin/eselect-python/eselect-python-20111108.ebuild manifest
which execs python-wrapper with argv set according to previous line
which executes
 $EPREFIX/usr/bin/python2.7 - $EPREFIX/usr/bin/ebuild app-admin/eselect-python/eselect-python-20111108.ebuild manifest
which displays the same thing as $EPREFIX/usr/bin/python2.7 alone: the welcome prompt line of python about copyright, which is
 Type "help", "copyright", "credits" or "license" for more information.
 >>> 

You may guess I had hard time understanding and solving this issue.

Note [1]: it happens only if $EPREFIX has a length of 110. Because then the first line of `which ebuild` is something linke 128 bytes long, and the O of '-O' is eaten out.
Then
 $EPREFIX/usr/bin/python - $EPREFIX/usr/bin/ebuild app-admin/eselect-python/eselect-python-20111108.ebuild manifest
is called instead of
 $EPREFIX/usr/bin/python -O $EPREFIX/usr/bin/ebuild app-admin/eselect-python/eselect-python-20111108.ebuild manifest

Fabian@ https://bugs.gentoo.org/show_bug.cgid=476398#c5 "prefix should be set in the profiles"
- Can you give me the full path to the file containing the relevant profiles ?
- 'prefix' should be in the variable USE ?
- 'prefix' it is not in the IUSE of app-admin/eselect-python/eselect-python-20111108.ebuild.

Benda@ https://bugs.gentoo.org/show_bug.cgid=476398#c6 "What do you have in your "prefix-with-glibc" overlay ?"
It is obtained by patching https://github.com/redlizard/gentoo-prefix-libc ; the patches are included in the patchset
 http://sourceforge.net/projects/gentooandroid/files/packages/packages/usr_portage.patch_v2

Benda@ https://bugs.gentoo.org/show_bug.cgid=476398#c6 "Does it have a profile ?"
I am not sure to understand clearly the question. Can you be more specific, now that I gave answer to you previous question ?

Thank you very much to you both to help me in my project (current state: xorg-server is now installed on my unrooted android, but I must patch and rebuild it, as /tmp does not exist).
Comment 8 Fabian Groffen gentoo-dev 2013-08-20 18:54:13 UTC
so, the prefix is too long for the shebang on the platform you're using, it seems
Comment 9 Daa Jaa 2013-08-23 16:00:37 UTC
1) I still have `use prefix` returning false, even after
echo prefix >> $EPREFIX/etc/portage/make.profile/use.force
(make.profile is $PORTDIR/profiles/default/linux/arm/13.0/armv6j/)
I found such a use.force in $PORTDIR/profiles/prefix/linux/ but this profiled is marked deprecated.

I will retry, adding prefix to IUSE when needed.

2) It would be nice to explain how to choose a profile, in http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt

3) Do you think I should nevertheless use $PORTDIR/profiles/prefix/linux/ ?
Comment 10 Daa Jaa 2013-08-23 16:28:10 UTC
1) I think that
echo '-prefix' >> $PORTDIR/etc/portage/make.profile/use.mask 
echo 'prefix' >> $PORTDIR/etc/portage/make.profile/use.mask 
should be in http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt

It will be the best solution to fix and resolve this bug.

What is you opinion ?

2) Other bug:
http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt is incompatible with profile $PORTDIR/profiles/default/linux/arm/13.0/armv6j//developer : is it documented ?kkkkkk
Comment 11 Daa Jaa 2013-08-23 16:29:24 UTC
oops, typo:

echo '-prefix' >> $PORTDIR/etc/portage/make.profile/use.mask
echo 'prefix' >> $PORTDIR/etc/portage/make.profile/use.force

is what solved the bug on =app-admin/eselect-python-20111108.ebuild.
Comment 12 Fabian Groffen gentoo-dev 2013-10-22 19:24:54 UTC
I don't understand really, you're bootstrapping a native gentoo on a Raspberry Pi, where does Prefix come into play here?

(I have a Raspberry Pi running vnilla Gentoo myself with no such problems.)
Comment 13 Daa Jaa 2013-11-01 20:36:17 UTC
@Fabian Groffen: "I don't understand really, you're bootstrapping a native gentoo on a Raspberry Pi, where does Prefix come into play here?"

I built it to bootstrap gentooandroid.sourceforge.net ; bootstrapping directly on Android did not work because I didn't find a working linker.
Comment 14 Fabian Groffen gentoo-dev 2013-11-01 20:45:40 UTC
(In reply to Daa Jaa from comment #13)
> @Fabian Groffen: "I don't understand really, you're bootstrapping a native
> gentoo on a Raspberry Pi, where does Prefix come into play here?"
> 
> I built it to bootstrap gentooandroid.sourceforge.net ; bootstrapping
> directly on Android did not work because I didn't find a working linker.

I'm not familiar with that project.  Frankly, I don't understand its description, in particular about IDEs and EPREFIX.
Comment 15 Daa Jaa 2013-11-03 07:50:02 UTC
I updated the description of GentooAndroid to take you comments in account.

md5sum d127df34b70923470a6608ea608bee0f, sha1sum 2c07ff43d2c8c8095fc0139adc93edbdcdece60e for gentoo_armv6l_unrooted_unlocked_android_v5.tar.bz2
Comment 16 Benda Xu gentoo-dev 2013-11-03 08:12:53 UTC
(In reply to Daa Jaa from comment #7)

> Benda@ https://bugs.gentoo.org/show_bug.cgid=476398#c6 "What do you have in
> your "prefix-with-glibc" overlay ?"
> It is obtained by patching https://github.com/redlizard/gentoo-prefix-libc ;
> the patches are included in the patchset
>  http://sourceforge.net/projects/gentooandroid/files/packages/packages/
> usr_portage.patch_v2

Nice job! Would you like to refine your patch to get it included in Gentoo and upstream? I am eager to help.

> Benda@ https://bugs.gentoo.org/show_bug.cgid=476398#c6 "Does it have a
> profile ?"
> I am not sure to understand clearly the question. Can you be more specific,

What's the output of

$ ls -l $EPREFIX/etc/portage/make.profile $EPREFIX/etc/make.profile
Comment 17 Benda Xu gentoo-dev 2013-11-03 08:17:19 UTC
(In reply to Daa Jaa from comment #10)

> 2) Other bug:
> http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/
> bootstrap-prefix.sh?format=txt is incompatible with profile
> $PORTDIR/profiles/default/linux/arm/13.0/armv6j//developer : is it
> documented ?kkkkkk

Please don't off topic. Open another bug please.

How incompatible is that?
Comment 18 Benda Xu gentoo-dev 2013-11-03 08:18:54 UTC
(In reply to Fabian Groffen from comment #8)
> so, the prefix is too long for the shebang on the platform you're using, it
> seems

Yeah, I think so, too.

http://stackoverflow.com/questions/10813538/shebang-line-limit-in-bash-and-linux-kernel
Comment 19 Daa Jaa 2013-11-03 21:50:50 UTC
> @Benda "Nice job!"

Thank you.

> @Benda "Would you like to refine your patch to get it included in Gentoo and upstream?"

Are you talking about everything in usr_portage.patch_v2 (dedicated to port Gentoo EPREFIX to Android, I just uploaded newest version http://sourceforge.net/projects/gentooandroid/files/packages/packages/usr_portage.patch_v6 for your information) ? Or just the part of it which is relevant to gentoo-prefix-libc ?

@Benda "I am eager to help."

My employer and my family life do not let me enough time to be able to pass http://www.gentoo.org/proj/en/devrel/quiz/ebuild-quiz.txt

So I have questions:

(1) how to modify bootstrap-prefix.sh so that it applies automatically my suggestions of adding prefix and -prefix, as specified in my comment #11 ? This is essential to close this bug.

(2) how to patch bin/misc-functions.sh, around message "prefixing shebang", so that it issues warnings when the prefixed shebang is larger than BINPRM_BUF_SIZE ?

(3) what script should write LDFLAGS="-Wl,-dynamic-linker=$EPREFIX/lib/ld-linux-armhf.so.3,-O1,--as-needed" to /etc/make.conf ?

(4) I have conflict between sys-apps/baselayout-2.2 and sys-apps/baselayout-prefix-2.2-r2, I need elements from both because of prefixed glibc, what should I do ?

(5) should bootstrap-prefix.sh be used on newest profile or on profile tested whose URL is given in bootstrap-prefix.sh ?

I have unfortunately temporarily lost access to my Android device, because of failed Android upgrade.

If you have more time than just answer to (1)-(4) above, you may contributes to step 4 and 6 of my project as explained in http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/daajaa/1 ;

In practice: please take a random patch from http://sourceforge.net/projects/gentooandroid/files/packages/packages/usr_portage.patch_v6 and test it on an arm prefix installation (based on my gentooandroid, or not), to see compiler errors without my patch. Then try to port my patch to the up-to-date ebuild, then try again without then with that patch.

> Benda@ "What's the output of $ ls -l $EPREFIX/etc/portage/make.profile $EPREFIX/etc/make.profile"

/data/data/com.spartacusrex.spartacuside/gentoo_armv6l/etc $ ls -l make.profile
 ls: cannot access make.profile: No such file or directory
/data/data/com.spartacusrex.spartacuside/gentoo_armv6l/etc $ ls -l portage/make.profile 
lrwxrwxrwx 1 10098 10098 105 Jun 18 13:23 portage/make.profile -> /data/data/com.spartacusrex.spartacuside/gentoo_armv6l/usr/portage/profiles/default/linux/arm/13.0/armv6j

> @Benda "How incompatible is that?"

bootstrap-prefix.sh fails earlier and a lot more than with profile $PORTDIR/profiles/default/linux/arm/13.0/armv6j

> @Benda "Please don't off topic. Open another bug please."

I think I will reported that bug after $PORTDIR/profiles/default/linux/arm/13.0/armv6j bootstraps nicely.
Comment 20 Benda Xu gentoo-dev 2013-11-04 10:30:41 UTC
(In reply to Daa Jaa from comment #19)

> > @Benda "Would you like to refine your patch to get it included in Gentoo and upstream?"
> 
> Are you talking about everything in usr_portage.patch_v2 (dedicated to port
> Gentoo EPREFIX to Android, I just uploaded newest version
> http://sourceforge.net/projects/gentooandroid/files/packages/packages/
> usr_portage.patch_v6 for your information) ? Or just the part of it which is
> relevant to gentoo-prefix-libc ?

Is there anything that is not relavent to gentoo-prefix-libc?
 
> @Benda "I am eager to help."
> 
> So I have questions:
> 
> (1) how to modify bootstrap-prefix.sh so that it applies automatically my
> suggestions of adding prefix and -prefix, as specified in my comment #11 ?
> This is essential to close this bug.

See my last reply below.

> (2) how to patch bin/misc-functions.sh, around message "prefixing shebang",
> so that it issues warnings when the prefixed shebang is larger than
> BINPRM_BUF_SIZE ?

Go ahead and figure it out yourself, and then submit it to the portage maintainers.

> (3) what script should write
> LDFLAGS="-Wl,-dynamic-linker=$EPREFIX/lib/ld-linux-armhf.so.3,-O1,--as-
> needed" to /etc/make.conf ?

Never, it is implemented in toolchain.eclass, in the gentoo-prefix-libc overlay.

> (4) I have conflict between sys-apps/baselayout-2.2 and
> sys-apps/baselayout-prefix-2.2-r2, I need elements from both because of
> prefixed glibc, what should I do ?

Use openrc and baselayout together.

> (5) should bootstrap-prefix.sh be used on newest profile or on profile
> tested whose URL is given in bootstrap-prefix.sh ?

The latter.

But use the one in gentoo-prefix-libc instead of that in Prefix overlay.

> If you have more time than just answer to (1)-(4) above, you may contributes
> to step 4 and 6 of my project as explained in
> http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/daajaa/1 ;

"This proposal is not made public, and you are not the student who submitted the proposal, nor are you a mentor for the organization it was submitted to."

BTW, I have a similar project this year.

http://www.awa.tohoku.ac.jp/~benda/projects/android.html

under gsoc. We should have known each other before to avoid duplicate effort.

> In practice: please take a random patch from
> http://sourceforge.net/projects/gentooandroid/files/packages/packages/
> usr_portage.patch_v6 and test it on an arm prefix installation (based on my
> gentooandroid, or not), to see compiler errors without my patch. Then try to
> port my patch to the up-to-date ebuild, then try again without then with
> that patch.

This implies too much work for me to carry it out.

Would you like to break the patch into logical units and explain the purposes, so that everyone will benefit from it easiser? It's easier for you than I to do so.

> > Benda@ "What's the output of $ ls -l $EPREFIX/etc/portage/make.profile $EPREFIX/etc/make.profile"
> 
> /data/data/com.spartacusrex.spartacuside/gentoo_armv6l/etc $ ls -l
> make.profile
>  ls: cannot access make.profile: No such file or directory
> /data/data/com.spartacusrex.spartacuside/gentoo_armv6l/etc $ ls -l
> portage/make.profile 
> lrwxrwxrwx 1 10098 10098 105 Jun 18 13:23 portage/make.profile ->
> /data/data/com.spartacusrex.spartacuside/gentoo_armv6l/usr/portage/profiles/
> default/linux/arm/13.0/armv6j

See the bottom reply

> > @Benda "How incompatible is that?"
> 
> bootstrap-prefix.sh fails earlier and a lot more than with profile
> $PORTDIR/profiles/default/linux/arm/13.0/armv6j

See the latest reply

> > @Benda "Please don't off topic. Open another bug please."
> 
> I think I will reported that bug after
> $PORTDIR/profiles/default/linux/arm/13.0/armv6j bootstraps nicely.

default/linux/arm/13.0/armv6j is not a Prefix profile. That's why it does not define USE prefix. Use default/linux/arm/13.0/armv6j/rap from gentoo-prefix-libc overlay intead. If it does not exist, copy one from default/linux/arm/13.0/armv7a/rap and customize yourself. Patch welcome.
Comment 21 Fabian Groffen gentoo-dev 2014-02-02 16:49:16 UTC
this should be fixed by latest version which was redone for Prefix