• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python trace_decorator.getLog函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mockbuild.trace_decorator.getLog函数的典型用法代码示例。如果您正苦于以下问题:Python getLog函数的具体用法?Python getLog怎么用?Python getLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getLog函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: condEnvironment

def condEnvironment(env=None):
    if not env:
        return
    getLog().debug("child environment: %s" % env)
    os.environ.clear()
    for k in env.keys():
        os.putenv(k, env[k])
开发者ID:alanfranz,项目名称:mock,代码行数:7,代码来源:util.py


示例2: _selinuxAtExit

 def _selinuxAtExit(self):
     if os.path.exists(self.filesystems):
         try:
             os.unlink(self.filesystems)
         except OSError as e:
             getLog().warning("unable to delete selinux filesystems (%s): %s" % (self.filesystems, e))
             pass
开发者ID:heysion,项目名称:mock_clone,代码行数:7,代码来源:selinux.py


示例3: __init__

 def __init__(self, rootObj, conf):
     self.rootObj = rootObj
     self.root_cache_opts = conf
     self.rootSharedCachePath = self.root_cache_opts['dir'] % self.root_cache_opts
     self.rootCacheFile = os.path.join(self.rootSharedCachePath, "cache.tar")
     self.rootCacheLock = None
     self.compressProgram = self.root_cache_opts['compress_program']
     if self.compressProgram == 'pigz' and not os.path.exists('/usr/bin/pigz'):
         getLog().warning("specified 'pigz' as the root cache compress program but not available; using gzip")
         self.compressProgram = 'gzip'
     if self.compressProgram:
          self.compressArgs = ['--use-compress-program', self.compressProgram]
          self.rootCacheFile = self.rootCacheFile + self.root_cache_opts['extension']
     else:
          self.compressArgs = []
     rootObj.rootCacheObj = self
     rootObj.addHook("preinit", self._rootCachePreInitHook)
     rootObj.addHook("preshell", self._rootCachePreShellHook)
     rootObj.addHook("prechroot", self._rootCachePreShellHook)
     rootObj.addHook("preyum", self._rootCachePreYumHook)
     rootObj.addHook("postinit", self._rootCachePostInitHook)
     rootObj.addHook("postshell", self._rootCachePostShellHook)
     rootObj.addHook("postchroot", self._rootCachePostShellHook)
     rootObj.addHook("postyum", self._rootCachePostShellHook)
     self.exclude_dirs = self.root_cache_opts['exclude_dirs']
     self.exclude_tar_cmds = [ "--exclude=" + dir for dir in self.exclude_dirs]
开发者ID:alanfranz,项目名称:mock,代码行数:26,代码来源:root_cache.py


示例4: _ccachePreInitHook

 def _ccachePreInitHook(self):
     getLog().info("enabled ccache")
     mockbuild.util.mkdirIfAbsent(self.rootObj.makeChrootPath('/tmp/ccache'))
     os.environ['CCACHE_DIR'] = "/tmp/ccache"
     os.environ['CCACHE_UMASK'] = "002"
     mockbuild.util.mkdirIfAbsent(self.ccachePath)
     self.rootObj.uidManager.changeOwner(self.ccachePath)
开发者ID:erikrose,项目名称:mock_mozilla,代码行数:7,代码来源:ccache.py


示例5: scrub

 def scrub(self, scrub_opts):
     """clean out chroot and/or cache dirs with extreme prejudice :)"""
     statestr = "scrub %s" % scrub_opts
     self.state.start(statestr)
     try:
         try:
             self.plugins.call_hooks('clean')
             for scrub in scrub_opts:
                 #FIXME hooks for all plugins
                 self.plugins.call_hooks('scrub', scrub)
                 if scrub == 'all':
                     self.buildroot.root_log.info("scrubbing everything for %s" % self.config_name)
                     self.buildroot.delete()
                     util.rmtree(self.buildroot.cachedir, selinux=self.buildroot.selinux)
                 elif scrub == 'chroot':
                     self.buildroot.root_log.info("scrubbing chroot for %s" % self.config_name)
                     self.buildroot.delete()
                 elif scrub == 'cache':
                     self.buildroot.root_log.info("scrubbing cache for %s" % self.config_name)
                     util.rmtree(self.buildroot.cachedir, selinux=self.buildroot.selinux)
                 elif scrub == 'c-cache':
                     self.buildroot.root_log.info("scrubbing c-cache for %s" % self.config_name)
                     util.rmtree(os.path.join(self.buildroot.cachedir, 'ccache'), selinux=self.buildroot.selinux)
                 elif scrub == 'root-cache':
                     self.buildroot.root_log.info("scrubbing root-cache for %s" % self.config_name)
                     util.rmtree(os.path.join(self.buildroot.cachedir, 'root_cache'), selinux=self.buildroot.selinux)
                 elif scrub == 'yum-cache':
                     self.buildroot.root_log.info("scrubbing yum-cache for %s" % self.config_name)
                     util.rmtree(os.path.join(self.buildroot.cachedir, 'yum_cache'), selinux=self.buildroot.selinux)
         except IOError as e:
             getLog().warn("parts of chroot do not exist: %s" % e)
             raise
     finally:
         print("finishing: %s" % statestr)
         self.state.finish(statestr)
开发者ID:heysion,项目名称:mock_clone,代码行数:35,代码来源:backend.py


示例6: rmtree

def rmtree(path, *args, **kargs):
    """version os shutil.rmtree that ignores no-such-file-or-directory errors,
       and tries harder if it finds immutable files"""
    do_selinux_ops = False
    if kargs.has_key('selinux'):
        do_selinux_ops = kargs['selinux']
        del kargs['selinux']
    tryAgain = 1
    retries = 0
    failedFilename = None
    getLog().debug("remove tree: %s" % path)
    while tryAgain:
        tryAgain = 0
        try:
            shutil.rmtree(path, *args, **kargs)
        except OSError, e:
            if e.errno == errno.ENOENT: # no such file or directory
                pass
            elif do_selinux_ops and (e.errno==errno.EPERM or e.errno==errno.EACCES):
                tryAgain = 1
                if failedFilename == e.filename:
                    raise
                failedFilename = e.filename
                os.system("chattr -R -i %s" % path)
            elif e.errno == errno.EBUSY:
                retries += 1
                if retries > 1:
                    raise
                tryAgain = 1
                getLog().debug("retrying failed tree remove after sleeping a bit")
                time.sleep(2)
            else:
                raise
开发者ID:alanfranz,项目名称:mock,代码行数:33,代码来源:util.py


示例7: __init__

 def __init__(self, plugins, conf, buildroot):
     self.buildroot = buildroot
     self.config = buildroot.config
     self.state = buildroot.state
     self.scan_opts = conf
     self.resultdir = os.path.join(buildroot.resultdir, "chroot_scan")
     plugins.add_hook("postbuild", self._scanChroot)
     getLog().info("chroot_scan: initialized")
开发者ID:mizdebsk,项目名称:mock,代码行数:8,代码来源:chroot_scan.py


示例8: unshare

def unshare(flags):
    getLog().debug("Unsharing. Flags: %s" % flags)
    try:
        res = _libc.unshare(flags)
        if res:
            raise mockbuild.exception.UnshareFailed(os.strerror(_errno.value))
    except AttributeError, e:
        pass
开发者ID:alanfranz,项目名称:mock,代码行数:8,代码来源:util.py


示例9: __init__

 def __init__(self, plugins, conf, buildroot):
     self.buildroot = buildroot
     self.config = buildroot.config
     self.state = buildroot.state
     self.conf = conf
     self.command = self.conf['command']
     plugins.add_hook("postbuild", self._compress_logs)
     getLog().info("compress_logs: initialized")
开发者ID:heysion,项目名称:mock_clone,代码行数:8,代码来源:compress_logs.py


示例10: __init__

    def __init__(self, plugins, conf, buildroot):
        self.plugins = plugins
        self.conf = conf
        self.buildroot = buildroot
        self.plugins.add_hook('postbuild', self.sign_results)

        getLog().info(conf)
        getLog().info("enabled package signing")
开发者ID:ianburrell,项目名称:mock,代码行数:8,代码来源:sign.py


示例11: __init__

 def __init__(self, rootObj, conf):
     self.rootObj = rootObj
     self.scan_opts = conf
     self.regexes = self.rootObj.pluginConf['chroot_scan_opts']['regexes']
     self.resultdir = os.path.join(rootObj.resultdir, "chroot_scan")
     rootObj.scanObj = self
     rootObj.addHook("postbuild",  self._scanChroot)
     getLog().info("chroot_scan: initialized")
开发者ID:alanfranz,项目名称:mock,代码行数:8,代码来源:chroot_scan.py


示例12: _init

    def _init(self, prebuild, do_log):
        # If previous run didn't finish properly
        self._umount_residual()

        self.state.start("chroot init")
        util.mkdirIfAbsent(self.basedir)
        mockgid = grp.getgrnam('mock').gr_gid
        os.chown(self.basedir, os.getuid(), mockgid)
        os.chmod(self.basedir, 0o2775)
        util.mkdirIfAbsent(self.make_chroot_path())
        self.plugins.call_hooks('mount_root')
        self.chroot_was_initialized = self.chroot_is_initialized()
        self._setup_result_dir()
        getLog().info("calling preinit hooks")
        self.plugins.call_hooks('preinit')
        self.chroot_was_initialized = self.chroot_is_initialized()

        self._setup_dirs()
        if not util.USE_NSPAWN:
            self._setup_devices()
        self._setup_files()
        self._setup_nosync()
        self.mounts.mountall()
        if do_log:
            self._resetLogging()

        # write out config details
        self.root_log.debug('rootdir = %s' % self.make_chroot_path())
        self.root_log.debug('resultdir = %s' % self.resultdir)

        self.pkg_manager.initialize()
        if not self.chroot_was_initialized:
            self._setup_resolver_config()
            self._setup_dbus_uuid()
            self._init_aux_files()
            if not util.USE_NSPAWN:
                self._setup_timezone()
            self._init_pkg_management()
            self._make_build_user()
            self._setup_build_dirs()
        elif prebuild:
            # Recreates build user to ensure the uid/gid are up to date with config
            # and there's no garbage left by previous build
            self._make_build_user()
            self._setup_build_dirs()
            if self.config['online'] and self.config['update_before_build']:
                update_state = "{0} update".format(self.pkg_manager.name)
                self.state.start(update_state)
                self.pkg_manager.update()
                self.state.finish(update_state)

        # mark the buildroot as initialized
        util.touch(self.make_chroot_path('.initialized'))

        # done with init
        self.plugins.call_hooks('postinit')
        self.state.finish("chroot init")
开发者ID:heysion,项目名称:mock_clone,代码行数:57,代码来源:buildroot.py


示例13: _tmpfsUmount

 def _tmpfsUmount(self):
     getLog().info("unmounting tmpfs.")
     mountCmd = ["umount", "-n", self.rootObj.makeChrootPath()]
     # since we're in a separate namespace, the mount will be cleaned up
     # on exit, so just warn if it fails here
     try:
         mockbuild.util.do(mountCmd, shell=False)
     except:
         getLog().warning("tmpfs-plugin: exception while umounting tmpfs! (cwd: %s)" % os.getcwd())
开发者ID:erikrose,项目名称:mock_mozilla,代码行数:9,代码来源:tmpfs.py


示例14: sign_results

 def sign_results(self):
     rpms = glob.glob('%s/*.rpm' % self.buildroot.resultdir)
     if rpms:
         getLog().info("Signing %s", ', '.join(rpms))
         opts = self.conf['opts'] % {'rpms': ' '.join(rpms), 'resultdir': self.buildroot.resultdir}
         cmd = "{0} {1}".format(self.conf['cmd'], opts)
         getLog().info("Executing %s", cmd)
         with self.buildroot.uid_manager:
             subprocess.call(cmd, shell=True, env=os.environ)
开发者ID:ianburrell,项目名称:mock,代码行数:9,代码来源:sign.py


示例15: _tmpfsMount

    def _tmpfsMount(self):
        getLog().info("mounting tmpfs at %s.", self.buildroot.make_chroot_path())

        if not self.mounted:
            mountCmd = ["mount", "-n", "-t", "tmpfs"] + self.optArgs + \
                       ["mock_chroot_tmpfs", self.buildroot.make_chroot_path()]
            mockbuild.util.do(mountCmd, shell=False)
        else:
            getLog().info("reusing tmpfs at %s.", self.buildroot.make_chroot_path())
        self.mounted = True
开发者ID:msimacek,项目名称:mock,代码行数:10,代码来源:tmpfs.py


示例16: _ccachePreInitHook

    def _ccachePreInitHook(self):
        getLog().info("enabled ccache")
        envupd = {"CCACHE_DIR": "/var/tmp/ccache", "CCACHE_UMASK": "002"}
        if self.ccache_opts.get('compress') is not None:
            envupd["CCACHE_COMPRESS"] = str(self.ccache_opts['compress'])
        self.buildroot.env.update(envupd)

        mockbuild.util.mkdirIfAbsent(self.buildroot.make_chroot_path('/var/tmp/ccache'))
        mockbuild.util.mkdirIfAbsent(self.ccachePath)
        self.buildroot.uid_manager.changeOwner(self.ccachePath, recursive=True)
开发者ID:xsuchy,项目名称:mock,代码行数:10,代码来源:ccache.py


示例17: _ccachePreInitHook

    def _ccachePreInitHook(self):
        getLog().info("enabled ccache")
        envupd = {"CCACHE_DIR": "/tmp/ccache", "CCACHE_UMASK": "002"}
        if self.ccache_opts.get("compress") is not None:
            envupd["CCACHE_COMPRESS"] = str(self.ccache_opts["compress"])
        self.rootObj.env.update(envupd)

        mockbuild.util.mkdirIfAbsent(self.rootObj.makeChrootPath("/tmp/ccache"))
        mockbuild.util.mkdirIfAbsent(self.ccachePath)
        self.rootObj.uidManager.changeOwner(self.ccachePath)
开发者ID:ringerc,项目名称:mock,代码行数:10,代码来源:ccache.py


示例18: _setupDev

    def _setupDev(self, interactive=False):
        if not self.internal_dev_setup:
            self._state_log.info("Skipping device setup due to config")
            return
        self.start("device setup")
        try:
            # files in /dev
            mockbuild.util.rmtree(self.makeChrootPath("dev"), selinux=self.selinux)
            mockbuild.util.mkdirIfAbsent(self.makeChrootPath("dev", "pts"))
            mockbuild.util.mkdirIfAbsent(self.makeChrootPath("dev", "shm"))
            prevMask = os.umask(0000)
            devFiles = [
                (stat.S_IFCHR | 0666, os.makedev(1, 3), "dev/null"),
                (stat.S_IFCHR | 0666, os.makedev(1, 7), "dev/full"),
                (stat.S_IFCHR | 0666, os.makedev(1, 5), "dev/zero"),
                (stat.S_IFCHR | 0666, os.makedev(1, 8), "dev/random"),
                (stat.S_IFCHR | 0444, os.makedev(1, 9), "dev/urandom"),
                (stat.S_IFCHR | 0666, os.makedev(5, 0), "dev/tty"),
                (stat.S_IFCHR | 0600, os.makedev(5, 1), "dev/console"),
                (stat.S_IFCHR | 0666, os.makedev(5, 2), "dev/ptmx"),
                ]
            kver = os.uname()[2]
            getLog().debug("kernel version == %s" % kver)
            for i in devFiles:
                # create node
                os.mknod( self.makeChrootPath(i[2]), i[0], i[1])
                # set context. (only necessary if host running selinux enabled.)
                # fails gracefully if chcon not installed.
                if self.selinux:
                    mockbuild.util.do(
                        ["chcon", "--reference=/%s"% i[2], self.makeChrootPath(i[2])]
                        , raiseExc=0, shell=False, env=self.env)

            os.symlink("/proc/self/fd/0", self.makeChrootPath("dev/stdin"))
            os.symlink("/proc/self/fd/1", self.makeChrootPath("dev/stdout"))
            os.symlink("/proc/self/fd/2", self.makeChrootPath("dev/stderr"))

            if os.path.isfile(self.makeChrootPath('etc', 'mtab')):
                os.remove(self.makeChrootPath('etc', 'mtab'))
            os.symlink("/proc/self/mounts", self.makeChrootPath('etc', 'mtab'))

            os.chown(self.makeChrootPath('dev/tty'), pwd.getpwnam('root')[2], grp.getgrnam('tty')[2])
            os.chown(self.makeChrootPath('dev/ptmx'), pwd.getpwnam('root')[2], grp.getgrnam('tty')[2])

            # symlink /dev/fd in the chroot for everything except RHEL4
            if mockbuild.util.cmpKernelVer(kver, '2.6.9') > 0:
                os.symlink("/proc/self/fd",   self.makeChrootPath("dev/fd"))

            os.umask(prevMask)

            if mockbuild.util.cmpKernelVer(kver, '2.6.18') >= 0:
                os.unlink(self.makeChrootPath('/dev/ptmx'))
            os.symlink("pts/ptmx", self.makeChrootPath('/dev/ptmx'))
        finally:
            self.finish("device setup")
开发者ID:martinmarques,项目名称:mock,代码行数:55,代码来源:backend.py


示例19: init

def init(rootObj, conf):
    system_ram_bytes = os.sysconf(os.sysconf_names['SC_PAGE_SIZE']) * os.sysconf(os.sysconf_names['SC_PHYS_PAGES'])
    system_ram_mb = system_ram_bytes / (1024 * 1024)
    if system_ram_mb > conf['required_ram_mb']:
        Tmpfs(rootObj, conf)
    else:
        getLog().warning("Tmpfs plugin disabled. "
            "System does not have the required amount of RAM to enable the tmpfs plugin. "
            "System has %sMB RAM, but the config specifies the minimum required is %sMB RAM. "
            %
            (system_ram_mb, conf['required_ram_mb']))
开发者ID:erikrose,项目名称:mock_mozilla,代码行数:11,代码来源:tmpfs.py


示例20: orphansKill

def orphansKill(rootToKill, killsig=SIGTERM):
    """kill off anything that is still chrooted."""
    getLog().debug("kill orphans")
    for fn in [ d for d in os.listdir("/proc") if d.isdigit() ]:
        try:
            root = os.readlink("/proc/%s/root" % fn)
            if os.path.realpath(root) == os.path.realpath(rootToKill):
                getLog().warning("Process ID %s still running in chroot. Killing..." % fn)
                pid = int(fn, 10)
                os.kill(pid, killsig)
                os.waitpid(pid, 0)
        except OSError, e:
            pass
开发者ID:alanfranz,项目名称:mock,代码行数:13,代码来源:util.py



注:本文中的mockbuild.trace_decorator.getLog函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mockcassandra.start_cassandra函数代码示例发布时间:2022-05-27
下一篇:
Python mockable_test_result.MockableTestResult类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap