diff options
author | Patrick Gartung <gartung@fnal.gov> | 2019-05-31 15:38:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-31 15:38:40 -0500 |
commit | 30ec13f37584ad2934ecdf5a4e86d93d35b3a76c (patch) | |
tree | 2f069942c4807ca1e37a773737ecb234c459ed73 | |
parent | 88473a8da307368cca1bb07ba92f3e312f1823a7 (diff) | |
download | spack-30ec13f37584ad2934ecdf5a4e86d93d35b3a76c.tar.gz spack-30ec13f37584ad2934ecdf5a4e86d93d35b3a76c.tar.bz2 spack-30ec13f37584ad2934ecdf5a4e86d93d35b3a76c.tar.xz spack-30ec13f37584ad2934ecdf5a4e86d93d35b3a76c.zip |
Git: patch to make git relocatable with buildcache. (#11596)
* Apply patch to git to make it search for config files from its current location instead of the locations hard coded at install.
* Add provenance info for patch
* Pass needed flags to make
* Environment variables need because of relocation
-rw-r--r-- | var/spack/repos/builtin/packages/git/package.py | 16 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/git/patch/relocatable.patch | 42 |
2 files changed, 58 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/git/package.py b/var/spack/repos/builtin/packages/git/package.py index 8828d68238..1692317f9d 100644 --- a/var/spack/repos/builtin/packages/git/package.py +++ b/var/spack/repos/builtin/packages/git/package.py @@ -185,6 +185,16 @@ class Git(AutotoolsPackage): depends_on('m4', type='build') depends_on('tk', type=('build', 'link'), when='+tcltk') + patch('patch/relocatable.patch', 0) + + build_targets = ['NO_INSTALL_HARDLINKS=1', + 'ETC_GITATTRIBUTES=config', + 'ETC_GITCONFIG=config'] + install_targets = ['NO_INSTALL_HARDLINKS=1', + 'ETC_GITATTRIBUTES=config', + 'ETC_GITCONFIG=config', + 'install'] + # See the comment in setup_environment re EXTLIBS. def patch(self): filter_file(r'^EXTLIBS =$', @@ -209,6 +219,12 @@ class Git(AutotoolsPackage): spack_env.append_flags('CFLAGS', '-I{0}'.format( self.spec['gettext'].prefix.include)) + run_env.set('GIT_EXEC_PATH', '%s/git-core' % self.spec.prefix.libexec) + run_env.set('GIT_TEMPLATE_DIR', '%s/git-core/templates' % + self.spec.prefix.share) + run_env.set('GIT_HOME', '%s' % self.spec.prefix) + run_env.set('GITPERLLIB', '%s/perl5' % self.spec.prefix.share) + def configure_args(self): spec = self.spec diff --git a/var/spack/repos/builtin/packages/git/patch/relocatable.patch b/var/spack/repos/builtin/packages/git/patch/relocatable.patch new file mode 100644 index 0000000000..9d698cb7d8 --- /dev/null +++ b/var/spack/repos/builtin/packages/git/patch/relocatable.patch @@ -0,0 +1,42 @@ +# Copied from https://cdcvs.fnal.gov/redmine/projects/build-framework/repository/git-ssi-build/revisions/master/entry/patch/git.patch +# curl -o relocatable.patch https://cdcvs.fnal.gov/redmine/projects/build-framework/repository/git-ssi-build/revisions/master/raw/patch/git.patch +diff -Naur config.c config.c +--- config.c 2015-07-15 14:31:07.000000000 -0500 ++++ config.c 2015-07-17 10:33:34.966072446 -0500 +@@ -1153,7 +1153,15 @@ + { + static const char *system_wide; + if (!system_wide) +- system_wide = system_path(ETC_GITCONFIG); ++ /* system_wide = system_path(ETC_GITCONFIG); */ ++ system_wide = ETC_GITCONFIG; ++ if (!is_absolute_path(system_wide)) { ++ /* interpret path relative to exec-dir */ ++ const char *exec_path = git_exec_path(); ++ system_wide = prefix_path(exec_path, strlen(exec_path), ++ system_wide); ++ } ++ + return system_wide; + } + +diff -Naur attr.c attr.c +--- attr.c 2015-07-15 14:31:07.000000000 -0500 ++++ attr.c 2015-07-17 10:33:34.966072446 -0500 +@@ -479,7 +479,15 @@ + { + static const char *system_wide; + if (!system_wide) +- system_wide = system_path(ETC_GITATTRIBUTES); ++ /* system_wide = system_path(ETC_GITATTRIBUTES); */ ++ system_wide = ETC_GITATTRIBUTES; ++ if (!is_absolute_path(system_wide)) { ++ /* interpret path relative to exec-dir */ ++ const char *exec_path = git_exec_path(); ++ system_wide = prefix_path(exec_path, strlen(exec_path), ++ system_wide); ++ } ++ + return system_wide; + } + |