|
|
|
diff --git a/modules/profile.eselect b/modules/profile.eselect
|
|
|
|
index 5e18178..2cd43a6 100644
|
|
|
|
--- a/modules/profile.eselect
|
|
|
|
+++ b/modules/profile.eselect
|
|
|
|
@@ -1,16 +1,21 @@
|
|
|
|
# -*-eselect-*- vim: ft=eselect
|
|
|
|
# Copyright 1999-2009 Gentoo Foundation
|
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
-# $Id: profile.eselect 736 2009-11-20 19:36:14Z ulm $
|
|
|
|
+# $Id: profile.eselect 727 2009-11-14 18:08:51Z ulm $
|
|
|
|
|
|
|
|
# This is a portage-only module.
|
|
|
|
inherit package-manager
|
|
|
|
|
|
|
|
DESCRIPTION="Manage the /etc/make.profile symlink"
|
|
|
|
MAINTAINER="eselect@gentoo.org"
|
|
|
|
-SVN_DATE='$Date: 2009-11-20 20:36:14 +0100 (Fri, 20 Nov 2009) $'
|
|
|
|
+SVN_DATE='$Date: 2009-11-14 19:08:51 +0100 (Sat, 14 Nov 2009) $'
|
|
|
|
VERSION=$(svn_date_to_version "${SVN_DATE}")
|
|
|
|
|
|
|
|
+NEW_CALCULATE_OVERLAY="/var/lib/layman/calculate"
|
|
|
|
+[[ -d ${NEW_CALCULATE_OVERLAY} ]] &&
|
|
|
|
+ CALCULATE_OVERLAY=${NEW_CALCULATE_OVERLAY} ||
|
|
|
|
+ CALCULATE_OVERLAY="/usr/local/portage/layman/calculate"
|
|
|
|
+
|
|
|
|
# get a list of valid profiles
|
|
|
|
find_targets() {
|
|
|
|
local arch p portdir=${1}
|
|
|
|
@@ -19,6 +24,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
|
|
|
|
@@ -54,6 +70,24 @@ set_symlink() {
|
|
|
|
if [[ ${arch} != ${parch} && ${2} != "--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} && ${2} != "--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} && ${2} != "--force" ]] ; then
|
|
|
|
+ die -q "${target} is not a valid profile for ${arch}"
|
|
|
|
+ fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z ${target} ]] ; then
|
|
|
|
@@ -75,6 +109,17 @@ set_symlink() {
|
|
|
|
write_warning_msg \
|
|
|
|
"Strange path. Check ${EROOT}/etc/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 ${EROOT}/etc/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
|
|
|
|
@@ -93,6 +138,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)" ""
|
|
|
|
@@ -115,6 +164,10 @@ do_list() {
|
|
|
|
profiledir=$(canonicalise "${ROOT}${portdir}/profiles")
|
|
|
|
active=$(canonicalise "${EROOT}/etc/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 = i + 1 )) ; do
|