3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/build-support
Will Dietz 0e95bed017 nix-prefetch-git: fix extraction of submodule hashes on latest git
Summary:

According to git-submodule manpage,
"git submodule status" prefixes the hash with a '-' if it is not
initialized, and other chars in other circumstances.
(this is consistent on the various git versions tested)

nix-prefetch-git runs "git submodule init" which does you'd think,
but apparently despite this earlier versions of git before 2.16
would still give the hash the '-' suffix.
In particular this is the behavior when using 2.15 and 2.14.1
from the nixos-17.09 and nixos-17.03 channels respectively.

The script then used awk to drop the first char of the first field
which does the wrong thing when there is no prefix emitted:
while there is a space character before the hash, this is not
part of the field and so we ended up eating the first character
of the hash.

To fix this in a way that also works with the previous behavior,
this commit instead uses awk to grab the hash field
and uses tr to delete any '-' chars should they be present.

This seems to work in my testing, and for example can now
successfully fetch the source for "nginxModules.brotli"
where previously it would generate an error:

fatal: '22564a95d9ab58865a096b8d9f7324ea5f2e03e' is not a commit and a branch 'fetchgit' cannot be created from it

(we dropped a '2' from the beginning of the hash)
2018-01-24 20:18:59 +02:00
..
agda
bintools-wrapper stdenv-setup: Ease the transition with native builds 2017-12-30 22:04:23 -05:00
build-dotnet-package treewide: Manual fix more pkg-config build-inputs 2017-09-21 15:49:54 -04:00
build-fhs-userenv chrootenv: rewrite on top of GLib 2017-12-30 22:28:38 +00:00
buildenv
cc-wrapper Merge branch 'master' into staging 2017-12-31 09:53:49 +01:00
docker treewide: Fix deps in a few other fixed output derivations 2018-01-10 11:18:44 -05:00
dotnetbuildhelpers
dotnetenv
emacs Fix emacsWithPackages after 7f3ca3e21a. 2018-01-04 12:15:55 -05:00
expand-response-params
fetchbower Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchbzr treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchcvs treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchdarcs Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchegg treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchfossil treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchgit nix-prefetch-git: fix extraction of submodule hashes on latest git 2018-01-24 20:18:59 +02:00
fetchgitlocal
fetchgx Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
fetchhg treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchipfs treewide: Fixed output fetch* derivations should use nativeBuildInputs 2018-01-09 20:14:46 -05:00
fetchmavenartifact
fetchmtn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchnuget treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchpatch fetchpatch: Add support for an arbitrary extra prefix 2018-01-18 12:19:49 -05:00
fetchrepoproject treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchs3 treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchsvn treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchsvnrevision
fetchsvnssh treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchurl treewide: Fetchers should use stdenvNoCC. 2018-01-10 11:18:44 -05:00
fetchzip fetchzip and friends: Set "name" to "source" by default 2017-10-30 17:17:07 +01:00
gcc-wrapper-old gcc-wrapper-old: grab name of dynamicLinker for bintools 2018-01-05 18:55:13 -06:00
icon-conv-tools
kernel platforms.nix: Clean up more 'uboot' legacy 2017-11-05 17:06:59 +02:00
libredirect libredirect: add description 2017-12-14 19:03:35 +00:00
make-desktopitem
make-startupitem
make-symlinks
mkshell mkShell: add builder (#30975) 2017-12-20 23:42:07 +00:00
mono-dll-fixer
nuke-references
ocaml
release schedulingPriority should be an int, fix check-meta type and in-tree use 2018-01-09 07:25:24 -06:00
remove-references-to
rust Merge remote-tracking branch 'upstream/master' into staging 2018-01-14 21:18:27 +02:00
setup-hooks treewide: Don't use envHook anymore 2017-12-30 22:04:22 -05:00
singularity-tools singularity: 2.2 -> 2.4 2017-12-21 10:50:06 +11:00
src-only
substitute
substitute-files
templaterpm
upstream-updater
vm nixos/initrd: Don't include some x86-specific modules unconditionally 2018-01-22 12:53:33 +02:00
vsenv
build-maven.nix
build-pecl.nix Revert "fix phpPackages memcache,memcached,xdebug" 2017-12-10 12:12:43 +01:00
closure-info.nix closure-info: another half-blind attempt to fix on Hydra 2017-11-01 08:07:15 +01:00
dhall-to-nix.nix
plugins.nix
replace-dependency.nix
safe-discard-string-context.nix callCabal2nix: Fix calling with a path in the store. 2018-01-11 10:17:56 -05:00
setup-systemd-units.nix
source-from-head-fun.nix
trivial-builders.nix makeSetupHook: make the default name "hook" overridable 2017-12-19 01:41:31 +00:00