From 62db637f3a58ae5ae69caa9b58b4af2bc0350f92 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Wed, 18 Dec 2013 05:04:54 +0100 Subject: [PATCH 01/13] move the cd from cli to set operation to avoid subprocess, fix #2433 --- scripts/cli | 9 ++------- scripts/set | 4 ++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/cli b/scripts/cli index a68e59a05f..20e93d2188 100755 --- a/scripts/cli +++ b/scripts/cli @@ -893,14 +893,9 @@ rvm() do) old_rvm_ruby_string=${rvm_ruby_string:-} unset rvm_ruby_string - export rvm_ruby_strings + export rvm_ruby_strings rvm_in_flag - ( - if [[ -n "${rvm_in_flag}" && -d "${rvm_in_flag}" ]] - then __rvm_cd "${rvm_in_flag}" - fi - "$rvm_scripts_path/set" "$rvm_action" "${rvm_ruby_args[@]}" - ) + "$rvm_scripts_path/set" "$rvm_action" "${rvm_ruby_args[@]}" result=$? # Restore the state pre-sets. diff --git a/scripts/set b/scripts/set index 888e66613f..83cafa2173 100755 --- a/scripts/set +++ b/scripts/set @@ -4,6 +4,10 @@ source "$rvm_scripts_path/base" rvm_is_not_a_shell_function=0 # for nested invocations of rvm +if [[ -n "${rvm_in_flag}" && -d "${rvm_in_flag}" ]] +then __rvm_cd "${rvm_in_flag}" +fi + __rvm_attempt_single_exec() { # Return if we have multiple rubies. or we're not running exec. From 66aebd19fdfad8c333ae569ad2e78414882f82e3 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Wed, 18 Dec 2013 12:10:44 +0100 Subject: [PATCH 02/13] fix rubinius installation after switching to gem-wrappers, fix #2434 --- scripts/functions/manage/rubinius | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/functions/manage/rubinius b/scripts/functions/manage/rubinius index 4ba41ac8e6..4b680a17cd 100644 --- a/scripts/functions/manage/rubinius +++ b/scripts/functions/manage/rubinius @@ -49,7 +49,7 @@ rubinius_install_ensure_wrapper() if (( $# )) then __rvm_log_command "install_${__binary}" "$rvm_ruby_string - #install ${__binary}" "$@" || return $? fi - "${rvm_scripts_path:-${rvm_path}/scripts}"/wrapper "$ruby" --no-links ${__binary} || return $? + gem wrappers regenerate || return $? } } @@ -99,9 +99,10 @@ rubinius_install() then ruby="${ruby}@rubinius" ( - rvm_create_flag=1 - rvm_verbose_flag=0 - __rvm_select "$ruby" + typeset rvm_create_flag=1 + typeset rvm_internal_use_flag=1 + typeset rvm_use_flag=0 + __rvm_use "$ruby" ) fi rvm_log "Using $ruby for $rvm_ruby_string installation" From 58850ca38b84bb8a36a32e236bcb695d2de69452 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Wed, 18 Dec 2013 17:44:22 +0100 Subject: [PATCH 03/13] fix removing broken links in bin, fix #2436 --- scripts/cleanup | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/cleanup b/scripts/cleanup index 841b17fa97..49edf853da 100755 --- a/scripts/cleanup +++ b/scripts/cleanup @@ -19,10 +19,17 @@ For gemsets removes remove only those without matching ruby. return 0 } +chmod_unless_link() +{ + if [[ -e "$1" && ! -L "$1" ]] + then chmod -R u+w "$1" || return $? + fi +} + remove_or_log() { (( rvm_verbose_flag == 0 )) || rvm_log " - removing - $1" - chmod -R u+w "$1" && + chmod_unless_link "$1" && __rvm_rm_rf "$1" || { : $(( failed_counter+=1 )) From 1430afd3fe88828a75848e7ce40a358070142935 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 15:15:28 +0100 Subject: [PATCH 04/13] add an improved warning for older ruby binaries, closes #2438 --- scripts/functions/manage/base | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/functions/manage/base b/scripts/functions/manage/base index 70708603a6..9d9b755e74 100644 --- a/scripts/functions/manage/base +++ b/scripts/functions/manage/base @@ -287,6 +287,14 @@ __rvm_install_source() rvm_log "Install of $rvm_ruby_string - #complete " } +__rvm_old_ruby() +{ + case "$1" in + (ree*|ruby-1.8*|ruby-1.9.1*|ruby-1.9.2*) return 0 ;; + (*) return 1 ;; + esac +} + __rvm_install_ruby_try_remote() { : rvm_disable_binary_flag:${rvm_disable_binary_flag:=0}: rvm_remote_flag:${rvm_remote_flag:=0}: @@ -311,6 +319,12 @@ __rvm_install_ruby_try_remote() then rvm_error "Requested binary installation but no rubies are available to download, consider skipping --binary flag." return 1 + elif + __rvm_old_ruby "${rvm_ruby_string}" + then + rvm_log "No binary rubies available for: $(__rvm_system_path -)/${rvm_ruby_string}. +It is not possible to build movable binaries for rubies 1.8-1.9.2, but you can do it for your system only. +Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies." else rvm_warn "No binary rubies available for: $(__rvm_system_path -)/${rvm_ruby_string}. Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies." From 5167260a2d0d182a58a465da37d16c7cf6786c81 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 15:56:59 +0100 Subject: [PATCH 05/13] fix installing older rubies --- gemsets/ruby/1.8.5/global.gems | 5 +++-- gemsets/ruby/1.8.6/global.gems | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gemsets/ruby/1.8.5/global.gems b/gemsets/ruby/1.8.5/global.gems index 139597f9cb..bdd421ef16 100644 --- a/gemsets/ruby/1.8.5/global.gems +++ b/gemsets/ruby/1.8.5/global.gems @@ -1,2 +1,3 @@ - - +gem-wrappers +rubygems-bundler +rvm diff --git a/gemsets/ruby/1.8.6/global.gems b/gemsets/ruby/1.8.6/global.gems index 139597f9cb..bdd421ef16 100644 --- a/gemsets/ruby/1.8.6/global.gems +++ b/gemsets/ruby/1.8.6/global.gems @@ -1,2 +1,3 @@ - - +gem-wrappers +rubygems-bundler +rvm From 16013c9ff3c9b9ae59774875f8b4be97def044d2 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 15:57:22 +0100 Subject: [PATCH 06/13] improved output messages for installation --- scripts/functions/gemset | 2 +- scripts/functions/manage/base | 18 +++++++++--------- scripts/functions/rubygems | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/scripts/functions/gemset b/scripts/functions/gemset index b98f3b416d..7578dc0b6b 100644 --- a/scripts/functions/gemset +++ b/scripts/functions/gemset @@ -269,8 +269,8 @@ __rvm_rubygems_create_link() __rvm_initial_gemsets_create() { + __rvm_log_command "chmod.bin" "$rvm_ruby_string - #making binaries executable" chmod +x "$rvm_ruby_home/bin"/* && ( rubygems_setup ${rvm_rubygems_version:-latest} ) && # () for exit in rubygems_fatal_error - __rvm_log_command "chmod.bin" "" chmod +x "$rvm_ruby_home/bin"/* && __rvm_rubygems_create_link "$1" && gemset_create "global" "" } diff --git a/scripts/functions/manage/base b/scripts/functions/manage/base index 9d9b755e74..95bb7a36ba 100644 --- a/scripts/functions/manage/base +++ b/scripts/functions/manage/base @@ -129,7 +129,7 @@ __rvm_apply_patch() else __rvm_apply_patch_prepare touch "patches.list" - __rvm_log_command "patch.apply.${_patch_name##*\/}" "Applying patch ${_full_patch_path}" \ + __rvm_log_command "patch.apply.${_patch_name##*\/}" "$rvm_ruby_string - #applying patch ${_full_patch_path}" \ __rvm_patch -F ${_patch_fuzziness} -p${_patch_level} -N -f -i "${_local_patch_path}" && printf "%b" "${_patch_name}\n" >> "patches.list" __rvm_apply_patch_remove @@ -436,7 +436,7 @@ __rvm_check_default() [[ -n "$current_ruby_interpreter" ]] && [[ "$current_ruby_interpreter" == "$default_ruby_interpreter" ]] then - __rvm_log_command 'default.restore' 'Removing default ruby interpreter' \ + __rvm_log_command 'default.restore' "$rvm_ruby_string - #removing default ruby interpreter" \ rvm use system --default fi } @@ -468,7 +468,7 @@ __rvm_remove_ruby() if [[ -d "${_dir}/$rvm_ruby_string" ]] then - __rvm_log_command "remove.${_dir##*/}" "Removing ${_dir}/$rvm_ruby_string" __rvm_rm_rf "${_dir}/$rvm_ruby_string" + __rvm_log_command "remove.${_dir##*/}" "$rvm_ruby_string - #removing ${_dir}/$rvm_ruby_string" __rvm_rm_rf "${_dir}/$rvm_ruby_string" else rvm_log "${_dir}/$rvm_ruby_string has already been removed." fi @@ -546,7 +546,7 @@ __rvm_remove_gemsets() if (( ${rvm_gems_flag:=0} == 1 )) then - __rvm_log_command remove_gemsets "Removing $rvm_ruby_string gemsets" __rvm_remove_gemsets__ || + __rvm_log_command remove_gemsets "$rvm_ruby_string - #removing gemsets" __rvm_remove_gemsets__ || return $? fi true # for OSX @@ -554,7 +554,7 @@ __rvm_remove_gemsets() __rvm_remove_wrappers() { - rvm_log "Removing $rvm_ruby_string wrappers..." + rvm_log "$rvm_ruby_string - #removing wrappers" typeset -a wrappers typeset wrapper @@ -570,7 +570,7 @@ __rvm_remove_wrappers() __rvm_remove_environments() { - rvm_log "Removing $rvm_ruby_string environments..." + rvm_log "$rvm_ruby_string - #removing environments" typeset environments environment for environment in "$rvm_environments_path/$rvm_ruby_string" "$rvm_environments_path/$rvm_ruby_string"@* @@ -583,7 +583,7 @@ __rvm_remove_environments() __rvm_remove_aliases() { - rvm_log "Removing $rvm_ruby_string aliases..." + rvm_log "$rvm_ruby_string - #removing aliases" typeset alias_name aliases aliases=($(__rvm_awk '/'$rvm_ruby_string'/{print}' "$rvm_path/config/alias" | __rvm_sed 's/=.*//')) @@ -598,7 +598,7 @@ __rvm_remove_archives() { if (( ${rvm_archive_flag:=0} == 1 )) then - rvm_log "Removing $rvm_ruby_string archives..." + rvm_log "$rvm_ruby_string - #removing archives" \rm -f ${rvm_archives_path}/${rvm_ruby_package_file}.* fi } @@ -606,7 +606,7 @@ __rvm_remove_archives() # Iterate over all binaries and check for symlinked wrappers etc. __rvm_remove_binaries() { - rvm_log "Removing $rvm_ruby_string binaries..." + rvm_log "$rvm_ruby_string - #removing binaries" typeset full_binary_path linked_binary_path typeset -a binaries diff --git a/scripts/functions/rubygems b/scripts/functions/rubygems index fe4d249863..5196d2e626 100755 --- a/scripts/functions/rubygems +++ b/scripts/functions/rubygems @@ -208,15 +208,15 @@ rubygems_setup() [[ -d "${rvm_src_path}/$rvm_gem_package_name" ]] || __rvm_rm_rf "${rvm_src_path}/$rvm_gem_package_name" - rvm_log "Retrieving $rvm_gem_package_name" + rvm_log "$rvm_ruby_string - #downloading $rvm_gem_package_name" "$rvm_scripts_path/fetch" "$rvm_gem_url" "${rvm_gem_package_name}.tgz" || rubygems_fatal_error "There has been an error while trying to fetch rubygems. \nHalting the installation." $? - __rvm_log_command "rubygems.extract" "Extracting $rvm_gem_package_name ..." \ + __rvm_log_command "rubygems.extract" "$rvm_ruby_string - #extracting $rvm_gem_package_name" \ __rvm_package_extract "${rvm_archives_path}/$rvm_gem_package_name.tgz" "${rvm_src_path}" || rubygems_fatal_error "There has been an error while trying to extract rubygems. \nHalting the installation." $? - rubygems_remove # Remove old gems. + __rvm_log_command "rubygems.remove" "$rvm_ruby_string - #removing rubygems" rubygems_remove __rvm_cd "${rvm_src_path}/$rvm_gem_package_name" @@ -230,7 +230,7 @@ rubygems_setup() fi rubygems_setup_lang_fallback if - __rvm_every_nth_dot 10 __rvm_log_command "rubygems.install" "Installing $rvm_gem_package_name for ${rvm_ruby_string}" \ + __rvm_every_nth_dot 10 __rvm_log_command "rubygems.install" "$rvm_ruby_string - #installing $rvm_gem_package_name for ${rvm_ruby_string}" \ "${__command[@]}" then typeset program_suffix @@ -243,9 +243,9 @@ rubygems_setup() \"$rvm_ruby_home/bin/gem\"" "$rvm_ruby_string - #linking gem${program_suffix} -> gem " ;; esac - rvm_log "Installation of rubygems completed successfully." + rvm_log "$rvm_ruby_string - #Installation of rubygems completed successfully." else - rvm_warn "Installation of rubygems did not complete successfully." + rvm_warn "$rvm_ruby_string - #Installation of rubygems did not complete successfully." fi } From d8902229a5e6799df703634b23cfea5b3f26c859 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 16:12:50 +0100 Subject: [PATCH 07/13] simplify logging dots --- scripts/functions/manage/base | 2 +- scripts/functions/manage/rubinius | 3 +-- scripts/functions/rubygems | 2 +- scripts/functions/utility_logging | 18 +++--------------- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/scripts/functions/manage/base b/scripts/functions/manage/base index 95bb7a36ba..3f2e5c4cf4 100644 --- a/scripts/functions/manage/base +++ b/scripts/functions/manage/base @@ -233,7 +233,7 @@ __rvm_install_source() __rvm_post_configure_${rvm_ruby_interpreter} fi - __rvm_every_nth_dot 20 __rvm_log_command "make" "$rvm_ruby_string - #compiling" ${rvm_ruby_make:-__rvm_make} "${rvm_make_flags[@]}" || + __rvm_log_command "make" "$rvm_ruby_string - #compiling" ${rvm_ruby_make:-__rvm_make} "${rvm_make_flags[@]}" || { result=$? rvm_error "There has been an error while running make. Halting the installation." diff --git a/scripts/functions/manage/rubinius b/scripts/functions/manage/rubinius index 4b680a17cd..7f4107f853 100644 --- a/scripts/functions/manage/rubinius +++ b/scripts/functions/manage/rubinius @@ -131,8 +131,7 @@ rubinius_install() then rvm_ruby_make="CONFIGURE_ARGS=${rvm_configure_args## } " fi - __rvm_every_nth_dot 20 \ - __rvm_log_command rake "$rvm_ruby_string - #compiling" \ + __rvm_log_command rake "$rvm_ruby_string - #compiling" \ "${rvm_ruby_make:-}$rvm_wrappers_path/$ruby/rake" install --trace || return $? [[ -d "$rvm_ruby_home" && -f "$rvm_ruby_home/bin/rbx" ]] || diff --git a/scripts/functions/rubygems b/scripts/functions/rubygems index 5196d2e626..2cba74b460 100755 --- a/scripts/functions/rubygems +++ b/scripts/functions/rubygems @@ -230,7 +230,7 @@ rubygems_setup() fi rubygems_setup_lang_fallback if - __rvm_every_nth_dot 10 __rvm_log_command "rubygems.install" "$rvm_ruby_string - #installing $rvm_gem_package_name for ${rvm_ruby_string}" \ + __rvm_log_command "rubygems.install" "$rvm_ruby_string - #installing $rvm_gem_package_name for ${rvm_ruby_string}" \ "${__command[@]}" then typeset program_suffix diff --git a/scripts/functions/utility_logging b/scripts/functions/utility_logging index 7f5dedf9f9..c150ecb137 100644 --- a/scripts/functions/utility_logging +++ b/scripts/functions/utility_logging @@ -159,9 +159,7 @@ __rvm_ask_for() __rvm_dotted() { - typeset flush __show_nth_dot - __show_nth_dot=${rvm_show_every_nth_dot:-9} - unset rvm_show_every_nth_dot + typeset flush if (( $# )) then printf "%b" "${rvm_notify_clr:-}$*${rvm_reset_clr:-}" @@ -174,11 +172,11 @@ __rvm_dotted() # the nasty '${flush}' inside is for compatibility, # old awk does not allow running function from variable - awk -v go_back="$( tput cub1 2>/dev/null || true)" -v __show_nth_dot="${__show_nth_dot}" \ + awk -v go_back="$( tput cub1 2>/dev/null || true)" \ ' BEGIN{ spin[0]="|"go_back; spin[1]="/"go_back; spin[2]="-"go_back; spin[3]="\\"go_back } { - if ((NR-1)%(__show_nth_dot+1)==__show_nth_dot) + if ((NR-1)%(10)==9) printf "."; else if (go_back!="") printf spin[(NR-1)%4]; @@ -218,16 +216,6 @@ __rvm_check_pipestatus() return 0 } -__rvm_every_nth_dot() -{ - typeset result=0 - export rvm_show_every_nth_dot=$1 # show dot for every nth line - shift - "$@" || result=$? - unset rvm_show_every_nth_dot - return $result -} - __rvm_wait_anykey() { if [[ -n "${1:-}" ]] From bac73a562892924c11fd99f8597553fabb1c6ade Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 16:49:34 +0100 Subject: [PATCH 08/13] updated tests for new ruby installation messages --- rvm-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rvm-test b/rvm-test index 0a2c7a2bd9..f35a5fe323 160000 --- a/rvm-test +++ b/rvm-test @@ -1 +1 @@ -Subproject commit 0a2c7a2bd9b44b43d478a20fed77ea0cbf6403d0 +Subproject commit f35a5fe32316ab6e92e08ce512e85e19815da736 From 40fda806748055f8d65697311cb70731bd33d16a Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 22:35:41 +0100 Subject: [PATCH 09/13] cleanup wrappers leftovers, fix #2441 --- scripts/alias | 48 +++++------------------------------ scripts/external | 3 ++- scripts/functions/gemset | 11 ++++++-- scripts/functions/manage/base | 15 ++++------- scripts/repair | 46 ++++++++++++--------------------- scripts/selector | 6 ----- 6 files changed, 39 insertions(+), 90 deletions(-) diff --git a/scripts/alias b/scripts/alias index 998dd56409..ec72797b8a 100755 --- a/scripts/alias +++ b/scripts/alias @@ -52,25 +52,19 @@ alias_after_delete_default() { rvm_log "Deleting default links/files" - for _path in $rvm_bin_path/default_* + for _path in "$rvm_bin_path"/default_* do # remove default_ruby - [[ -f "$_path" ]] && \rm -rf ${_path} + [[ -f "$_path" ]] && \rm -rf "${_path}" # remove ruby - _path=${_path#default_} - [[ -f "$_path" ]] && \rm -rf ${_path} + _path="${_path#default_}" + [[ -f "$_path" ]] && \rm -rf "${_path}" done - for wrapper in "$rvm_path"/wrappers/default/* gem irb erb ri rdoc testrb rake ruby bundle + for _path in "$rvm_path"/wrappers/default/* gem irb erb ri rdoc testrb rake ruby bundle do - wrapper="${wrapper##*\/}" - \rm -f "$rvm_bin_path/${wrapper}" - - # If the RVM bin path is different from rvm_path/bin, ensure they are - # in sync. - if [[ "${rvm_bin_path}" != "${rvm_path}/bin" ]] - then \rm -f "${rvm_path}/bin/${wrapper}" - fi + _path="${_path##*\/}" + \rm -f "$rvm_bin_path/${_path}" done } @@ -97,37 +91,9 @@ alias_after_create_default() environment_id="${final_environment_identifier}" - if (( ${rvm_user_install_flag:=0} == 0 )) - then - # Sets up the default wrappers. - "$rvm_scripts_path/wrapper" "$rvm_ruby_string" --no-prefix - else - "$rvm_scripts_path/wrapper" "$rvm_ruby_string" "default" - fi - RUBY_VERSION="$("$rvm_ruby_home/bin/ruby" -v | __rvm_sed 's#^\(.*\) (.*$#\1#')" export GEM_HOME GEM_PATH MY_RUBY_HOME RUBY_VERSION - - # Copy wrapper scripts for the newly set default to the RVM bin path. - for wrapper in "$rvm_path"/wrappers/default/* - do - [[ -r "${wrapper}" ]] || continue - - if [[ -L "$rvm_bin_path/${wrapper##*\/}" ]] - then - \rm -f "$rvm_bin_path/${wrapper##*\/}" - fi - - __rvm_cp -f "$wrapper" "$rvm_bin_path/${wrapper##*\/}" - - # If the RVM bin path is different from rvm_path/bin, ensure they are - # in sync. - if [[ "${rvm_bin_path}" != "${rvm_path}/bin" ]] - then - __rvm_cp -f "${wrapper}" "${rvm_path}/bin/" - fi - done } alias_create() diff --git a/scripts/external b/scripts/external index 518386f827..e982b3a480 100755 --- a/scripts/external +++ b/scripts/external @@ -504,7 +504,8 @@ external_import_validate_binary() __rvm_fix_wrappers() { typeset actual_file - __rvm_find "$rvm_rubies_path/$rvm_ruby_string/bin/" -type f | while read actual_file + __rvm_find "$rvm_rubies_path/$rvm_ruby_string/bin/" -type f | + while read actual_file do if [[ -s "$actual_file" ]] diff --git a/scripts/functions/gemset b/scripts/functions/gemset index 7578dc0b6b..46f4f9a0b3 100644 --- a/scripts/functions/gemset +++ b/scripts/functions/gemset @@ -229,8 +229,15 @@ gemset_initial() done __rvm_log_command "gemset.wrappers.$1" \ "$rvm_ruby_string - #generating ${1} wrappers" \ - gem wrappers regenerate 2>/dev/null || true - # ruby -rgem-wrappers/command -e WrappersCommand.new.execute_regenerate + run_gem_wrappers_regenerate 2>/dev/null || true +} + +run_gem_wrappers_regenerate() +{ + gem search gem-wrappers | grep gem-wrappers >/dev/null || + gem install gem-wrappers && + gem wrappers regenerate || + return $? } __gemset_gem() diff --git a/scripts/functions/manage/base b/scripts/functions/manage/base index 3f2e5c4cf4..1872ce10b6 100644 --- a/scripts/functions/manage/base +++ b/scripts/functions/manage/base @@ -607,20 +607,15 @@ __rvm_remove_archives() __rvm_remove_binaries() { rvm_log "$rvm_ruby_string - #removing binaries" - typeset full_binary_path linked_binary_path - typeset -a binaries + typeset _binary_path + typeset -a _binaries - __rvm_read_lines binaries <( + __rvm_read_lines _binaries <( __rvm_find "${rvm_bin_path:-$rvm_path/bin}" -maxdepth 1 -mindepth 1 "${name_opt}" "*$rvm_ruby_string" -or "${name_opt}" "*$rvm_ruby_string@*" ) - for full_binary_path in "${binaries[@]}" + for _binary_path in "${_binaries[@]}" do - if - [[ -L "$full_binary_path" ]] && - __rvm_string_match "$(__rvm_readlink "$full_binary_path")" "*$rvm_ruby_string/*" "*$rvm_ruby_string@*" - then - \rm -f "$full_binary_path" - fi + \rm -f "${_binary_path}" done } diff --git a/scripts/repair b/scripts/repair index 31ddf883e4..e3f37f2056 100755 --- a/scripts/repair +++ b/scripts/repair @@ -1,6 +1,7 @@ #!/usr/bin/env bash source "$rvm_scripts_path/base" +source "$rvm_scripts_path/functions/gemset" usage() { @@ -46,18 +47,15 @@ repair_gemsets() repair_wrappers() { - typeset -a wrapper_ruby_names failed_wrappers - typeset wrapper_ruby_name - rvm_log "Regenerating all wrappers..." - __rvm_read_lines wrapper_ruby_names <("$rvm_scripts_path/list" gemsets strings) + __rvm_read_lines ruby_names <("$rvm_scripts_path/list" gemsets strings) - for wrapper_ruby_name in "${wrapper_ruby_names[@]}" + for ruby_name in "${ruby_names[@]}" do __rvm_log_command \ - "wrappers.regenerate.$wrapper_ruby_name" \ - "Regenerating wrappers for $wrapper_ruby_name" \ - "$rvm_scripts_path/wrapper" "$wrapper_ruby_name" || + "wrappers.regenerate.$ruby_name" \ + "Regenerating wrappers for $ruby_name" \ + __rvm_with $ruby_name run_gem_wrappers_regenerate || failed_wrappers+=( "$wrapper_ruby_name" ) done @@ -68,31 +66,19 @@ repair_wrappers() return ${#failed_wrappers[@]} } -# Removes stale symlinks in $rvm_bin_path, likely -# related to wrappers. +# Removes stale symlinks in $rvm_bin_path, likely related to wrappers. repair_symlinks() { rvm_log "Repairing symlinks..." - - ( - __rvm_cd "${rvm_bin_path}" - - for executable_name in $(__rvm_find \. -type l) - do - if [[ -e "$executable_name" || \ - "$(__rvm_readlink "$executable_name")" != "$rvm_wrappers_path/"* ]] - then - continue - fi - - if [[ -f "$executable_name" ]] - then - rvm_log "removing stale symlink from $(basename "$executable_name")" - \rm -f "$executable_name" - fi - done - ) - + for executable_name in "${rvm_bin_path}"/* + do + if + [[ -l "$executable_name" && ! -e "$executable_name" && "$executable_name" != "${rvm_bin_path}/*" ]] + then + rvm_log "removing stale symlink from $(basename "$executable_name")" + \rm -f "$executable_name" + fi + done rvm_log "Symlinks repaired" } diff --git a/scripts/selector b/scripts/selector index 5cda925080..afc0bdf0f9 100755 --- a/scripts/selector +++ b/scripts/selector @@ -673,12 +673,6 @@ __rvm_use() "$rvm_scripts_path/alias" create default "$environment_id" >& /dev/null fi rvm_default_flag=0 - if - [[ -n "${rvm_wrapper_name:-}" ]] - then - "$rvm_scripts_path/wrapper" "$environment_id" "$rvm_wrapper_name" > /dev/null 2>&1 - rvm_wrapper_name="" - fi if [[ -n "${rvm_ruby_alias:-}" ]] then From 79d3f2247f30e99c29ffd8c80a3a6fc13e4467ee Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 22:51:24 +0100 Subject: [PATCH 10/13] ensure wrappers are in place before creating links for them, fix #2440 --- scripts/wrapper | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/wrapper b/scripts/wrapper index 2f5bdc9a61..4ea8c526f6 100755 --- a/scripts/wrapper +++ b/scripts/wrapper @@ -7,6 +7,7 @@ unset rvm_default_flag rvm_wrapper_name prefix source "$rvm_scripts_path/base" source "$rvm_scripts_path/initialize" +source "$rvm_scripts_path/functions/gemset" # Empty ruby string: show usage and exit. [[ -n "${1:-}" ]] || @@ -41,6 +42,10 @@ __rvm_become "$ruby_string" || { exit 3 } +__rvm_log_command "gemset.wrappers.$ruby_string" \ + "Regenerating $ruby_string wrappers" \ + run_gem_wrappers_regenerate 2>/dev/null || true + # strip trailing / so we can use ${...%/*} to get parent rvm_bin_path="${rvm_bin_path%/}" rvm_wrappers_path="${rvm_wrappers_path%/}" @@ -49,15 +54,8 @@ if [[ ! -d "$rvm_bin_path" && ! -w "${rvm_bin_path%/*}" ]] then # can not write currently set location, try to switch relatively to wrappers path - if - [[ -w "${rvm_wrappers_path%/*}" || -w "${rvm_wrappers_path%/*}/bin" ]] - then - rvm_bin_path="${rvm_wrappers_path%/*}/bin" - rvm_warn "Wrappers will be saved to '$rvm_bin_path', make sure it's accessible in your PATH before using them." - else - rvm_error "No bin path suitable for lining wrapper. Try setting 'rvm_bin_path'." - exit 4 - fi + rvm_error "No bin path suitable for lining wrapper. Try setting 'rvm_bin_path'." + exit 4 fi [[ -d "$rvm_bin_path" ]] || mkdir -p "$rvm_bin_path" From 52f7bfac732ef2cdc7677cb2593e1c3a5589bd39 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Thu, 19 Dec 2013 22:57:34 +0100 Subject: [PATCH 11/13] use the fedora like patches on all affected ruby versions, fix #2439 --- patchsets/ruby/1.8.7/{p374 => }/centos | 0 patchsets/ruby/1.8.7/{p374 => }/fedora | 0 patchsets/ruby/1.8.7/{p374 => }/redhat | 0 patchsets/ruby/1.9.2/{p320 => }/centos | 0 patchsets/ruby/{1.9.3/p448 => 1.9.2}/fedora | 0 patchsets/ruby/1.9.2/{p320 => }/redhat | 0 patchsets/ruby/1.9.3/{p448 => }/centos | 0 patchsets/ruby/{2.0.0/p247 => 1.9.3}/fedora | 0 patchsets/ruby/1.9.3/{p448 => }/redhat | 0 patchsets/ruby/2.0.0/{p247 => }/centos | 0 patchsets/ruby/2.0.0/{p247/redhat => fedora} | 0 patchsets/ruby/2.0.0/redhat | 1 + 12 files changed, 1 insertion(+) rename patchsets/ruby/1.8.7/{p374 => }/centos (100%) rename patchsets/ruby/1.8.7/{p374 => }/fedora (100%) rename patchsets/ruby/1.8.7/{p374 => }/redhat (100%) rename patchsets/ruby/1.9.2/{p320 => }/centos (100%) rename patchsets/ruby/{1.9.3/p448 => 1.9.2}/fedora (100%) rename patchsets/ruby/1.9.2/{p320 => }/redhat (100%) rename patchsets/ruby/1.9.3/{p448 => }/centos (100%) rename patchsets/ruby/{2.0.0/p247 => 1.9.3}/fedora (100%) rename patchsets/ruby/1.9.3/{p448 => }/redhat (100%) rename patchsets/ruby/2.0.0/{p247 => }/centos (100%) rename patchsets/ruby/2.0.0/{p247/redhat => fedora} (100%) create mode 100644 patchsets/ruby/2.0.0/redhat diff --git a/patchsets/ruby/1.8.7/p374/centos b/patchsets/ruby/1.8.7/centos similarity index 100% rename from patchsets/ruby/1.8.7/p374/centos rename to patchsets/ruby/1.8.7/centos diff --git a/patchsets/ruby/1.8.7/p374/fedora b/patchsets/ruby/1.8.7/fedora similarity index 100% rename from patchsets/ruby/1.8.7/p374/fedora rename to patchsets/ruby/1.8.7/fedora diff --git a/patchsets/ruby/1.8.7/p374/redhat b/patchsets/ruby/1.8.7/redhat similarity index 100% rename from patchsets/ruby/1.8.7/p374/redhat rename to patchsets/ruby/1.8.7/redhat diff --git a/patchsets/ruby/1.9.2/p320/centos b/patchsets/ruby/1.9.2/centos similarity index 100% rename from patchsets/ruby/1.9.2/p320/centos rename to patchsets/ruby/1.9.2/centos diff --git a/patchsets/ruby/1.9.3/p448/fedora b/patchsets/ruby/1.9.2/fedora similarity index 100% rename from patchsets/ruby/1.9.3/p448/fedora rename to patchsets/ruby/1.9.2/fedora diff --git a/patchsets/ruby/1.9.2/p320/redhat b/patchsets/ruby/1.9.2/redhat similarity index 100% rename from patchsets/ruby/1.9.2/p320/redhat rename to patchsets/ruby/1.9.2/redhat diff --git a/patchsets/ruby/1.9.3/p448/centos b/patchsets/ruby/1.9.3/centos similarity index 100% rename from patchsets/ruby/1.9.3/p448/centos rename to patchsets/ruby/1.9.3/centos diff --git a/patchsets/ruby/2.0.0/p247/fedora b/patchsets/ruby/1.9.3/fedora similarity index 100% rename from patchsets/ruby/2.0.0/p247/fedora rename to patchsets/ruby/1.9.3/fedora diff --git a/patchsets/ruby/1.9.3/p448/redhat b/patchsets/ruby/1.9.3/redhat similarity index 100% rename from patchsets/ruby/1.9.3/p448/redhat rename to patchsets/ruby/1.9.3/redhat diff --git a/patchsets/ruby/2.0.0/p247/centos b/patchsets/ruby/2.0.0/centos similarity index 100% rename from patchsets/ruby/2.0.0/p247/centos rename to patchsets/ruby/2.0.0/centos diff --git a/patchsets/ruby/2.0.0/p247/redhat b/patchsets/ruby/2.0.0/fedora similarity index 100% rename from patchsets/ruby/2.0.0/p247/redhat rename to patchsets/ruby/2.0.0/fedora diff --git a/patchsets/ruby/2.0.0/redhat b/patchsets/ruby/2.0.0/redhat new file mode 100644 index 0000000000..2a72a49368 --- /dev/null +++ b/patchsets/ruby/2.0.0/redhat @@ -0,0 +1 @@ +ssl_no_ec2m From f5c442ca71b6e12ecab6ce0b98188e7d99365e31 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Fri, 20 Dec 2013 00:33:26 +0100 Subject: [PATCH 12/13] fix ensuring environemnt file exist, fix #2442 --- scripts/functions/environment | 2 +- scripts/functions/gemset | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/functions/environment b/scripts/functions/environment index 909390c2ea..0dccf431ec 100644 --- a/scripts/functions/environment +++ b/scripts/functions/environment @@ -84,7 +84,7 @@ __rvm_ensure_has_environment_files() { typeset file_name variable value environment_id __path __gem_home - __gem_home="${1:-"${rvm_ruby_gem_home}"}" + __gem_home="${rvm_ruby_gem_home}" file_name="${__gem_home}/environment" __path="" if [[ "${__gem_home##*@}" != "global" ]] diff --git a/scripts/functions/gemset b/scripts/functions/gemset index 46f4f9a0b3..89a5068d59 100644 --- a/scripts/functions/gemset +++ b/scripts/functions/gemset @@ -76,7 +76,6 @@ gemset_create() else mkdir -p "$gem_home/cache" fi - __rvm_ensure_has_environment_files "$gem_home" rvm_log "$rvm_ruby_string - #gemset created $gem_home" if (( ${rvm_skip_gemsets_flag:-0} == 0 )) @@ -206,6 +205,8 @@ gemset_initial() [[ -d "$rvm_gems_path/${rvm_ruby_string}/cache" ]] || mkdir -p "$rvm_gems_path/${rvm_ruby_string}/cache" 2>/dev/null + __rvm_ensure_has_environment_files + paths=( $( __rvm_ruby_string_paths_under "$rvm_gemsets_path" | sort -r ) ) for _iterator in "${paths[@]}" From a8abf387c1b6c345f9035846013e5557f55aac68 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Fri, 20 Dec 2013 15:10:01 +0100 Subject: [PATCH 13/13] 1.25.1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ad2191947f..d905a6d1d6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.25.0 +1.25.1