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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Jan 30, 2019, at 11:26, Johannes Schindelin <Johannes.Schindelin@xxxxxx> 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@xxxxxxxxx>
> 
> 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.

> 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)
>> 
>> 




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux