From 1b82779087ed4bb7b90d30da02ffff9b655d6fcc Mon Sep 17 00:00:00 2001 From: psakievich Date: Wed, 14 Aug 2024 23:28:34 -0600 Subject: Add options for sparse checkout in GitFetcher (#45473) * Add options for sparse checkout in GitFetcher Newer versions of git have a beta feature called sparse checkout that allow users to check out a portion of a large repo. This feature will be ideal for monolithic repo projects that want to model their infrastructure via spack. This PR implements an addition to the GitFetcher that allows users to add a `git_sparse_paths` attribute to package classes or versions which will then use sparse checkout on those directories/files for the package. * Style * Split git clone into multiple functions * Add sparse-checkout impl * Internalize src clone functions * Docs * Adding sparse clone test * Add test for partial clone * [@spackbot] updating style on behalf of psakievich * Small fixes * Restore default branch status * Fix attributes for package * Update lib/spack/docs/packaging_guide.rst Co-authored-by: Matthew Mosby <44072882+mdmosby@users.noreply.github.com> * Extend unit test to multiple git versions * style --------- Co-authored-by: psakievich Co-authored-by: Matthew Mosby <44072882+mdmosby@users.noreply.github.com> --- .../packages/git-sparsepaths-pkg/package.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 var/spack/repos/builtin.mock/packages/git-sparsepaths-pkg/package.py (limited to 'var') diff --git a/var/spack/repos/builtin.mock/packages/git-sparsepaths-pkg/package.py b/var/spack/repos/builtin.mock/packages/git-sparsepaths-pkg/package.py new file mode 100644 index 0000000000..b37aba8660 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/git-sparsepaths-pkg/package.py @@ -0,0 +1,17 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class GitSparsepathsPkg(Package): + """Mock package with git_sparse_paths attribute""" + + homepage = "http://www.git-fetch-example.com" + git = "https://a/really.com/big/repo.git" + + version("1.0", tag="v1.0") + + git_sparse_paths = ["foo", "bar", "bing/bang"] -- cgit v1.2.3-70-g09d2