You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/profiles/patches/app-admin/eselect-1.2.17-18-profile.p...

102 lines
3.4 KiB

diff --git a/profile.eselect b/profile.eselect
index 521825e..9aef02c 100644
--- a/modules/profile.eselect
+++ b/modules/profile.eselect
@@ -11,6 +11,13 @@ MAINTAINER="eselect@gentoo.org"
SVN_DATE='$Date: 2011-03-15 15:51:32 +0100 (Tue, 15 Mar 2011) $'
VERSION=$(svn_date_to_version "${SVN_DATE}")
+# get a list of valid profiles
+# add calculate overlay to profiles
+NEW_CALCULATE_OVERLAY="/var/lib/layman/calculate"
+[[ -d ${NEW_CALCULATE_OVERLAY} ]] &&
+ CALCULATE_OVERLAY=${NEW_CALCULATE_OVERLAY} ||
+ CALCULATE_OVERLAY="/usr/local/portage/layman/calculate"
+
# get location of make.profile symlink
get_symlink_location() {
local oldloc=${EROOT%/}/etc/make.profile
@@ -35,6 +42,17 @@ find_targets() {
arch=$(arch)
[[ -z ${arch} ]] && return 1
+ # add support calculate overlay
+ if [[ -f "${ROOT}${CALCULATE_OVERLAY}/profiles/profiles.desc" ]]
+ then
+ for p in $(sed -n -e \
+ "s|^${arch}[[:space:]]\+\([^[:space:]]\+\).*$|\1|p" \
+ "${ROOT}${CALCULATE_OVERLAY}/profiles/profiles.desc")
+ do
+ echo ${p}
+ done
+ fi
+
for p in $(sed -n -e "s|^${arch}[[:space:]]\+\([^[:space:]]\+\).*$|\1|p" \
"${ROOT}${portdir}/profiles/profiles.desc")
do
@@ -70,6 +88,24 @@ set_symlink() {
if [[ ${arch} != ${parch} && -z ${force} ]]; then
die -q "${target} is not a valid profile for ${arch}"
fi
+ # add support calculate overlay
+ elif [[ -n ${target} && -d ${ROOT}${CALCULATE_OVERLAY}/profiles/${target} ]]
+ then
+ local arch parch
+
+ # 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}${CALCULATE_OVERLAY}/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
@@ -91,6 +127,17 @@ set_symlink() {
write_warning_msg \
"Strange path. Check ${MAKE_PROFILE} symlink"
fi
+ # add support calculate overlay
+ elif [[ -d ${ROOT}${CALCULATE_OVERLAY}/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 "..${CALCULATE_OVERLAY}/profiles/${target}" \
+ "${EROOT}/etc/make.profile"
else
die -q "Target \"$1\" doesn't appear to be valid!"
fi
@@ -110,6 +157,10 @@ do_show() {
local portdir=$(portageq portdir)
local profiledir=$(canonicalise "${ROOT}${portdir}/profiles")
link=${link##${profiledir}/}
+ # add support calculate overlay
+ calcprofiledir=$(canonicalise "${ROOT}${CALCULATE_OVERLAY}/profiles")
+ link=${link##${calcprofiledir}/}
+
write_kv_list_entry "${link}" ""
else
write_kv_list_entry "(unset)" ""
@@ -133,6 +184,10 @@ do_list() {
profiledir=$(canonicalise "${ROOT}${portdir}/profiles")
active=$(canonicalise "${MAKE_PROFILE}")
active=${active##${profiledir}/}
+ # add support calculate overlay
+ calcprofiledir=$(canonicalise "${ROOT}${CALCULATE_OVERLAY}/profiles")
+ active=${active##${calcprofiledir}/}
+
if [[ -n ${targets[@]} ]]; then
local i
for (( i = 0; i < ${#targets[@]}; i++ )); do