Repository: spack/spack

Issue:
Installation issue: fpm
### Steps to reproduce the issue

```console
$ spack spec -I fpm
Input spec
--------------------------------
 -   fpm

Concretized
--------------------------------
 -   fpm@0.4.0%gcc@10.2.0+openmp arch=linux-centos7-broadwell
[+]      ^curl@7.79.0%gcc@10.2.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2~nghttp2 tls=openssl arch=linux-centos7-broadwell
[+]          ^openssl@1.1.1l%gcc@10.2.0~docs certs=system arch=linux-centos7-broadwell
[+]              ^perl@5.34.0%gcc@10.2.0+cpanm+shared+threads arch=linux-centos7-broadwell
[+]                  ^berkeley-db@18.1.40%gcc@10.2.0+cxx~docs+stl patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff4
1de522 arch=linux-centos7-broadwell
[+]                  ^bzip2@1.0.8%gcc@10.2.0~debug~pic+shared arch=linux-centos7-broadwell
[+]                      ^diffutils@3.8%gcc@10.2.0 arch=linux-centos7-broadwell
[+]                          ^libiconv@1.16%gcc@10.2.0 libs=shared,static arch=linux-centos7-broadwell
[+]                  ^gdbm@1.19%gcc@10.2.0 arch=linux-centos7-broadwell
[+]                      ^readline@8.1%gcc@10.2.0 arch=linux-centos7-broadwell
[+]                          ^ncurses@6.2%gcc@10.2.0~symlinks+termlib abi=none arch=linux-centos7-broadwell
[+]                              ^pkgconf@1.8.0%gcc@10.2.0 arch=linux-centos7-broadwell
[+]                  ^zlib@1.2.11%gcc@10.2.0+optimize+pic+shared arch=linux-centos7-broadwell

$ spack install fpm
```


### Error message

<details><summary>Error message</summary><pre>
Initialized empty Git repository in /tmp/wyphan/spack-stage/spack-stage-fpm-0.4.0-6b7dpcrdo55u42qb4bqgsv5n3yp2w3lv/spack-src/build/d
ependencies/toml-f/.git/
Unknown option: -C
usage: git [--version] [--help] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]
[Error] Error while fetching git repository for remote dependency
ERROR STOP 1

Error termination. Backtrace:
#0  0x41dde3 in ???
#1  0x4925ba in ???
#2  0x494c7f in ???
#3  0x401c2c in ???
#4  0x7f72e2135554 in __libc_start_main
        at ../csu/libc-start.c:266
#5  0x401c5c in ???
#6  0xffffffffffffffff in ???
</pre></details>


### Information on your system

* **Spack:** 0.17.1
* **Python:** 3.7.3
* **Platform:** linux-centos7-broadwell
* **Concretizer:** clingo

My wild guess is `git` on this system is _too old_ not to have the `-C` flag. It's running CentOS 7, after all...

```console
$ cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)
$ git --version
git version 1.8.3.1
```

[System specs](https://systems.nic.uoregon.edu/internal-wiki/index.php?title=Compute:_Delphi)


### Additional information

Summoning @awvwgk as the `fpm` maintainer.

[spack-build-env.txt](https://github.com/spack/spack/files/8506808/spack-build-env.txt)
[spack-build-out.txt](https://github.com/spack/spack/files/8506809/spack-build-out.txt)


### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
Looks like git is too old, ~~can you share the git version used here?~~ I don't know the exact lower bound for git to support changing directories with `-C`.
1.8.3.1, yep definitely too old. I can either email the admin or take things into my own hands with `spack install git`, which route should I take?
Checking my notes... https://github.com/fortran-lang/fpm/pull/163, it is git 1.8.5 which implements `-C`, so a close miss.
Maybe we can require a git version in the fpm package file?
@awvwgk That sounds straightforward, do you wanna create the PR or should I do it?
Feel free to submit a patch for this.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/fpm/package.py b/var/spack/repos/builtin/packages/fpm/package.py
--- a/var/spack/repos/builtin/packages/fpm/package.py
+++ b/var/spack/repos/builtin/packages/fpm/package.py
@@ -27,6 +27,7 @@ class Fpm(Package):
     variant("openmp", default=True, description="Use OpenMP parallelisation")
 
     depends_on("curl", type="build")
+    depends_on("git@1.8.5:", type="build")
 
     def setup_build_environment(self, env):
         if "@0.4.0" in self.spec:


Test patch: