Fixes for linux feature/linux_bundle
authorleap <leap@leap32>
Fri, 22 Nov 2013 17:09:23 +0000 (12:09 -0500)
committerTomás Touceda <chiiph@leap.se>
Wed, 27 Nov 2013 13:59:17 +0000 (10:59 -0300)
README.rst
bundler/actions.py
bundler/depcollector.py
bundler/main.py

index d7eaaf3..35f2fbf 100644 (file)
@@ -19,6 +19,12 @@ NOTE: Most of this will be done automatically in a while, but this is how it's d
 ::
   pip install -r pkg/requirements.pip
 
+- Install the needed dependencies
+
+::
+  # Linux only dependencies
+  aptitude install libsqlite3-dev
+
 - psutils is a dependency for another dependency, it might get installed in a zip form, which we don't want, so we install it by hand for now
 
 ::
@@ -50,12 +56,21 @@ NOTE: Most of this will be done automatically in a while, but this is how it's d
   git clone git://gitorious.org/pyside/shiboken.git
   git clone git://gitorious.org/pyside/pyside.git
   git clone git://gitorious.org/pyside/pyside-tools.git
+
+  # OSX
   export PYSIDESANDBOXPATH=$HOME/Code/pyside/sandbox
+  export DYLD_LIBRARY_PATH=$PYSIDESANDBOXPATH/lib:$DYLD_LIBRARY_PATH
+
+  # Linux
+  export PYSIDESANDBOXPATH=$HOME/sandbox
+  export LD_LIBRARY_PATH=$PYSIDESANDBOXPATH/lib:$LD_LIBRARY_PATH
+
   export PATH=$PYSIDESANDBOXPATH/bin:$PATH
   export PYTHONPATH=$PYSIDESANDBOXPATH/lib/python2.6/site-packages:$PYTHONPATH
-  export DYLD_LIBRARY_PATH=$PYSIDESANDBOXPATH/lib:$DYLD_LIBRARY_PATH
   export PKG_CONFIG_PATH=$PYSIDESANDBOXPATH/lib/pkgconfig:$PKG_CONFIG_PATH
 
+  alias runcmake='cmake .. -DCMAKE_INSTALL_PREFIX=$PYSIDESANDBOXPATH'
+
   # In OSX, the paths may vary depending on the Qt installation
   runcmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk .. -DQT_QMAKE_EXECUTABLE=/usr/local/bin/qmake -DQT_INCLUDE_DIR=/usr/local/include/ -DQT_INCLUDES=/usr/local/include/ -DALTERNATIVE_QT_INCLUDE_DIR=/usr/local/include/
   # In Linux
index 6b977d4..15d5f10 100644 (file)
@@ -7,11 +7,15 @@ from contextlib import contextmanager
 from distutils import file_util, dir_util
 
 from sh import git, cd, python, mkdir, make, cp, glob, pip, rm
-from sh import find, SetFile, hdiutil, ln
+from sh import find, ln, tar, mv
 
 from utils import IS_MAC
+
+if IS_MAC:
+    from sh import SetFile, hdiutil
+    from darwin_dyliber import fix_all_dylibs
+
 from depcollector import collect_deps
-from darwin_dyliber import fix_all_dylibs
 
 class Action(object):
     __metaclass__ = ABCMeta
@@ -213,11 +217,11 @@ class CopyBinaries(Action):
     def run(self, binaries_path):
         print "Copying binaries..."
         dest_lib_dir = platform_dir(self._basedir, "lib")
-        cp(glob(os.path.join(binaries_path, "Qt*")), dest_lib_dir)
-        cp(glob(os.path.join(binaries_path, "*.dylib")), dest_lib_dir)
-        cp(glob(os.path.join(binaries_path, "Python")), dest_lib_dir)
 
         if IS_MAC:
+            cp(glob(os.path.join(binaries_path, "Qt*")), dest_lib_dir)
+            cp(glob(os.path.join(binaries_path, "*.dylib")), dest_lib_dir)
+            cp(glob(os.path.join(binaries_path, "Python")), dest_lib_dir)
             resources_dir = os.path.join(self._basedir,
                                          "Bitmask",
                                          "Bitmask.app",
@@ -232,16 +236,18 @@ class CopyBinaries(Action):
 
             cp("-r", os.path.join(binaries_path, "qt_menu.nib"), resources_dir)
             cp("-r", os.path.join(binaries_path, "tuntap-installer.app"), resources_dir)
+            cp(os.path.join(binaries_path, "Bitmask"), platform_dir(self._basedir))
         else:
+            cp(glob(os.path.join(binaries_path, "*.so*")), dest_lib_dir)
+
             eip_dir = platform_dir(self._basedir, "apps", "eip")
-            cp(glob(os.path.join(binaries_path, "openvpn.leap*")), eip_dir)
+            cp(os.path.join(binaries_path, "openvpn"), eip_dir)
 
-            mkdir(os.path.join(resources_dir, "openvpn"))
             cp("-r", glob(os.path.join(binaries_path, "openvpn.files", "*")), os.path.join(eip_dir, "files"))
+            cp(os.path.join(binaries_path, "bitmask"), platform_dir(self._basedir))
 
         mail_dir = platform_dir(self._basedir, "apps", "mail")
         cp(os.path.join(binaries_path, "gpg"), mail_dir)
-        cp(os.path.join(binaries_path, "Bitmask"), platform_dir(self._basedir))
         print "Done"
 
 class PLister(Action):
@@ -373,9 +379,9 @@ class CopyMisc(Action):
                         "leap_pycommon",
                         "src", "leap", "common", "cacert.pem"),
            os.path.join(lib_dir, "leap", "common"))
-        cp(os.path.join(self._basedir,
-                        "bitmask_client", "build",
-                        "lib", "leap", "bitmask", "_version.py"),
+        cp(glob(os.path.join(self._basedir,
+                             "bitmask_client", "build",
+                             "lib*", "leap", "bitmask", "_version.py")),
            os.path.join(apps_dir, "leap", "bitmask"))
 
         cp(os.path.join(self._basedir,
@@ -432,6 +438,22 @@ class DmgIt(Action):
                 dmg_path)
         rm("-f", raw_dmg_path)
 
+class TarballIt(Action):
+    def __init__(self, basedir, skip, do):
+        Action.__init__(self, "tarballit", basedir, skip, do)
+
+    @skippable
+    def run(self):
+        cd(self._basedir)
+        version = "unknown"
+        with push_pop("bitmask_client"):
+            version = git("describe").strip()
+        import platform
+        bits = platform.architecture()[0][:2]
+        bundle_name = "Bitmask-linux%s-%s" % (bits, version)
+        mv("Bitmask", bundle_name)
+        tar("cjf", bundle_name+".tar.bz2", bundle_name)
+
 class PycRemover(Action):
     def __init__(self, basedir, skip, do):
         Action.__init__(self, "removepyc", basedir, skip, do)
index de765a0..2f9864a 100644 (file)
@@ -84,6 +84,8 @@ def collect_deps(root, dest_lib_dir, path_file):
         # if i.identifier == "distutils":
         #     i.filename = distutils.__file__
         print i.identifier, i.filename
+        if i.identifier == "leap.bitmask":
+            continue
         parts = i.identifier.split(".")
         destdir = os.path.join(*([dest_lib_dir]+parts))
         mkdir_p(destdir)
@@ -104,9 +106,3 @@ def collect_deps(root, dest_lib_dir, path_file):
         #     i.filename = site.__file__
         print i.identifier, i.filename
         file_util.copy_file(i.filename, dest_lib_dir)
-
-    # TODO: remove everything in dest_lib_dir/PySide that is not QtCore, QtGui and __init__
-
-    # ON OSX ONLY:
-    # TODO: remove dest_lib_dir/sre* and PYTHONHOME from the launcher script
-    # remove dest_lib_dir/_socket.so
index 2c1207e..4768c31 100644 (file)
@@ -13,7 +13,7 @@ from distutils import dir_util
 from actions import GitCloneAll, PythonSetupAll, CreateDirStructure
 from actions import CollectAllDeps, CopyBinaries, PLister, SeededConfig
 from actions import DarwinLauncher, CopyAssets, CopyMisc, FixDylibs
-from actions import DmgIt, PycRemover
+from actions import DmgIt, PycRemover, TarballIt
 
 from utils import IS_MAC
 
@@ -109,6 +109,9 @@ def main():
         if IS_MAC:
             dm = init(DmgIt)
             dm.run()
+        else:
+            ti = init(TarballIt)
+            ti.run()
 
         # do manifest on windows