Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dependencies, a boring, solved problem?

Dependencies, a boring, solved problem?

I gave this talk at Rulu 2013 in Lyon

Greg Karékinian

June 20, 2013
Tweet

More Decks by Greg Karékinian

Other Decks in Programming

Transcript

  1. No.

  2. $ sudo gem install nokogiri Fetching: mini_portile-0.5.0.gem (100%) Fetching: nokogiri-1.6.0.gem

    (100%) Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError) from /usr/lib/ruby/1.9.1/rubygems/ custom_require.rb:36:in `require' from extconf.rb:5:in `<main>' Gem files will remain installed in /var/lib/gems/1.9.1/ gems/nokogiri-1.6.0 for inspection. Results logged to /var/lib/gems/1.9.1/gems/ nokogiri-1.6.0/ext/nokogiri/gem_make.out
  3. No.

  4. $ sudo gem install nokogiri Building native extensions. This could

    take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb Extracting libxml2-2.8.0.tar.gz into tmp//ports/libxml2/2.8.0... OK Running 'configure' for libxml2 2.8.0... ERROR, review 'tmp//ports/libxml2/2.8.0/configure.log' to see what happened. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby1.9.1 /var/lib/gems/1.9.1/gems/mini_portile-0.5.0/lib/mini_portile.rb:235:in `block in execute': Failed to complete configure task (RuntimeError) from /var/lib/gems/1.9.1/gems/mini_portile-0.5.0/lib/mini_portile.rb:227:in `chdir' from /var/lib/gems/1.9.1/gems/mini_portile-0.5.0/lib/mini_portile.rb:227:in `execute' from /var/lib/gems/1.9.1/gems/mini_portile-0.5.0/lib/mini_portile.rb:57:in `configure' from /var/lib/gems/1.9.1/gems/mini_portile-0.5.0/lib/mini_portile.rb:100:in `cook' from extconf.rb:101:in `block in <main>' from extconf.rb:119:in `call' from extconf.rb:119:in `block in <main>' from extconf.rb:109:in `tap' from extconf.rb:109:in `<main>' Gem files will remain installed in /var/lib/gems/1.9.1/gems/nokogiri-1.6.0 for inspection. Results logged to /var/lib/gems/1.9.1/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
  5. No.

  6. http://railscasts.com/episodes/110-gem-dependencies # config/environment.rb config.gem "RedCloth", :version => ">= 3.0.4", :source

    => "http://code.whytheluckystiff.net/" config.gem 'aws-s3', :lib => 'aws/s3' $ gem install rails -v 2.1.0 $ rake gems:install
  7. GEM remote: https://rubygems.org/ specs: actionmailer (4.0.0.rc1) actionpack (= 4.0.0.rc1) mail

    (~> 2.5.3) actionpack (4.0.0.rc1) activesupport (= 4.0.0.rc1) builder (~> 3.1.0) erubis (~> 2.7.0) rack (~> 1.5.2) rack-test (~> 0.6.2) active_model_serializers (0.7.0) activemodel (>= 3.0) activemodel (4.0.0.rc1)
  8. $ gem install chef -v 0.10.10 ERROR: While executing gem

    ... (Gem::DependencyError) Unable to resolve dependencies: chef requires net-ssh (~> 2.2.2); net-ssh- multi requires net-ssh (>= 2.1.4); net-ssh-gateway requires net-ssh (>= 2.6.5)
  9. # chef 0.10.10 'net-ssh', '~> 2.2.2' 'net-ssh-multi', '~> 1.1.0' #

    net-ssh-multi 1.1 'net-ssh', '>= 2.1.4' 'net-ssh-gateway','>= 0.99.0' # net-ssh-gateway 1.2.0 'net-ssh', '>= 2.6.5'
  10. $ gem install chef -v 0.10.10 ERROR: While executing gem

    ... (Gem::DependencyError) Unable to resolve dependencies: net-ssh-gateway requires net-ssh (>= 2.6.5)
  11. $ gem install chef -v 0.10.10 Building native extensions. This

    could take a while... Fetching: [...] Successfully installed chef-0.10.10 20 gems installed
  12. $ gem install net-ssh-gateway -v 1.1.0 $ gem install moneta

    -v 0.6.0 $ gem install chef -v 0.10.10 Install chef 0.10.10:
  13. “Constrain the dependency too much (rack =1.2.1) and you make

    it hard to use your project in other compatible projects.”
  14. “Constrain it too little (rack >= 1.0) and a new

    release of Rack may break your code.”
  15. “Using dependencies like rack ~> 1.2.1 and versioning code in

    a SemVer compliant way mostly solves this problem, but it assumes universal compliance.”
  16. # tinder 1.9.1 'json', '~> 1.6' >= 1.6.0, < 2.0.0

    # tinder 1.9.2 'json', '~> 1.7.5'
  17. # tinder 1.9.1 'json', '~> 1.6' >= 1.6.0, < 2.0.0

    # tinder 1.9.2 'json', '~> 1.7.5' >= 1.7.5, < 1.8.0
  18. # chef 11.4.4 # The JSON gem reliably releases breaking

    # changes as a patch release s.add_dependency "json", ">= 1.4.4", "<= 1.7.7"
  19. Bunchr::Software.new do |t| t.name = 'libxml2' t.version = '2.9.0' install_prefix

    = "#{Bunchr.install_dir}/embedded" t.download_commands << "curl -O http://xmlsoft.org/sources/"\ "libxml2-#{t.version}.tar.gz" t.download_commands << "tar xfvz libxml2-#{t.version}.tar.gz" t.work_dir = "libxml2-#{t.version}" t.build_commands << "./configure --prefix=#{install_prefix}" t.build_commands << "make" t.install_commands << "make install" CLEAN << install_prefix end
  20. Bunchr::Packages.new do |t| t.name = 'greenalto_idk' t.version = '1' t.iteration

    = ENV['BUILD_NUMBER'] || '7' t.category = 'Development' t.license = 'All right reserved' t.vendor = 'Green Alto SAS' t.url = 'http://www.greenalto.com' t.description = 'Green Alto Infrastructure Developer Kit' t.include_software 'ruby' t.include_software 'chef' t.include_software 'knife-ec2' t.include_software 'knife-openstack' t.include_software 'greenalto_wrapper' t.files << Bunchr.install_dir t.files << '/usr/local/bin/greenalto' end
  21. Go

  22. !

  23. NO

  24. "Dependency my friends is someone elses’s piece of crap without

    which your piece of crap doesn’t work." areyoufuckingcoding.me/ 2012/04/16/dpendency- hell/
  25. fish shot at terrifyingly high aperture: @mortice Jason Seifer pics:

    http://jasonlint.org box-pile: http://www.flickr.com/photos/sillydog/ 287354869 Rake: http://www.flickr.com/photos/islespunkfan/ 2794069762 Broken eggs: http://www.flickr.com/photos/ peppysis/4870119233 Reggie Watts - If You're Fucking, you're Fucking Credits