diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | modules/profile.eselect | 48 |
3 files changed, 46 insertions, 15 deletions
@@ -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 @@ -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 |