From drbrain at segment7.net Wed Nov 2 17:42:55 2005 From: drbrain at segment7.net (Eric Hodel) Date: Wed, 2 Nov 2005 14:42:55 -0800 Subject: [Rubygems-developers] gem uninstall bug Message-ID: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> $ sudo gem uninstall rails Attempting to uninstall gem 'rails' Select RubyGem to uninstall: 1. rails-0.14.2 2. rails_analyzer_tools-1.1.0 3. All versions > 1 Successfully uninstalled rails version 0.14.2 Remove executables and scripts for 'rails_stat, bench, crawl' in addition to the gem? [Yn] rails_stat, bench and crawl are part of rails_analyzer_tools, not rails itself, so gems shouldn't be asking me to uninstall them. -- Eric Hodel - drbrain at segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 From curt.hibbs at gmail.com Thu Nov 3 10:38:35 2005 From: curt.hibbs at gmail.com (Curt Hibbs) Date: Thu, 3 Nov 2005 09:38:35 -0600 Subject: [Rubygems-developers] gem uninstall bug In-Reply-To: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> References: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> Message-ID: <31d15f490511030738i45763f21j6b7d173c7ec36ce9@mail.gmail.com> Eric, on a related side note, uninstalling the rails gem will not uninstall all of its component gems (ActiveRecord, ActionPack, etc.). You probebly knew this already, but it bit me before, so I though I should mention it. Curt On 11/2/05, Eric Hodel wrote: > $ sudo gem uninstall rails > Attempting to uninstall gem 'rails' > > Select RubyGem to uninstall: > 1. rails-0.14.2 > 2. rails_analyzer_tools-1.1.0 > 3. All versions > > 1 > Successfully uninstalled rails version 0.14.2 > Remove executables and scripts for > 'rails_stat, bench, crawl' in addition to the gem? [Yn] > > rails_stat, bench and crawl are part of rails_analyzer_tools, not > rails itself, so gems shouldn't be asking me to uninstall them. > > -- > Eric Hodel - drbrain at segment7.net - http://segment7.net > FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 > > > _______________________________________________ > Rubygems-developers mailing list > Rubygems-developers at rubyforge.org > http://rubyforge.org/mailman/listinfo/rubygems-developers > From chad at chadfowler.com Thu Nov 3 10:53:10 2005 From: chad at chadfowler.com (Chad Fowler) Date: Thu, 3 Nov 2005 10:53:10 -0500 Subject: [Rubygems-developers] gem uninstall bug In-Reply-To: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> References: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> Message-ID: On 02-Nov-05, at 5:42 PM, Eric Hodel wrote: > $ sudo gem uninstall rails > Attempting to uninstall gem 'rails' > > Select RubyGem to uninstall: > 1. rails-0.14.2 > 2. rails_analyzer_tools-1.1.0 > 3. All versions >> 1 > Successfully uninstalled rails version 0.14.2 > Remove executables and scripts for > 'rails_stat, bench, crawl' in addition to the gem? [Yn] > > rails_stat, bench and crawl are part of rails_analyzer_tools, not > rails itself, so gems shouldn't be asking me to uninstall them. Yuck. I'll check it out later today. Thanks, Chad From chad at chadfowler.com Thu Nov 3 10:54:44 2005 From: chad at chadfowler.com (Chad Fowler) Date: Thu, 3 Nov 2005 10:54:44 -0500 Subject: [Rubygems-developers] gem uninstall bug In-Reply-To: <31d15f490511030738i45763f21j6b7d173c7ec36ce9@mail.gmail.com> References: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> <31d15f490511030738i45763f21j6b7d173c7ec36ce9@mail.gmail.com> Message-ID: <7C42B7E1-FB8F-4226-A8D4-B9F8E4FD2CD5@chadfowler.com> On 03-Nov-05, at 10:38 AM, Curt Hibbs wrote: > Eric, on a related side note, uninstalling the rails gem will not > uninstall all of its component gems (ActiveRecord, ActionPack, etc.). > You probebly knew this already, but it bit me before, so I though I > should mention it. > > This one is intentional. You might have an app that uses Rake, having installed Rake as part of Rails. It would be bad to autouninstall Rake when Rails comes off. That being said, DHH has requested (for this very reason) the ability to explicitly ask rubygems to uninstall with dependencies. It's on the list. Feel free to implement it if you have spare time :) Otherwise we'll get to it probably for the next release. Chad From halostatue at gmail.com Thu Nov 3 11:02:59 2005 From: halostatue at gmail.com (Austin Ziegler) Date: Thu, 3 Nov 2005 11:02:59 -0500 Subject: [Rubygems-developers] gem uninstall bug In-Reply-To: <7C42B7E1-FB8F-4226-A8D4-B9F8E4FD2CD5@chadfowler.com> References: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> <31d15f490511030738i45763f21j6b7d173c7ec36ce9@mail.gmail.com> <7C42B7E1-FB8F-4226-A8D4-B9F8E4FD2CD5@chadfowler.com> Message-ID: <9e7db9110511030802h19112975q424ecff48b2625e7@mail.gmail.com> On 11/3/05, Chad Fowler wrote: > On 03-Nov-05, at 10:38 AM, Curt Hibbs wrote: > > Eric, on a related side note, uninstalling the rails gem will not > > uninstall all of its component gems (ActiveRecord, ActionPack, etc.). > > You probebly knew this already, but it bit me before, so I though I > > should mention it. > This one is intentional. You might have an app that uses Rake, > having installed Rake as part of Rails. It would be bad to > autouninstall Rake when Rails comes off. Rake should only be autouninstalled when removing Rails if there are no other stated dependencies to it, and then it should probably be asked if that's desired in any case. -austin -- Austin Ziegler * halostatue at gmail.com * Alternate: austin at halostatue.ca From drbrain at segment7.net Thu Nov 3 13:35:25 2005 From: drbrain at segment7.net (Eric Hodel) Date: Thu, 3 Nov 2005 10:35:25 -0800 Subject: [Rubygems-developers] gem uninstall bug In-Reply-To: <31d15f490511030738i45763f21j6b7d173c7ec36ce9@mail.gmail.com> References: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> <31d15f490511030738i45763f21j6b7d173c7ec36ce9@mail.gmail.com> Message-ID: <3A96535B-ED10-4798-8099-45189696945A@segment7.net> On Nov 3, 2005, at 7:38 AM, Curt Hibbs wrote: > Eric, on a related side note, uninstalling the rails gem will not > uninstall all of its component gems (ActiveRecord, ActionPack, etc.). > You probebly knew this already, but it bit me before, so I though I > should mention it. I didn't expect it to remove the component gems. -- Eric Hodel - drbrain at segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 From chad at chadfowler.com Thu Nov 3 17:34:42 2005 From: chad at chadfowler.com (Chad Fowler) Date: Thu, 3 Nov 2005 17:34:42 -0500 Subject: [Rubygems-developers] gem uninstall bug In-Reply-To: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> References: <72D9474D-8B73-44C8-8D8F-DC270890FBF1@segment7.net> Message-ID: <4AA201CF-E898-4F8A-984B-EFEA8F007C46@chadfowler.com> On 02-Nov-05, at 5:42 PM, Eric Hodel wrote: > $ sudo gem uninstall rails > Attempting to uninstall gem 'rails' > > Select RubyGem to uninstall: > 1. rails-0.14.2 > 2. rails_analyzer_tools-1.1.0 > 3. All versions >> 1 > Successfully uninstalled rails version 0.14.2 > Remove executables and scripts for > 'rails_stat, bench, crawl' in addition to the gem? [Yn] > > rails_stat, bench and crawl are part of rails_analyzer_tools, not > rails itself, so gems shouldn't be asking me to uninstall them. Fixed in CVS, thanks. Chad From hgs at dmu.ac.uk Fri Nov 11 12:20:42 2005 From: hgs at dmu.ac.uk (Hugh Sasse) Date: Fri, 11 Nov 2005 17:20:42 +0000 (WET) Subject: [Rubygems-developers] rubygems claiming installation for existing latest gems. Message-ID: I have just updated rails and associated gems. Some gems I tried to update didn't need updating, they were the latest versions. However, gem update reported them as being successfully installed. In some sense it was not a failure, so that's OK but it is odd. I see from the code that the installation routines supply a list of what was installed. However, they have no means of providing feedback about what wasn't installed, and why it wasn't installed. The attached patch is an attempt to address this, as yet incomplete. I think that returning something more structured than an array would facilitate better communication between the objects involved. So I've started out with a class descended from Hash, and an extra option with a long name to enable this. Before I make any attempt to follow this through, is there a reason why this is a bad idea and, does anyone have a better way to do this? Hugh -------------- next part -------------- --- ./lib/rubygems/remote_installer.rb 2005-11-11 15:18:38.182763000 +0000 +++ ./lib/rubygems/remote_installer.rb.new 2005-11-11 17:07:47.037109000 +0000 @@ -8,6 +8,7 @@ class GemNotFoundException < Gem::Exception; end class RemoteInstallationCancelled < Gem::Exception; end + # ================================================================== # RemoteSourceFetcher handles the details of fetching gems and gem # information from a remote source. @@ -368,6 +369,7 @@ class RemoteInstaller include UserInteraction + # http_proxy:: # * [String]: explicit specification of proxy; overrides any # environment variable setting @@ -375,6 +377,12 @@ # * :no_proxy: ignore environment variables and _don't_ # use a proxy # + # Other supported options: + # ignore_dependencies + # include_dependencies + # New options: + # return_installation_information + # def initialize(options={}) # Ensure http_proxy env vars are used if no proxy explicitly supplied. @options = options @@ -409,17 +417,27 @@ unless version_requirement.respond_to?(:satisfied_by?) version_requirement = Version::Requirement.new(version_requirement) end - installed_gems = [] caches = source_index_hash spec, source = find_gem_to_install(gem_name, version_requirement, caches) dependencies = find_dependencies_not_installed(spec.dependencies) - installed_gems << install_dependencies(dependencies, force, install_dir) + if @options.has_key?(:return_installation_information) + installed_gems = InstallationInformation.new + installed_gems.merge(install_dependencies(dependencies, force, install_dir)) + else + installed_gems = [] + installed_gems << install_dependencies(dependencies, force, install_dir) + end cache_dir = File.join(install_dir, "cache") destination_file = File.join(cache_dir, spec.full_name + ".gem") download_gem(destination_file, source, spec) installer = new_installer(destination_file) - installed_gems.unshift installer.install(force, install_dir, install_stub) - installed_gems.flatten + if @options.has_key?(:return_installation_information) + installed_gems.merge installer.install(force, install_dir, install_stub) + installed_gems + else + installed_gems.unshift installer.install(force, install_dir, install_stub) + installed_gems.flatten + end end # Search Gem repository for a gem by specifying all or part of --- ./lib/rubygems/installer.rb 2005-11-11 15:18:38.161653000 +0000 +++ ./lib/rubygems/installer.rb.new 2005-11-11 17:07:51.229336000 +0000 @@ -22,6 +22,9 @@ # # gem:: [String] The file name of the gem # + # options can include: + # return_installation_information + # def initialize(gem, options={}) @gem = gem @options = options @@ -90,7 +93,13 @@ end format.spec.loaded_from = File.join(install_dir, 'specifications', format.spec.full_name+".gemspec") - return format.spec + if @options.has_key?(:return_installation_information) + info = InstallationInformation.new() + info[installed] = format_spec + return info + else + return format.spec ; + end end ## --- ./lib/rubygems.rb 2005-11-11 15:18:38.089946000 +0000 +++ ./lib/rubygems.rb.new 2005-11-11 16:54:37.551370000 +0000 @@ -4,6 +4,23 @@ class LoadError < ::LoadError attr_accessor :name, :version_requirement end + + + # At present the installer returns a list of gems successfully + # installed. There is no facility for saying why a gem was or + # was not installed. This means that rubygems can only say it + # has successfully installed a gem when we ask for the latest + # version and it is the same as we have, because there is no + # mechanism to feed that kind of information back to the user. + class InstallationInformation < Hash + def initialize() + super + self[:installed] = nil + self[:failed] = nil + self[:have_latest] = nil + end + end + end module Kernel From flori at nixe.ping.de Sat Nov 12 13:04:18 2005 From: flori at nixe.ping.de (Florian Frank) Date: 12 Nov 2005 19:04:18 +0100 Subject: [Rubygems-developers] Problems with RemoteInstaller Message-ID: <43762EA2.1010008@nixe.ping.de> Hello, I hade some problems using the Rubygems RemoteInstaller. It requires a 'rubygems/open-uri.rb', that contains a copy of the 'open-uri.rb' file, that comes with Ruby. I think this was done to be compatible with older versions of Ruby. I used the RemoteInstaller in an app, that used the standard 'open-uri.rb', and I had some strange errors, because of this: SystemStackError (stack level too deep): /usr/local/stow/ruby/lib/ruby/18/open-urirb:82:in `open_uri_original_open' /usr/local/stow/ruby/lib/ruby/18/open-urirb:87:in `open_uri_original_open' /usr/local/stow/ruby/lib/ruby/18/open-urirb:87:in `open_uri_original_open' /usr/local/stow/ruby/lib/ruby/18/open-urirb:87:in `open_uri_original_open' ... Both libraries alias Kernel#open to this method and seem to confuse each other. I made the following patch, that solved the problem for me: --- remote_installer.rb.bak 2005-11-12 18:17:16.330519355 +0100 +++ remote_installer.rb 2005-11-12 18:17:41.877160601 +0100 @@ -114,7 +114,11 @@ # Read the data from the (source based) URI, but if it is a # file:// URI, read from the filesystem instead. def open_uri_or_path(uri, &block) - require 'rubygems/open-uri' + begin + require 'open-uri' + rescue LoadError + require 'rubygems/open-uri' + end if is_file_uri(uri) open(get_file_uri_path(uri), &block) else Could you appy it to Rubygems, please? -- Florian Frank From mfp at acm.org Sat Nov 12 19:11:37 2005 From: mfp at acm.org (Mauricio =?iso-8859-1?Q?Fern=E1ndez?=) Date: Sun, 13 Nov 2005 01:11:37 +0100 Subject: [Rubygems-developers] Problems with RemoteInstaller In-Reply-To: <43762EA2.1010008@nixe.ping.de> References: <43762EA2.1010008@nixe.ping.de> Message-ID: <20051113001137.GA12993@tux-chan> On Sat, Nov 12, 2005 at 07:04:18PM +0100, Florian Frank wrote: > Hello, > > I hade some problems using the Rubygems RemoteInstaller. It requires a > 'rubygems/open-uri.rb', that contains a copy of the 'open-uri.rb' file, > that comes with Ruby. I think this was done to be compatible with older > versions of Ruby. It was a workaround for a bug in an older open-uri (as opposed to a way to use open-uri in outdated Ruby setups). > def open_uri_or_path(uri, &block) > - require 'rubygems/open-uri' > + begin > + require 'open-uri' > + rescue LoadError > + require 'rubygems/open-uri' > + end If you go that way, just require 'open-uri' would make more sense. -- Mauricio Fernandez From chad at chadfowler.com Sun Nov 13 09:07:44 2005 From: chad at chadfowler.com (Chad Fowler) Date: Sun, 13 Nov 2005 09:07:44 -0500 Subject: [Rubygems-developers] Problems with RemoteInstaller In-Reply-To: <20051113001137.GA12993@tux-chan> References: <43762EA2.1010008@nixe.ping.de> <20051113001137.GA12993@tux-chan> Message-ID: <0A468C90-E400-4B0A-9133-D2674A8D1692@chadfowler.com> On Nov 12, 2005, at 7:11 PM, Mauricio Fern?ndez wrote: > On Sat, Nov 12, 2005 at 07:04:18PM +0100, Florian Frank wrote: >> Hello, >> >> I hade some problems using the Rubygems RemoteInstaller. It >> requires a >> 'rubygems/open-uri.rb', that contains a copy of the 'open-uri.rb' >> file, >> that comes with Ruby. I think this was done to be compatible with >> older >> versions of Ruby. > > It was a workaround for a bug in an older open-uri (as opposed to a > way to > use open-uri in outdated Ruby setups). > >> def open_uri_or_path(uri, &block) >> - require 'rubygems/open-uri' >> + begin >> + require 'open-uri' >> + rescue LoadError >> + require 'rubygems/open-uri' >> + end > > If you go that way, just > require 'open-uri' > would make more sense. > > Yes, true. We should do some testing with various open-uri versions and perhaps change the minimum ruby version requirement for rubygems. Chad From mfp at acm.org Sun Nov 13 10:05:47 2005 From: mfp at acm.org (Mauricio =?iso-8859-1?Q?Fern=E1ndez?=) Date: Sun, 13 Nov 2005 16:05:47 +0100 Subject: [Rubygems-developers] Problems with RemoteInstaller In-Reply-To: <0A468C90-E400-4B0A-9133-D2674A8D1692@chadfowler.com> References: <43762EA2.1010008@nixe.ping.de> <20051113001137.GA12993@tux-chan> <0A468C90-E400-4B0A-9133-D2674A8D1692@chadfowler.com> Message-ID: <20051113150547.GB12993@tux-chan> On Sun, Nov 13, 2005 at 09:07:44AM -0500, Chad Fowler wrote: > On Nov 12, 2005, at 7:11 PM, Mauricio Fern?ndez wrote: > > It was a workaround for a bug in an older open-uri (as opposed to a way > > to use open-uri in outdated Ruby setups). [...] > Yes, true. We should do some testing with various open-uri versions > and perhaps change the minimum ruby version requirement for rubygems. IIRC the open-uri shipped with Ruby 1.8.1 exhibited the bug that bit us and which was finally fixed on Jan 31st 2004. Hence RUBY_VERSION_CODE > 181 || RUBY_RELEASE_CODE > 20040131 should be OK, unless new dependencies were added later. -- Mauricio Fernandez