Example #1
0
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(
         os.path.join(self.config.prefix, self._files_list[0]))
     libdir = os.path.dirname(plugins_dir)
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-0.10/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         f_no_static = f.replace('/static/', '/')
         f_path = os.path.join(self.config.prefix, f)
         shutil.copyfile(
             os.path.join(self.tmp_destdir,
                          to_unixpath(self.config.prefix)[1:], f_no_static),
             f_path)
         # Fix libdir path in libtool libraries
         if f.endswith('.la'):
             shell.replace(
                 f_path, {
                     "libdir='%s'" % to_unixpath(libdir):
                     "libdir='%s'" % to_unixpath(plugins_dir)
                 })
Example #2
0
    def _make_paths_relative(self):
        sofiles = shell.find_files('*.so', self.tmp_install_dir)
        for sof in sofiles:
            try:
                shell.call("chrpath -d %s" % sof, self.tmp_install_dir,
                           fail=False)
            except FatalError:
                m.warning("Could not 'chrpath' %s" % sof)

        shell.call("ln -s . usr", self.tmp_install_dir, fail=False)

        # Make gd-pixbuf loader.cache file use relative paths
        cache = os.path.join(self.tmp_install_dir, 'lib', 'gdk-pixbuf-2.0',
            '2.10.0', 'loaders.cache')
        shell.replace(cache, {self.config.install_dir: '.'})

        for icondir in os.listdir(os.path.join(self.tmp_install_dir, "share/icons/")):
            if os.path.exists(os.path.join(icondir, "index.theme")):
                shell.call("gtk-update-icon-cache %s" % icondir, fail=False)

        shell.call("update-mime-database %s" % os.path.join(self.tmp_install_dir, "share", "mime"), fail=False)

        # Use system wide applications in case the bundle needs to open apps not included in
        # the bundle (to show the documentation most probably)
        shell.call("rm -rf %s" % os.path.join(self.tmp_install_dir, "share", "applications"), fail=False)
        shell.call("ln -s %s %s" % (os.path.join("/usr", "share", "applications"),
                                    os.path.join(self.tmp_install_dir, "share", "applications")),
                   fail=False)
Example #3
0
 def create_tree(self, tmpdir):
     # create a tmp dir to use as topdir
     if tmpdir is None:
         tmpdir = tempfile.mkdtemp()
     srcdir = os.path.join(tmpdir, self.full_package_name)
     os.mkdir(srcdir)
     packagedir = os.path.join(srcdir, 'debian')
     os.mkdir(packagedir)
     os.mkdir(os.path.join(packagedir, 'source'))
     m.action(
         _('Creating debian package structure at %s for package %s') %
         (srcdir, self.package.name))
     files_list = self.files_list(PackageType.RUNTIME)
     files = '\n'.join([os.path.join(self.install_dir + '/' + f) \
         for f in files_list])
     if os.path.exists(self.package.resources_postinstall):
         postinst_path = os.path.join(packagedir, 'postinst')
         shutil.copy(os.path.join(self.package.resources_postinstall),
                     postinst_path)
         shell.replace(postinst_path, {'%(files)s': files})
     if os.path.exists(self.package.resources_postremove):
         postrm_path = os.path.join(packagedir, 'postrm')
         shutil.copy(os.path.join(self.package.resources_postremove),
                     postrm_path)
         shell.replace(postrm_path, {'%(files)s': files})
     return (tmpdir, packagedir, srcdir)
Example #4
0
 def write(self, output_dir):
     config_out_path = os.path.join(output_dir,
             os.path.basename(self.wix_config))
     shutil.copy(self.config_path, os.path.join(output_dir,
                 os.path.basename(self.wix_config)))
     shell.replace(config_out_path, self.replacements)
     return config_out_path
Example #5
0
 def write(self, output_dir):
     config_out_path = os.path.join(output_dir,
                                    os.path.basename(self.wix_config))
     shutil.copy(
         self.config_path,
         os.path.join(output_dir, os.path.basename(self.wix_config)))
     shell.replace(config_out_path, self.replacements)
     return config_out_path
Example #6
0
    def fix_lib_paths(self):
        orig_sysroot = self.find_mingw_sys_root()
        if self.config.platform != Platform.WINDOWS:
            new_sysroot = os.path.join(self.prefix, 'mingw', 'lib')
        else:
            new_sysroot = os.path.join(self.prefix, 'lib')
        lib_path = new_sysroot

        # Replace the old sysroot in all .la files
        for path in [f for f in os.listdir(lib_path) if f.endswith('la')]:
            path = os.path.abspath(os.path.join(lib_path, path))
            shell.replace(path, {orig_sysroot: new_sysroot})
Example #7
0
    def fix_lib_paths(self):
        orig_sysroot = self.find_mingw_sys_root()
        if self.config.platform != Platform.WINDOWS:
            new_sysroot = os.path.join(self.prefix, 'mingw', 'lib')
        else:
            new_sysroot = os.path.join(self.prefix, 'lib')
        lib_path = new_sysroot

        # Replace the old sysroot in all .la files
        for path in [f for f in os.listdir(lib_path) if f.endswith('la')]:
            path = os.path.abspath(os.path.join(lib_path, path))
            shell.replace(path, {orig_sysroot: new_sysroot})
Example #8
0
 def install_bin_deps(self):
     # FIXME: build intltool as part of the build tools bootstrap
     for url in WINDOWS_BIN_DEPS:
         temp = fix_winpath(tempfile.mkdtemp())
         path = os.path.join(temp, 'download.zip')
         shell.download(GNOME_FTP + url, path)
         shell.unpack(path, self.config.toolchain_prefix)
     # replace /opt/perl/bin/perl in intltool
     files = shell.ls_files(['bin/intltool*'], self.config.toolchain_prefix)
     for f in files:
         shell.replace(os.path.join(self.config.toolchain_prefix, f),
                       {'/opt/perl/bin/perl': '/bin/perl'})
     return
Example #9
0
 def install_bin_deps(self):
     # FIXME: build intltool as part of the build tools bootstrap
     for url in WINDOWS_BIN_DEPS:
         temp = fix_winpath(tempfile.mkdtemp())
         path = os.path.join(temp, 'download.zip')
         shell.download(GNOME_FTP + url, path)
         shell.unpack(path, self.config.toolchain_prefix)
     # replace /opt/perl/bin/perl in intltool
     files = shell.ls_files(['bin/intltool*'], self.config.toolchain_prefix)
     for f in files:
         shell.replace(os.path.join(self.config.toolchain_prefix, f),
                       {'/opt/perl/bin/perl': '/bin/perl'})
     return
Example #10
0
 def install_bin_deps(self):
     # On windows, we need to install first wget and pkg-config.
     # pkg-config can't be installed otherwise because it depends
     # on glib and glib depends on pkg-config
     for url in WINDOWS_BIN_DEPS:
         temp = fix_winpath(tempfile.mkdtemp())
         path = os.path.join(temp, 'download.zip')
         shell.download(GNOME_FTP + url, path)
         shell.unpack(path, self.config.toolchain_prefix)
     # replace /opt/perl/bin/perl in intltool
     files = shell.ls_files(['bin/intltool*'], self.config.toolchain_prefix)
     for f in files:
         shell.replace(os.path.join(self.config.toolchain_prefix, f),
                       {'/opt/perl/bin/perl': '/bin/perl'})
     return
Example #11
0
 def install_bin_deps(self):
     # On windows, we need to install first wget and pkg-config.
     # pkg-config can't be installed otherwise because it depends
     # on glib and glib depends on pkg-config
     for url in WINDOWS_BIN_DEPS:
         temp = fix_winpath(tempfile.mkdtemp())
         path = os.path.join(temp, 'download.zip')
         shell.download(GNOME_FTP + url, path)
         shell.unpack(path, self.config.toolchain_prefix)
     # replace /opt/perl/bin/perl in intltool
     files = shell.ls_files(['bin/intltool*'], self.config.toolchain_prefix)
     for f in files:
         shell.replace(os.path.join(self.config.toolchain_prefix, f),
                       {'/opt/perl/bin/perl': '/bin/perl'})
     return
Example #12
0
 def write(self, output_dir):
     config_out_path = os.path.join(output_dir,
             os.path.basename(self.wix_config))
     shutil.copy(self.config_path, os.path.join(output_dir,
                 os.path.basename(self.wix_config)))
     replacements = {
         "@ProductID@": '*',
         "@UpgradeCode@": self.package.get_wix_upgrade_code(),
         "@Language@": '1033',
         "@Manufacturer@": self.package.vendor,
         "@Version@": self._format_version(self.package.version),
         "@PackageComments@": self.package.longdesc,
         "@Description@": self.package.shortdesc,
         "@ProjectURL": self.package.url,
         "@ProductName@": self._product_name(),
         "@ProgramFilesFolder@": self._program_folder(),
         "@Platform@": self._platform()}
     shell.replace(config_out_path, replacements)
     return config_out_path
Example #13
0
 def write(self, output_dir):
     config_out_path = os.path.join(output_dir,
                                    os.path.basename(self.wix_config))
     shutil.copy(
         self.config_path,
         os.path.join(output_dir, os.path.basename(self.wix_config)))
     replacements = {
         "@ProductID@": '*',
         "@UpgradeCode@": self.package.get_wix_upgrade_code(),
         "@Language@": '1033',
         "@Manufacturer@": self.package.vendor,
         "@Version@": self._format_version(self.package.version),
         "@PackageComments@": self.package.longdesc,
         "@Description@": self.package.shortdesc,
         "@ProjectURL": self.package.url,
         "@ProductName@": self._product_name(),
         "@ProgramFilesFolder@": self._program_folder(),
         "@Platform@": self._platform(),
         "@UIType@": self.ui_type
     }
     shell.replace(config_out_path, replacements)
     return config_out_path
Example #14
0
 def post_install(self):
     if not self._files_list:
         return
     plugins_dir = os.path.dirname(os.path.join(self.config.prefix,
                                                self._files_list[0]))
     libdir = os.path.dirname(plugins_dir)
     if not os.path.exists(plugins_dir):
         os.makedirs(plugins_dir)
     # Copy all files installed in the temporary build-static directory
     # to the prefix. Static plugins will be installed in
     # lib/gstreamer-0.10/static to avoid conflicts with the libgstplugin.la
     # generated with the shared build
     for f in self._files_list:
         f_no_static = f.replace('/static/', '/')
         f_path = os.path.join(self.config.prefix, f)
         shutil.copyfile(os.path.join(self.tmp_destdir,
             to_unixpath(self.config.prefix)[1:], f_no_static),f_path)
         # Fix libdir path in libtool libraries
         if f.endswith('.la'):
             shell.replace(f_path,
                 {"libdir='%s'" % to_unixpath(libdir):
                     "libdir='%s'" % to_unixpath(plugins_dir)})
Example #15
0
    def _make_paths_relative(self):
        sofiles = shell.find_files('*.so', self.tmp_install_dir)
        for sof in sofiles:
            try:
                shell.call("chrpath -d %s" % sof,
                           self.tmp_install_dir,
                           fail=False)
            except FatalError:
                m.warning("Could not 'chrpath' %s" % sof)

        shell.call("ln -s . usr", self.tmp_install_dir, fail=False)

        # Make gd-pixbuf loader.cache file use relative paths
        cache = os.path.join(self.tmp_install_dir, 'lib', 'gdk-pixbuf-2.0',
                             '2.10.0', 'loaders.cache')
        shell.replace(cache, {self.config.install_dir: '.'})

        for icondir in os.listdir(
                os.path.join(self.tmp_install_dir, "share/icons/")):
            if os.path.exists(os.path.join(icondir, "index.theme")):
                shell.call("gtk-update-icon-cache %s" % icondir, fail=False)

        shell.call("update-mime-database %s" %
                   os.path.join(self.tmp_install_dir, "share", "mime"),
                   fail=False)
        shell.call("glib-compile-schemas %s/share/glib-2.0/schemas" %
                   self.tmp_install_dir)

        # Use system wide applications in case the bundle needs to open apps not included in
        # the bundle (to show the documentation most probably)
        shell.call("rm -rf %s" %
                   os.path.join(self.tmp_install_dir, "share", "applications"),
                   fail=False)
        shell.call(
            "ln -s %s %s" %
            (os.path.join("/usr", "share", "applications"),
             os.path.join(self.tmp_install_dir, "share", "applications")),
            fail=False)
Example #16
0
 def extract_binary(self, recipe):
     packages_names = self._get_packages_names(recipe)
     # There is a weird bug where the links in the devel package are overwriting the
     # file it's linking instaed of just creating the link.
     # For example libmonosgen-2.0.dylib will be extracted creating # a link
     # libmonosgen-2.0.dylib -> libmonosgen-2.0.1.dylib and copying
     # libmonosgen-2.0.dylib to libmonosgen-2.0.1.dylib
     # As a workaround we extract first the devel package and finally the runtime
     for filename in [
             packages_names[PackageType.DEVEL],
             packages_names[PackageType.RUNTIME]
     ]:
         if filename:
             tar = tarfile.open(os.path.join(self.binaries, filename),
                                'r:bz2')
             tar.extractall(self.config.prefix)
             for member in tar.getmembers():
                 # Simple sed for .la and .pc files
                 if os.path.splitext(member.name)[1] in [
                         '.la', '.pc'
                 ] or ('bin' in os.path.splitext(member.name)[0]
                       and is_text_file(
                           os.path.join(self.config.prefix, member.name))):
                     shell.replace(
                         os.path.join(self.config.prefix, member.name),
                         {"CERBERO_PREFIX": self.config.prefix})
                 if os.path.splitext(member.name)[1] in [
                         '.dylib'
                 ] and self.config.target_platform == Platform.DARWIN:
                     extracted_object = os.path.join(
                         self.config.prefix, member.name)
                     # When extracting, we change the install_name of the library to match the path
                     if not os.path.islink(extracted_object):
                         self.relocator.change_id(extracted_object,
                                                  extracted_object)
             tar.close()
Example #17
0
 def _copy_and_replace_paths(self, src, dest, dirs):
     self._copy(src, dest)
     replacements = {}
     for d in dirs:
         replacements[d] = self.output_root
     shell.replace(dest, replacements)
 def _copy_and_replace_paths(self, src, dest, dirs):
     self._copy(src, dest)
     replacements = {}
     for d in dirs:
         replacements[d]=self.output_root
     shell.replace(dest, replacements)
Example #19
0
 def _relocate(self, file, subst_path):
     shell.replace(file, {"CERBERO_PREFIX": subst_path})
Example #20
0
 def fix_bin_deps(self):
     # replace /opt/perl/bin/perl in intltool
     files = shell.ls_files(['bin/intltool*'], self.prefix)
     for f in files:
         shell.replace(os.path.join(self.prefix, f),
                       {'/opt/perl/bin/perl': '/bin/perl'})