Discussion:
[Nix-dev] nix-prefetch-git in nixpkgs
Lluís Batlle i Rossell
2012-06-04 19:01:40 UTC
Permalink
Hello,

I can't understand how nix-prefetch-git works.
If I call:
./nix-prefetch-git git://gitorious.org/qt-labs/jom.git v1.0.11
it does not fetch anything and gives always the same hash.

If I call:
./nix-prefetch-git --url git://gitorious.org/qt-labs/jom.git --rev v1.0.11
it says: unknown flag '--rev'.

And its output without parameters is a help that says:
syntax: nix-prefetch-git [options] [URL [REVISION [EXPECTED-HASH]]]

Options:
--out path Path where the output would be stored.
--url url Any url understand by 'git clone'.
--rev ref Any sha1 or references (such as refs/heads/master)
--hash h Expected hash.
--deepClone Clone submodules recursively.
--no-deepClone Do not clone submodules.
--leave-dotGit Keep the .git directories.
--builder Clone as fetchgit does, but url, rev, and out option are mandatory.

So, do I fail to understand how to call nix-prefetch-git, or it is very wrong? :)

Thank you,
Lluís.
Vladimír Čunát
2012-06-06 15:15:12 UTC
Permalink
Hi.
Post by Lluís Batlle i Rossell
I can't understand how nix-prefetch-git works.
 ./nix-prefetch-git git://gitorious.org/qt-labs/jom.git v1.0.11
it does not fetch anything and gives always the same hash.
 ./nix-prefetch-git --url git://gitorious.org/qt-labs/jom.git --rev v1.0.11
it says: unknown flag '--rev'.
So, do I fail to understand how to call nix-prefetch-git, or it is very wrong? :)
I never used it but this calling works for me:
./nix-prefetch-git git://gitorious.org/qt-labs/jom.git
28235fb362e3b6eafbbff29bb7c552a353235fdb

But there seem to be at least some incompatibility between
documentation and behaviour.

Vlada
Kirill Elagin
2012-06-07 14:06:34 UTC
Permalink
Hi,

I'm reading nix-prefetch-git from HEAD right now and its behaviour seems to
be consistent with documentation except for a small bug that renders those
--* setters a bit unusable (see
this<https://github.com/kirelagin/nixpkgs/commit/7d786f3b7b41d1a417cde496cc002e5fa6f2352e>
).

Next. You are giving a *tag* as `rev`. `rev` must be one of "HEAD",
`refs/*`-reference or commit hash (actually adding support for tags would
be really nice). The problem is that the script doesn't have a code path
that handles invalid rev's — it just doesn't do anything (see
here<https://github.com/kirelagin/nixpkgs/commit/61a640d13ca0a1beeba738989716bfa5fb0ee92f>
) =).

--
КОрОлл ЕлагОМ
Post by Lluís Batlle i Rossell
Hello,
I can't understand how nix-prefetch-git works.
./nix-prefetch-git git://gitorious.org/qt-labs/jom.git v1.0.11
it does not fetch anything and gives always the same hash.
./nix-prefetch-git --url git://gitorious.org/qt-labs/jom.git --rev v1.0.11
it says: unknown flag '--rev'.
syntax: nix-prefetch-git [options] [URL [REVISION [EXPECTED-HASH]]]
--out path Path where the output would be stored.
--url url Any url understand by 'git clone'.
--rev ref Any sha1 or references (such as refs/heads/master)
--hash h Expected hash.
--deepClone Clone submodules recursively.
--no-deepClone Do not clone submodules.
--leave-dotGit Keep the .git directories.
--builder Clone as fetchgit does, but url, rev, and out option are mandatory.
So, do I fail to understand how to call nix-prefetch-git, or it is very wrong? :)
Thank you,
Lluís.
_______________________________________________
nix-dev mailing list
http://lists.science.uu.nl/mailman/listinfo/nix-dev
Nicolas Pierron
2012-06-08 03:22:35 UTC
Permalink
Hi,
Post by Kirill Elagin
I'm reading nix-prefetch-git from HEAD right now and its behaviour seems to
be consistent with documentation except for a small bug that renders those
--* setters a bit unusable (see this).
What you call the old syntax is currently the most used. I would be
quite happy to remove it, but this will change a lot of hashes.
I don't understand, the for loop should still iterate over the
arguments, unless bash is removing them from the list of argument
because they are directly used.
Post by Kirill Elagin
Next. You are giving a tag as `rev`. `rev` must be one of "HEAD",
`refs/*`-reference or commit hash (actually adding support for tags would be
really nice).
refs/tags/v1.0.11

May be a --tag which does this desugaring should be enough.
Post by Kirill Elagin
The problem is that the script doesn't have a code path that
handles invalid rev's — it just doesn't do anything (see here) =).
Can somebody accept these patch, if this is not already the case?
Post by Kirill Elagin
Post by Lluís Batlle i Rossell
Hello,
I can't understand how nix-prefetch-git works.
 ./nix-prefetch-git git://gitorious.org/qt-labs/jom.git v1.0.11
it does not fetch anything and gives always the same hash.
 ./nix-prefetch-git --url git://gitorious.org/qt-labs/jom.git --rev
v1.0.11
it says: unknown flag '--rev'.
 syntax: nix-prefetch-git [options] [URL [REVISION [EXPECTED-HASH]]]
     --out path      Path where the output would be stored.
     --url url       Any url understand by 'git clone'.
     --rev ref       Any sha1 or references (such as refs/heads/master)
     --hash h        Expected hash.
     --deepClone     Clone submodules recursively.
     --no-deepClone  Do not clone submodules.
     --leave-dotGit  Keep the .git directories.
     --builder       Clone as fetchgit does, but url, rev, and out option
are mandatory.
So, do I fail to understand how to call nix-prefetch-git, or it is very wrong? :)
Thank you,
Lluís.
_______________________________________________
nix-dev mailing list
http://lists.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________
nix-dev mailing list
http://lists.science.uu.nl/mailman/listinfo/nix-dev
--
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Kirill Elagin
2012-06-08 10:13:18 UTC
Permalink
Post by Nicolas Pierron
Hi,
Post by Kirill Elagin
I'm reading nix-prefetch-git from HEAD right now and its behaviour seems
to
Post by Kirill Elagin
be consistent with documentation except for a small bug that renders
those
Post by Kirill Elagin
--* setters a bit unusable (see this).
What you call the old syntax is currently the most used. I would be
quite happy to remove it, but this will change a lot of hashes.
I don't understand, the for loop should still iterate over the
arguments, unless bash is removing them from the list of argument
because they are directly used.
I didn't say it's old syntax. I said it's old way of accepting that syntax.
The new for-loop approach also handles this way of specifying url and rev
as positional args without --* setters.

I probably should explain what was going on.
Note that when you call `./nix-prefetch-git --url git://
gitorious.org/qt-labs/jom.git --rev HEAD`,
$3 is "--rev", and due to those lines that I modified in the first patch,
$expHash becomes "--rev".
Since there is no `--hash` option, $expHash is not overwritten later and
that's why call to nix-store fails.

Again, this patch won't break `./nix-prefetch-git git://
gitorious.org/qt-labs/jom.git HEAD` call.

--
КОрОлл ЕлагОМ
Nicolas Pierron
2012-06-08 17:21:15 UTC
Permalink
Post by Kirill Elagin
Post by Nicolas Pierron
Hi,
Post by Kirill Elagin
I'm reading nix-prefetch-git from HEAD right now and its behaviour seems to
be consistent with documentation except for a small bug that renders those
--* setters a bit unusable (see this).
I don't understand, the for loop should still iterate over the
arguments, unless bash is removing them from the list of argument
because they are directly used.
I probably should explain what was going on.
Note that when you call `./nix-prefetch-git --url
git://gitorious.org/qt-labs/jom.git --rev HEAD`,
$3 is "--rev", and due to those lines that I modified in the first patch,
$expHash becomes "--rev".
Since there is no `--hash` option, $expHash is not overwritten later and
that's why call to nix-store fails.
Good catch.
--
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Loading...