Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for overriding profile #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crossdev
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ SHOW_FAIL_LOG="no"
SHOW_TARGET_CFG="no"
INIT_TARGET_ONLY="no"
LLVM="no"
PROFILE="embedded"

while [[ $# -gt 0 ]] ; do
case $1 in
Expand Down Expand Up @@ -939,6 +940,7 @@ while [[ $# -gt 0 ]] ; do
--cpkg) shift; CPKG=$1;;
-ox|--ov-extra) shift; XOVLS+=( "$1" );;
--env) shift; AENV=$1;;
--profile) shift; PROFILE=$1;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hard to tell in GitHub, but I think your whitespace is off here.

-L|--llvm) LLVM="yes";;
-A|--abis) shift; MULTILIB_ABIS=$1;;
--host-abi) shift; HOST_ABI=$1;;
Expand Down Expand Up @@ -1557,7 +1559,7 @@ hr
### Create links for helper scripts ###

xmkdir -p "${EPREFIX}"/usr/${CTARGET}
LLVM="${LLVM}" emerge-wrapper --target ${CTARGET} --init || exit 1
LLVM="${LLVM}" emerge-wrapper --target ${CTARGET} --init --profile ${PROFILE} || exit 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also quote here, include CTARGET while you're at it.

Suggested change
LLVM="${LLVM}" emerge-wrapper --target ${CTARGET} --init --profile ${PROFILE} || exit 1
LLVM="${LLVM}" emerge-wrapper --target "${CTARGET}" --init --profile "${PROFILE}" || exit 1


#############################################################
### Create directories usually created by sys-apps/baselayout
Expand Down
9 changes: 8 additions & 1 deletion wrappers/emerge-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ cross_wrap_etc()
setup_warning=false

cp -a "${PREFIX}"/share/crossdev/etc ${SYSROOT}/ || return 1
ln -snf "${MAIN_REPO_PATH}/profiles/embedded" "${SYSROOT}/etc/portage/make.profile" || return 1

local confs=(
${SYSROOT}/etc/portage/make.conf
Expand Down Expand Up @@ -107,6 +106,8 @@ cross_wrap_etc()
EOF
fi

PORTAGE_CONFIGROOT=${SYSROOT} eselect profile set --force ${PROFILE}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to suggest setting ROOT=/usr/${CHOST} and EPREFIX= instead, but looking at how profile.eselect works, I think what you have is correct because the repos are not configured under /usr/${CHOST}/etc/portage.

It's slightly brittle in that it relies on profile.eselect calling portageq get_repo_path "${EROOT:-/}" and portageq get_repo_path (thankfully) ignoring PORTAGE_CONFIGROOT, but that's what we have to work with.

But it is probably best to quote PROFILE here.

Suggested change
PORTAGE_CONFIGROOT=${SYSROOT} eselect profile set --force ${PROFILE}
PORTAGE_CONFIGROOT=${SYSROOT} eselect profile set --force "${PROFILE}"


return 0
}

Expand Down Expand Up @@ -159,12 +160,18 @@ CHOST=${CHOST%-emerge}
CHOST=${CHOST#emerge-}
export CHOST

PROFILE="embedded"

if [[ $1 == "--target" ]] ; then
CHOST=$2
shift 2
fi

if [[ $1 == "--init" ]] ; then
shift
if [[ $1 == "--profile" ]] ; then
PROFILE=$2
fi
cross_init
exit $?
fi
Expand Down