Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 384167 - sys-devel/crossdev: prefix support
Summary: sys-devel/crossdev: prefix support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: x86 OS X
: Normal major with 1 vote (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
: 428804 586726 632662 (view as bug list)
Depends on: 395633 prefix-glibc
Blocks: prefix-gx86 395505
  Show dependency tree
 
Reported: 2011-09-23 06:39 UTC by Benn Snyder
Modified: 2017-11-19 00:54 UTC (History)
12 users (show)

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


Attachments
sys-devel/crossdev-20101011.ebuild (crossdev-20101011.ebuild,847 bytes, text/plain)
2011-09-23 06:40 UTC, Benn Snyder
Details
crossdev-20101011-eprefix.patch (crossdev-20101011-eprefix.patch,5.20 KB, patch)
2011-09-23 06:41 UTC, Benn Snyder
Details | Diff
patch fail (crossdev-20110819-eprefix.patch.out,9.55 KB, text/plain)
2011-10-02 18:49 UTC, matt
Details
patch against crossdev git HEAD (prefixify.patch,9.89 KB, patch)
2011-12-22 04:44 UTC, Benda Xu
Details | Diff
crossdev.patch (crossdev.patch,3.51 KB, patch)
2012-07-31 15:41 UTC, Massimo Burcheri
Details | Diff
crossdev-20120531.patch for Prefix (crossdev-20120531.patch,5.39 KB, patch)
2012-08-01 07:57 UTC, Massimo Burcheri
Details | Diff
crossdev-prefix.patch (0001-Prefix-support.patch,8.34 KB, patch)
2013-07-28 01:33 UTC, Benda Xu
Details | Diff
crossdev-prefix.patch (0001-Prefix-support.patch,7.89 KB, patch)
2013-07-28 01:39 UTC, Benda Xu
Details | Diff
Extended patch against current devel HEAD (0001-Add-Prefix-support-to-crossdev.patch,8.72 KB, patch)
2016-06-24 15:00 UTC, Michael Weiser
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benn Snyder 2011-09-23 06:39:19 UTC
sys-devel/crossdev-20101011 fails to build due to an unset SRC_URI variable.  It also fails because it tries to install files outside the prefix.

Reproducible: Always

Steps to Reproduce:
1. emerge -v =sys-devel/crossdev-20101011
Actual Results:  
Build fails

Expected Results:  
Build succeeds

Portage 2.2.01.19295-prefix (prefix/darwin/macos/10.5/x86, gcc-4.2.1, unavailable, 9.8.0 i386)
=================================================================
System uname: Darwin-9.8.0-i386-32bit
Timestamp of tree: Thu, 22 Sep 2011 23:11:30 +0000
distcc 2.18.5-Apple.1 i386-apple-darwin9.0 (protocols 1 and 2) (default port 3632) [disabled]
app-shells/bash:      4.2_p10
dev-lang/python:      2.7.2
dev-util/pkgconfig:   0.25-r2
sys-devel/autoconf:   2.68
sys-devel/automake:   1.11.1
sys-devel/gcc-config: 1.4.1-r00.2
sys-devel/libtool:    2.4-r01.1
sys-devel/make:       3.82
Repositories: gentoo_prefix x-portage
Installed sets: 
ACCEPT_KEYWORDS="~x86-macos"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-apple-darwin9"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CHOST="i686-apple-darwin9"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/portage /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
DISTDIR="/Volumes/gentoo-osx-prefix/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-j 8 --load-average=6"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles fixpackages news nostrip parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-dead_strip_dylibs"
MAKEOPTS="-j 10 -l 8"
PKGDIR="/Volumes/gentoo-osx-prefix/usr/portage/packages"
PORTAGE_CONFIGROOT="/Volumes/gentoo-osx-prefix/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/Volumes/gentoo-osx-prefix/var/tmp"
PORTDIR="/Volumes/gentoo-osx-prefix/usr/portage"
PORTDIR_OVERLAY="/Volumes/gentoo-osx-prefix/usr/local/portage"
SYNC="rsync://rsync.prefix.freens.org/gentoo-portage-prefix"
USE="aqua coreaudio cracklib cxx mmx mmxext modules ncurses objc objc++ prefix readline sse sse2 ssl threads x86-macos zlib" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="Darwin" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse" KERNEL="Darwin" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Benn Snyder 2011-09-23 06:40:50 UTC
Created attachment 287471 [details]
sys-devel/crossdev-20101011.ebuild

Fixed ebuild for sys-devel/crossdev-20101011
Comment 2 Benn Snyder 2011-09-23 06:41:53 UTC
Created attachment 287473 [details, diff]
crossdev-20101011-eprefix.patch

Patch to keep sys-devel/crossdev inside the prefix
Comment 3 matt 2011-10-02 18:49:15 UTC
Created attachment 288587 [details]
patch fail

tried your patch on osx and failed

Portage 2.2.01.19295-prefix (prefix/darwin/macos/10.4/ppc, gcc-4.2.1, unavailable, 8.11.0 Power Macintosh)
=================================================================
System uname: Darwin-8.11.0-Power_Macintosh-powerpc-32bit
Timestamp of tree: Wed, 28 Sep 2011 02:10:13 +0000
distcc 2.18.4-Apple.1 powerpc-apple-darwin8.0 (protocols 1 and 2) (default port 3632) [disabled]
app-shells/bash:      4.2_p10
dev-lang/python:      2.6.5-r2, 2.7.2
dev-util/cmake:       2.8.1-r2
dev-util/pkgconfig:   0.25-r2
sys-devel/autoconf:   2.68
sys-devel/automake:   1.10.3, 1.11.1
sys-devel/gcc-config: 1.4.1-r00.2
sys-devel/libtool:    2.4-r01.1
sys-devel/make:       3.82
Repositories: gentoo_prefix myprefixebuilds nesicide mupen64plus supertuxkart
Installed sets: 
ACCEPT_KEYWORDS="~ppc-macos"
ACCEPT_LICENSE="* -@EULA"
CBUILD="powerpc-apple-darwin8"
CFLAGS="-02 -pipe -maltivec -mcpu=G4 -mtune=G4"
CHOST="powerpc-apple-darwin8"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/portage /etc/revdep-rebuild /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-02 -pipe -maltivec -mcpu=G4 -mtune=G4"
DISTDIR="/Volumes/prefix-ppc-macos-native/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles fixpackages news nostrip parallel-fetch preserve-libs protect-owned sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,-dead_strip_dylibs"
LINGUAS="en en_US"
Comment 4 Benn Snyder 2011-10-02 21:48:43 UTC
The patch I submitted is for crossdev-20101011.  Once I upgrade to a newer version of crossdev, I'll upload a patch for it.
Comment 5 SpanKY gentoo-dev 2011-11-18 17:36:00 UTC
(In reply to comment #2)

really should be written against git and submitted so it can actually get merged
Comment 6 Benda Xu gentoo-dev 2011-12-22 04:44:03 UTC
Created attachment 296623 [details, diff]
patch against crossdev git HEAD

This patch should work only for toolchain building (will verify it when glibc/uclibc are synced to prefix tree)

for cross emerge, need to wait for bug 395633 to be solved, which does not seem trivial.
Comment 7 Massimo Burcheri 2012-07-30 12:47:00 UTC
As for crossdev-20120531.ebuild this still fails because of files outside the prefix.
Comment 8 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2012-07-31 13:53:22 UTC
*** Bug 428804 has been marked as a duplicate of this bug. ***
Comment 9 Massimo Burcheri 2012-07-31 15:41:18 UTC
Created attachment 319886 [details, diff]
crossdev.patch

First of all the ebuild needs to be patched:

$ diff  ~/gentoo/usr/portage/sys-devel/crossdev/crossdev-20120531.ebuild crossdev-20120531.ebuild 
31c31,32
< 	default
---
> 	emake PREFIX=${EPREFIX} install


Then the crossdev script itself is not adapted for Prefix. I added a patch here which makes crossdev working so far. Only cross-glibc-headers is failing at the end. First there still was a a keyword missing which the script should manage itself. This I added to a seperate package.keywords file (for not getting overwritten by crossdev):
=cross-powerpc-unknown-linux-gnu/glibc-2.14 **

But then it fails again like this:

 * ERROR: cross-powerpc-unknown-linux-gnu/glibc-2.14 failed (unpack phase):
 *   Could not locate requested eblit 'src_unpack' in /home/mo/gentoo/usr/local/portage/cross-powerpc-unknown-linux-gnu/glibc/files/eblits/
Comment 10 SpanKY gentoo-dev 2012-07-31 16:17:13 UTC
Comment on attachment 319886 [details, diff]
crossdev.patch

patches should be in unidiff format
Comment 11 Massimo Burcheri 2012-08-01 07:57:54 UTC
Created attachment 319948 [details, diff]
crossdev-20120531.patch for Prefix

Again in unidiff format.
Comment 12 SpanKY gentoo-dev 2012-08-20 21:43:49 UTC
Comment on attachment 319948 [details, diff]
crossdev-20120531.patch for Prefix

i'm not sure about some parts of this.  the prefix team will have to comment.

first off, initialize EPREFIX at the top of the file:
    EPREFIX="@EPREFIX@"
    if [[ ${EPREFIX} == @*@ ]] ; then
        EPREFIX=""
    fi

make sure you always quote this variable, e.g.:
    cd "${EPREFIX}/"

with PORTAGE_CONFIGROOT, i think EPREFIX should be after it, not before, or perhaps the two are completely mutually exclusive.  prefix team would have to comment.

similarly, i think PORT_LOGDIR should not always have EPREFIX added to it:
    : ${PORT_LOGDIR:=${EPREFIX}/var/log/portage}
    mkdir -p "${PORT_LOGDIR}"

for the uninstall logic, please declare local variables to hold these paths so we don't have to copy & paste them all the time.  like:
    local vdb="${EPREFIX}/var/db/pkg"
    local bindir="${EPREFIX}/usr/bin"
    ...

pretty sure the change to "logfile" at the end is unnecessary.  you've prepended EPREFIX to the path twice at that point.
Comment 13 Christoph Junghans (RETIRED) gentoo-dev 2012-08-27 20:23:48 UTC
@heroxbd: Did you had a look at crossdev-20120531 there seem to be no difference anymore between the version in gx86 and prefix-overlay.
Comment 14 Benda Xu gentoo-dev 2012-09-12 10:42:10 UTC
(In reply to comment #13)

Yeah, prefix overlay copies from gx86 tree by default.
Comment 15 Greg Turner 2013-06-20 20:53:55 UTC
I whipped up this eprefixify-based implementation for an overlay; I'm not sure if it's 100% correct, but it seems to work:

https://raw.github.com/gmt/crossdev-prefix-compat-fixes/master/portage_diffs/sys-devel_crossdev.diff

https://raw.github.com/gmt/crossdev-prefix-compat-fixes/master/sys-devel/crossdev/files/crossdev-git-eprefix.patch

I can definitely upload those to this bug if folks feel this approach has any merit upstream.
Comment 16 Greg Turner 2013-06-21 08:46:31 UTC
(In reply to Greg Turner from comment #15)
> I whipped up this eprefixify-based implementation for an overlay; I'm not
> sure if it's 100% correct, but it seems to work:
> 
> https://raw.github.com/gmt/crossdev-prefix-compat-fixes/master/portage_diffs/
> sys-devel_crossdev.diff
> 
> https://raw.github.com/gmt/crossdev-prefix-compat-fixes/master/sys-devel/
> crossdev/files/crossdev-git-eprefix.patch
> 
> I can definitely upload those to this bug if folks feel this approach has
> any merit upstream.

Not entirely sure why I bothered to reimplement it this way as I was aware of this bug when I did this eprefixification patch, btw.

This may be a flaw -- by design, or otherwise -- of crossdev's code, or a symptom of my own cognitive sloppiness/ignorance, but for such a small body of code, I find crossdev (the script, as in $(which crossdev)) fairly difficult to comprehend.

I suppose I figured eprefixification would absolve me of the need to satisfy myself, for example, that variables defined at point "A" in crossdev are still around and valid at point "B".

Portability (in the sense of being usable outside of the prefix for which it was emerged) would be a good argument against my and Benda's approaches and in favor of Massimo's, assuming both work equally well otherwise.

Another argument against my and Benda's approaches would be that were patches like ours to go upstream, an additional processing step (eprefixification or processing with sed, respectively -- same difference really) would need to occur before the script code in git is runnable, whereas, with Massimo's approach, no such limitation exists.

I must say, however, that in Massimo's version, I don't understand where the variable EPREFIX is expected to come from.  If the answer is "the environment," then I think that's no good, as EPREFIX is not expected or required to be defined, and, indeed, it is scrubbed by the officially sanctioned way to activate a prefix environment: scripts/startprefix.in.

To effectively fix that, I would propose to add something like:

  : ${EPREFIX:=$(portageq envvar EPREFIX)}

towards the beginning, before $EPREFIX is used.
Comment 17 Benda Xu gentoo-dev 2013-07-28 01:21:23 UTC
Hey Greg,

Good to see you again! Let me revise this patch to reflect what I've learnt in the past year.
Comment 18 Benda Xu gentoo-dev 2013-07-28 01:33:52 UTC
Created attachment 354346 [details, diff]
crossdev-prefix.patch

Mike,

I have updated the patch to use the same EPREFIX style in bug 473484.

Please review.

Benda
Comment 19 Benda Xu gentoo-dev 2013-07-28 01:39:05 UTC
Created attachment 354352 [details, diff]
crossdev-prefix.patch

a revision
Comment 20 Benda Xu gentoo-dev 2013-09-21 11:10:07 UTC
Hey, Mike. I really want to have Prefix support in crossdev. If your time is limited, I'd be eager to co-maintain. Thanks.
Comment 21 Felix Janda 2016-01-20 14:08:08 UTC
From the patch in Comment 19:

--- a/crossdev
+++ b/crossdev
@@ -12,9 +12,15 @@ if [[ ${ROOT:-/} != "/" ]] ; then
 	exit 2
 fi
 
+EPREFIX="/home/benda/gnto"
+if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
+	EPREFIX=""
+fi

It might be useful to generate crossdev from a crossdev.in...
Comment 22 SpanKY gentoo-dev 2016-01-20 16:19:47 UTC
(In reply to Felix Janda from comment #21)

no, i don't want that at all.  i run crossdev directly when testing all the time.
Comment 23 SpanKY gentoo-dev 2016-01-20 16:21:42 UTC
Comment on attachment 354352 [details, diff]
crossdev-prefix.patch

the crossdev here has your $HOME encoded in it ;)

that logic for setting up EPREFIX should be used in the other wrappers too instead of just hardcoding @GENTOO_PORTAGE_EPREFIX@ in them.

as for make.conf, you can use direct $EPREFIX and such there.  those files are fully generated already.
Comment 24 Benda Xu gentoo-dev 2016-06-23 00:38:50 UTC
*** Bug 586726 has been marked as a duplicate of this bug. ***
Comment 25 Michael Weiser 2016-06-24 15:00:10 UTC
Created attachment 438666 [details, diff]
Extended patch against current devel HEAD

As asked in bug #586726 I've rebased Benda's last patch against current devel HEAD and added missing stuff from my patch of bug #586726 to it. This basically is only this bit:

--- a/crossdev
+++ b/crossdev
@@ -7,15 +7,20 @@ CROSSDEV_VER="@CDEVPV@"
 cd /
 umask 0022 #159111

-: ${ROOT:=/}
-if [[ ${ROOT} != "/" ]] ; then
+: ${ROOT:=${EPREFIX}}
+if [[ ${ROOT} != "${EPREFIX}" ]] ; then

which avoids the following message from crossdev:

$ crossdev --gcc 5.3.0 avr
ERROR: This version of portageq only supports <eroot>s ending in '/usr/local/gentoo'. The provided <eroot>, '/', doesn't.
 * You need to specify an output overlay.  Please use --ov-output, or consult
 * https://wiki.gentoo.org/wiki/Overlay/Local_overlay for more details.

I also followed vapier's suggestion to only once initialise EPREFIX from @GENTOO_PORTAGE_EPREFIX@ in each file and then use variable EPREFIX as normal.
Comment 26 tsmksubc 2016-10-29 20:05:32 UTC
Any progress?
Comment 27 Benda Xu gentoo-dev 2017-10-02 03:11:13 UTC
*** Bug 632662 has been marked as a duplicate of this bug. ***
Comment 28 Fabian Groffen gentoo-dev 2017-11-14 14:36:08 UTC
@heroxbd: could you give this a final spin, else I'd like to officially give up on this bug and close it.
Comment 29 Michael Weiser 2017-11-15 19:01:08 UTC
(In reply to Fabian Groffen from comment #28)
> @heroxbd: could you give this a final spin, else I'd like to officially give
> up on this bug and close it.

Prefixification is in the git repo since 2017-06-25:

commit d370474e3f85a3bbcbb2026ca5ec55257b7a0f39
Author:     XU Benda <heroxbd@gmail.com>
AuthorDate: Thu Dec 22 13:37:11 2011 +0900
Commit:     Benda Xu <heroxbd@gentoo.org>
CommitDate: Sat Jun 25 22:45:04 2016 +0900

    prefixify build system and scripts.

I just installed it via crossdev-99999999 and it sets off fine, building and installing a new toolchain. I guess, this bug can be closed then.
Comment 30 Fabian Groffen gentoo-dev 2017-11-18 09:52:38 UTC
Thanks Michael!
Comment 31 Benda Xu gentoo-dev 2017-11-19 00:54:27 UTC
Sorry, I don't remember that I have fixed it :)