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

Python msger.error函数代码示例

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

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



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

示例1: read_kickstart

def read_kickstart(path):
    """Parse a kickstart file and return a KickstartParser instance.

    This is a simple utility function which takes a path to a kickstart file,
    parses it and returns a pykickstart KickstartParser instance which can
    be then passed to an ImageCreator constructor.

    If an error occurs, a CreatorError exception is thrown.
    """

    # version = ksversion.makeVersion()
    # ks = ksparser.KickstartParser(version)

    using_version = ksversion.DEVEL
    commandMap[using_version]["bootloader"] = wicboot.Wic_Bootloader
    commandMap[using_version]["part"] = partition.Wic_Partition
    commandMap[using_version]["partition"] = partition.Wic_Partition
    dataMap[using_version]["PartData"] = partition.Wic_PartData
    superclass = ksversion.returnClassForVersion(version=using_version)

    class KSHandlers(superclass):
        def __init__(self):
            superclass.__init__(self, mapping=commandMap[using_version])

    kickstart = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True)

    try:
        kickstart.readKickstart(path)
    except (kserrors.KickstartParseError, kserrors.KickstartError), err:
        msger.warning("Errors occurred when parsing kickstart file: %s\n" % path)
        msger.error("%s" % err)
开发者ID:shenki,项目名称:poky,代码行数:31,代码来源:__init__.py


示例2: do_prepare_partition

    def do_prepare_partition(self, part, source_params, cr, cr_workdir,
                             oe_builddir, bootimg_dir, kernel_dir,
                             krootfs_dir, native_sysroot):
        """
        Called to do the actual content population for a partition i.e. it
        'prepares' the partition to be incorporated into the image.
        In this case, prepare content for legacy bios boot partition.
        """
        if part.rootfs is None:
            if not 'ROOTFS_DIR' in krootfs_dir:
                msg = "Couldn't find --rootfs-dir, exiting"
                msger.error(msg)
            rootfs_dir = krootfs_dir['ROOTFS_DIR']
        else:
            if part.rootfs in krootfs_dir:
                rootfs_dir = krootfs_dir[part.rootfs]
            elif part.rootfs:
                rootfs_dir = part.rootfs
            else:
                msg = "Couldn't find --rootfs-dir=%s connection"
                msg += " or it is not a valid path, exiting"
                msger.error(msg % part.rootfs)

        real_rootfs_dir = self.__get_rootfs_dir(rootfs_dir)

        part.set_rootfs(real_rootfs_dir)
        part.prepare_rootfs(cr_workdir, oe_builddir, real_rootfs_dir, native_sysroot)
开发者ID:jasmeetbagga,项目名称:oe-core,代码行数:27,代码来源:rootfs.py


示例3: do_install_disk

    def do_install_disk(cls, disk, disk_name, creator, workdir, oe_builddir,
                        bootimg_dir, kernel_dir, native_sysroot):
        """
        Called after all partitions have been prepared and assembled into a
        disk image.  In this case, we install the MBR.
        """
        mbrfile = "%s/syslinux/" % bootimg_dir
        if creator.ptable_format == 'msdos':
            mbrfile += "mbr.bin"
        elif creator.ptable_format == 'gpt':
            mbrfile += "gptmbr.bin"
        else:
            msger.error("Unsupported partition table: %s" % creator.ptable_format)

        if not os.path.exists(mbrfile):
            msger.error("Couldn't find %s.  If using the -e option, do you "
                        "have the right MACHINE set in local.conf?  If not, "
                        "is the bootimg_dir path correct?" % mbrfile)

        full_path = creator._full_path(workdir, disk_name, "direct")
        msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
                    % (disk_name, full_path, disk['min_size']))

        rcode = runner.show(['dd', 'if=%s' % mbrfile,
                             'of=%s' % full_path, 'conv=notrunc'])
        if rcode != 0:
            raise ImageError("Unable to set MBR to %s" % full_path)
开发者ID:nathanrossi,项目名称:meta-random,代码行数:27,代码来源:bootimg-initramfs-pcbios.py


示例4: exec_native_cmd

def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3):
    """
    Execute native command, catching stderr, stdout

    Need to execute as_shell if the command uses wildcards

    Always need to execute native commands as_shell
    """
    native_paths = \
        "export PATH=%s/sbin:%s/usr/sbin:%s/usr/bin" % \
        (native_sysroot, native_sysroot, native_sysroot)
    native_cmd_and_args = "%s;%s" % (native_paths, cmd_and_args)
    msger.debug("exec_native_cmd: %s" % cmd_and_args)

    args = cmd_and_args.split()
    msger.debug(args)

    rc, out = __exec_cmd(native_cmd_and_args, True, catch)

    if rc == 127: # shell command-not-found
        msger.error("A native program %s required to build the image "
                    "was not found (see details above). Please make sure "
                    "it's installed and try again." % args[0])

    return (rc, out)
开发者ID:sheungkim,项目名称:openembedded-core,代码行数:25,代码来源:misc.py


示例5: postoptparse

    def postoptparse(self, options):
        abspath = lambda pth: os.path.abspath(os.path.expanduser(pth))

        if options.verbose:
            msger.set_loglevel('verbose')
        if options.debug:
            msger.set_loglevel('debug')

        if options.logfile:
            logfile_abs_path = abspath(options.logfile)
            if os.path.isdir(logfile_abs_path):
                raise errors.Usage("logfile's path %s should be file"
                                   % options.logfile)
            if not os.path.exists(os.path.dirname(logfile_abs_path)):
                os.makedirs(os.path.dirname(logfile_abs_path))
            msger.set_interactive(False)
            msger.set_logfile(logfile_abs_path)
            configmgr.create['logfile'] = options.logfile

        if options.config:
            configmgr.reset()
            configmgr._siteconf = options.config

        if options.outdir is not None:
            configmgr.create['outdir'] = abspath(options.outdir)

        cdir = 'outdir'
        if os.path.exists(configmgr.create[cdir]) \
           and not os.path.isdir(configmgr.create[cdir]):
            msger.error('Invalid directory specified: %s' \
                        % configmgr.create[cdir])

        if options.enabletmpfs:
            configmgr.create['enabletmpfs'] = options.enabletmpfs
开发者ID:32bitmicro,项目名称:riscv-poky,代码行数:34,代码来源:creator.py


示例6: do_prepare_partition

    def do_prepare_partition(cls, part, source_params, cr, cr_workdir,
                             oe_builddir, bootimg_dir, kernel_dir,
                             rootfs_dir, native_sysroot):
        """
        Called to do the actual content population for a partition i.e. it
        'prepares' the partition to be incorporated into the image.
        """
        if not bootimg_dir:
            bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
            if not bootimg_dir:
                msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")

        msger.debug('Bootimg dir: %s' % bootimg_dir)

        if 'file' not in source_params:
            msger.error("No file specified\n")
            return

        src = os.path.join(bootimg_dir, source_params['file'])
        dst = os.path.join(cr_workdir, "%s.%s" % (source_params['file'], part.lineno))

        if 'skip' in source_params:
            sparse_copy(src, dst, skip=source_params['skip'])
        else:
            sparse_copy(src, dst)

        # get the size in the right units for kickstart (kB)
        du_cmd = "du -Lbks %s" % dst
        out = exec_cmd(du_cmd)
        filesize = out.split()[0]

        if int(filesize) > int(part.size):
            part.size = filesize

        part.source_file = dst
开发者ID:agangidi53,项目名称:openbmc,代码行数:35,代码来源:rawcopy.py


示例7: do_install_disk

    def do_install_disk(cls, disk, disk_name, image_creator, workdir, oe_builddir,
                        bootimg_dir, kernel_dir, native_sysroot):
        """
        Assemble partitions to disk image

        Called after all partitions have been prepared and assembled into a
        disk image. In this case, we install the MBR.
        """
        mbrfile = os.path.join(native_sysroot, "usr/share/syslinux/")
        if image_creator.ptable_format == 'msdos':
            mbrfile += "mbr.bin"
        elif image_creator.ptable_format == 'gpt':
            mbrfile += "gptmbr.bin"
        else:
            msger.error("Unsupported partition table: %s" % \
                        image_creator.ptable_format)

        if not os.path.exists(mbrfile):
            msger.error("Couldn't find %s. Has syslinux-native been baked?" % mbrfile)

        full_path = disk['disk'].device
        msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
                    % (disk_name, full_path, disk['min_size']))

        ret_code = runner.show(['dd', 'if=%s' % mbrfile, 'of=%s' % full_path, 'conv=notrunc'])
        if ret_code != 0:
            raise ImageError("Unable to set MBR to %s" % full_path)
开发者ID:Brainbuster,项目名称:openpli-buildumgebung,代码行数:27,代码来源:rootfs_pcbios_ext.py


示例8: do_configure_partition

    def do_configure_partition(cls, part, source_params, creator, cr_workdir,
                               oe_builddir, bootimg_dir, kernel_dir,
                               native_sysroot):
        """
        Called before do_prepare_partition(), creates syslinux config
        """
        hdddir = "%s/hdd/boot" % cr_workdir
        rm_cmd = "rm -rf " + cr_workdir
        exec_cmd(rm_cmd)

        install_cmd = "install -d %s" % hdddir
        exec_cmd(install_cmd)

        bootloader = creator.ks.bootloader

        custom_cfg = None
        if bootloader.configfile:
            custom_cfg = get_custom_config(bootloader.configfile)
            if custom_cfg:
                # Use a custom configuration for grub
                syslinux_conf = custom_cfg
                msger.debug("Using custom configuration file "
                            "%s for syslinux.cfg" % bootloader.configfile)
            else:
                msger.error("configfile is specified but failed to "
                            "get it from %s." % bootloader.configfile)

        if not custom_cfg:
            # Create syslinux configuration using parameters from wks file
            splash = os.path.join(cr_workdir, "/hdd/boot/splash.jpg")
            if os.path.exists(splash):
                splashline = "menu background splash.jpg"
            else:
                splashline = ""

            syslinux_conf = ""
            syslinux_conf += "PROMPT 0\n"
            syslinux_conf += "TIMEOUT " + str(bootloader.timeout) + "\n"
            syslinux_conf += "\n"
            syslinux_conf += "ALLOWOPTIONS 1\n"
            syslinux_conf += "SERIAL 0 115200\n"
            syslinux_conf += "\n"
            if splashline:
                syslinux_conf += "%s\n" % splashline
            syslinux_conf += "DEFAULT boot\n"
            syslinux_conf += "LABEL boot\n"

            kernel = "/vmlinuz"
            syslinux_conf += "KERNEL " + kernel + "\n"

            syslinux_conf += "APPEND label=boot root=%s %s\n" % \
                             (creator.rootdev, bootloader.append)

        msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \
                    % cr_workdir)
        cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w")
        cfg.write(syslinux_conf)
        cfg.close()
开发者ID:carosio,项目名称:poky,代码行数:58,代码来源:bootimg-pcbios.py


示例9: runtool

def runtool(cmdln_or_args, catch=1):
    """ wrapper for most of the subprocess calls
    input:
        cmdln_or_args: can be both args and cmdln str (shell=True)
        catch: 0, quitely run
               1, only STDOUT
               2, only STDERR
               3, both STDOUT and STDERR
    return:
        (rc, output)
        if catch==0: the output will always None
    """

    if catch not in (0, 1, 2, 3):
        # invalid catch selection, will cause exception, that's good
        return None

    if isinstance(cmdln_or_args, list):
        cmd = cmdln_or_args[0]
        shell = False
    else:
        import shlex
        cmd = shlex.split(cmdln_or_args)[0]
        shell = True

    if catch != 3:
        dev_null = os.open("/dev/null", os.O_WRONLY)

    if catch == 0:
        sout = dev_null
        serr = dev_null
    elif catch == 1:
        sout = subprocess.PIPE
        serr = dev_null
    elif catch == 2:
        sout = dev_null
        serr = subprocess.PIPE
    elif catch == 3:
        sout = subprocess.PIPE
        serr = subprocess.STDOUT

    try:
        process = subprocess.Popen(cmdln_or_args, stdout=sout,
                                   stderr=serr, shell=shell)
        (sout, serr) = process.communicate()
        # combine stdout and stderr, filter None out and decode
        out = ''.join([out.decode('utf-8') for out in [sout, serr] if out])
    except OSError as err:
        if err.errno == 2:
            # [Errno 2] No such file or directory
            msger.error('Cannot run command: %s, lost dependency?' % cmd)
        else:
            raise # relay
    finally:
        if catch != 3:
            os.close(dev_null)

    return (process.returncode, out)
开发者ID:MentorEmbedded,项目名称:poky,代码行数:58,代码来源:runner.py


示例10: do_prepare_partition

    def do_prepare_partition(self, part, source_params, cr, cr_workdir,
                             oe_builddir, bootimg_dir, kernel_dir,
                             rootfs_dir, native_sysroot):
        """
        Called to do the actual content population for a partition i.e. it
        'prepares' the partition to be incorporated into the image.
        In this case, does the following:
        - sets up a vfat partition
        - copies all files listed in IMAGE_BOOT_FILES variable
        """
        hdddir = "%s/boot" % cr_workdir
        rm_cmd = "rm -rf %s" % cr_workdir
        exec_cmd(rm_cmd)

        install_cmd = "install -d %s" % hdddir
        exec_cmd(install_cmd)

        if not bootimg_dir:
            bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
            if not bootimg_dir:
                msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")

        msger.debug('Bootimg dir: %s' % bootimg_dir)

        boot_files = get_bitbake_var("IMAGE_BOOT_FILES")

        if not boot_files:
            msger.error('No boot files defined, IMAGE_BOOT_FILES unset')

        msger.debug('Boot files: %s' % boot_files)

        # list of tuples (src_name, dst_name)
        deploy_files = []
        for src_entry in re.findall(r'[\w;\-\./]+', boot_files):
            if ';' in src_entry:
                dst_entry = tuple(src_entry.split(';'))
            else:
                dst_entry = (src_entry, src_entry)

            msger.debug('Destination entry: %r' % (dst_entry,))
            deploy_files.append(dst_entry)

        for deploy_entry in deploy_files:
            src, dst = deploy_entry
            src_path = os.path.join(bootimg_dir, src)
            dst_path = os.path.join(hdddir, dst)

            msger.debug('Install %s as %s' % (os.path.basename(src_path),
                                              dst_path))
            install_cmd = "install -m 0644 -D %s %s" \
                          % (src_path, dst_path)
            exec_cmd(install_cmd)

        msger.debug('Prepare boot partition using rootfs in %s' % (hdddir))
        part.prepare_rootfs(cr_workdir, oe_builddir, hdddir,
                            native_sysroot)
开发者ID:abelal,项目名称:openembedded-core,代码行数:56,代码来源:bootimg-partition.py


示例11: _build_initramfs_path

    def _build_initramfs_path(rootfs_dir, cr_workdir):
        """
        Create path for initramfs image
        """

        initrd = get_bitbake_var("INITRD")
        if not initrd:
            initrd_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
            if not initrd_dir:
                msger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting.\n")

            image_name = get_bitbake_var("IMAGE_BASENAME")
            if not image_name:
                msger.error("Couldn't find IMAGE_BASENAME, exiting.\n")

            image_type = get_bitbake_var("INITRAMFS_FSTYPES")
            if not image_type:
                msger.error("Couldn't find INITRAMFS_FSTYPES, exiting.\n")

            machine_arch = get_bitbake_var("MACHINE_ARCH")
            if not machine_arch:
                msger.error("Couldn't find MACHINE_ARCH, exiting.\n")

            initrd = "%s/%s-initramfs-%s.%s" \
                    % (initrd_dir, image_name, machine_arch, image_type)

        if not os.path.exists(initrd):
            # Create initrd from rootfs directory
            initrd = "%s/initrd.cpio.gz" % cr_workdir
            initrd_dir = "%s/INITRD" % cr_workdir
            shutil.copytree("%s" % rootfs_dir, \
                            "%s" % initrd_dir, symlinks=True)

            if os.path.isfile("%s/init" % rootfs_dir):
                shutil.copy2("%s/init" % rootfs_dir, "%s/init" % initrd_dir)
            elif os.path.lexists("%s/init" % rootfs_dir):
                os.symlink(os.readlink("%s/init" % rootfs_dir), \
                            "%s/init" % initrd_dir)
            elif os.path.isfile("%s/sbin/init" % rootfs_dir):
                shutil.copy2("%s/sbin/init" % rootfs_dir, \
                            "%s" % initrd_dir)
            elif os.path.lexists("%s/sbin/init" % rootfs_dir):
                os.symlink(os.readlink("%s/sbin/init" % rootfs_dir), \
                            "%s/init" % initrd_dir)
            else:
                msger.error("Couldn't find or build initrd, exiting.\n")

            exec_cmd("cd %s && find . | cpio -o -H newc >%s/initrd.cpio " \
                    % (initrd_dir, cr_workdir), as_shell=True)
            exec_cmd("gzip -f -9 -c %s/initrd.cpio > %s" \
                    % (cr_workdir, initrd), as_shell=True)
            shutil.rmtree(initrd_dir)

        return initrd
开发者ID:rofehr,项目名称:openembedded-core,代码行数:54,代码来源:isoimage-isohybrid.py


示例12: __get_rootfs_dir

    def __get_rootfs_dir(rootfs_dir):
        if os.path.isdir(rootfs_dir):
            return rootfs_dir

        image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir)
        if not os.path.isdir(image_rootfs_dir):
            msg = "No valid artifact IMAGE_ROOTFS from image named"
            msg += " %s has been found at %s, exiting.\n" % \
                (rootfs_dir, image_rootfs_dir)
            msger.error(msg)

        return image_rootfs_dir
开发者ID:dexteradeus,项目名称:meta-perlnode,代码行数:12,代码来源:data-partition.py


示例13: do_configure_gummiboot

    def do_configure_gummiboot(cls, hdddir, creator, cr_workdir):
        """
        Create loader-specific (gummiboot) config
        """
        install_cmd = "install -d %s/loader" % hdddir
        exec_cmd(install_cmd)

        install_cmd = "install -d %s/loader/entries" % hdddir
        exec_cmd(install_cmd)

        options = creator.ks.handler.bootloader.appendLine

        timeout = kickstart.get_timeout(creator.ks)
        if not timeout:
            timeout = 0

        loader_conf = ""
        loader_conf += "default boot\n"
        loader_conf += "timeout %d\n" % timeout

        msger.debug("Writing gummiboot config %s/hdd/boot/loader/loader.conf" \
                        % cr_workdir)
        cfg = open("%s/hdd/boot/loader/loader.conf" % cr_workdir, "w")
        cfg.write(loader_conf)
        cfg.close()

        configfile = kickstart.get_bootloader_file(creator.ks)
        custom_cfg = None
        if configfile:
            custom_cfg = get_custom_config(configfile)
            if custom_cfg:
                # Use a custom configuration for gummiboot
                boot_conf = custom_cfg
                msger.debug("Using custom configuration file "
                        "%s for gummiboots's boot.conf" % configfile)
            else:
                msger.error("configfile is specified but failed to "
                        "get it from %s." % configfile)

        if not custom_cfg:
            # Create gummiboot configuration using parameters from wks file
            kernel = "/bzImage"

            boot_conf = ""
            boot_conf += "title boot\n"
            boot_conf += "linux %s\n" % kernel
            boot_conf += "options LABEL=Boot root=%s %s\n" % (creator.rootdev, options)

        msger.debug("Writing gummiboot config %s/hdd/boot/loader/entries/boot.conf" \
                        % cr_workdir)
        cfg = open("%s/hdd/boot/loader/entries/boot.conf" % cr_workdir, "w")
        cfg.write(boot_conf)
        cfg.close()
开发者ID:jhofstee,项目名称:openembedded-core,代码行数:53,代码来源:bootimg-efi.py


示例14: exec_cmd

def exec_cmd(cmd_and_args, as_shell = False, catch = 3):
    """
    Execute command, catching stderr, stdout

    Exits if rc non-zero
    """
    rc, out = __exec_cmd(cmd_and_args, as_shell, catch)

    if rc != 0:
        msger.error("exec_cmd: %s returned '%s' instead of 0" % (cmd_and_args, rc))

    return out
开发者ID:sheungkim,项目名称:openembedded-core,代码行数:12,代码来源:misc.py


示例15: exec_native_cmd

def exec_native_cmd(cmd_and_args, native_sysroot, catch=3, pseudo=""):
    """
    Execute native command, catching stderr, stdout

    Need to execute as_shell if the command uses wildcards

    Always need to execute native commands as_shell
    """
    # The reason -1 is used is because there may be "export" commands.
    args = cmd_and_args.split(';')[-1].split()
    msger.debug(args)

    if pseudo:
        cmd_and_args = pseudo + cmd_and_args
    native_paths = \
        "%s/sbin:%s/usr/sbin:%s/usr/bin" % \
        (native_sysroot, native_sysroot, native_sysroot)
    native_cmd_and_args = "export PATH=%s:$PATH;%s" % \
                           (native_paths, cmd_and_args)
    msger.debug("exec_native_cmd: %s" % cmd_and_args)

    # If the command isn't in the native sysroot say we failed.
    if cmd_in_path(args[0], native_paths):
        ret, out = _exec_cmd(native_cmd_and_args, True, catch)
    else:
        ret = 127

    prog = args[0]
    # shell command-not-found
    if ret == 127 \
       or (pseudo and ret == 1 and out == "Can't find '%s' in $PATH." % prog):
        msg = "A native program %s required to build the image "\
              "was not found (see details above).\n\n" % prog
        recipe = NATIVE_RECIPES.get(prog)
        if recipe:
            msg += "Please bake it with 'bitbake %s-native' "\
                   "and try again.\n" % recipe
        else:
            msg += "Wic failed to find a recipe to build native %s. Please "\
                   "file a bug against wic.\n" % prog
        msger.error(msg)
    if out:
        msger.debug('"%s" output: %s' % (args[0], out))

    if ret != 0:
        msger.error("exec_cmd: '%s' returned '%s' instead of 0" % \
                    (cmd_and_args, ret))

    return ret, out
开发者ID:32bitmicro,项目名称:riscv-poky,代码行数:49,代码来源:misc.py


示例16: main

    def main(self, argv=None):
        if argv is None:
            argv = sys.argv
        else:
            argv = argv[:] # don't modify caller's list

        pname = argv[0]
        if pname not in self._subcmds:
            msger.error('Unknown plugin: %s' % pname)

        optparser = self.get_optparser()
        options, args = optparser.parse_args(argv)

        self.postoptparse(options)

        return self._subcmds[pname](options, *args[1:])
开发者ID:32bitmicro,项目名称:riscv-poky,代码行数:16,代码来源:creator.py


示例17: _parse_kickstart

    def _parse_kickstart(self, ksconf=None):
        if not ksconf:
            return

        try:
            ksobj = KickStart(ksconf)
        except KickStartError as err:
            msger.error(str(err))

        self.create['ks'] = ksobj
        self.create['name'] = os.path.splitext(os.path.basename(ksconf))[0]

        self.create['name'] = misc.build_name(ksconf,
                                              self.create['release'],
                                              self.create['name_prefix'],
                                              self.create['name_suffix'])
开发者ID:MentorEmbedded,项目名称:poky,代码行数:16,代码来源:conf.py


示例18: __get_rootfs_dir

    def __get_rootfs_dir(rootfs_dir):
        if os.path.isdir(rootfs_dir):
            return rootfs_dir

        bitbake_env_lines = find_bitbake_env_lines(rootfs_dir)
        if not bitbake_env_lines:
            msg = "Couldn't get bitbake environment, exiting."
            msger.error(msg)

        image_rootfs_dir = find_artifact(bitbake_env_lines, "IMAGE_ROOTFS")
        if not os.path.isdir(image_rootfs_dir):
            msg = "No valid artifact IMAGE_ROOTFS from image named"
            msg += " %s has been found at %s, exiting.\n" % (rootfs_dir, image_rootfs_dir)
            msger.error(msg)

        return image_rootfs_dir
开发者ID:open-switch,项目名称:ops-build,代码行数:16,代码来源:rootfs.py


示例19: do_stage_partition

    def do_stage_partition(cls, part, source_params, creator, cr_workdir,
                           oe_builddir, bootimg_dir, kernel_dir,
                           native_sysroot):
        """
        Special content staging called before do_prepare_partition().
        It cheks if all necessary tools are available, if not
        tries to instal them.
        """
        # Make sure parted is available in native sysroot
        if not os.path.isfile("%s/usr/sbin/parted" % native_sysroot):
            msger.info("Building parted-native...\n")
            exec_cmd("bitbake parted-native")

        # Make sure mkfs.ext2/3/4 is available in native sysroot
        if not os.path.isfile("%s/sbin/mkfs.ext2" % native_sysroot):
            msger.info("Building e2fsprogs-native...\n")
            exec_cmd("bitbake e2fsprogs-native")

        # Make sure syslinux is available in sysroot and in native sysroot
        syslinux_dir = get_bitbake_var("STAGING_DATADIR")
        if not syslinux_dir:
            msger.error("Couldn't find STAGING_DATADIR, exiting.\n")
        if not os.path.exists("%s/syslinux" % syslinux_dir):
            msger.info("Building syslinux...\n")
            exec_cmd("bitbake syslinux")
        if not os.path.exists("%s/syslinux" % syslinux_dir):
            msger.error("Please build syslinux first\n")

        # Make sure syslinux is available in native sysroot
        if not os.path.exists("%s/usr/bin/syslinux" % native_sysroot):
            msger.info("Building syslinux-native...\n")
            exec_cmd("bitbake syslinux-native")

        #Make sure mkisofs is available in native sysroot
        if not os.path.isfile("%s/usr/bin/mkisofs" % native_sysroot):
            msger.info("Building cdrtools-native...\n")
            exec_cmd("bitbake cdrtools-native")

        # Make sure mkfs.vfat is available in native sysroot
        if not os.path.isfile("%s/sbin/mkfs.vfat" % native_sysroot):
            msger.info("Building dosfstools-native...\n")
            exec_cmd("bitbake dosfstools-native")

        # Make sure mtools is available in native sysroot
        if not os.path.isfile("%s/usr/bin/mcopy" % native_sysroot):
            msger.info("Building mtools-native...\n")
            exec_cmd("bitbake mtools-native")
开发者ID:KenChenIEC,项目名称:openbmc,代码行数:47,代码来源:isoimage-isohybrid.py


示例20: __run_parted

    def __run_parted(self, args):
        """ Run parted with arguments specified in the 'args' list. """

        args.insert(0, self.parted)
        msger.debug(args)

        rc, out = runner.runtool(args, catch = 3)
        out = out.strip()
        if out:
            msger.debug('"parted" output: %s' % out)

        if rc != 0:
            # We don't throw exception when return code is not 0, because
            # parted always fails to reload part table with loop devices. This
            # prevents us from distinguishing real errors based on return
            # code.
            msger.error("WARNING: parted returned '%s' instead of 0 (use --debug for details)" % rc)
开发者ID:abelal,项目名称:openembedded-core,代码行数:17,代码来源:partitionedfs.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python misc.exec_cmd函数代码示例发布时间:2022-05-26
下一篇:
Python msger.debug函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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