Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 266411 Details for
Bug 265264
app-admin/eselect: profiles module does not support profiles in overlays
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add support selecting profile from overlay
profile.eselect.diff (text/plain), 5.38 KB, created by
mike
on 2011-03-18 23:28:03 UTC
(
hide
)
Description:
Add support selecting profile from overlay
Filename:
MIME Type:
Creator:
mike
Created:
2011-03-18 23:28:03 UTC
Size:
5.38 KB
patch
obsolete
>--- profile.eselect-810 2011-03-19 00:48:55.328215898 +0200 >+++ profile.eselect 2011-03-19 01:09:45.192215899 +0200 >@@ -11,6 +11,15 @@ > SVN_DATE='$Date$' > VERSION=$(svn_date_to_version "${SVN_DATE}") > >+ROOT="$(canonicalise "${ROOT}")" >+EROOT="$(canonicalise "${EROOT}")" >+# remove the exta slashes and oter tash if exist >+ROOT="${ROOT:=/}" >+ >+# get a list of all overlays >+PORTDIR_OVERLAY=$(PORTAGE_CONFIGROOT=${ROOT} portageq portdir_overlay) >+#echo "PORTDIR_OVERLAY=${PORTDIR_OVERLAY}" >+ > # get location of make.profile symlink > get_symlink_location() { > local oldloc=${EROOT%/}/etc/make.profile >@@ -27,19 +36,29 @@ > fi > } > >+### using in show and list action ### >+ >+get_active() { >+ get_symlink_location >+ local portdir=$(PORTAGE_CONFIGROOT=${ROOT} portageq portdir) >+ canonicalise "${MAKE_PROFILE}" | \ >+ sed -nre "s:^${ROOT%/}($( >+ echo $portdir $PORTDIR_OVERLAY | sed -re 's/\s+/|/g' >+ ))/profiles/(\S+)$:\2:p" >+} >+ > # get a list of valid profiles > find_targets() { > local arch p portdir=$1 >- [[ -n ${portdir} ]] || portdir=$(portageq portdir) >+ [[ -n ${portdir} ]] || portdir=$(PORTAGE_CONFIGROOT=${ROOT} portageq portdir) > > arch=$(arch) > [[ -z ${arch} ]] && return 1 > >- for p in $(sed -n -e "s|^${arch}[[:space:]]\+\([^[:space:]]\+\).*$|\1|p" \ >- "${ROOT}${portdir}/profiles/profiles.desc") >- do >- echo ${p} >- done >+ sed -rne "s|^${arch}\s+(\S+).*$|\1|p" \ >+ $(echo $PORTDIR_OVERLAY $portdir | \ >+ sed -re 's|(\S+)\s*|\1/profiles/profiles.desc |g') \ >+ 2>/dev/null > } > > # remove make.profile symlink >@@ -49,50 +68,40 @@ > > # set the make.profile symlink > set_symlink() { >- local portdir=$(portageq portdir) target=$1 force=$2 targets arch parch >+ [[ -z "${target}" ]] && die -q "Target \"${target}\" doesn't appear to be valid!" >+ >+ local portdir=$(PORTAGE_CONFIGROOT=${ROOT} portageq portdir) target=$1 targets profdir arch > > if is_number "${target}"; then > targets=( $(find_targets "${portdir}") ) > [[ -z ${targets} ]] && die -q "Failed to get a list of valid profiles" > target=${targets[target-1]} >- elif [[ -n ${target} && -d ${ROOT}${portdir}/profiles/${target} ]] >- then >- # if the profile was explicitly specified (rather than a number) >- # double check and make sure it's valid > arch=$(arch) >- [[ -z ${arch} && -z ${force} ]] && return 1 >- >- # do a reverse lookup and find the arch associated with ${target} >- parch=$(sed -n -e \ >- "s|^\([[:alnum:]]\+\)[[:space:]].*${target}[[:space:]].*$|\1|p" \ >- "${ROOT}${portdir}/profiles/profiles.desc") >- >- if [[ ${arch} != ${parch} && -z ${force} ]]; then >- die -q "${target} is not a valid profile for ${arch}" >- fi > fi > >- if [[ -z ${target} ]]; then >- die -q "Target \"$1\" doesn't appear to be valid!" >- elif [[ -d ${ROOT}${portdir}/profiles/${target} ]]; then >- # we must call remove_symlink() here instead of calling >- # it from do_set(), since if the link is removed, we >- # cannot determine $ARCH in find_targets() >- if [[ -L ${MAKE_PROFILE} ]]; then >- remove_symlink \ >- || die -q "Couldn't remove current ${MAKE_PROFILE} symlink" >- fi >- ln -s "$(relative_name \ >- "${ROOT}${portdir}" "${MAKE_PROFILE%/*}")/profiles/${target}" \ >- "${MAKE_PROFILE}" >- # check if the resulting symlink is sane >- if [[ $(canonicalise "${MAKE_PROFILE}") \ >- != "$(canonicalise "${EROOT}")"/* ]]; then >- write_warning_msg \ >- "Strange path. Check ${MAKE_PROFILE} symlink" >- fi >- else >- die -q "Target \"$1\" doesn't appear to be valid!" >+ [[ -z "${arch}" ]] && ( [[ "${2}" != "--force" ]] && arch=$(arch) || arch='\S+' ) >+ profdir=$( grep -lP "${arch}\s+${target}\s+" \ >+ $(echo $portdir $PORTDIR_OVERLAY | sed -re 's|(\S+)\s*|\1/profiles/profiles.desc |g') 2>/dev/null | \ >+ head -n1 | sed -e 's|/profiles/profiles.desc$||' ) >+ if [[ -z "${profdir}" ]]; then >+ [[ "${2}" != "--force" ]] && return 1 >+ ## I don't know what mesage need write here >+ die -q "${target} is not a valid profile for ${arch}" >+ fi >+ [[ ! -d "${ROOT}${profdir}/profiles/${target}" ]] && die -q "Target \"${target}\" doesn't appear to be valid!" >+ >+ if [[ -L ${MAKE_PROFILE} ]]; then >+ remove_symlink \ >+ || die -q "Couldn't remove current ${MAKE_PROFILE} symlink" >+ fi >+ >+ ln -s "$(relative_name \ >+ "${ROOT}${profdir}/profiles/${target}" "${MAKE_PROFILE%/*}")" \ >+ "${MAKE_PROFILE}" >+ if [[ $(canonicalise "${MAKE_PROFILE}") \ >+ != "$(canonicalise "${EROOT}")"/* ]]; then >+ write_warning_msg \ >+ "Strange path. Check ${MAKE_PROFILE} symlink" > fi > } > >@@ -103,17 +112,9 @@ > } > > do_show() { >- get_symlink_location > write_list_start "Current ${MAKE_PROFILE} symlink:" >- if [[ -L ${MAKE_PROFILE} ]]; then >- local link=$(canonicalise "${MAKE_PROFILE}") >- local portdir=$(portageq portdir) >- local profiledir=$(canonicalise "${ROOT}${portdir}/profiles") >- link=${link##${profiledir}/} >- write_kv_list_entry "${link}" "" >- else >- write_kv_list_entry "(unset)" "" >- fi >+ link=$(get_active) >+ write_kv_list_entry "${link:=(unset)}" "" > } > > ### list action ### >@@ -123,16 +124,11 @@ > } > > do_list() { >- local portdir profiledir active targets >- targets=( $(find_targets) ) >+ local targets=( $(find_targets) ) >+ local active=$(get_active) > > [[ -z ${targets} ]] && die -q "Failed to get a list of valid profiles" > >- get_symlink_location >- portdir=$(portageq portdir) >- profiledir=$(canonicalise "${ROOT}${portdir}/profiles") >- active=$(canonicalise "${MAKE_PROFILE}") >- active=${active##${profiledir}/} > if [[ -n ${targets[@]} ]]; then > local i > for (( i = 0; i < ${#targets[@]}; i++ )); do
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 265264
:
266113
|
266131
|
266411
|
266489
|
284575
|
284687
|
284781
|
294431
|
294433
|
294437