Răsfoiți Sursa

Merge pull request #1507 from ThomasWaldmann/use-modified-pyinstaller

use patched LDLP-preserving pyinstaller
enkore 8 ani în urmă
părinte
comite
81dd381701
2 a modificat fișierele cu 18 adăugiri și 7 ștergeri
  1. 9 4
      Vagrantfile
  2. 9 3
      src/borg/remote.py

+ 9 - 4
Vagrantfile

@@ -248,10 +248,13 @@ def install_pyinstaller_bootloader(boxname)
     . borg-env/bin/activate
     . borg-env/bin/activate
     git clone https://github.com/pyinstaller/pyinstaller.git
     git clone https://github.com/pyinstaller/pyinstaller.git
     cd pyinstaller
     cd pyinstaller
-    git checkout v3.1.1
+    # develop branch, merge commit of ThomasWaldmann/do-not-overwrite-LD_LP
+    git checkout 639fcec992d753db2058314b843bccc37b815265
     # build bootloader, if it is not included
     # build bootloader, if it is not included
     cd bootloader
     cd bootloader
-    python ./waf all
+    # XXX temporarily use --no-lsb as we have no LSB environment
+    # XXX https://github.com/borgbackup/borg/issues/1506
+    python ./waf --no-lsb all
     cd ..
     cd ..
     pip install -e .
     pip install -e .
   EOF
   EOF
@@ -392,7 +395,8 @@ Vagrant.configure(2) do |config|
     b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("wheezy32")
     b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("wheezy32")
     b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("wheezy32")
     b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("wheezy32")
     b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg("wheezy32")
     b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg("wheezy32")
-    b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller("wheezy32")
+    # XXX https://github.com/borgbackup/borg/issues/1506
+    b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller_bootloader("wheezy32")
     b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("wheezy32")
     b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("wheezy32")
     b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("wheezy32")
     b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("wheezy32")
   end
   end
@@ -405,7 +409,8 @@ Vagrant.configure(2) do |config|
     b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("wheezy64")
     b.vm.provision "install pythons", :type => :shell, :privileged => false, :inline => install_pythons("wheezy64")
     b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("wheezy64")
     b.vm.provision "build env", :type => :shell, :privileged => false, :inline => build_pyenv_venv("wheezy64")
     b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg("wheezy64")
     b.vm.provision "install borg", :type => :shell, :privileged => false, :inline => install_borg("wheezy64")
-    b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller("wheezy64")
+    # XXX https://github.com/borgbackup/borg/issues/1506
+    b.vm.provision "install pyinstaller", :type => :shell, :privileged => false, :inline => install_pyinstaller_bootloader("wheezy64")
     b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("wheezy64")
     b.vm.provision "build binary with pyinstaller", :type => :shell, :privileged => false, :inline => build_binary_with_pyinstaller("wheezy64")
     b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("wheezy64")
     b.vm.provision "run tests", :type => :shell, :privileged => false, :inline => run_tests("wheezy64")
   end
   end

+ 9 - 3
src/borg/remote.py

@@ -167,9 +167,15 @@ class RemoteRepository:
         env = dict(os.environ)
         env = dict(os.environ)
         if not testing:
         if not testing:
             borg_cmd = self.ssh_cmd(location) + borg_cmd
             borg_cmd = self.ssh_cmd(location) + borg_cmd
-            # pyinstaller binary adds LD_LIBRARY_PATH=/tmp/_ME... but we do not want
-            # that the system's ssh binary picks up (non-matching) libraries from there
-            env.pop('LD_LIBRARY_PATH', None)
+            # pyinstaller binary modifies LD_LIBRARY_PATH=/tmp/_ME... but we do not want
+            # that the system's ssh binary picks up (non-matching) libraries from there.
+            # thus we install the original LDLP, before pyinstaller has modified it:
+            lp_key = 'LD_LIBRARY_PATH'
+            lp_orig = env.get(lp_key + '_ORIG')  # pyinstaller >= 20160820 has this
+            if lp_orig is not None:
+                env[lp_key] = lp_orig
+            else:
+                env.pop(lp_key, None)
         env.pop('BORG_PASSPHRASE', None)  # security: do not give secrets to subprocess
         env.pop('BORG_PASSPHRASE', None)  # security: do not give secrets to subprocess
         env['BORG_VERSION'] = __version__
         env['BORG_VERSION'] = __version__
         self.p = Popen(borg_cmd, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)
         self.p = Popen(borg_cmd, bufsize=0, stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env)