aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'wrappers/emerge-wrapper')
-rwxr-xr-xwrappers/emerge-wrapper19
1 files changed, 17 insertions, 2 deletions
diff --git a/wrappers/emerge-wrapper b/wrappers/emerge-wrapper
index 7bcbcf0..154d82e 100755
--- a/wrappers/emerge-wrapper
+++ b/wrappers/emerge-wrapper
@@ -41,7 +41,7 @@ cross_wrap_etc()
# Re-use existing CHOST->portage ARCH mapping code
ARCH=$(
inherit() { :; }
- . "${PORTDIR}"/eclass/toolchain-funcs.eclass
+ . "${MAIN_REPO_PATH}"/eclass/toolchain-funcs.eclass
tc-arch
)
[[ ${ARCH} == "unknown" ]] && emit_setup_warning
@@ -109,10 +109,25 @@ cross_init()
# CBUILD must be the first thing we export, but might as well avoid
# running portageq multiple times ...
-import_vars="PORTDIR DISTDIR PORTDIR_OVERLAY MAKEOPTS GENTOO_MIRRORS"
+import_vars="DISTDIR MAKEOPTS GENTOO_MIRRORS"
eval $(portageq envvar -v CBUILD ${import_vars})
export CBUILD
+# Probably shouldn't hardcode "gentoo" here.
+MAIN_REPO_PATH=$(portageq repositories_configuration / | gawk '
+ {
+ if ($1 == "main-repo") {
+ main_repo = $NF
+ } else if ($1 ~ /^\[/) {
+ locs[repo_name] = loc
+ repo_name = gensub(/\[([^\]]*)\]/, "\\1", "", $1)
+ } else if ($1 == "location") {
+ loc = $3
+ }
+ }
+ END { print(locs[main_repo]) }
+')
+
# Get default CHOST value from program name
CHOST=${0##*/}
CHOST=${CHOST%-emerge}