nix-community / bundix

Generates a Nix expression for your Bundler-managed application. [maintainer=@manveru]
163 stars 55 forks source link

Bundix fails for mocha and rexml #96

Closed njaremko closed 1 year ago

njaremko commented 1 year ago

Describe the bug

Bundix is failing for several gems with wrong number of arguments (given 4, expected 1..3)

Steps To Reproduce

Steps to reproduce the behavior:

  1. Make a Gemfile with:
    gem 'rexml', '~> 3.2.0'
    gem 'mocha', '~> 1.14.0'
  2. Bundix outputs:
    Downloading /Users/njaremko/.cache/bundix/_nix_store_mlmbdpr3ln9i12q0pppcrkzw5qrjxirc-ruby-3_0_4_lib_ruby_gems_3_0_0_cache_rexml-3_2_5_gem from /nix/store/mlmbdpr3ln9i12q0pppcrkzw5qrjxirc-ruby-3.0.4/lib/ruby/gems/3.0.0/cache/rexml-3.2.5.gem
    wrong number of arguments (given 4, expected 1..3)
    Skipping rexml: undefined method `[]' for nil:NilClass
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/source.rb:98:in `block in fetch_local_hash'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/source.rb:95:in `each'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/source.rb:95:in `fetch_local_hash'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/source.rb:150:in `convert_rubygems'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/source.rb:130:in `convert'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:92:in `convert_spec'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:45:in `block in convert'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:44:in `reverse_each'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:44:in `with_object'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:44:in `convert'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/commandline.rb:149:in `build_gemset'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/commandline.rb:36:in `run'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/commandline.rb:22:in `run'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/bin/bundix:5:in `<top (required)>'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/bin/.bundix-wrapped:18:in `load'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/bin/.bundix-wrapped:18:in `<main>'
    Downloading /Users/njaremko/.cache/bundix/https_rubygems_org_gems_mocha-1_14_0_gem from https://rubygems.org/gems/mocha-1.14.0.gem
    wrong number of arguments (given 4, expected 1..3)
    Skipping mocha: couldn't fetch hash for mocha-1.14.0
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/source.rb:152:in `convert_rubygems'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/source.rb:130:in `convert'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:92:in `convert_spec'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:45:in `block in convert'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:44:in `reverse_each'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:44:in `with_object'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix.rb:44:in `convert'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/commandline.rb:149:in `build_gemset'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/commandline.rb:36:in `run'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/lib/bundix/commandline.rb:22:in `run'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/lib/ruby/gems/3.0.0/gems/bundix-2.5.0/bin/bundix:5:in `<top (required)>'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/bin/.bundix-wrapped:18:in `load'
    /nix/store/7cpnijyqc3qhkd2zqf0h6gplncaa8pdm-bundix-2.5.1/bin/.bundix-wrapped:18:in `<main>'
  3. Gemset is generated with:
    mocha = {
    };
    rexml = {
    };

Expected behavior

Outputs something like:

  mocha = {
    dependencies = ["ruby2_keywords"];
    groups = ["test"];
    platforms = [];
    source = {
      remotes = ["https://rubygems.org"];
      sha256 = "sha256-1GRCOLWy9BEL6BOS/hpGi9eExsyQEr0nT5BlUI37l80=";
      type = "gem";
    };
    version = "1.16.1";
  };
 rexml = {
    groups = ["default" "development" "test"];
    platforms = [];
    source = {
      remotes = ["https://rubygems.org"];
      sha256 = "08ximcyfjy94pm1rhcx04ny1vx2sk0x4y185gzn86yfsbzwkng53";
      type = "gem";
    };
    version = "3.2.5";
  };

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"aarch64-darwin"`
 - host os: `Darwin 22.1.0, macOS 13.0`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.11.1`
 - channels(njaremko): `""`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixpkgs`
marsam commented 1 year ago

Addressed by 12adb3703c06032db266986db5bc000bd7a2992d