Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://….git#hash links should be recognized correctly #17

Open
Profpatsch opened this issue Aug 16, 2018 · 0 comments
Open

https://….git#hash links should be recognized correctly #17

Profpatsch opened this issue Aug 16, 2018 · 0 comments

Comments

@Profpatsch
Copy link
Owner

A lockfile entry like

"dfinity-tx@git+https://github.com/dfinity/js-dfinity-tx.git":
  version "0.0.1"
  resolved "git+https://github.com/dfinity/js-dfinity-tx.git#32240a29f03e1e5062dcd8f8e4ff50eb69bb91a0"
  dependencies:
    assert "^1.4.1"
    borc "git+https://github.com/dignifiedquire/borc.git#fix/nested-array"
    events "^2.0.0"
    safe-buffer "^5.1.1"
    secp256k1 "^3.3.1"

"dfinity-tx@https://github.com/dfinity/js-dfinity-tx.git":
  version "0.0.1"
  resolved "https://github.com/dfinity/js-dfinity-tx.git#8657759ce78bde01c16858a9543c1d069a77333f"
  dependencies:
    assert "^1.4.1"
    borc "^2.0.3"
    events "^2.0.0"
    safe-buffer "^5.1.1"
    secp256k1 "^3.3.1"

Generates this nix expression:

        "[email protected]" = f "dfinity-tx" "0.0.1" (ir "https://github.com/dfinity/js-dfinity-tx.git") "8657759ce78bde01c16858a9543c1d069a77333f" [
          (s."assert@^1.4.1")
          (s."borc@^2.0.3")
          (s."events@^2.0.0")
          (s."safe-buffer@^5.1.1")
          (s."secp256k1@^3.3.1")
        ];
        "dfinity-tx@git+https://github.com/dfinity/js-dfinity-tx.git" = s."[email protected]";
        "dfinity-tx@https://github.com/dfinity/js-dfinity-tx.git" = s."[email protected]";

f and ir resolve to fetchurl, so that is clearly wrong.

The second entry’s link has the form:

https://github.com/dfinity/js-dfinity-tx.git#8657759ce78bde01c16858a9543c1d069a77333f

So we should probably parse everything that ends in .git and contains a hash as a GitRemote.

Note that the bug happens because the yarn.lock file format is very ill structured and provides no easy way to distinguish different kinds of remotes from each other. Thus, the logic in https://github.com/Profpatsch/yarn-lock/blob/master/src/Yarn/Lock/File.hs#L114-L160 is one of the most brittle path of yarn2nix (while the other brittle part is the rest of the parser). This is also where these changes need to be implemented.

The corresponding tests in https://github.com/Profpatsch/yarn-lock/blob/master/tests/TestFile.hs#L30-L47 need to be amended as well.

Thanks to @jwiegley for the bug report!

@Profpatsch Profpatsch changed the title https://….git links should be recognized correctly https://….git#hash links should be recognized correctly Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant