sonatype / nexus-ruby-support

26 stars 7 forks source link

latest_specs.4.8 on hosted repo is wrong #13

Closed mkristian closed 11 years ago

mkristian commented 11 years ago

latest_specs.4.8 should contain only the latest released version of a given gem. currently the latest_specs.4.8 is identical specs.4.8

from a practical point of view that is workable - $ gem list -r will just use whatever latest_specs.4.8 is delivering - just a bit more than expected by the user.

flyinprogrammer commented 11 years ago

what's worse is that bundler is determining 'latest' based on dir.glob sorting (we're pretty sure) meaning that: 0.0.8 is 'newer' than 0.0.14; because 8 > 1

Working with @tylerrhodes to make this work better, or at least understand the full extent of the issue.

mkristian commented 11 years ago

the whole file is "corrupt" - it basically is identical to specs.4.8. i.e. it is list of versions but it should have only a single version per gem. which client handles that list and how I do not know and I am not surprised that it does a lexical sort on the list (which could be natural ordering).

where and how does that issue pop up ? having a gem with version 0.0.8 and version 0.0.14 and using bundler will install the wrong gem ?

flyinprogrammer commented 11 years ago

correct - bundler will think 0.0.8 is latest; we use a group to fetch gems; we've proven by deleting 0.0.8 - hoping maybe it would pull from latest again, but bundler then insisted on then pulling from 0.0.7

flyinprogrammer commented 11 years ago

what's better is that doing gem install will pull down 0.1.x ; but bundler will still insist on 0.0.7

mkristian commented 11 years ago

OK. I will try to fix it over the weekend.

flyinprogrammer commented 11 years ago

ok -- if you can point me to where/how bundler determines 'latest', or where in this pluggin the magic lives, i can try and help. i've also noticed that if you host gems like 0.2.2.[letters] -- the gem will not be populated in the api call.

so for example: pushing up a gem: nexus-0.2.2.ha can be downloaded via 'gem install nexus -v 0.2.2.ha' but not through bundle update if you specify the gem in your gemfile or gemspec. you'll get things like:

Could not find gem 'nexus (= 0.2.2.ha) ruby', which is required by gem 'hasc_pages (>= 0) ruby', in any of the sources.

mkristian commented 11 years ago

OK - some pointers: for hosted repos the lines

https://github.com/sonatype/nexus-ruby-support/blob/master/nexus-ruby-tools/src/main/resources/nexus/rubygems.rb#L89 https://github.com/sonatype/nexus-ruby-support/blob/master/nexus-ruby-tools/src/main/resources/nexus/rubygems.rb#L110

do the wrong thing. they should delete old version(s) of the given gem/platform and then add the new one

for the group repos: https://github.com/sonatype/nexus-ruby-support/blob/master/nexus-ruby-tools/src/main/resources/nexus/rubygems.rb#L72

needs to be able to distinguish latest from the other indeces. probably by changing the method to something like def merge_specs( source, sources, latest = false )

the prereleased gems (one with letters in the version) had an issue with bundler which should be solved by this commit: e141922023bdf26fcb23b07926dd927e97adfe06

please make sure that you run the latest code and if you still see problems bundler installing prereleased gems, please open a new issue.

how bundler finds the latest version I am have no idea (yet) but solving the above issues is anyways time to get fixed.

flyinprogrammer commented 11 years ago

awesome - thanks! we'll make sure to update to latest on monday!

flyinprogrammer commented 11 years ago

so -- I have but failed you; I have tried as I might to get this plugin working locally with a local version of nexus so that I could have a fresh baseline for what is and is not working so that I could start by writing a failing test, and get it to pass. but alas... I cannot seem to create a blank ruby repository without nexus crashing, and my java foo is not strong enough to figure out what is the matter :cry: --- my new plan is to have @tylerrhodes teach me some foo on Tuesday so that I might be able to positively contribute in the future -- I'm truly really sorry!!!!

mkristian commented 11 years ago

I have failed - it should be just working to build the plugin and run the test. But it is still too error prone. You need to make sure that the nexus version from the root pom matches your local nexus installation.

mkristian commented 11 years ago

I am not really sure if that issue is related to bundler not installing the latest gem. anyways now the hosted gem repo on nexus should behave nicely. if the bundler problem persists please open a new issue with a small Gemfile and console dump of the bundle call.