git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH (Apple Git) 10/13] Support for Xcode.app co-exestince and relocation

From
Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date
Jan 30, 2019, 21:07 UTC
Message-ID
<97CD298A-D301-4D27-9C7A-598C582EB43E@apple.com>
In-Reply-To
<nycvar.QRO.7.76.6.1901302025490.41@tvgsbejvaqbjf.bet>
Show 19 quoted lines
> On Jan 30, 2019, at 11:26, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> 
> Hi Jeremy,
> 
> On Tue, 29 Jan 2019, Jeremy Huddleston Sequoia wrote:
> 
>> This patch has been trimmed down significantly from its original version
>> when rebasing on top of git 2.18 because git 2.18 included support for
>> runtime prefix support for darwin, making this patch mostly duplicative.
>> 
>> The remaining changes are needed to ensure that git-perl can find the
>> subversion perl module (which relocates with it) and handle relocation
>> of python scripts.
>> 
>> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
> 
> I am really curious about this kind of problem now. Is it that you want to
> bundle a Perl inside a portable Git, and that Perl is not at all
> relocatable and so you force Git to pretend that it is?
Not exactly, although that's an interesting problem as well.
In our specific case, Xcode.app is a relocatable bundle that contains the Xcode application, SDKs, toolchains, useful command line tools including git and svn, and more.  perl is distributed with the system in /usr/bin/perl and not with Xcode.
git-svn uses requires the perl modules that ship with subversion.  Since subversion ships with Xcode, those perl modules are packaged inside of Xcode, and the system perl has no logic to locate modules in various apps on the system as that would be an abstraction violation, IMO.
This patch changes the perl template to allow git-svn (or any other perl based tool installed by git) to locate these subversion perl modules within Xcode.app.  It requires the perl script itself to have been executed from within Xcode.app, which is why this complicates testing out of the build directory as discussed in patch 2 in the series.
The /usr/local/versioner/perl/versions logic there is specific to our build infrastructure, but if you're interested in taking something like this, I could come up with a better way to generalize it.
The issues for python are similar to for perl, but I forget the specifics around what exactly was failing in the python case.
Show 66 quoted lines
> Ciao,
> Johannes
> 
>> ---
>> Makefile                                      |  3 +++
>> .../runtime_prefix.template.pl                | 25 +++++++++++++++++++
>> 2 files changed, 28 insertions(+)
>> 
>> diff --git a/Makefile b/Makefile
>> index 60711d6abe..97f46444f5 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -2171,6 +2171,7 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile
>> 	sed -e 's=@@PATHSEP@@=$(pathsep)=g' \
>> 	    -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \
>> 	    -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \
>> +	    -e 's=@@PERLVERSION@@=$(shell grep DEFAULT /usr/local/versioner/perl/versions | sed 's:^.*= *\([^ ]*\)$$:\1:')=g' \
>> 	    -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \
>> 	    -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \
>> 	    $< >$@+ && \
>> @@ -2206,6 +2207,8 @@ $(SCRIPT_PYTHON_GEN): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
>> $(SCRIPT_PYTHON_GEN): % : %.py
>> 	$(QUIET_GEN)$(RM) $@ $@+ && \
>> 	sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
>> +	    -e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \
>> +	    -e 's|"@@INSTLIBDIR@@"|os.path.realpath(os.path.dirname(sys.argv[0])) + "/../../share/git-core/python"|g' \
>> 	    $< >$@+ && \
>> 	chmod +x $@+ && \
>> 	mv $@+ $@
>> diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl
>> index 9d28b3d863..b0b6b0bef1 100644
>> --- a/perl/header_templates/runtime_prefix.template.pl
>> +++ b/perl/header_templates/runtime_prefix.template.pl
>> @@ -1,3 +1,28 @@
>> +# BEGIN XCODE RUNTIME_PREFIX generated code
>> +BEGIN {
>> +    use File::Spec;
>> +    my $PERLVERSION = "@@PERLVERSION@@";
>> +    if ($^V =~ m/v([0-9]+).([0-9]+)/) {
>> +        $PERLVERSION = $1.".".$2;
>> +    }
>> +    my $__prefix = File::Spec->rel2abs( __FILE__ );
>> +
>> +    if ($__prefix =~ m/\/libexec\/git-core\// ) {
>> +        $__prefix =~ s/\/libexec\/git-core\/.*//;
>> +        unshift @INC, $__prefix . "/share/git-core/perl";
>> +        unshift @INC, $__prefix . "/../Library/Perl/".$PERLVERSION."/darwin-thread-multi-2level";
>> +    } elsif ($__prefix =~ m/\/bin\// ) {
>> +        $__prefix =~ s/\/bin\/.*//;
>> +        unshift @INC, $__prefix . "/share/git-core/perl";
>> +        unshift @INC, $__prefix . "/../Library/Perl/".$PERLVERSION."/darwin-thread-multi-2level";
>> +    } elsif ( $__prefix =~ m/\/usr\// ) {
>> +        $__prefix =~ s/\/usr\/.*/\/usr/;
>> +        unshift @INC, $__prefix . "/share/git-core/perl";
>> +        unshift @INC, $__prefix . "/../Library/Perl/".$PERLVERSION."/darwin-thread-multi-2level";
>> +    }
>> +}
>> +# END XCODE RUNTIME_PREFIX generated code.
>> +
>> # BEGIN RUNTIME_PREFIX generated code.
>> #
>> # This finds our Git::* libraries relative to the script's runtime path.
>> -- 
>> 2.20.0 (Apple Git-115)
>> 
>> 
Previous: Johannes SchindelinNext: Jeremy Huddleston Sequoia
Message 31 of 63 in “Differences between git-2.20.1 and Apple Git-116”
  1. 00/13 Differences between git-2.20.1 and Apple Git-116Jeremy Huddleston Sequoia, Jan 29, 2019
  2. 05/13 t5701: git --version can have SP in itJeremy Huddleston Sequoia, Jan 29, 2019
  3. Johannes SchindelinJan 30, 2019
  4. Jeremy Huddleston SequoiaJan 30, 2019
  5. 08/13 git mergetool/difftool doesn't list 'opendiff' as an available tool on 10.8Jeremy Huddleston Sequoia, Jan 29, 2019
  6. Johannes SchindelinJan 30, 2019
  7. 06/13 Set Apple Git version during buildJeremy Huddleston Sequoia, Jan 29, 2019
  8. Johannes SchindelinJan 30, 2019
  9. Jeremy Huddleston SequoiaJan 30, 2019
  10. 09/13 Use symbolic links rather than hard links for files in libexecJeremy Huddleston Sequoia, Jan 29, 2019
  11. brian m. carlsonJan 30, 2019
  12. Jeremy Huddleston SequoiaJan 30, 2019
  13. Johannes SchindelinJan 30, 2019
  14. Jeremy Huddleston SequoiaJan 30, 2019
  15. 01/13 .gitignore: Remove *.s as it matches *.S on case insensitive filesystemJeremy Huddleston Sequoia, Jan 29, 2019
  16. Eric SunshineJan 30, 2019
  17. Jeremy Huddleston SequoiaJan 30, 2019
  18. Eric SunshineJan 30, 2019
  19. Eric SunshineJan 30, 2019
  20. Johannes SchindelinJan 30, 2019
  21. Jeremy Huddleston SequoiaJan 30, 2019
  22. Junio C HamanoJan 31, 2019
  23. Jeremy SequoiaJan 31, 2019
  24. Eric SunshineJan 31, 2019
  25. Junio C HamanoJan 30, 2019
  26. 04/13 t4014: git --version can have SP in itJeremy Huddleston Sequoia, Jan 29, 2019
  27. Junio C HamanoJan 29, 2019
  28. Johannes SchindelinJan 30, 2019
  29. 10/13 Support for Xcode.app co-exestince and relocationJeremy Huddleston Sequoia, Jan 29, 2019
  30. Johannes SchindelinJan 30, 2019
  31. Jeremy Huddleston SequoiaJan 30, 2019
  32. 07/13 HTML documentation is not provided with Apple's git. Make the error message more on point.Jeremy Huddleston Sequoia, Jan 29, 2019
  33. Junio C HamanoJan 29, 2019
  34. Johannes SchindelinJan 30, 2019
  35. Junio C HamanoJan 30, 2019
  36. Johannes SchindelinJan 30, 2019
  37. 03/13 t0500: New regression test for git add of a path that contains a .git directoryJeremy Huddleston Sequoia, Jan 29, 2019
  38. Eric SunshineJan 30, 2019
  39. Johannes SchindelinJan 30, 2019
  40. Jeremy Huddleston SequoiaJan 30, 2019
  41. 12/13 Enable support for Xcode.app-bundled gitconfigJeremy Huddleston Sequoia, Jan 29, 2019
  42. Junio C HamanoJan 29, 2019
  43. Jeremy Huddleston SequoiaJan 29, 2019
  44. Johannes SchindelinJan 30, 2019
  45. Jeremy Huddleston SequoiaJan 30, 2019
  46. Jeremy Huddleston SequoiaJan 30, 2019
  47. Jonathan NiederJan 31, 2019
  48. Jeremy Huddleston SequoiaJan 31, 2019
  49. Junio C HamanoJan 31, 2019
  50. brian m. carlsonJan 30, 2019
  51. 13/13 Enable support for Xcode.app-bundled gitattributesJeremy Huddleston Sequoia, Jan 29, 2019
  52. 02/13 test-lib: Export PERL5LIB for testing git-svnJeremy Huddleston Sequoia, Jan 29, 2019
  53. Junio C HamanoJan 29, 2019
  54. Jeremy Huddleston SequoiaJan 29, 2019
  55. SZEDER GáborJan 29, 2019
  56. Jeremy SequoiaJan 30, 2019
  57. Junio C HamanoJan 30, 2019
  58. Carlo ArenasJan 30, 2019
  59. Johannes SchindelinJan 30, 2019
  60. Jeremy SequoiaJan 30, 2019
  61. 11/13 Fix problem found from running the test suite.Jeremy Huddleston Sequoia, Jan 29, 2019
  62. Junio C HamanoJan 29, 2019
  63. Eric WongJan 29, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.