本文整理汇总了Python中relinux.logger.logV函数的典型用法代码示例。如果您正苦于以下问题:Python logV函数的具体用法?Python logV怎么用?Python logV使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了logV函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
logger.logI(tn, _("Generating compressed filesystem"))
# Generate the SquashFS file
# Options:
# -b 1M Use a 1M blocksize (maximum)
# -no-recovery No recovery files
# -always-use-fragments Fragment blocks for files larger than the blocksize (1M)
# -comp Compression type
logger.logVV(tn, _("Generating options"))
opts = "-b 1M -no-recovery -no-duplicates -always-use-fragments"
opts = opts + " -comp " + configutils.getValue(configs[configutils.sfscomp])
opts = opts + " " + configutils.getValue(configs[configutils.sfsopts])
sfsex = "dev etc home media mnt proc sys var usr/lib/ubiquity/apt-setup/generators/40cdrom"
sfspath = isotreel + "casper/filesystem.squashfs"
logger.logI(tn, _("Adding the edited /etc and /var to the filesystem"))
os.system("mksquashfs " + tmpsys + " " + sfspath + " " + opts)
logger.logI(tn, _("Adding the rest of the system"))
os.system("mksquashfs / " + sfspath + " " + opts + " -e " + sfsex)
# Make sure the SquashFS file is OK
doSFSChecks(sfspath, int(configutils.getValue(configs[configutils.isolevel])))
# Find the size after it is uncompressed
logger.logV(tn, _("Writing the size"))
files = open(isotreel + "casper/filesystem.size", "w")
files.write(fsutil.getSFSInstSize(sfspath) + "\n")
files.close()
示例2: runthread
def runthread(self):
# Remove these files as they can conflict inside the installed system
logger.logV(self.tn, logger.I, _("Removing personal configurations that can break the installed system"))
fsutil.rmfiles(
[
tmpsys + "etc/X11/xorg.conf*",
tmpsys + "etc/resolv.conf",
tmpsys + "etc/hosts",
tmpsys + "etc/hostname",
tmpsys + "etc/timezone",
tmpsys + "etc/mtab",
tmpsys + "etc/fstab",
tmpsys + "etc/udev/rules.d/70-persistent*",
tmpsys + "etc/cups/ssl/server.crt",
tmpsys + "etc/cups/ssl/server.key",
tmpsys + "etc/ssh/ssh_host_rsa_key",
tmpsys + "etc/ssh/ssh_host_dsa_key.pub",
tmpsys + "etc/ssh/ssh_host_dsa_key",
tmpsys + "etc/ssh/ssh_host_rsa_key.pub",
# tmpsys + "etc/group", tmpsys + "etc/passwd", tmpsys + "etc/shadow",
# tmpsys + "etc/shadow-", tmpsys + "etc/gshadow", tmpsys + "etc/gshadow-",
tmpsys + "etc/wicd/wired-settings.conf",
tmpsys + "etc/wicd/wireless-settings.conf",
tmpsys + "etc/printcap",
tmpsys + "etc/cups/printers.conf",
]
)
示例3: runthread
def runthread(self):
logger.logI(self.tn, logger.I, _(
"Making the ISO compatible with a USB burner"))
logger.logVV(self.tn, logger.I, _("Writing .disk/info"))
files = open(isotreel + ".disk/info", "w")
files.write(getDiskName() + "\n")
files.close()
self.setProgress(self.tn, 20)
logger.logV(self.tn, logger.I, _(
"Making symlink pointing to the ISO root dir"))
if os.path.lexists(isotreel + "ubuntu"):
fsutil.rm(isotreel + "ubuntu", False, self.tn)
os.symlink(isotreel, isotreel + "ubuntu")
self.setProgress(self.tn, 40)
logger.logVV(self.tn, logger.I, _("Writing release notes URL"))
files = open(isotreel + ".disk/release_notes_url", "w")
files.write(configutils.getValue(configs[configutils.url]) + "\n")
files.close()
self.setProgress(self.tn, 60)
logger.logVV(self.tn, logger.I, _("Writing .disk/base_installable"))
fsutil.touch(isotreel + ".disk/base_installable")
self.setProgress(self.tn, 80)
logger.logVV(self.tn, logger.I, _("Writing CD Type"))
files = open(isotreel + ".disk/cd_type", "w")
files.write("full_cd/single\n")
files.close()
示例4: run
def run(self):
# Edit the casper.conf
# Strangely enough, casper uses the "quiet" flag if the build system is either Debian or Ubuntu
if config.VStatus is False:
logger.logI(self.tn, _("Editing casper and LSB configuration files"))
logger.logV(self.tn, _("Editing casper.conf"))
buildsys = "Ubuntu"
if configutils.parseBoolean(configutils.getValue(configs[configutils.casperquiet])) is False:
buildsys = ""
unionfs = configutils.getValue(configs[configutils.unionfs])
if unionfs == "overlayfs" and aptutil.compVersions(aptutil.getPkgVersion(aptutil.getPkg("casper", aptcache)), "1.272", aptutil.lt):
logger.logW(self.tn, _("Using DEFAULT instead of overlayfs"))
unionfs = "DEFAULT"
self.varEditor(tmpsys + "etc/casper.conf", {
"USERNAME": configutils.getValue(configs[configutils.username]),
"USERFULLNAME":
configutils.getValue(configs[configutils.userfullname]),
"HOST": configutils.getValue(configs[configutils.host]),
"BUILD_SYSTEM": buildsys,
"FLAVOUR": configutils.getValue(configs[configutils.flavour]),
"UNIONFS": unionfs})
logger.logV(self.tn, _("Editing lsb-release"))
self.varEditor(tmpsys + "etc/lsb-release", {
"DISTRIB_ID": configutils.getValue(configs[configutils.sysname]),
"DISTRIB_RELEASE": configutils.getValue(configs[configutils.version]),
"DISTRIB_CODENAME": configutils.getValue(configs[configutils.codename]),
"DISTRIB_DESCRIPTION":
configutils.getValue(configs[configutils.description])})
示例5: runthread
def runthread(self):
# Generate the package manifest
logger.logV(self.tn, logger.I, _("Generating package manifests"))
logger.logVV(self.tn, logger.I, _(
"Generating filesystem.manifest and filesystem.manifest-desktop"))
writer = open(isotreel + "casper/filesystem.manifest", "w")
writer_desktop = open(
isotreel + "casper/filesystem.manifest-desktop", "w")
# installedVersion throws an error when it doesn't exist in 'Package'
# TODO: figure out why, but for now.. check for attribute as well
for i in config.AptCache:
if not hasattr(i,'installedVersion') or i.installedVersion is None or len(i.installedVersion) <= 0:
continue
name = i.fullname.strip()
ver = i.installedVersion.strip()
strs = name + " " + ver + "\n"
writer.write(strs)
if (not name in
configutils.getValue(configs[configutils.remafterinst])):
writer_desktop.write(strs)
writer.close()
writer_desktop.close()
logger.logVV(
self.tn, logger.I, _("Generating filesytem.manifest-remove"))
writer = open(isotreel + "casper/filesystem.manifest-remove", "w")
for i in configutils.parseMultipleValues(configutils.getValue(configs[configutils.remafterinst])):
writer.write(i.strip() + "\n")
writer.close()
示例6: exclude
def exclude(names, files, tn=""):
excludes = []
for i in files:
excludes.extend(fnmatch.filter(names, i))
logger.logV(tn, logger.I, _("Created exclude list") + " " + "(" + str(len(excludes)) + " " +
str(gettext.ngettext("entry", "entries", len(excludes))) + " " + _("allocated") + ")")
return excludes
示例7: fscopy
def fscopy(src, dst, excludes1, tn=""):
# Get a list of all files
files = listdir(src, {"recurse": True, "dirs": True, "symlinks": True}, tn)
# Exclude the files that are not wanted
excludes = []
if len(excludes1) > 0:
excludes = exclude(files, excludes1)
makedir(dst)
# Copy the files
for file in files:
# Make sure we don't copy files that are supposed to be excluded
if file in excludes:
logger.logVV(tn, file + " " + _("is to be excluded. Skipping a CPU cycle"))
continue
fullpath = os.path.join(src, file)
newpath = os.path.join(dst, file)
dfile = delink(fullpath)
if dfile is not None:
logger.logVV(tn, file + " " + _("is a symlink. Creating an identical symlink at") + " " +
newpath)
os.symlink(dfile, newpath)
elif os.path.isdir(fullpath):
logger.logVV(tn, _("Recursing into") + " " + file)
fscopy(fullpath, newpath, excludes, tn)
else:
logger.logVV(tn, _("Copying") + " " + fullpath + " " + _("to") + " " + newpath)
shutil.copy2(fullpath, newpath)
logger.logV(tn, _("Setting permissions"))
shutil.copystat(src, dst)
示例8: runThread
def runThread(threadid, threadsdone, threadsrunning, threads, lock, **options):
thread = getThread(threadid, threads)
if not thread["thread"].is_alive() and not threadid in threadsdone and not threadid in threadsrunning:
threadsrunning.append(threadid)
logger.logV(tn, logger.I, _("Starting") + " " + thread["tn"] + "...")
thread["thread"].start()
if options.get("poststart") is not None and lock is not None:
with lock:
options["poststart"](threadid, threadsrunning, threads)
示例9: checkThread
def checkThread(threadid, threadsdone, threadsrunning, threads, lock, **options):
if threadid in threadsrunning:
if (not getThread(threadid, threads)["thread"].is_alive()
or getThread(threadid, threads)["thread"].isFinished()):
threadsrunning.remove(threadid)
threadsdone.append(threadid)
logger.logV(tn, logger.I, getThread(threadid, threads)["tn"] + " " +
_("has finished. Number of threads running: ") + str(len(threadsrunning)))
if options.get("postend") != None and lock != None:
with lock:
options["postend"](threadid, threadsrunning, threads)
示例10: checkThread
def checkThread(threadid, threadsdone, threadsrunning, threads, lock, **options):
thread = getThread(threadid, threads)
if threadid in threadsrunning:
if not thread["thread"].is_alive():
thread["thread"].wait()
threadsrunning.remove(threadid)
threadsdone.append(threadid)
logger.logV(tn, logger.I, thread["tn"] + " " +
_("has finished. Number of threads running: ") + str(len(threadsrunning)))
if options.get("postend") is not None and lock is not None:
with lock:
options["postend"](threadid, threadsrunning, threads)
示例11: runthread
def runthread(self):
# Create the logs
logger.logV(self.tn, logger.I, _("Creating empty logs"))
a = ["dpkg.log", "lastlog", "mail.log", "syslog", "auth.log", "daemon.log", "faillog",
"lpr.log", "mail.warn", "user.log", "boot", "debug", "mail.err", "messages", "wtmp",
"bootstrap.log", "dmesg", "kern.log", "mail.info"]
la = len(a)
inc = 100 / la
for i in range(la):
logger.logVV(
self.tn, logger.I, logger.MTab + _("Creating") + " " + a[i])
fsutil.touch(tmpsys + "var/log/" + a[i])
self.setProgress(self.tn, (i + 1) * inc)
示例12: runthread
def runthread(self):
logger.logI(self.tn, logger.I, _("Starting generation of the ISO image"))
# Make a last verification on the SquashFS
squashfs.doSFSChecks(isotreel + "casper/filesystem.squashfs",
configutils.getValue(configs[configutils.isolevel]))
self.setProgress(self.tn, 5)
# Generate MD5 checksums
logger.logV(self.tn, logger.I, _("Generating MD5 sums"))
files = open(isotreel + "md5sum.txt", "w")
for x in fsutil.listdir(isotreel, {"recurse": True}):
i = re.sub(r"^ *" + isotreel + "/*", "./", x)
if not "isolinux" in i and not "md5sum" in i:
logger.logVV(self.tn, logger.I, _("Writing MD5 sum of") + " " + i)
fmd5 = fsutil.genFinalMD5(i, x)
if fmd5 != "" and fmd5 != None:
files.write(fmd5)
files.close()
self.setProgress(self.tn, 15)
logger.logI(self.tn, logger.I, _("Generating the ISO"))
location = (configutils.getValue(configs[configutils.isodir]) + "/" +
configutils.getValue(configs[configutils.isolocation]))
patt = re.compile("^ *([0-9]+)\.?[0-9]*%.*$")
appnd = "32"
if sys.maxsize > 2 ** 32:
appnd = "64"
os.environ["LD_PRELOAD"] = os.path.split(os.path.realpath(__file__))[0] + "/isatty" + appnd + ".so"
isocmd = subprocess.Popen(shlex.split(configutils.getValue(configs[configutils.isogenerator]) + " -o " +
location + " " + isogenopts + " -V \"" +
configutils.getValue(configs[configutils.label]) + "\" " + isotreel),
stderr=subprocess.PIPE, universal_newlines=True)
oldprogress = 0
while isocmd.poll() is None:
output = isocmd.stderr.readline()
match = patt.match(output)
if match != None:
progress = int(match.group(1))
if progress > oldprogress:
# 1.4285714285714286 is just 100 / 70
self.setProgress(self.tn, 15 + int(utilities.floatDivision(progress, 1.4285714285714286)))
oldprogress = progress
sys.stdout.write(output)
sys.stdout.flush()
os.environ["LD_PRELOAD"] = ""
self.setProgress(self.tn, 85)
# Generate the MD5 sum
logger.logV(self.tn, logger.I, _("Generating MD5 sum for the ISO"))
files = open(location + ".md5", "w")
files.write(fsutil.genFinalMD5("./" + configutils.getValue(configs[configutils.isolocation]),
location))
files.close()
示例13: run
def run(self):
logger.logV(self.tn, _("Copying ISOLINUX to the ISO tree"))
copyFile("/usr/lib/syslinux/isolinux.bin", isotreel + "isolinux/", True)
copyFile("/usr/lib/syslinux/vesamenu.c32", isotreel + "isolinux/", True)
logger.logVV(self.tn, _("Copying isolinux.cfg to the ISO tree"))
copyFile(configutils.getValue(configs[configutils.isolinuxfile], isotreel +
"isolinux/isolinux.cfg", True))
# Edit the isolinux.cfg file to replace the variables
logger.logV(_("Editing isolinux.cfg"))
for i in [["LABEL", configutils.getValue(configs[configutils.label])],
["SPLASH", configutils.getValue(configs[configutils.splash])],
["TIMEOUT", configutils.getValue(configs[configutils.timeout])]]:
fsutil.ife(fsutil.ife_getbuffers(isotreel + "isolinux/isolinux.cfg"),
lambda line: re.sub("\$" + i[0], i[1], line))
示例14: run
def run(self):
logger.logV(self.tn, logger.I, "Setting up Ubiquity")
if os.getenv("KDE_FULL_SESSION") != None:
aptutil.instPkg(aptutil.getPkg("ubiquity-frontend-kde", aptcache), self.depcache)
aptutil.remPkg(aptutil.getPkg("ubiquity-frontend-gtk", aptcache), self.depcache, True)
else:
aptutil.remPkg(aptutil.getPkg("ubiquity-frontend-kde", aptcache), self.depcache, True)
aptutil.instPkg(aptutil.getPkg("ubiquity-frontend-gtk", aptcache), self.depcache)
if configutils.parseBoolean(config[configutils.popcon]):
logger.logV(self.tn, logger.I, "Setting up Popularity Contest")
aptutil.instPkg(aptutil.getPkg("popularity-contest"), self.depcache)
else:
aptutil.remPkg(aptutil.getPkg("popularity-contest"), self.depcache, True)
aptutil.commitChanges(self.depcache, self.ap, self.ip)
示例15: listdir
def listdir(dirs, options, tn=""):
logger.logV(tn, _("Gathering a list of files in") + " " + dirs)
listed = os.listdir(dirs)
returnme = []
returnme.append(dirs)
for i in listed:
if options.symlinks is True and os.path.islink(i):
returnme.append(i)
if options.dirs is True and os.path.isdir(i):
if options.recurse is True:
returnme.extend(listdir(i, options))
else:
returnme.append(i)
if os.path.isfile(i):
returnme.append(i)
return returnme