commit: 9e088d37a7bff06c0aededc98439456de3193659 Author: Justin Lecher <jlec <AT> gentoo <DOT> org> AuthorDate: Thu Jun 21 18:20:06 2018 +0000 Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> CommitDate: Thu Jun 21 18:26:56 2018 +0000 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=9e088d37
app-admin/eselect: Fix eselect patch Fixes #870 Signed-off-by: Justin Lecher <jlec <AT> gentoo.org> Package-Manager: Portage-2.3.40, Repoman-2.3.9 Signed-off-by: Justin Lecher <jlec <AT> gentoo.org> .../files/eselect-1.4.13-alternatives.patch | 203 ++++++++++----------- 1 file changed, 101 insertions(+), 102 deletions(-) diff --git a/app-admin/eselect/files/eselect-1.4.13-alternatives.patch b/app-admin/eselect/files/eselect-1.4.13-alternatives.patch index 0dbc50ef7..c47887fe6 100644 --- a/app-admin/eselect/files/eselect-1.4.13-alternatives.patch +++ b/app-admin/eselect/files/eselect-1.4.13-alternatives.patch @@ -5,11 +5,8 @@ libs/alternatives.bash.in | 316 ++++++++++++++++++++++++ modules/Makefile.am | 1 + modules/alternatives.eselect | 178 ++++++++++++++ - modules/modules.eselect | 282 ++++++++++++++-------- - 8 files changed, 1340 insertions(+), 105 deletions(-) - create mode 100644 libs/alternatives-common.bash.in - create mode 100644 libs/alternatives.bash.in - create mode 100644 modules/alternatives.eselect + modules/modules.eselect | 288 ++++++++++++++-------- + 8 files changed, 1343 insertions(+), 108 deletions(-) diff --git a/bin/Makefile.am b/bin/Makefile.am index 20902c1..ad08867 100644 @@ -254,7 +251,7 @@ index 6ebd08e..c19f173 100644 @$(dosed) $< > $@ diff --git a/libs/alternatives-common.bash.in b/libs/alternatives-common.bash.in new file mode 100644 -index 0000000..79b6eb5 +index 0000000..8753b89 --- /dev/null +++ b/libs/alternatives-common.bash.in @@ -0,0 +1,510 @@ @@ -280,7 +277,7 @@ index 0000000..79b6eb5 +inherit config output path-manipulation tests + +: "${ALTERNATIVESDIR_ROOTLESS:=@sysconfdir@/env.d/alternatives}" -+: "${ALTERNATIVESDIR_ROOT:=${EROOT%/}}" ++: "${ALTERNATIVESDIR_ROOT:=${ROOT%/}}" +ALTERNATIVESDIR="${ALTERNATIVESDIR_ROOT}${ALTERNATIVESDIR_ROOTLESS}" + +get_current_provider() { @@ -550,7 +547,7 @@ index 0000000..79b6eb5 + elif [[ ! -d "${provider_dir}" ]]; then + die "${provider_dir} exists but is a file" + else -+ die "${provider_dir} already present. You need ot remove it before adding it again" ++ die "${provider_dir} already present. You need to remove it before adding it again" + fi + + # Make sure importance is a signed integer @@ -1311,47 +1308,7 @@ index 5bc78ca..23c1e59 100644 do_list() { - local only_names path file module name desc - local -a extra_modules -+ local path file module name desc group groups Extra_modules -+ -+ write_list_start "Built-in modules:" -+ write_kv_list_entry "help" "Display a help message" -+ write_kv_list_entry "usage" "Display a usage message" -+ write_kv_list_entry "version" "Display version information" -+ write_kv_list_entry "print-modules" "Print eselect modules" -+ write_kv_list_entry "print-actions" "Print actions for a given module" -+ write_kv_list_entry "print-options" "Print options for a given action" -+ -+ for path in "${ESELECT_MODULES_PATH[@]}" ; do -+ [[ -d ${path} ]] || continue -+ for file in ${path}/*.eselect ; do -+ [[ -f ${file} ]] || continue -+ group=$(load_config "${file}" ESELECT_MODULE_GROUP) -+ if [[ -n ${group} ]]; then -+ has ${group} ${groups} || groups+=" ${group}" -+ declare ${group}_modules+=" ${file}" -+ else -+ Extra_modules+=" ${file}" -+ fi -+ done -+ done -+ -+ for group in ${groups} Extra; do -+ local m -+ m="${group}_modules" -+ if [[ -n ${!m} ]] ; then -+ echo -+ write_list_start "${group} modules:" -+ for module in ${!m}; do -+ name=${module##*/} -+ name=${name%%.eselect} -+ desc=$(load_config "${module}" DESCRIPTION) -+ desc=${desc:-No description available} -+ write_kv_list_entry "${name}" "${desc}" -+ done -+ fi -+ done -+} - +- - if [[ ${1#--} = only-names ]]; then - only_names=1 - shift @@ -1365,8 +1322,7 @@ index 5bc78ca..23c1e59 100644 - extra_modules=( "${extra_modules[@]}" "${file}" ) - done - done -+### group action - +- - if [[ -n ${only_names} ]]; then - # This is mainly intended for bash completion - echo "help" @@ -1395,6 +1351,49 @@ index 5bc78ca..23c1e59 100644 - done - fi - fi ++ local path file module name desc group groups Extra_modules ++ ++ write_list_start "Built-in modules:" ++ write_kv_list_entry "help" "Display a help message" ++ write_kv_list_entry "usage" "Display a usage message" ++ write_kv_list_entry "version" "Display version information" ++ write_kv_list_entry "print-modules" "Print eselect modules" ++ write_kv_list_entry "print-actions" "Print actions for a given module" ++ write_kv_list_entry "print-options" "Print options for a given action" ++ ++ for path in "${ESELECT_MODULES_PATH[@]}" ; do ++ [[ -d ${path} ]] || continue ++ for file in ${path}/*.eselect ; do ++ [[ -f ${file} ]] || continue ++ group=$(load_config "${file}" ESELECT_MODULE_GROUP) ++ if [[ -n ${group} ]]; then ++ has ${group} ${groups} || groups+=" ${group}" ++ declare ${group}_modules+=" ${file}" ++ else ++ Extra_modules+=" ${file}" ++ fi ++ done ++ done ++ ++ for group in ${groups} Extra; do ++ local m ++ m="${group}_modules" ++ if [[ -n ${!m} ]] ; then ++ echo ++ write_list_start "${group} modules:" ++ for module in ${!m}; do ++ name=${module##*/} ++ name=${name%%.eselect} ++ desc=$(load_config "${module}" DESCRIPTION) ++ desc=${desc:-No description available} ++ write_kv_list_entry "${name}" "${desc}" ++ done ++ fi ++ done ++} ++ ++### group action ++ +describe_group() { + echo "Lists all available modules belonging to a specified group." +} @@ -1452,6 +1451,12 @@ index 5bc78ca..23c1e59 100644 do_has() { - [[ -z $1 ]] && die -q "Required option (module name) missing" - [[ $# -gt 1 ]] && die -q "Too many parameters" +- +- local modname=$1 modpath +- for modpath in "${ESELECT_MODULES_PATH[@]}" ; do +- [[ -f ${modpath}/${modname}.eselect ]] && return 0 +- done +- return 1 + [[ -z $1 ]] && die -q "Required option (module name) missing" + [[ $# -gt 1 ]] && die -q "Too many parameters" + local modname="$1" modpath @@ -1460,17 +1465,52 @@ index 5bc78ca..23c1e59 100644 + [[ -f "${modpath}/${modname}.eselect" ]] && return 0 + done + return 1 -+} -+ -+### add action + } + + ### add action +-# *** Commented out. Do we really want to have an eselect module that is +-# *** installing other modules in a system directory? Also, this should +-# *** go together with a "remove" action. +- +-# describe_add() { +-# echo "Install the given module file somewhere that eselect can find it." +-# echo "By default, install to \$HOME/.eselect/modules/, unless running as " +-# echo "root. Then, install to ${ESELECT_DATA_PATH}/modules/." +-# } +- +-# describe_add_parameters() { +-# echo "<module_file>" +-# } +- +-# do_add() { +-# local local_path="${ROOT}${HOME}/.eselect/modules/" module_file +-# local force_default=0 +-# +-# if [[ $1 = "--force-default-location" ]] ; then +-# force_default=1 +-# shift +-# fi +-# module_file=$1 +-# +-# [[ -z ${module_file} ]] && die -q "Required option (module file) missing" +-# +-# # TODO: Don't install the module "somewhere", depending on write access. +-# # Add an option to control if it goes to the user's or to the system dir. +-# if ! cp "${module_file}" "${ESELECT_DEFAULT_MODULES_PATH}" &> /dev/null ; then +-# [[ ${force_default} == 1 ]] \ +-# && die -q "Failed to install module file to default modules path" +-# +-# mkdir -p "${local_path}" \ +-# || die -q "Failed to create module install directory" +-# cp "${module_file}" "${local_path}" \ +-# || die -q "Failed to install module file" +-# fi +-# } + +describe_add() { + echo "Install a module file" +} - -- local modname=$1 modpath -- for modpath in "${ESELECT_MODULES_PATH[@]}" ; do -- [[ -f ${modpath}/${modname}.eselect ]] && return 0 ++ +describe_add_options() { + echo "--default : install as global module (default if root)" + echo "--user : install as user's module" @@ -1555,50 +1595,9 @@ index 5bc78ca..23c1e59 100644 + for module_path in "${ESELECT_MODULES_PATH[@]}" ; do + rm "${module_path}/${module_name}.eselect" &> /dev/null + ret=$? - done -- return 1 ++ done + fi + [[ ${ret} != 0 ]] && die -q "Failed to remove module ${module_name}" - } - --### add action --# *** Commented out. Do we really want to have an eselect module that is --# *** installing other modules in a system directory? Also, this should --# *** go together with a "remove" action. -- --# describe_add() { --# echo "Install the given module file somewhere that eselect can find it." --# echo "By default, install to \$HOME/.eselect/modules/, unless running as " --# echo "root. Then, install to ${ESELECT_DATA_PATH}/modules/." --# } -- --# describe_add_parameters() { --# echo "<module_file>" --# } -- --# do_add() { --# local local_path="${ROOT}${HOME}/.eselect/modules/" module_file --# local force_default=0 --# --# if [[ $1 = "--force-default-location" ]] ; then --# force_default=1 --# shift --# fi --# module_file=$1 --# --# [[ -z ${module_file} ]] && die -q "Required option (module file) missing" --# --# # TODO: Don't install the module "somewhere", depending on write access. --# # Add an option to control if it goes to the user's or to the system dir. --# if ! cp "${module_file}" "${ESELECT_DEFAULT_MODULES_PATH}" &> /dev/null ; then --# [[ ${force_default} == 1 ]] \ --# && die -q "Failed to install module file to default modules path" --# --# mkdir -p "${local_path}" \ --# || die -q "Failed to create module install directory" --# cp "${module_file}" "${local_path}" \ --# || die -q "Failed to install module file" --# fi --# } ++} ++ +# vim: set ft=eselect sw=4 sts=4 ts=4 et tw=80 : -