Commit Graph

106 Commits

Author SHA1 Message Date
Vincent Laporte
cded306f82 nix-prefetch-git: allow dots in submodule names 2014-11-15 18:37:58 +00:00
Edward Tjörnhammar
4030ab3ba4 add parens to de ambiguify 2014-11-10 06:53:24 +01:00
Edward Tjörnhammar
91c7ffc498 Revert "Revert "initialized git repo should use the set http_proxy""
This reverts commit f8a833cfb149b35d590e0f63fe194d1f4f9db42a.
This makes sure the check returns a zero code.

See discussion on https://github.com/NixOS/nixpkgs/commit/5af576f
2014-11-09 21:27:26 +01:00
Luca Bruno
f8a833cfb1 Revert "initialized git repo should use the set http_proxy"
This reverts commit 5af576ff7f4e657c0053f66d6fba03bfd1e97669.

See discussion on https://github.com/NixOS/nixpkgs/commit/5af576f
2014-11-09 13:50:48 +01:00
Edward Tjörnhammar
5af576ff7f initialized git repo should use the set http_proxy 2014-11-07 11:50:30 +01:00
Bjørn Forsman
96cacf01bf nix-prefetch-git: run single-threaded 'git repack'
Without this, the generated pack files are non-deterministic.

I didn't notice this issue in my earlier testing, because my test repo
had too few commits for the thread scheduling to take effect. (Test repo
had about 10 commits.)
2014-11-03 22:52:57 +01:00
Bjørn Forsman
53614cf1a7 nix-prefetch-git: fix determinism with leaveDotGit
Add more files to the delete list:

 * .git/FETCH_HEAD
 * .git/ORIG_HEAD
 * .git/refs/remotes/origin/HEAD
 * .git/config

Further, remove all remote branches, remove tags not reachable from the
given 'rev', do a full repack and then garbage collect unreferenced
objects.

According to my testing, the result is fully deterministic. As in "any
change done to the upstream repo, ahead of 'rev', will not affect the
hash of the resulting 'clone'". Even changing the clone URL will not
change the output hash, because .git/config is removed.

A new version of git can of course change store format, but that's
unavoidable.

For big repositories, the repack operation may be a bit heavy. But as
far as I can see there is no cheaper way to determinism.
2014-11-02 13:15:33 +01:00
Bjørn Forsman
faaa8a6acf nix-prefetch-git: remove unneeded semicolons
Shell isn't Perl ;-)
2014-11-01 15:17:11 +01:00
Bjørn Forsman
8ec8358724 nix-prefetch-git: whitespace cleanup
Use 4 spaces per indent level instead of a mix of 2 spaces, 4 spaces and
hardtab. (According to nixpkgs coding style for shell scripts.)
2014-11-01 13:47:37 +01:00
Michael Raskin
46cdc2e017 Allow git checkouts to have custom name 2014-09-03 21:54:25 +04:00
aszlig
5e7a1cf955
build-support: Fix nix-prefetch-* on OS X.
Fixes a regression on OS X introduced by f83af95.

Don't use --tmpdir for mktemp, because that flag doesn't exist on OS X.
However, using -t is deprecated in GNU coreutils, so as suggested by
@ip1981 we're now using parameter expansion on ${TMPDIR:-/tmp} to
provide /tmp as a fallback if TMPDIR is not set and use it instead.

Also use this approach for nix-prefetch-cvs now in order to stay
consistent.

Reported-by: Vladimir Kirillov <proger@wilab.org.ua>
Tested-by: Igor Pashev <pashev.igor@gmail.com>
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-08-27 11:22:34 +02:00
aszlig
f83af95f8a
build-support: Use mktemp -d in nix-prefetch-*.
Instead of relying on $$ to not collide with an existing path.

Quoting the Bash manual about $$:

> Expands to the process ID of the shell. In a () subshell, it expands
> to the process ID of the current shell, not the subshell.

So, this is different from $BASHPID:

> Expands to the process ID of the current bash process. This differs
> from $$ under certain circumstances, such as subshells that do not
> require bash to be re-initialized.

But even $BASHPID is prone to race conditions if the process IDs wrap
around, so to be on the safe side, we're using mktemp here.

Closes #3784.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2014-08-25 15:28:55 +02:00
Benno Fünfstück
ce3e86702f prefetch-git: output human-readable rev to stderr
that way, the stdout stays compatible with nix-prefetch-{bzr,svn,hg}
2014-08-17 23:00:03 +02:00
Georges Dubus
ca0b0a68e8 Fixed deterministicness of fetchgit with leaveDotGit
The shebang of .git/hooks depended the git's bash, which made the result
depend of that bash's path.
2014-08-10 16:25:29 +02:00
Georges Dubus
f4fbcddd44 fetchgit: make deterministic with leaveDotGit (close #3392)
There was a few files containing timestamp, so we now remove them.

It shouldn't be a problem for logs. However, index might be. Anyway,
that's better than nothing.
2014-08-08 21:51:29 +02:00
Shea Levy
b969e9340b Separate fetchgitPrivate into a separate file 2014-07-16 18:05:56 -04:00
Paul Colomiets
c1e24abfef Print output of git describe in nix-prefetch-git
I hope it will help make git-packages' versions much nicer

It's usually only useful in --deepClone is also specified.
2014-06-25 01:12:10 +03:00
Benno Fünfstück
be25ce8f58 nix-prefetch-git: fix printing of revision
If the user explictly gives a ref such as "refs/heads/master", `git
rev-parse` failed because we only checked out the `fetchgit`
branch. Now, we also try `git rev-parse fetchgit` if the first call
fails, which fixes the issue.
2014-06-11 14:09:58 +02:00
Simon Hengel
26fb26e331 nix-prefetch-git: Print git revision 2014-05-16 15:22:28 +08:00
ambrop7@gmail.com
3a765a7309 fetchgit: Implement option to not check out submodules. 2014-03-25 20:03:55 +01:00
Eelco Dolstra
a8ded9d5d3 fetchgit: Require a content hash
Without this, the result will not be a fixed-output derivation and
won't work in general.
2014-02-18 19:13:07 +01:00
Vladimír Čunát
161d029d7d preferLocalBuild: set to true for wrappers and fetchers 2014-02-10 21:04:17 +01:00
William A. Kennington III
42229f1040 nix-prefetch-git: Convert relative submodule URLS to absolute URLS
nix-prefetch-git does not convert relative submodule urls into absolute
urls based on the parent's origin. This patch adds support for
repositories which are using the relative url syntax.
2014-01-10 17:28:35 -06:00
William A. Kennington III
49b36a3a77 Fix nix-prefetch-git
The nix-prefect git script was broken when trying to parse certain
groups of submodules. This patch fixes the url detection for submodule
repositories to use the more reliable `git config` commands.
2013-11-24 14:03:34 +01:00
Kirill Elagin
1be62b87fe Handle invalid references 2012-06-20 23:28:53 -04:00
Kirill Elagin
ba766ebcf4 Do not use old way of setting url and rev
This was breaking `nix-prefetch-git --url smth --ref smth` (when
expected hash is not specified)
2012-06-20 23:28:52 -04:00
Nicolas Pierron
9cd0f7ed09 nix-prefetch-git: remove .git in the cloned directory. (Fix issue 116)
svn path=/nixpkgs/trunk/; revision=29077
2011-09-07 10:02:17 +00:00
Nicolas Pierron
0608f1a9b5 nix-prefetch-git: Display usage message if missing builder arguments are
missing.

svn path=/nixpkgs/trunk/; revision=29076
2011-09-07 10:02:14 +00:00
Nicolas Pierron
5f5a47fc76 nix-prefetch-git: Remove missleading option name.
svn path=/nixpkgs/trunk/; revision=29075
2011-09-07 10:02:12 +00:00
Michael Raskin
f9728ee0db Fix a typo
svn path=/nixpkgs/trunk/; revision=28871
2011-08-29 10:06:12 +00:00
Nicolas Pierron
d528cba5b8 fetchgit: Handle https.
svn path=/nixpkgs/trunk/; revision=28857
2011-08-28 16:03:14 +00:00
Nicolas Pierron
9e53a20f50 Replace fetchgit default builder by a wrapper around nix-prefect-git.
svn path=/nixpkgs/trunk/; revision=28709
2011-08-20 14:29:57 +00:00
Peter Simons
c78c1288c3 fetchgit: strip trailing whitespace
svn path=/nixpkgs/trunk/; revision=27862
2011-07-20 22:56:44 +00:00
Peter Simons
0b1bf668cd fetchgit: added support for fetching sub-modules
svn path=/nixpkgs/trunk/; revision=27860
2011-07-20 22:56:35 +00:00
Florian Friesdorf
8e606466b3 fetchgit builder - correctly quote "$rev"
svn path=/nixpkgs/trunk/; revision=27531
2011-06-22 23:33:41 +00:00
Florian Friesdorf
c8f12bd8be fetchgit builder comment: can handle remotes without HEAD
thx civodul for bringing it up and testing

svn path=/nixpkgs/trunk/; revision=27523
2011-06-22 21:01:36 +00:00
Florian Friesdorf
e50e84daa1 fetchgit report fetch progress
svn path=/nixpkgs/trunk/; revision=27522
2011-06-22 19:34:32 +00:00
Florian Friesdorf
ee731974e9 fetchgit builder to handle broken remotes without a HEAD
svn path=/nixpkgs/trunk/; revision=27521
2011-06-22 19:34:27 +00:00
Florian Friesdorf
a8c3649dd4 fetchgit builder rewrite to handle more cases
The old builder failed for:
- remote HEAD != master
- local repositories

svn path=/nixpkgs/trunk/; revision=26984
2011-04-27 03:00:47 +00:00
Ludovic Courtès
3369508fa9 nix-prefetch-git: Add rudimentary TopGit support.
svn path=/nixpkgs/trunk/; revision=26305
2011-03-14 22:00:20 +00:00
Ludovic Courtès
8ccb0fda33 fetchgit: Track all remote branches when `$rev' is non-empty.
svn path=/nixpkgs/trunk/; revision=21892
2010-05-19 21:27:01 +00:00
Rob Vermaas
13417770a3 applying patches provided by griswold
svn path=/nixpkgs/trunk/; revision=19707
2010-01-27 12:12:35 +00:00
Ludovic Courtès
45aa4e2d7f nix-prefetch-git: Add support for $NIX_PREFETCH_GIT_DEEP_CLONE.
svn path=/nixpkgs/trunk/; revision=19648
2010-01-25 13:23:08 +00:00
Nicolas Pierron
ba79b38503 nix-prefetch-git:
* Optimized download size in case of references.
* Add support for submodules.

svn path=/nixpkgs/trunk/; revision=19513
2010-01-18 08:28:38 +00:00
Rob Vermaas
4dca2c8b12 echo to stderr in stead of stdout. else hydra cannot read hash/path
svn path=/nixpkgs/trunk/; revision=18448
2009-11-18 19:10:24 +00:00
Ludovic Courtès
4f20056bca nix-prefetch-git: Default to SHA256.
svn path=/nixpkgs/trunk/; revision=18443
2009-11-18 16:39:09 +00:00
Ludovic Courtès
39476057a2 nix-prefetch-git: Support $NIX_PREFETCH_GIT_LEAVE_DOT_GIT.
svn path=/nixpkgs/trunk/; revision=18442
2009-11-18 16:39:06 +00:00
Ludovic Courtès
3124661215 nix-prefetch-git: Remove `--depth' argument since it's risky.
The `--depth' argument asks Git to fetch the last revisions of the given
repo on *any* branch, which is often useless.

Thanks to Lluís Battle for clarifying this.

svn path=/nixpkgs/trunk/; revision=18438
2009-11-18 16:24:31 +00:00
Rob Vermaas
66a537f774 redirect stdout of git calls to stderr to allow git to work in hydra as input
svn path=/nixpkgs/trunk/; revision=18393
2009-11-17 15:50:20 +00:00
Marc Weber
edf78fcb6a some fetchgit documentation
svn path=/nixpkgs/trunk/; revision=18283
2009-11-08 03:02:10 +00:00
Lluís Batlle i Rossell
896dc42662 Forgot some 'depth' regarding fetchgit still.
svn path=/nixpkgs/trunk/; revision=18279
2009-11-08 01:59:50 +00:00
Lluís Batlle i Rossell
f1ee14bfaf Removing fetchgit --depth and its usage. It does not provide much advantages...
I think it takes the recent N commits into the repository, which says very little,
even for wanting master/HEAD.

svn path=/nixpkgs/trunk/; revision=18277
2009-11-08 01:51:20 +00:00
Michael Raskin
cd04c58fe2 Allow not-that-shallow git fetches; enable it for uzbl
svn path=/nixpkgs/trunk/; revision=17980
2009-10-27 19:52:01 +00:00
Michael Raskin
edd56d707a Update source updater to support fetchgit; add aufs2 using that method. Unfortunately, AUFS2 seems to require some strict conditions on kernel options and version..
svn path=/nixpkgs/trunk/; revision=16983
2009-09-08 09:35:21 +00:00
Marc Weber
c59fb90f62 make fetchgit and nix-prefetch-git use --depth 1 to receive only a shallow clone cutting history
svn path=/nixpkgs/trunk/; revision=16047
2009-06-26 00:56:54 +00:00
Rob Vermaas
205fb0c87e * fetchgit and nix-prefetch-git
svn path=/nixpkgs/trunk/; revision=16035
2009-06-24 12:48:01 +00:00