git-lfs: fix build on darwin (#361797)

This commit is contained in:
Gaétan Lepage
2024-12-05 01:13:36 +01:00
committed by GitHub
3 changed files with 115 additions and 63 deletions
@@ -1,61 +0,0 @@
{ lib, buildGoModule, fetchFromGitHub, asciidoctor, installShellFiles, git, testers, git-lfs, stdenv }:
buildGoModule rec {
pname = "git-lfs";
version = "3.6.0";
src = fetchFromGitHub {
owner = "git-lfs";
repo = "git-lfs";
rev = "v${version}";
hash = "sha256-PpNdbvtDAZDT43yyEkUvnhfUTAMM+mYImb3dVbAVPic=";
};
vendorHash = "sha256-JT0r/hs7ZRtsYh4aXy+v8BjwiLvRJ10e4yRirqmWVW0=";
nativeBuildInputs = [ asciidoctor installShellFiles ];
ldflags = [
"-s"
"-w"
"-X github.com/git-lfs/git-lfs/v${lib.versions.major version}/config.Vendor=${version}"
];
subPackages = [ "." ];
preBuild = ''
GOARCH= go generate ./commands
'';
postBuild = ''
make man
'';
nativeCheckInputs = [ git ];
preCheck = ''
unset subPackages
'';
postInstall = ''
installManPage man/man*/*
'' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd git-lfs \
--bash <($out/bin/git-lfs completion bash) \
--fish <($out/bin/git-lfs completion fish) \
--zsh <($out/bin/git-lfs completion zsh)
'';
passthru.tests.version = testers.testVersion {
package = git-lfs;
};
meta = with lib; {
description = "Git extension for versioning large files";
homepage = "https://git-lfs.github.com/";
changelog = "https://github.com/git-lfs/git-lfs/raw/v${version}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ twey ];
mainProgram = "git-lfs";
};
}
+115
View File
@@ -0,0 +1,115 @@
{
lib,
stdenv,
buildGoModule,
fetchFromGitHub,
asciidoctor,
installShellFiles,
git,
versionCheckHook,
nix-update-script,
}:
buildGoModule rec {
pname = "git-lfs";
version = "3.6.0";
src = fetchFromGitHub {
owner = "git-lfs";
repo = "git-lfs";
rev = "refs/tags/v${version}";
hash = "sha256-PpNdbvtDAZDT43yyEkUvnhfUTAMM+mYImb3dVbAVPic=";
};
vendorHash = "sha256-JT0r/hs7ZRtsYh4aXy+v8BjwiLvRJ10e4yRirqmWVW0=";
nativeBuildInputs = [
asciidoctor
installShellFiles
];
ldflags = [
"-s"
"-w"
"-X github.com/git-lfs/git-lfs/v${lib.versions.major version}/config.Vendor=${version}"
];
subPackages = [ "." ];
preBuild = ''
GOARCH= go generate ./commands
'';
postBuild = ''
make man
'';
nativeCheckInputs = [ git ];
preCheck = ''
unset subPackages
'';
checkFlags = lib.optionals stdenv.hostPlatform.isDarwin (
let
# Fail in the sandbox with network-related errors.
# Enabling __darwinAllowLocalNetworking is not enough.
skippedTests = [
"TestAPIBatch"
"TestAPIBatchOnlyBasic"
"TestAuthErrWithBody"
"TestAuthErrWithoutBody"
"TestCertFromSSLCAInfoConfig"
"TestCertFromSSLCAInfoEnv"
"TestCertFromSSLCAInfoEnvWithSchannelBackend"
"TestCertFromSSLCAPathConfig"
"TestCertFromSSLCAPathEnv"
"TestClientRedirect"
"TestClientRedirectReauthenticate"
"TestDoAPIRequestWithAuth"
"TestDoWithAuthApprove"
"TestDoWithAuthNoRetry"
"TestDoWithAuthReject"
"TestFatalWithBody"
"TestFatalWithoutBody"
"TestHttp2"
"TestHttpVersion"
"TestWithNonFatal500WithBody"
"TestWithNonFatal500WithoutBody"
];
in
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ]
);
postInstall =
''
installManPage man/man*/*
''
+ lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd git-lfs \
--bash <($out/bin/git-lfs completion bash) \
--fish <($out/bin/git-lfs completion fish) \
--zsh <($out/bin/git-lfs completion zsh)
'';
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = [ "--version" ];
doInstallCheck = true;
passthru = {
updateScript = nix-update-script { };
};
__darwinAllowLocalNetworking = true;
meta = {
description = "Git extension for versioning large files";
homepage = "https://git-lfs.github.com/";
changelog = "https://github.com/git-lfs/git-lfs/raw/v${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ twey ];
mainProgram = "git-lfs";
};
}
-2
View File
@@ -1243,8 +1243,6 @@ with pkgs;
git-imerge = python3Packages.callPackage ../applications/version-management/git-imerge { };
git-lfs = lowPrio (callPackage ../applications/version-management/git-lfs { });
git-machete = python3Packages.callPackage ../applications/version-management/git-machete { };
git-ps-rs = callPackage ../development/tools/git-ps-rs {