commit:     4bd139a86d73388dfdc6cbcf553f59b3ffa1138e
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  9 08:16:01 2018 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Tue Jan  9 08:16:01 2018 +0000
URL:        https://gitweb.gentoo.org/proj/eselect.git/commit/?id=4bd139a8

Require --force option when selecting an experimental profile.

* modules/profile.eselect (set_symlink): Require --force option
when selecting an experimental profile.

 ChangeLog               | 5 +++++
 modules/profile.eselect | 7 ++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 57e768e..0be1bc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-09  Ulrich Müller  <[email protected]>
+
+       * modules/profile.eselect (set_symlink): Require --force option
+       when selecting an experimental profile.
+
 2018-01-08  Ulrich Müller  <[email protected]>
 
        * modules/profile.eselect (find_targets): Add a fourth field for

diff --git a/modules/profile.eselect b/modules/profile.eselect
index de85f90..1e1dcff 100644
--- a/modules/profile.eselect
+++ b/modules/profile.eselect
@@ -75,7 +75,7 @@ remove_symlink() {
 
 # set the make.profile symlink
 set_symlink() {
-       local target=$1 force=$2 targets arch parch repo repopath
+       local target=$1 force=$2 targets arch parch repo repopath status
 
        if is_number "${target}"; then
                targets=( $(find_targets) )
@@ -86,7 +86,12 @@ set_symlink() {
                target=${targets[target-1]}
                repo=${target%%::*}; target=${target#*::}
                repopath=${target%%::*}; target=${target#*::}
+               status=${target#*::}; status=${status%%::*}
                target=${target%%::*}
+               if [[ ${status} == exp && -z ${force} ]]; then
+                       write_error_msg "Profile ${target} is experimental"
+                       die -q "Refusing to select ${status} profile without 
--force option"
+               fi
        elif [[ -n ${target} ]]; then
                # if the profile was explicitly specified (rather than a number)
                # double check and make sure it's valid

Reply via email to