예제 #1
0
    def fetch(self, redownload=False):
        if not os.path.exists(self.repo_dir):
            os.makedirs(self.repo_dir)

        cached_file = os.path.join(self.config.cached_sources,
                                   self.package_name, self.tarball_name)
        if not redownload and os.path.isfile(cached_file) and self.verify(cached_file, fatal=False):
            m.action(_('Copying cached tarball from %s to %s instead of %s') %
                     (cached_file, self.download_path, self.url))
            shutil.copy(cached_file, self.download_path)
            return
        if self.offline:
            if not os.path.isfile(self.download_path):
                msg = 'Offline mode: tarball {!r} not found in cached sources ({}) or local sources ({})'
                raise FatalError(msg.format(self.tarball_name, self.config.cached_sources, self.repo_dir))
            self.verify()
            m.action(_('Found tarball for %s at %s') % (self.url, self.download_path))
            return
        m.action(_('Fetching tarball %s to %s') %
                 (self.url, self.download_path))
        # Enable certificate checking only on Linux for now
        # FIXME: Add more platforms here after testing
        cc = self.config.platform == Platform.LINUX
        try:
            shell.download(self.url, self.download_path, check_cert=cc,
                           overwrite=redownload)
        except (FatalError, urllib.error.URLError):
            # Try our mirror
            shell.download(self.mirror_url, self.download_path, check_cert=cc,
                           overwrite=redownload)
        self.verify()
예제 #2
0
파일: windows.py 프로젝트: z-ming/cerbero
    def install_python_sdk(self):
        ### FIXME : MOVE OVER REPOSITORY TO STANDARD ROOT
        #old_sdk_git_root = 'git://anongit.freedesktop.org/gstreamer-sdk'
        #m.action(_("Installing Python headers"))
        tmp_dir = tempfile.mkdtemp()
        #shell.call("git clone %s" % os.path.join(old_sdk_git_root,
        #                                         'windows-external-sdk.git'),
        #           tmp_dir)

        url = 'https://github.com/Mingyiz/cerbero/releases/download/untagged-6857bfba99b7d813cf5b/python27-windows.tar.bz2'
        path = os.path.join(tmp_dir, 'python27-windows.tar.bz2')
        shell.download(url, path)
        shell.unpack(path, tmp_dir)

        python_headers = os.path.join(self.prefix, 'include', 'Python2.7')
        python_headers = to_unixpath(os.path.abspath(python_headers))

        shell.call('mkdir -p %s' % python_headers)
        python_libs = os.path.join(self.prefix, 'lib')
        python_libs = to_unixpath(python_libs)

        temp = to_unixpath(os.path.abspath(tmp_dir))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/include/* %s' %
                   (temp, self.version, python_headers))
        shell.call('cp -f %s/windows-external-sdk/python27/%s/lib/* %s' %
                   (temp, self.version, python_libs))
        try:
            os.remove('%s/lib/python.dll' % self.prefix)
        except:
            pass
        shell.call('ln -s python27.dll python.dll', '%s/lib' % self.prefix)
        shutil.rmtree(tmp_dir)
 def fetch_impl(self, redownload=False):
     if self.offline:
         if not os.path.isfile(self.download_path):
             msg = 'Offline mode: tarball {!r} not found in local sources ({})'
             raise FatalError(
                 msg.format(self.tarball_name, self.download_dir))
         self.verify()
         m.action(_('Found %s at %s') % (self.url, self.download_path))
         return
     if not os.path.exists(self.download_dir):
         os.makedirs(self.download_dir)
     m.action(
         _('Fetching tarball %s to %s') % (self.url, self.download_path))
     # Enable certificate checking only on Linux for now
     # FIXME: Add more platforms here after testing
     cc = self.config.platform == Platform.LINUX
     try:
         shell.download(self.url,
                        self.download_path,
                        check_cert=cc,
                        overwrite=redownload,
                        logfile=get_logfile(self))
     except (FatalError, urllib.error.URLError):
         # Try our mirror
         shell.download(self.mirror_url,
                        self.download_path,
                        check_cert=cc,
                        overwrite=redownload,
                        logfile=get_logfile(self))
     self.verify()
예제 #4
0
 def _install_perl_deps(self):
     # Install cpan-minus, a zero-conf CPAN wrapper
     cpanm_installer = tempfile.NamedTemporaryFile().name
     shell.download(self.CPANM_URL, cpanm_installer)
     shell.call('chmod +x %s' % cpanm_installer)
     # Install XML::Parser, required for intltool
     shell.call("sudo %s XML::Parser" % cpanm_installer)
예제 #5
0
파일: source.py 프로젝트: abuecher/cerbero
    def fetch(self, redownload=False):
        if not os.path.exists(self.repo_dir):
            os.makedirs(self.repo_dir)

        cached_file = os.path.join(self.config.cached_sources,
                                   self.package_name, self.tarball_name)
        if not redownload and os.path.isfile(cached_file):
            m.action(
                _('Copying cached tarball from %s to %s instead of %s') %
                (cached_file, self.download_path, self.url))
            shutil.copy(cached_file, self.download_path)
            return
        m.action(
            _('Fetching tarball %s to %s') % (self.url, self.download_path))
        # Enable certificate checking only on Linux for now
        # FIXME: Add more platforms here after testing
        cc = self.config.platform == Platform.LINUX
        try:
            shell.download(self.url,
                           self.download_path,
                           check_cert=cc,
                           overwrite=redownload)
        except (FatalError, urllib.error.URLError):
            # Try our mirror
            shell.download(self.mirror_url,
                           self.download_path,
                           check_cert=cc,
                           overwrite=redownload)
예제 #6
0
파일: osx.py 프로젝트: GStreamer/cerbero
 def _install_perl_deps(self):
     # Install cpan-minus, a zero-conf CPAN wrapper
     cpanm_installer = tempfile.NamedTemporaryFile()
     shell.download(self.CPANM_URL, cpanm_installer.name, overwrite=True)
     shell.call("chmod +x %s" % cpanm_installer.name)
     # Install XML::Parser, required for intltool
     shell.call("sudo %s XML::Parser" % cpanm_installer.name)
     cpanm_installer.close()
예제 #7
0
파일: windows.py 프로젝트: davibe/cerbero
 def install_gl_headers(self):
     m.action("Installing wglext.h")
     if self.arch == Architecture.X86:
         inst_path = os.path.join(self.prefix, 'i686-w64-mingw32/include/GL/wglext.h')
     else:
         inst_path = os.path.join(self.prefix, 'x86_64-w64-mingw32/include/GL/wglext.h')
     gl_header = 'http://www.opengl.org/registry/api/GL/wglext.h'
     shell.download(gl_header, inst_path)
예제 #8
0
파일: windows.py 프로젝트: osdrv/cerbero
 def install_gl_headers(self):
     m.action("Installing wglext.h")
     if self.arch == Architecture.X86:
         inst_path = os.path.join(self.prefix, 'i686-w64-mingw32/include/GL/wglext.h')
     else:
         inst_path = os.path.join(self.prefix, 'x86_64-w64-mingw32/include/GL/wglext.h')
     gl_header = 'http://www.opengl.org/registry/api/GL/wglext.h'
     shell.download(gl_header, inst_path, False, check_cert=False)
예제 #9
0
파일: osx.py 프로젝트: deepak6/cerbero
 def start(self):
     # FIXME: enable it when buildbots are properly configured
     return
     tar = self.GCC_TAR[self.config.distro_version]
     url = os.path.join(self.GCC_BASE_URL, tar)
     pkg = os.path.join(self.config.local_sources, tar)
     shell.download(url, pkg, check_cert=False)
     shell.call('sudo installer -pkg %s -target /' % pkg)
예제 #10
0
 def start(self):
     # FIXME: enable it when buildbots are properly configured
     return
     tar = self.GCC_TAR[self.config.distro_version]
     url = os.path.join(self.GCC_BASE_URL, tar)
     pkg = os.path.join(self.config.local_sources, tar)
     shell.download(url, pkg, check_cert=False)
     shell.call('sudo installer -pkg %s -target /' % pkg)
예제 #11
0
파일: linux.py 프로젝트: fluendo/cerbero
 def _download_wine_package(self, path_name, package_names):
     package_path = os.path.expanduser('~/.cache/winetricks/%s/' % path_name)
     CUSTOM_WINE_PACKAGE_PATH="ftp://*****:*****@officestorage1.fluendo.lan/data/fluendo/tech/private/cerbero/custom_packages/wine"
     if not os.path.exists (package_path):
         os.makedirs (package_path)
     for package_name in package_names:
       package_dest_filename = os.path.expanduser('%s/%s' % (package_path, package_name))
       url = '%s/%s/%s' % (CUSTOM_WINE_PACKAGE_PATH, path_name, package_name)
       shell.download(url, package_dest_filename, cache_url=self.config.cache_url)
예제 #12
0
 def fetch(self):
     m.action(_('Fetching tarball %s to %s') %
              (self.url, self.download_path))
     if not os.path.exists(self.repo_dir):
         os.makedirs(self.repo_dir)
     if self.url.startswith('file://'):
         shutil.copy(self.url[7:], self.download_path)
     else:
         shell.download(self.url, self.download_path, check_cert=False)
예제 #13
0
 def fetch(self):
     m.action(
         _('Fetching tarball %s to %s') % (self.url, self.download_path))
     if not os.path.exists(self.repo_dir):
         os.makedirs(self.repo_dir)
     if self.url.startswith('file://'):
         shutil.copy(self.url[7:], self.download_path)
     else:
         shell.download(self.url, self.download_path, check_cert=False)
예제 #14
0
파일: linux.py 프로젝트: kuggaa/cerbero
 def _download_wine_package(self, path_name, package_name):
     package_path = os.path.expanduser('~/.cache/winetricks/%s/' %
                                       path_name)
     url = 'ftp://*****:*****@officestorage1.fluendo.lan/data/fluendo/tech/private/cerbero/custom_packages/wine/%s' % package_name
     if not os.path.exists(package_path):
         os.makedirs(package_path)
         package_path = os.path.expanduser('~/.cache/winetricks/%s/%s' %
                                           (path_name, package_name))
         shell.download(url, package_path)
예제 #15
0
 def install_pthreads(self):
     pthreadszip = os.path.join(self.prefix, 'pthreads.zip')
     shell.download(PTHREADS_URL, pthreadszip)
     temp = fix_winpath(os.path.abspath(tempfile.mkdtemp()))
     # real pthreads stuff is in a zip file inside the previous zip file
     # under mingwxx/pthreads-xx.zip
     shell.unpack(pthreadszip, temp)
     shell.unpack(
         os.path.join(temp, 'pthreads-20100604', 'ming%s' % self.version,
                      'pthreads-%s.zip' % self.version), self.prefix)
예제 #16
0
파일: linux.py 프로젝트: fluendo/cerbero
 def _download_winetricks(self):
     if self.config.distro_version in [DistroVersion.DEBIAN_STRETCH]:
         self.winetricks_tool = os.path.join(self.config.build_tools_prefix, 'winetricks')
         WINETRICKS_URL = 'https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks'
         if not os.path.isfile(self.winetricks_tool):
             shell.download(WINETRICKS_URL, self.winetricks_tool)
         shell.call ('chmod +x %s' % self.winetricks_tool)
     else:
         self.winetricks_tool = 'winetricks'
         shell.call(self.tool % ' winetricks')
예제 #17
0
 def install_pthreads(self):
     pthreadszip = os.path.join(self.prefix, 'pthreads.zip')
     shell.download(PTHREADS_URL, pthreadszip)
     temp = fix_winpath(os.path.abspath(tempfile.mkdtemp()))
     # real pthreads stuff is in a zip file inside the previous zip file
     # under mingwxx/pthreads-xx.zip
     shell.unpack(pthreadszip, temp)
     shell.unpack(os.path.join(temp, 'pthreads-20100604',
         'ming%s' % self.version, 'pthreads-%s.zip' % self.version),
         self.prefix)
예제 #18
0
파일: linux.py 프로젝트: kuggaa/cerbero
 def _download_winetricks(self):
     if self.config.distro_version in [DistroVersion.DEBIAN_STRETCH]:
         self.winetricks_tool = os.path.join(self.config.build_tools_prefix,
                                             'winetricks')
         WINETRICKS_URL = 'https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks'
         if not os.path.isfile(self.winetricks_tool):
             shell.download(WINETRICKS_URL, self.winetricks_tool)
         shell.call('chmod +x %s' % self.winetricks_tool)
     else:
         self.winetricks_tool = 'winetricks'
         shell.call(self.tool % ' winetricks')
예제 #19
0
파일: osx.py 프로젝트: davibe/cerbero
 def start(self):
     # skip system package install if not needed
     if not self.config.distro_packages_install:
         return
     self._install_perl_deps()
     # FIXME: enable it when buildbots are properly configured
     return
     tar = self.GCC_TAR[self.config.distro_version]
     url = os.path.join(self.GCC_BASE_URL, tar)
     pkg = os.path.join(self.config.local_sources, tar)
     shell.download(url, pkg, check_cert=False)
     shell.call('sudo installer -pkg %s -target /' % pkg)
예제 #20
0
 def start(self):
     dest = self.config.toolchain_prefix
     tar = os.path.join(dest, self.NDK_TAR)
     if os.path.exists(dest):
         shutil.rmtree(dest)
     os.makedirs(dest)
     shell.download("%s/%s" % (self.NDK_BASE_URL, self.NDK_TAR), tar)
     try:
         shell.unpack(tar, os.path.join(dest))
         shell.call('mv android-ndk-r8b/* .', dest)
     except Exception:
         pass
예제 #21
0
파일: android.py 프로젝트: deepak6/cerbero
 def start(self):
     dest = self.config.toolchain_prefix
     tar = os.path.join(dest, self.NDK_TAR)
     if os.path.exists(dest):
         shutil.rmtree(dest)
     os.makedirs(dest)
     shell.download("%s/%s" % (self.NDK_BASE_URL, self.NDK_TAR), tar)
     try:
         shell.unpack(tar, os.path.join(dest))
         shell.call('mv android-ndk-r8b/* .', dest)
     except Exception:
         pass
예제 #22
0
파일: windows.py 프로젝트: z-ming/cerbero
 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
예제 #23
0
파일: windows.py 프로젝트: davibe/cerbero
 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
예제 #24
0
파일: linux.py 프로젝트: llenroc/cerbero
 def _download_wine_package(self, path_name, package_names):
     package_path = os.path.expanduser('~/.cache/winetricks/%s/' %
                                       path_name)
     CUSTOM_WINE_PACKAGE_PATH = "ftp://*****:*****@officestorage1.fluendo.lan/data/fluendo/tech/private/cerbero/custom_packages/wine"
     if not os.path.exists(package_path):
         os.makedirs(package_path)
     for package_name in package_names:
         package_dest_filename = os.path.expanduser(
             '%s/%s' % (package_path, package_name))
         url = '%s/%s/%s' % (CUSTOM_WINE_PACKAGE_PATH, path_name,
                             package_name)
         shell.download(url,
                        package_dest_filename,
                        cache_url=self.config.cache_url)
예제 #25
0
파일: source.py 프로젝트: jpakkane/cerbero
    def fetch(self):
        if not os.path.exists(self.repo_dir):
            os.makedirs(self.repo_dir)

        cached_file = os.path.join(self.config.cached_sources,
                                   self.package_name, self.tarball_name)
        if os.path.isfile(cached_file):
            m.action(_('Copying cached tarball from %s to %s instead of %s') %
                     (cached_file, self.download_path, self.url))
            shutil.copy(cached_file, self.download_path)
            return
        m.action(_('Fetching tarball %s to %s') %
                 (self.url, self.download_path))
        shell.download(self.url, self.download_path, check_cert=False)
예제 #26
0
    def fetch(self):
        if not os.path.exists(self.repo_dir):
            os.makedirs(self.repo_dir)

        cached_file = os.path.join(self.config.cached_sources,
                                   self.package_name, self.tarball_name)
        if os.path.isfile(cached_file):
            m.action(_('Copying cached tarball from %s to %s instead of %s') %
                     (cached_file, self.download_path, self.url))
            shutil.copy(cached_file, self.download_path)
            return
        m.action(_('Fetching tarball %s to %s') %
                 (self.url, self.download_path))
        shell.download(self.url, self.download_path, check_cert=False)
예제 #27
0
 def start(self):
     dest = self.config.toolchain_prefix
     ndk_tar = self.NDK_TAR % self.config.arch
     tar = os.path.join(dest, ndk_tar)
     try:
         os.makedirs(dest)
     except:
         pass
     shell.download("%s/%s" % (self.NDK_BASE_URL, ndk_tar), tar)
     try:
         shell.call('tar -xvjf %s' % ndk_tar, dest)
         shell.call('mv android-ndk-r8e/* .', dest)
     except Exception:
         pass
예제 #28
0
 def start(self):
     dest = self.config.toolchain_prefix
     ndk_zip = self.NDK_ZIP % (self.config.platform, self.config.arch)
     zip_file = os.path.join(dest, ndk_zip)
     try:
         os.makedirs(dest)
     except:
         pass
     shell.download("%s/%s" % (self.NDK_BASE_URL, ndk_zip), zip_file)
     if not os.path.exists(os.path.join(dest, "ndk-build")):
         try:
             shell.call('unzip %s' % ndk_zip, dest)
             shell.call('mv android-ndk-%s/* .' % self.NDK_VERSION, dest)
         except Exception as ex:
             raise FatalError(_("Error installing Android NDK: %s") % (ex))
예제 #29
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
예제 #30
0
파일: android.py 프로젝트: davibe/cerbero
 def start(self):
     dest = self.config.toolchain_prefix
     ndk_tar = self.NDK_TAR % (self.config.platform, self.config.arch)
     tar = os.path.join(dest, ndk_tar)
     try:
         os.makedirs(dest)
     except:
         pass
     shell.download("%s/%s" % (self.NDK_BASE_URL, ndk_tar), tar)
     if not os.path.exists(os.path.join(dest, "README.TXT")):
         try:
             shell.call('tar -xvjf %s' % ndk_tar, dest)
             shell.call('mv android-ndk-r9d/* .', dest)
         except Exception:
             pass
예제 #31
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
예제 #32
0
 def start(self):
     dest = self.config.toolchain_prefix
     ndk_tar = self.NDK_TAR % (self.config.platform, self.config.arch)
     tar = os.path.join(dest, ndk_tar)
     try:
         os.makedirs(dest)
     except:
         pass
     shell.download("%s/%s" % (self.NDK_BASE_URL, ndk_tar), tar)
     if not os.path.exists(os.path.join(dest, "README.TXT")):
         try:
             shell.call('unzip %s' % ndk_tar, dest)
             shell.call('mv android-ndk-%s-%s-%s.tar.bz2/* .' % (self.NDK_VERSION, self.config.platform, self.config.arch), dest)
         except Exception, ex:
             raise FatalError(_("Error installing Android NDK: %s") % (ex))
예제 #33
0
 def start(self):
     dest = self.config.toolchain_prefix
     ndk_zip = self.NDK_ZIP % (self.config.platform, self.config.arch)
     zip_file = os.path.join(dest, ndk_zip)
     try:
         os.makedirs(dest)
     except:
         pass
     shell.download("%s/%s" % (self.NDK_BASE_URL, ndk_zip), zip_file)
     if not os.path.exists(os.path.join(dest, "ndk-build")):
         try:
             shell.call('unzip %s' % ndk_zip, dest)
             shell.call('mv android-ndk-%s/* .' % self.NDK_VERSION, dest)
         except Exception as ex:
             raise FatalError(_("Error installing Android NDK: %s") % (ex))
예제 #34
0
파일: android.py 프로젝트: osdrv/cerbero
 def start(self):
     dest = self.config.toolchain_prefix
     ndk_tar = self.NDK_TAR % (self.config.platform, self.config.arch)
     tar = os.path.join(dest, ndk_tar)
     try:
         os.makedirs(dest)
     except:
         pass
     shell.download("%s/%s" % (self.NDK_BASE_URL, ndk_tar), tar)
     if not os.path.exists(os.path.join(dest, "README.TXT")):
         try:
             shell.call('chmod +x ./%s' % ndk_tar, dest)
             shell.call('./%s' % ndk_tar, dest)
             shell.call('mv android-ndk-r10d/* .', dest)
         except Exception:
             pass
예제 #35
0
파일: android.py 프로젝트: zaheerm/cerbero
 def start(self):
     dest = self.config.toolchain_prefix
     ndk_tar = self.NDK_TAR % (self.config.platform, self.config.arch)
     tar = os.path.join(dest, ndk_tar)
     try:
         os.makedirs(dest)
     except:
         pass
     shell.download("%s/%s" % (self.NDK_BASE_URL, ndk_tar), tar)
     if not os.path.exists(os.path.join(dest, "README.TXT")):
         try:
             shell.call('chmod +x ./%s' % ndk_tar, dest)
             shell.call('./%s' % ndk_tar, dest)
             shell.call('mv android-ndk-%s/* .' % (self.NDK_VERSION), dest)
         except Exception, ex:
             raise FatalError(_("Error installing Android NDK: %s") % (ex))
예제 #36
0
    def install_mingw(self):
        tarball = MINGW_TARBALL_TPL % (self.version, self.platform, self.arch)

        tarfile = os.path.join(self.prefix, tarball)
        tarfile = to_unixpath(os.path.abspath(tarfile))
        shell.download("%s/%s" % (MINGW_DOWNLOAD_SOURCE, tarball), tarfile)
        try:
            shell.unpack(tarfile, self.prefix)
        except Exception:
            pass
        self.fix_lib_paths()
        if self.arch == Architecture.X86:
            try:
                shutil.rmtree('/mingw/lib')
            except Exception:
                pass
예제 #37
0
파일: windows.py 프로젝트: davibe/cerbero
    def install_mingw(self):
        tarball = MINGW_TARBALL_TPL % (self.version, GCC_VERSION,
                self.platform, self.arch)

        tarfile = os.path.join(self.prefix, tarball)
        tarfile = os.path.abspath(tarfile)
        shell.download("%s/%s" % (MINGW_DOWNLOAD_SOURCE, tarball), tarfile)
        try:
            shell.unpack(tarfile, self.prefix)
        except Exception:
            pass
        self.fix_lib_paths()
        if self.arch == Architecture.X86:
            try:
                shutil.rmtree('/mingw/lib')
            except Exception:
                pass
예제 #38
0
    def install_mingw(self):
        tarball = MINGW_TARBALL_TPL % (self.version, GCC_VERSION,
                self.platform, self.arch)

        tarfile = os.path.join(self.prefix, tarball)
        tarfile = os.path.abspath(tarfile)
        shell.download("%s/%s" % (MINGW_DOWNLOAD_SOURCE, tarball), tarfile, False, False, cache_url=self.config.cache_url)
        if not os.path.exists(os.path.join(self.prefix, 'bin')):
            try:
                shell.unpack(tarfile, self.prefix)
            except Exception:
                pass
        self.fix_lib_paths()
        self.update_ntdll()
        if self.arch == Architecture.X86:
            try:
                shutil.rmtree('/mingw/lib')
            except Exception:
                pass
예제 #39
0
 def fetch_dep(self, config, dep, namespace):
     try:
         artifacts_path = "%s/cerbero-deps.tar.gz" % config.home_dir
         shell.download(dep['url'],
                        artifacts_path,
                        check_cert=True,
                        overwrite=True)
         shell.unpack(artifacts_path, config.home_dir)
         os.remove(artifacts_path)
         origin = self.build_dir % namespace
         m.message("Relocating from %s to %s" % (origin, config.home_dir))
         # FIXME: Just a quick hack for now
         shell.call(("grep -lnrIU %(origin)s | xargs "
                     "sed \"s#%(origin)s#%(dest)s#g\" -i") % {
                         'origin': origin,
                         'dest': config.home_dir
                     }, config.home_dir)
     except FatalError as e:
         m.warning(
             ("Could not retrieve artifact for commit %s (the artifact "
              "may have expired): %s") % (dep['commit'], e.msg))
예제 #40
0
파일: windows.py 프로젝트: taktik/cerbero
 def install_openssl_mingw_perl(self):
     '''
     This perl is only used by openssl; we can't use it everywhere else
     because it can't find msys tools, and so perl scripts like autom4te
     fail to run, f.ex., m4. Lucky for us, openssl doesn't use those.
     '''
     url = MINGW_PERL_TPL.format(PERL_VERSION)
     tarfile = os.path.join(self.perl_prefix, os.path.basename(url))
     tarfile = os.path.abspath(tarfile)
     shell.download(url, tarfile, check_cert=False)
     try:
         shell.unpack(tarfile, self.perl_prefix)
     except Exception:
         pass
     # Move perl installation from perl-5.xx.y to perl
     perldir = os.path.join(self.perl_prefix, 'perl-' + PERL_VERSION)
     for d in os.listdir(perldir):
         dest = os.path.join(self.perl_prefix, d)
         if os.path.exists(dest):
             shutil.rmtree(dest)
         shutil.move(os.path.join(perldir, d), self.perl_prefix)
예제 #41
0
 def install_openssl_mingw_perl(self):
     '''
     This perl is only used by openssl; we can't use it everywhere else
     because it can't find msys tools, and so perl scripts like autom4te
     fail to run, f.ex., m4. Lucky for us, openssl doesn't use those.
     '''
     url = MINGW_PERL_TPL.format(PERL_VERSION)
     tarfile = os.path.join(self.perl_prefix, os.path.basename(url))
     tarfile = os.path.abspath(tarfile)
     shell.download(url, tarfile, check_cert=False)
     try:
         shell.unpack(tarfile, self.perl_prefix)
     except Exception:
         pass
     # Move perl installation from perl-5.xx.y to perl
     perldir = os.path.join(self.perl_prefix, 'perl-' + PERL_VERSION)
     for d in os.listdir(perldir):
         dest = os.path.join(self.perl_prefix, d)
         if os.path.exists(dest):
             shutil.rmtree(dest)
         shutil.move(os.path.join(perldir, d), self.perl_prefix)
예제 #42
0
파일: source.py 프로젝트: GStreamer/cerbero
    def fetch(self, redownload=False):
        if not os.path.exists(self.repo_dir):
            os.makedirs(self.repo_dir)

        cached_file = os.path.join(self.config.cached_sources,
                                   self.package_name, self.tarball_name)
        if not redownload and os.path.isfile(cached_file):
            m.action(_('Copying cached tarball from %s to %s instead of %s') %
                     (cached_file, self.download_path, self.url))
            shutil.copy(cached_file, self.download_path)
            return
        m.action(_('Fetching tarball %s to %s') %
                 (self.url, self.download_path))
        # Enable certificate checking Linux for now
        # FIXME: Add more platforms here after testing
        cc = self.config.platform == Platform.LINUX
        try:
            shell.download(self.url, self.download_path, check_cert=cc,
                           overwrite=redownload)
        except FatalError:
            # Try our mirror
            shell.download(self.mirror_url, self.download_path, check_cert=cc,
                           overwrite=redownload)
예제 #43
0
    def request(self, url, values, token=None):
        headers = {}
        if token:
            headers = {"Private-Token": token}

        data = urllib.parse.urlencode(values)
        url = "%s?%s" % (url, data)

        m.message("GET %s" % url)

        tmpdir = tempfile.mkdtemp()
        tmpfile = os.path.join(tmpdir, 'deps.json')

        try:
            shell.download(url, destination=tmpfile)
        except urllib.error.URLError as e:
            raise FatalError(_(e.reason))

        with open(tmpfile, 'r') as f:
            resp = f.read()
        shutil.rmtree(tmpdir)

        return json.loads(resp)
예제 #44
0
    def json_get(self, url):
        m.message("GET %s" % url)

        tmpdir = tempfile.mkdtemp()
        tmpfile = os.path.join(tmpdir, 'deps.json')
        run_until_complete(
            shell.download(url,
                           destination=tmpfile,
                           logfile=open(os.devnull, 'w')))

        with open(tmpfile, 'r') as f:
            resp = f.read()
        shutil.rmtree(tmpdir)

        return json.loads(resp)
예제 #45
0
 def fetch(self):
     m.action(_('Fetching tarball %s to %s') %
              (self.url, self.download_path))
     if not os.path.exists(self.repo_dir):
         os.makedirs(self.repo_dir)
     shell.download(self.url, self.download_path, check_cert=False)
예제 #46
0
파일: hijack.py 프로젝트: z-ming/cerbero
import os
import shutil
from cerbero.utils import shell, _, fix_winpath, to_unixpath, git
from cerbero.utils import messages as m

#load auto config
cac = None
CERBERO_AUTO_CONFIG = None

if not os.path.exists('cerbero.cac'):
    CERBERO_AUTO_CONFIG = os.getenv('CERBERO_AUTO_CONFIG', None)
    if CERBERO_AUTO_CONFIG is not None:
        if os.path.exists(CERBERO_AUTO_CONFIG):
            shutil.copy(CERBERO_AUTO_CONFIG, 'cerbero.cac')
        else:
            shell.download(CERBERO_AUTO_CONFIG, 'cerbero.cac')
print os.path.exists('cerbero.cac')
if os.path.exists('cerbero.cac'):
    import cerbero
    d = {}
    cac = execfile('./cerbero.cac', d)
    print d
    print hasattr(d, 'mirror')
    print '**********', cac

if platform.system() == 'Windows':
    #overwrite windows bootstrap with hijack one
    import cerbero.bootstrap.bootstrapper
    import cerbero.bootstrap.hijack.windows
    cerbero.bootstrap.hijack.windows.register_all()