Example #1
0
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                 self.build_dir)
     self.apply_patches()
Example #2
0
 def extract(self):
     if not os.path.exists(self.build_dir):
         os.mkdir(self.build_dir)
     self._find_tarball()
     shell.unpack(self.tarball_path, self.unpack_dir)
     # apply common patches
     self._apply_patches(self.repo_dir)
     # apply platform patches
     self._apply_patches(self.platform_patches_dir)
Example #3
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)
Example #4
0
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         if os.path.exists(self.build_dir):
             shutil.rmtree(self.build_dir)
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                 self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         shell.apply_patch(patch, self.build_dir, self.strip)
Example #5
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
Example #6
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 #7
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
    def _unpack(self, name, cats=['devel', 'runtime'], version=None):
        profile = self.profile[name]
        #ppath = profile.get('__file__',None)
        #if ppath is None or not os.path.exists( ppath ):
        #    m.error('package <%s> not exists!'%name)
        #    raise FatalError('install package failed')

        path = profile.get('__file__', None)
        if path:
            if not os.path.exists(path):
                m.error('package <%s> not exists!' % name)
                raise FatalError('install package failed')
            d = os.path.dirname(profile['__file__'])
        else:
            d = profile.get('__dir__', None)
        assert d, '!!!!!!!'

        prefix = self.args.prefix
        if prefix is None:
            if name == 'build-tools':
                prefix = self.config.build_tools_prefix
            else:
                prefix = self.config.prefix

        #profile path
        ip = os.path.join(prefix, name + '.yaml')
        if os.path.exists(ip):
            pro = yaml.load(open(ip))
            if version:
                m.error(
                    'installed package %s version %s not consistent with require %s'
                    % (name, pro['version'], version))
                raise FatalError("install package failed.")
            else:
                m.message('package %s (%s) already installed.' %
                          (name, pro['version']))
                return

        for cat, info in profile['tarball'].viewitems():

            filename = info['filename']
            url = os.path.join(d, filename)
            path = cache(url, self.args.cache_dir)
            assert os.path.exists(path)

            shell.unpack(path, prefix)

        yaml.dump(profile, open(ip, 'w'), default_flow_style=False)
        m.message('package <%s> installation done.' % name)
Example #9
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 #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 extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                 self.build_dir)
     git.init_directory(self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         if self.strip == 1:
             git.apply_patch(patch, self.build_dir)
         else:
             shell.apply_patch(patch, self.build_dir, self.strip)
Example #12
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
Example #13
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)
        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
Example #14
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
Example #15
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)
Example #16
0
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     try:
         shell.unpack(self.download_path, self.config.sources)
     except (IOError, EOFError, tarfile.ReadError):
         m.action(_('Corrupted or partial tarball, redownloading...'))
         self.fetch(redownload=True)
         shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                 self.build_dir)
     git.init_directory(self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         if self.strip == 1:
             git.apply_patch(patch, self.build_dir)
         else:
             shell.apply_patch(patch, self.build_dir, self.strip)
Example #17
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)
Example #18
0
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     try:
         shell.unpack(self.download_path, self.config.sources)
     except (IOError, EOFError, tarfile.ReadError):
         m.action(_('Corrupted or partial tarball, redownloading...'))
         self.fetch(redownload=True)
         shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                   self.build_dir)
     git.init_directory(self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         if self.strip == 1:
             git.apply_patch(patch, self.build_dir)
         else:
             shell.apply_patch(patch, self.build_dir, self.strip)
Example #19
0
 async def fetch_dep(self, config, dep, namespace):
     try:
         artifacts_path = "%s/cerbero-deps.tar.gz" % config.home_dir
         await 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))