aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2011-03-13 12:22:08 +0000
committerUlrich Müller <ulm@gentoo.org>2011-03-13 12:22:08 +0000
commit0525b9ee52646f826d7131e480feec54bcb551f6 (patch)
treed6801a474082fb7eb60cf08d34b02e3a56682ec3
parentCoding style. (diff)
downloadeselect-0525b9ee52646f826d7131e480feec54bcb551f6.tar.gz
eselect-0525b9ee52646f826d7131e480feec54bcb551f6.tar.bz2
eselect-0525b9ee52646f826d7131e480feec54bcb551f6.zip
profile.eselect: Support make.profile in the /etc/portage directory.
svn path=/trunk/; revision=810
-rw-r--r--ChangeLog10
-rw-r--r--NEWS3
-rw-r--r--modules/profile.eselect48
3 files changed, 46 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 7622338..7227a52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-03-13 Ulrich Mueller <ulm@gentoo.org>
+
+ * modules/profile.eselect: Support make.profile in both the /etc
+ and the /etc/portage directory.
+ (DESCRIPTION): Don't mention explicit path.
+ (get_symlink_location): New function, sets MAKE_PROFILE variable.
+ (do_show, do_set): Call get_symlink_location.
+ (remove_symlink, set_symlink, do_show, do_set): Use MAKE_PROFILE
+ instead of hardcoded path.
+
2011-03-10 Ulrich Mueller <ulm@gentoo.org>
* modules/news.eselect (read_item): Don't precede news item dir
diff --git a/NEWS b/NEWS
index 1378dda..274c141 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ ChangeLog file for a more detailed listing of changes/bug fixes.
Bug fixes:
- Fixed bug #358185: ROOT handling in news module.
+ New features:
+ - The profile module supports make.profile in the /etc/portage directory.
+
1.2.14:
New features:
- Module locale.eselect for the LANG environment variable (bug #351363).
diff --git a/modules/profile.eselect b/modules/profile.eselect
index c07ceed..f89a8ba 100644
--- a/modules/profile.eselect
+++ b/modules/profile.eselect
@@ -6,11 +6,27 @@
# This is a portage-only module.
inherit package-manager
-DESCRIPTION="Manage the /etc/make.profile symlink"
+DESCRIPTION="Manage the make.profile symlink"
MAINTAINER="eselect@gentoo.org"
SVN_DATE='$Date$'
VERSION=$(svn_date_to_version "${SVN_DATE}")
+# get location of make.profile symlink
+get_symlink_location() {
+ local oldloc=${EROOT%/}/etc/make.profile
+ local newloc=${EROOT%/}/etc/portage/make.profile
+
+ if [[ -e ${oldloc} ]]; then
+ MAKE_PROFILE=${oldloc}
+ if [[ -e ${newloc} ]]; then
+ write_warning_msg "Both ${oldloc} and ${newloc} exist."
+ write_warning_msg "Using ${MAKE_PROFILE} for now."
+ fi
+ else
+ MAKE_PROFILE=${newloc}
+ fi
+}
+
# get a list of valid profiles
find_targets() {
local arch p portdir=$1
@@ -28,7 +44,7 @@ find_targets() {
# remove make.profile symlink
remove_symlink() {
- rm "${EROOT}/etc/make.profile"
+ rm "${MAKE_PROFILE}"
}
# set the make.profile symlink
@@ -62,18 +78,18 @@ set_symlink() {
# 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
+ if [[ -L ${MAKE_PROFILE} ]]; then
remove_symlink \
- || die -q "Couldn't remove current make.profile symlink"
+ || die -q "Couldn't remove current ${MAKE_PROFILE} symlink"
fi
ln -s "$(relative_name \
- "${ROOT}${portdir}" "${EROOT}/etc")/profiles/${target}" \
- "${EROOT}/etc/make.profile"
+ "${ROOT}${portdir}" "${MAKE_PROFILE%/*}")/profiles/${target}" \
+ "${MAKE_PROFILE}"
# check if the resulting symlink is sane
- if [[ $(canonicalise "${EROOT}/etc/make.profile") \
+ if [[ $(canonicalise "${MAKE_PROFILE}") \
!= "$(canonicalise "${EROOT}")"/* ]]; then
write_warning_msg \
- "Strange path. Check ${EROOT}/etc/make.profile symlink"
+ "Strange path. Check ${MAKE_PROFILE} symlink"
fi
else
die -q "Target \"$1\" doesn't appear to be valid!"
@@ -87,9 +103,10 @@ describe_show() {
}
do_show() {
- write_list_start "Current make.profile symlink:"
- if [[ -L ${EROOT}/etc/make.profile ]]; then
- local link=$(canonicalise "${EROOT}/etc/make.profile")
+ 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}/}
@@ -111,9 +128,10 @@ do_list() {
[[ -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 "${EROOT}/etc/make.profile")
+ active=$(canonicalise "${MAKE_PROFILE}")
active=${active##${profiledir}/}
if [[ -n ${targets[@]} ]]; then
local i
@@ -151,9 +169,9 @@ do_set() {
[[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to"
[[ $# -gt 1 ]] && die -q "Too many parameters"
- if [[ -e ${EROOT}/etc/make.profile ]] &&
- [[ ! -L ${EROOT}/etc/make.profile ]]; then
- die -q "${EROOT}/etc/make.profile isn't a symlink"
+ get_symlink_location
+ if [[ -e ${MAKE_PROFILE} ]] && [[ ! -L ${MAKE_PROFILE} ]]; then
+ die -q "${MAKE_PROFILE} exists but is not a symlink"
else
set_symlink "$1" ${force} || die -q "Couldn't set a new symlink"
fi