Commit Graph

66 Commits

Author SHA1 Message Date
Nikolay Amiantov
f5deff5137 nix-prefetch-git: pull all tags from remote when checkouting by revision
Close #9790.
This fixes checkouting for a nasty combination:

1. To be checkouted is a revision which corresponds to tag in a form "<tag>^{}".
2. This revision is not fetched by default.
2015-09-20 18:24:34 +02:00
William A. Kennington III
ffd0539eba cacert: store ca-bundle.crt in $out/etc/ssl/certs instead of $out 2015-06-05 13:00:52 -07:00
William A. Kennington III
14c1e0fa1f Fix ca-bundle paths 2015-05-29 14:03:34 -07:00
Georges Dubus
7d67efa3f2 Add support for building cargo'ed Rust programs 2015-04-21 19:46:29 +02:00
Ricardo M. Correia
c55c7e1c1e fetchgit: Add support for specifying branch name
This is useful when `leaveDotGit = true` and some other derivation
expects some branch name to exist.

Previously, `nix-prefetch-git` always created a branch with a
hard-coded name (`fetchgit`).
2015-04-21 19:46:29 +02:00
Peter Simons
5d02f0e854 fetchgit: add 'deepClone' argument to disable shallow fetching
This patch resolves https://github.com/NixOS/nixpkgs/issues/6395. Deep
cloning is useful in combination with 'leaveDotGit' for builds that want
to run "git describe" to obtain a proper version string, etc., like the
'haskellngPackages.cabal2nix' package does.
2015-03-10 13:14:00 +01:00
Bjørn Forsman
06f5651ef5 nix-prefetch-git: print commit date (close #6522)
The commit date can be used as a version number in packages that don't
have proper releases.
2015-02-24 23:02:59 +01:00
Vladimír Čunát
77d66ed834 fetchgit: improve name detection, discard nix-1.8 check
The name detection didn't work for e.g. http://git.suckless.org/sinit/.
I tested the tarball builds now.

@shlevy claimed nixpkgs requires nix-1.8 features anyway,
so the additional check with message were superfluous.
2015-01-13 19:45:31 +01:00
Shea Levy
a8603605aa fetchgit: give output a nicer name
Instead of git-export, we get the basename of the repo, plus the
shortrev if the commit-ish is a rev.
2015-01-01 10:03:45 -05:00
William A. Kennington III
4fcbe096b6 fetchgit: Simplify submodule url discovery 2014-12-04 15:17:58 -08:00
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 f8a833cfb1.
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 5af576ff7f.

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