当前位置: 首页>>代码示例>>Python>>正文


Python msger.info函数代码示例

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


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

示例1: generate_bmap

    def generate_bmap(self):
        """ Generate block map file for the image. The idea is that while disk
        images we generate may be large (e.g., 4GiB), they may actually contain
        only little real data, e.g., 512MiB. This data are files, directories,
        file-system meta-data, partition table, etc. In other words, when
        flashing the image to the target device, you do not have to copy all the
        4GiB of data, you can copy only 512MiB of it, which is 4 times faster.

        This function generates the block map file for an arbitrary image that
        mic has generated. The block map file is basically an XML file which
        contains a list of blocks which have to be copied to the target device.
        The other blocks are not used and there is no need to copy them. """

        if self.bmap_needed is None:
            return

        msger.info("Generating the map file(s)")

        for name in self.__disks.keys():
            image = self._full_path(self.__imgdir, name, self.__disk_format)
            bmap_file = self._full_path(self._outdir, name, "bmap")
            self.image_files.setdefault(name, {}).update({'bmap': \
                                            os.path.basename(bmap_file)})

            msger.debug("Generating block map file '%s'" % bmap_file)
            
            bmaptoolcmd = misc.find_binary_path('bmaptool')
            rc = runner.show([bmaptoolcmd, 'create', image, '-o', bmap_file])
            if rc != 0:
                raise CreatorError("Failed to create bmap file: %s" % bmap_file)
开发者ID:tizenorg,项目名称:tools.mic,代码行数:30,代码来源:raw.py

示例2: __create_iso

    def __create_iso(self, isodir):
        iso = self._outdir + "/" + self.name + ".iso"
        genisoimage = fs_related.find_binary_path("genisoimage")
        args = [genisoimage,
                "-J", "-r",
                "-hide-rr-moved", "-hide-joliet-trans-tbl",
                "-V", self.fslabel,
                "-o", iso]

        args.extend(self._get_mkisofs_options(isodir))

        args.append(isodir)

        if runner.show(args) != 0:
            raise CreatorError("ISO creation failed!")

        """ It should be ok still even if you haven't isohybrid """
        isohybrid = None
        if self._isohybrid:
            try:
                isohybrid = fs_related.find_binary_path("isohybrid")
                msger.info("isohybrid found")
            except:
                msger.warning("isohybrid NOT found")

        if isohybrid:
            args = [isohybrid, "-partok", iso ]
            if runner.show(args) != 0:
             	raise CreatorError("Hybrid ISO creation failed!")
            else:
                msger.info("Hybrid ISO created successfully")

        self.__implant_md5sum(iso)
开发者ID:maui-project,项目名称:maui-mic-plugins,代码行数:33,代码来源:livecd.py

示例3: __build_repo_cache

    def __build_repo_cache(self, name):
        repo = self.repo_manager.getRepositoryInfo(name)
        if self.repo_manager.isCached(repo) or not repo.enabled():
            return

        msger.info('Refreshing repository: %s ...' % name)
        self.repo_manager.buildCache(repo, zypp.RepoManager.BuildIfNeeded)
开发者ID:117111302,项目名称:poky,代码行数:7,代码来源:zypppkgmgr.py

示例4: create_manifest

    def create_manifest(self):
        def get_pack_suffix():
            return '.' + self.pack_to.split('.', 1)[1]

        if not os.path.exists(self.destdir):
            os.makedirs(self.destdir)

        now = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        manifest_dict = {'version': VERSION,
                         'created': now}
        if self.img_format:
            manifest_dict.update({'format': self.img_format})

        if hasattr(self, 'logfile') and self.logfile:
            manifest_dict.update({'log_file': self.logfile})

        if self.image_files:
            if self.pack_to:
                self.image_files.update({'pack': get_pack_suffix()})
            manifest_dict.update({self.img_format: self.image_files})

        msger.info('Creating manifest file...')
        manifest_file_path = os.path.join(self.destdir, 'manifest.json')
        with open(manifest_file_path, 'w') as fest_file:
            json.dump(manifest_dict, fest_file, indent=4)
        self.outimage.append(manifest_file_path)
开发者ID:tizenorg,项目名称:tools.mic,代码行数:26,代码来源:baseimager.py

示例5: generate_bmap

    def generate_bmap(self):
        """ Generate block map file for the image. The idea is that while disk
        images we generate may be large (e.g., 4GiB), they may actually contain
        only little real data, e.g., 512MiB. This data are files, directories,
        file-system meta-data, partition table, etc. In other words, when
        flashing the image to the target device, you do not have to copy all the
        4GiB of data, you can copy only 512MiB of it, which is 4 times faster.

        This function generates the block map file for an arbitrary image that
        mic has generated. The block map file is basically an XML file which
        contains a list of blocks which have to be copied to the target device.
        The other blocks are not used and there is no need to copy them. """

        if self.bmap_needed is None:
            return

        from mic.utils import BmapCreate
        msger.info("Generating the map file(s)")

        for name in self.__disks.keys():
            image = self._full_path(self.__imgdir, name, self.__disk_format)
            bmap_file = self._full_path(self._outdir, name, "bmap")

            msger.debug("Generating block map file '%s'" % bmap_file)

            try:
                creator = BmapCreate.BmapCreate(image, bmap_file)
                creator.generate()
                del creator
            except BmapCreate.Error as err:
                raise CreatorError("Failed to create bmap file: %s" % str(err))
开发者ID:nataliakoval,项目名称:mic,代码行数:31,代码来源:raw.py

示例6: _stage_final_image

    def _stage_final_image(self):
        if self.compress_to:

            self._resparse(0)

            cfile_name = self.compress_to
            mountfp_xml = os.path.splitext(cfile_name)[0] + ".xml"

            for item in self._instloops:
                imgfile = os.path.join(self.__imgdir, item['name'])
                if item['fstype'] == "ext4":
                    runner.show('/sbin/tune2fs '
                                '-O ^huge_file,extents,uninit_bg %s ' \
                                % imgfile)

            msger.info("Compress all loop images together to %s" % cfile_name)
            dstfile = os.path.join(self._outdir, cfile_name)
            if self.compress_imgdir_method == "tar":
                misc.taring(dstfile, self.__imgdir)
            elif self.compress_imgdir_method == "zip":
                misc.ziping(dstfile, self.__imgdir)
            else:
                raise CreatorError("Unsupported compress type: %s" \
                                   % self.compress_imgdir_method)

            # save mount points mapping file to xml
            save_mountpoints(os.path.join(self._outdir, mountfp_xml),
                             self._instloops, 
                             self.target_arch)

        else:
            self._resparse()
            for item in self._instloops:
                shutil.move(os.path.join(self.__imgdir, item['name']),
                            os.path.join(self._outdir, item['name']))
开发者ID:sanyaade-embedded-systems,项目名称:mic,代码行数:35,代码来源:loop.py

示例7: _stage_final_image

    def _stage_final_image(self):
        """Stage the final system image in _outdir.
           write meta data
        """
        self._resparse()

        if self.compress_image:
            for imgfile in os.listdir(self.__imgdir):
                if imgfile.endswith('.raw') or imgfile.endswith('bin'):
                    imgpath = os.path.join(self.__imgdir, imgfile)
                    msger.info("Compressing image %s" % imgfile)
                    misc.compressing(imgpath, self.compress_image)

        if self.pack_to:
            dst = os.path.join(self._outdir, self.pack_to)
            msger.info("Pack all raw images to %s" % dst)
            misc.packing(dst, self.__imgdir)
        else:
            msger.debug("moving disks to stage location")
            for imgfile in os.listdir(self.__imgdir):
                src = os.path.join(self.__imgdir, imgfile)
                dst = os.path.join(self._outdir, imgfile)
                msger.debug("moving %s to %s" % (src,dst))
                shutil.move(src,dst)
        self._write_image_xml()
开发者ID:nataliakoval,项目名称:mic,代码行数:25,代码来源:raw.py

示例8: installLocal

 def installLocal(self, pkg, po=None, updateonly=False):
     if not self.ts:
         self.__initialize_transaction()
     solvfile = "%s/.solv" % (self.creator.cachedir)
     rc, out = runner.runtool([fs_related.find_binary_path("rpms2solv"), pkg])
     if rc == 0:
         f = open(solvfile, "w+")
         f.write(out)
         f.close()
         warnmsg = self.repo_manager.loadSolvFile(solvfile , os.path.basename(pkg))
         if warnmsg:
             msger.warning(warnmsg)
         os.unlink(solvfile)
     else:
         msger.warning('Can not get %s solv data.' % pkg)
     hdr = rpmmisc.readRpmHeader(self.ts, pkg)
     arch = zypp.Arch(hdr['arch'])
     if self.creator.target_arch == None:
         # TODO, get the default_arch from conf or detected from global settings
         sysarch = zypp.Arch('i686')
     else:
         sysarch = zypp.Arch(self.creator.target_arch)
     if arch.compatible_with (sysarch):
         pkgname = hdr['name']
         self.localpkgs[pkgname] = pkg
         self.selectPackage(pkgname)
         msger.info("Marking %s to be installed" % (pkg))
     else:
         msger.warning ("Cannot add package %s to transaction. Not a compatible architecture: %s" % (pkg, hdr['arch']))
开发者ID:xiaoqiang0,项目名称:mic,代码行数:29,代码来源:zypppkgmgr.py

示例9: _stage_final_image

    def _stage_final_image(self):
        if self.taring_to:
            import tarfile

            curdir = os.getcwd()
            os.chdir(self.__imgdir)
            self._resparse(0)

            tarfile_name = self.taring_to
            if not tarfile_name.endswith('.tar'):
                tarfile_name += ".tar"

            msger.info("Tar all loop images together to %s" % tarfile_name)
            tar = tarfile.open(os.path.join(self._outdir, tarfile_name), 'w')
            for item in self._instloops:
                if item['fstype'] == "ext4":
                    runner.show('/sbin/tune2fs -O ^huge_file,extents,uninit_bg ' + item['name'])
                tar.add(item['name'])

            tar.close()
            os.chdir(curdir)

        else:
            self._resparse()
            for item in self._instloops:
                shutil.move(os.path.join(self.__imgdir, item['name']), os.path.join(self._outdir, item['name']))
开发者ID:xiaoqiang0,项目名称:mic,代码行数:26,代码来源:loop.py

示例10: _make_zipfile

def _make_zipfile(archive_name, target_name):
    """ Create a zip file from all the files under 'target_name' or itself.

    @archive_name: the name of the archived file
    @target_name: the directory or the file name to archive
    @retval: indicate the archiving result
    """
    import zipfile

    msger.info("Zipping files to %s using zipfile module" % archive_name)
    arv = zipfile.ZipFile(archive_name, 'w', compression=zipfile.ZIP_DEFLATED)

    if os.path.isdir(target_name):
        for dirpath, dirname, filenames in os.walk(target_name):
            for filename in filenames:
                filepath = os.path.normpath(os.path.join(dirpath, filename))
                arcname = os.path.relpath(filepath, target_name)
                if os.path.isfile(filepath):
                    arv.write(filepath, arcname)
    else:
        arv.write(target_name, os.path.basename(target_name))

    arv.close()

    return os.path.exists(archive_name)
开发者ID:tizenorg,项目名称:tools.mic,代码行数:25,代码来源:archive.py

示例11: print_outimage_info

    def print_outimage_info(self):
        """
        Print the image(s) and artifacts used, for the user.
        """
        msg = "The new image(s) can be found here:\n"

        parts = self._get_parts()

        for disk_name, disk in self.__instimage.disks.items():
            full_path = self._full_path(self.__imgdir, disk_name, "direct")
            msg += '  %s\n\n' % full_path

        msg += 'The following build artifacts were used to create the image(s):\n'
        for p in parts:
            if p.get_rootfs() is None:
                continue
            if p.mountpoint == '/':
                str = ':'
            else:
                str = '["%s"]:' % p.label
            msg += '  ROOTFS_DIR%s%s\n' % (str.ljust(20), p.get_rootfs())

        msg += '  BOOTIMG_DIR:                  %s\n' % self.bootimg_dir
        msg += '  KERNEL_DIR:                   %s\n' % self.kernel_dir
        msg += '  NATIVE_SYSROOT:               %s\n' % self.native_sysroot

        msger.info(msg)
开发者ID:117111302,项目名称:poky,代码行数:27,代码来源:direct.py

示例12: __run_post_scripts

    def __run_post_scripts(self):
        msger.info("Running scripts ...")
        if os.path.exists(self._instroot + "/tmp"):
            shutil.rmtree(self._instroot + "/tmp")
        os.mkdir(self._instroot + "/tmp", 0755)
        for s in kickstart.get_post_scripts(self.ks):
            (fd, path) = tempfile.mkstemp(prefix="ks-script-", dir=self._instroot + "/tmp")

            s.script = s.script.replace("\r", "")
            os.write(fd, s.script)
            os.close(fd)
            os.chmod(path, 0700)

            env = self._get_post_scripts_env(s.inChroot)

            if not s.inChroot:
                env["INSTALL_ROOT"] = self._instroot
                env["IMG_NAME"] = self._name
                preexec = None
                script = path
            else:
                preexec = self._chroot
                script = "/tmp/" + os.path.basename(path)

            try:
                try:
                    subprocess.call(
                        [s.interp, script], preexec_fn=preexec, env=env, stdout=sys.stdout, stderr=sys.stderr
                    )
                except OSError, (err, msg):
                    raise CreatorError("Failed to execute %%post script " "with '%s' : %s" % (s.interp, msg))
            finally:
                os.unlink(path)
开发者ID:JussiPakkanen,项目名称:mic,代码行数:33,代码来源:baseimager.py

示例13: package_output

    def package_output(self, image_format, destdir=".", package="none"):
        if not package or package == "none":
            return

        destdir = os.path.abspath(os.path.expanduser(destdir))
        (pkg, comp) = os.path.splitext(package)
        if comp:
            comp = comp.lstrip(".")

        if pkg == "tar":
            if comp:
                dst = "%s/%s-%s.tar.%s" % (destdir, self.name, image_format, comp)
            else:
                dst = "%s/%s-%s.tar" % (destdir, self.name, image_format)

            msger.info("creating %s" % dst)
            tar = tarfile.open(dst, "w:" + comp)

            for file in self.outimage:
                msger.info("adding %s to %s" % (file, dst))
                tar.add(file, arcname=os.path.join("%s-%s" % (self.name, image_format), os.path.basename(file)))
                if os.path.isdir(file):
                    shutil.rmtree(file, ignore_errors=True)
                else:
                    os.remove(file)

            tar.close()

            """All the file in outimage has been packaged into tar.* file"""
            self.outimage = [dst]
开发者ID:JussiPakkanen,项目名称:mic,代码行数:30,代码来源:baseimager.py

示例14: _stage_final_image

    def _stage_final_image(self):

        if self.pack_to or self.shrink_image:
            self._resparse(0)
        else:
            self._resparse()

        for item in self._instloops:
            imgfile = os.path.join(self.__imgdir, item['name'])
            if item['fstype'] == "ext4":
                runner.show('/sbin/tune2fs -O ^huge_file,extents,uninit_bg %s '
                            % imgfile)
            if self.compress_image:
                misc.compressing(imgfile, self.compress_image)

        if not self.pack_to:
            for item in os.listdir(self.__imgdir):
                shutil.move(os.path.join(self.__imgdir, item),
                            os.path.join(self._outdir, item))
        else:
            msger.info("Pack all loop images together to %s" % self.pack_to)
            dstfile = os.path.join(self._outdir, self.pack_to)
            misc.packing(dstfile, self.__imgdir)

        if self.pack_to:
            mountfp_xml = os.path.splitext(self.pack_to)[0]
            mountfp_xml = misc.strip_end(mountfp_xml, '.tar') + ".xml"
        else:
            mountfp_xml = self.name + ".xml"
        # save mount points mapping file to xml
        save_mountpoints(os.path.join(self._outdir, mountfp_xml),
                         self._instloops,
                         self.target_arch)
开发者ID:117111302,项目名称:poky,代码行数:33,代码来源:loop.py

示例15: configure

    def configure(self, repodata=None):
        """Configure the system image according to the kickstart.

        This method applies the (e.g. keyboard or network) configuration
        specified in the kickstart and executes the kickstart %post scripts.

        If necessary, it also prepares the image to be bootable by e.g.
        creating an initrd and bootloader configuration.

        """
        ksh = self.ks.handler

        msger.info("Applying configurations ...")
        try:
            kickstart.LanguageConfig(self._instroot).apply(ksh.lang)
            kickstart.KeyboardConfig(self._instroot).apply(ksh.keyboard)
            kickstart.TimezoneConfig(self._instroot).apply(ksh.timezone)
            # kickstart.AuthConfig(self._instroot).apply(ksh.authconfig)
            kickstart.FirewallConfig(self._instroot).apply(ksh.firewall)
            kickstart.RootPasswordConfig(self._instroot).apply(ksh.rootpw)
            kickstart.UserConfig(self._instroot).apply(ksh.user)
            kickstart.ServicesConfig(self._instroot).apply(ksh.services)
            kickstart.XConfig(self._instroot).apply(ksh.xconfig)
            kickstart.NetworkConfig(self._instroot).apply(ksh.network)
            kickstart.RPMMacroConfig(self._instroot).apply(self.ks)
            kickstart.DesktopConfig(self._instroot).apply(ksh.desktop)
            self.__save_repo_keys(repodata)
            kickstart.MoblinRepoConfig(self._instroot).apply(ksh.repo, repodata)
        except:
            msger.warning("Failed to apply configuration to image")
            raise

        self._create_bootconfig()
        self.__run_post_scripts()
开发者ID:JussiPakkanen,项目名称:mic,代码行数:34,代码来源:baseimager.py


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