コード例 #1
0
ファイル: cmmi.py プロジェクト: djay/minitage.recipe.cmmi
 def _choose_configure(self, compile_dir=None):
     """configure magic to runne with
     exotic configure systems.
     """
     self.go_inner_dir()
     configure = os.path.join(compile_dir, self.configure)
     if not os.path.isfile(configure) \
        and (not self.noconfigure):
         self.logger.error('Unable to find the configure script')
         raise core.MinimergeError('Invalid package contents, '
                                   'there is no configure script in %s.' %
                                   compile_dir)
     return configure
コード例 #2
0
ファイル: cmmidev.py プロジェクト: ICRAR/ngas_portal
 def _make(self, directory, targets):
     """Run make targets except install."""
     self.go_inner_dir()
     cwd = os.getcwd()
     os.chdir(directory)
     if self.makedir and os.path.exists(self.makedir):
         os.chdir(self.makedir)
     if not self.nomake:
         for target in targets:
             try:
                 self._system('%s %s %s' % (self.make_cmd, self.make_options, target))
             except Exception, e:
                 message = 'Make failed for targets: %s' % targets
                 raise core.MinimergeError(message)
コード例 #3
0
ファイル: cmmidev.py プロジェクト: ICRAR/ngas_portal
 def _make_install(self, directory):
     """"""
     # moving and restoring if problem :)
     self.go_inner_dir()
     cwd = os.getcwd()
     os.chdir(directory)
     if self.makeinstalldir:
         os.chdir(self.makeinstalldir)
     tmp = '%s.old' % self.prefix
     if len(self.install_options)>0:
         self.make_options = self.install_options
     self.make_options_before = self.make_options
     self.make_options_after = ''
     if len(self.make_install_append_options) > 0:
         self.make_options_before = ''
         self.make_options_after = self.make_options
     self.make_options = ''
     self.install_targets = ['%s %s %s' % (self.make_options_before, 
                                           t, 
                                           self.make_options_after)
                             for t in self.install_targets]
     self.make_options = ''
     if not self.noinstall:
         #if os.path.isdir(self.prefix):
         #    print "now going to copy from tmp to target"
         #    copy_tree(self.prefix, tmp)
         if not self.install_in_place:
             os.chdir(cwd)
             shutil.rmtree(self.prefix)
         try:
             if not os.path.exists(self.prefix):
                 os.makedirs(self.prefix)
             self._call_hook('pending-make-install-hook')
             self._make(directory, self.install_targets)
         except Exception, e:
             remove_path(self.prefix)
             if os.path.exists(tmp):
                 print "now move tmp target, dont know where to where"
                 shutil.move(tmp, self.prefix)
             raise core.MinimergeError('Install failed:\n\t%s' % e)
コード例 #4
0
ファイル: cmmi.py プロジェクト: djay/minitage.recipe.cmmi
    def install(self):
        """Install the recipe."""
        # initialise working directories
        for path in [self.prefix, self.tmp_directory]:
            if not os.path.exists(path):
                os.makedirs(path)
        try:
            cwd = os.getcwd()
            # downloading or get the path
            # in the cache if we are offline
            fname = self._download(md5=self.md5, cache=True)

            # preconfigure hook
            self._call_hook('pre-unpack-hook')

            # unpack
            self._unpack(fname)

            # get default compilation directory
            self.compil_dir = self._get_compil_dir(self.tmp_directory)
            if self.inner_dir:
                self.compil_dir = self._get_compil_dir(self.inner_dir)

            # set path
            self._set_path()

            # set pkgconfigpath
            self._set_pkgconfigpath()

            # set compile path
            self._set_compilation_flags()

            # set pypath
            self._set_py_path()

            # write environment file for further debugging
            self.write_env()
            # preconfigure hook
            self._call_hook('post-unpack-hook')

            # configure compilation build directory
            if self.build_dir:
                if not os.path.isdir(self.build_dir):
                    os.makedirs(self.build_dir)
            else:
                self.build_dir = self.compil_dir

            # apply patches
            self._patch(self.build_dir)

            # preautogen hook
            self._call_hook('pre-autogen-hook')

            # autogen, maybe
            self._autogen()

            # choose configure
            self.configure = self._choose_configure(self.compil_dir)
            self.options['compile-directory'] = self.build_dir

            # preconfigure hook
            self._call_hook('pre-configure-hook')

            # run configure
            self._configure(self.configure)

            # postconfigure/premake hook
            self._call_hook('pre-make-hook')

            # running make
            #import pdb;pdb.set_trace()
            self._make(self.build_dir, self.make_targets)

            # post build hook
            self._call_hook('post-build-hook')

            # installing
            self._make_install(self.build_dir)

            # post hook
            self._call_hook('post-make-hook')

            # cleaning
            if 'debug' in self.options:
                import pdb
                pdb.set_trace()
            os.chdir(cwd)
            for path in self.build_dir, self.tmp_directory:
                if os.path.isdir(path):
                    shutil.rmtree(path)

            # regaining original cwd in case we changed build directory
            # during build process.

            # remove lafiles
            if self.move_lafiles:
                move_lafiles(self.prefix)

            self.logger.info('Completed install.')
        except Exception, e:
            raise
            self.logger.error('Compilation error. '
                              'The package is left as is at %s where '
                              'you can inspect what went wrong' %
                              self.tmp_directory)
            self.logger.error('Message was:\n\t%s' % e)
            raise core.MinimergeError('Recipe failed, cant install.')