Kaydet (Commit) b9ff787d authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Debug ve Info mesajları düzenlendi

üst aa53db9a
......@@ -8,11 +8,11 @@ INARY 2.0 Yol Haritası ve Yapılacaklar
1. Pre-Alpha
- Daha temiz logging stratejisi:
- Her çıktının log dosyasına yazılması işleri biraz karıştırıyor. log dosyası şişiyor.
/ Daha temiz logging stratejisi:
/ Her çıktının log dosyasına yazılması işleri biraz karıştırıyor. log dosyası şişiyor.
bu iş için bir çare bulmak lazım. Adım adım neler yapacağım:
- ctx.ui.debug fonksiyonu gerekli olmadıkça kullanılmamalı.
- ctx.ui.info önemli mesajlar ve detaylar için (verbose parametresi ile kullanılmalı)
+ ctx.ui.debug fonksiyonu gerekli olmadıkça kullanılmamalı.
+ ctx.ui.info önemli mesajlar ve detaylar için (verbose parametresi ile kullanılmalı)
- Bilgilendirme için kullanılan mesajlar ayıklanıp logdan ayrılmalı.
- Paket kurulması öncesi tam bilgilendirme.
- İndirilecek boyutu yazdır.
......
......@@ -239,7 +239,7 @@ def getBinutilsInfo(util):
if not existBinary(util):
raise BinutilsError(_('Util \'{}\' cannot be found').format(util))
else:
ctx.ui.debug(_('Warning: \'{0}\' does not exist, using plain name \'{1}\'').format(cross_build_name, util))
ctx.ui.warning(_('\'{0}\' does not exist, using plain name \'{1}\'').format(cross_build_name, util))
return util
else:
return cross_build_name
......
......@@ -335,7 +335,7 @@ class ArchiveTar(ArchiveBase):
except OSError:
pass
ctx.ui.debug(_("* Target DIR: \"{}\"").format(target_dir))
ctx.ui.info(_("Target DIR: \"{}\"").format(target_dir), verbose=True)
os.chdir(target_dir)
for tarinfo in self.tar:
......@@ -487,10 +487,10 @@ class ArchiveTar(ArchiveBase):
gid = os.getgid()
if not os.path.islink(tarinfo.name):
ctx.ui.debug(_("* Chowning {0} ({1}:{2})").format(tarinfo.name, uid, gid))
ctx.ui.info(_("Chowning {0} ({1}:{2})").format(tarinfo.name, uid, gid), verbose=True)
os.chown(tarinfo.name, uid, gid)
else:
ctx.ui.debug(_("* LChowning {0} ({1}:{2})").format(tarinfo.name, uid, gid))
ctx.ui.info(_("LChowning {0} ({1}:{2})").format(tarinfo.name, uid, gid), verbose=True)
os.lchown(tarinfo.name, uid, gid)
if callback:
......@@ -516,7 +516,6 @@ class ArchiveTar(ArchiveBase):
elif self.type == 'tarbz2':
wmode = 'w:bz2'
elif self.type in ('tarlzma', 'tarxz'):
format = "xz" if self.type == "tarxz" else "alone"
compresslevel = int(ctx.config.values.build.compressionlevel)
self.tar = TarFile.lzmaopen(self.file_path, "w",
fileobj=self.fileobj,
......
......@@ -190,7 +190,7 @@ class Install(AtomicOperation):
total_size, symbol = util.human_readable_size(util.free_space())
if util.free_space() < self.installedSize:
raise Error(_("Is there enought free space in your disk."))
ctx.ui.debug(_("Free Space: %.2f %s " % (total_size, symbol)))
ctx.ui.info(_("Free Space: %.2f %s " % (total_size, symbol)), verboe=True)
# what to do if / is split into /usr, /var, etc.
# check scom
......@@ -311,10 +311,9 @@ class Install(AtomicOperation):
for _file in self.package.get_files().list:
fpath = util.join_path(ctx.config.dest_dir(), _file.path)
if os.path.islink(fpath):
ctx.ui.debug(_("* Added symlink '{}' ").format(fpath))
# Kontrol et
ctx.ui.info(_("Added symlink '{}' ").format(fpath), verbose=True)
else:
ctx.ui.debug(_("* Chowning in postinstall {0} ({1}:{2})").format(_file.path, _file.uid, _file.gid))
ctx.ui.info(_("Chowning in postinstall {0} ({1}:{2})").format(_file.path, _file.uid, _file.gid), verbose=True)
os.chown(fpath, int(_file.uid), int(_file.gid))
if ctx.scom:
......
......@@ -113,7 +113,7 @@ class CLI(inary.ui.UI):
# let's cheat from KDE :)
msg = util.colorize(msg, color)
if verbose:
msg = util.colorize(_('Verboses: '), 'white') + msg
msg = util.colorize(_('Verboses: '), 'brightwhite') + msg
if not noln:
msg = '{}\n'.format(msg)
......
......@@ -202,7 +202,7 @@ class Fetcher:
ctx.ui.info("\n", noln=True) # This is not a bug. This is a new feature. ŞAka bir yana bu hata
# pycurl yüzünden kaynaklanıyor
file_id.close()
ctx.ui.debug(_("Downloaded from:" + str(c.getinfo(c.EFFECTIVE_URL))))
ctx.ui.info(_("Downloaded from:" + str(c.getinfo(c.EFFECTIVE_URL))), verbose=True)
c.close()
except pycurl.error as x:
raise FetchError("{}".format(x.args[1]))
......
......@@ -150,7 +150,7 @@ def exclude_special_files(filepath, fileinfo, ag):
ctx.ui.warning(_("Removing special file skipped for: \"{}\"").format(filepath))
return
elif re.match(pattern, fileinfo):
ctx.ui.debug("Removing special \"{0}\" file: \"{1}\"".format(name, filepath))
ctx.ui.warning(_("Removing special \"{0}\" file: \"{1}\"").format(name, filepath))
os.unlink(filepath)
# Remove dir if it becomes empty (Bug #11588)
util.rmdirs(os.path.dirname(filepath))
......@@ -171,7 +171,7 @@ def strip_debug_action(filepath, fileinfo, install_dir, ag):
path)
if util.strip_file(filepath, fileinfo, outputpath):
ctx.ui.debug("{0} [{1}]".format(path, "stripped"))
ctx.ui.info("{0} [{1}]".format(path, "stripped"), verbose=True)
class Builder:
......@@ -199,7 +199,7 @@ class Builder:
os.path.dirname(repo.indexuri.get_uri()),
str(src_uri.path()))
ctx.ui.debug(_("Source URI: {}").format(src_path))
ctx.ui.info(_("Source URI: {}").format(src_path), verbose=True)
return Builder(src_path)
else:
......@@ -719,7 +719,7 @@ class Builder:
if not os.path.exists(src_dir):
src_dir = util.join_path(self.pkg_work_dir(), [d for d in os.walk(self.pkg_work_dir()).__next__()[1] if
not d.startswith(".")][0])
if self.get_state() == "unpack": ctx.ui.debug("Using {} as WorkDir".format(src_dir))
if self.get_state() == "unpack": ctx.ui.info("Using {} as WorkDir".format(src_dir), verbose=True)
return src_dir
......
......@@ -290,7 +290,7 @@ def plan_install_pkg_names(A):
for x in B:
pkg = packagedb.get_package(x)
for dep in pkg.runtimeDependencies():
ctx.ui.debug(' -> checking {}'.format(str(dep)))
ctx.ui.info(' -> checking {}'.format(str(dep)), verbose=True)
# we don't deal with already *satisfied* dependencies
if not dep.satisfied_by_installed():
if not dep.satisfied_by_repo(packagedb=packagedb):
......
......@@ -86,7 +86,7 @@ def find_upgrades(packages, replaces):
continue
if i_pkg.endswith(ctx.const.package_suffix):
ctx.ui.debug(_("Warning: package *name* ends with '.inary'"))
ctx.ui.info(_("Warning: package *name* ends with '.inary'"), verbose=True)
if not installdb.has_package(i_pkg):
ctx.ui.info(_('Package \"{}\" is not installed.').format(i_pkg), True)
......
......@@ -66,10 +66,6 @@ def get_link():
"""Connect to the SCOM daemon and return the link."""
sockname = "/var/run/dbus/system_bus_socket"
# YALI starts scom chrooted in the install target, but uses INARY
# outside of the chroot environment, so Inary needs to use a different
# socket path to be able to connect true dbus (and scom).
# (usually /var/run/dbus/system_bus_socket)
if ctx.dbus_sockname:
sockname = ctx.dbus_sockname
......@@ -110,7 +106,7 @@ def post_install(package_name, provided_scripts,
fromVersion, fromRelease, toVersion, toRelease):
"""Do package's post install operations"""
ctx.ui.info(_("Configuring \"{}\" package".).format(package_name))
ctx.ui.info(_("Configuring \"{}\" package.").format(package_name))
self_post = False
package_name = safe_script_name(package_name)
......@@ -123,7 +119,7 @@ def post_install(package_name, provided_scripts,
link = get_link()
for script in provided_scripts:
ctx.ui.debug(_("Registering \"{}\" named scom script.").format(script.om))
ctx.ui.debug(_("Registering \"{0}\" named scom script for \"{1}\".").format(script.om, package_name))
script_name = safe_script_name(script.name) \
if script.name else package_name
if script.om == "System.Package":
......@@ -139,7 +135,7 @@ def post_install(package_name, provided_scripts,
except dbus.exceptions.DBusException as exception:
raise Error(_("Script error: {}").format(exception))
ctx.ui.debug(_("Calling post install handlers."))
ctx.ui.debug(_("Calling post install handlers for \"{}\" package.").format(package_name))
for handler in link.System.PackageHandler:
try:
link.System.PackageHandler[handler].setupPackage(
......@@ -150,7 +146,7 @@ def post_install(package_name, provided_scripts,
# Do nothing if setupPackage method is not defined
# in package script
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
raise Error(_("Script error for \"{0}\" package: {1}").format(package_name, exception))
if self_post:
if not fromVersion:
......@@ -158,7 +154,7 @@ def post_install(package_name, provided_scripts,
if not fromRelease:
fromRelease = ""
ctx.ui.debug(_("Running package's post install script."))
ctx.ui.debug(_("Running package's post install script for \"{0}\" package.").format(package_name))
try:
link.System.Package[package_name].postInstall(
fromVersion, fromRelease, toVersion, toRelease,
......@@ -166,19 +162,19 @@ def post_install(package_name, provided_scripts,
except dbus.exceptions.DBusException as exception:
# Do nothing if postInstall method is not defined in package script
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
raise Error(_("Script error for \"{0}\" package: {1}").format(package_name, exception))
def pre_remove(package_name, metapath, filepath):
"""Do package's pre removal operations"""
ctx.ui.info(_("Running pre removal operations for \"{}\".").format(package_name))
ctx.ui.info(_("Running pre removal operations for \"{}\" package.").format(package_name))
link = get_link()
package_name = safe_script_name(package_name)
if package_name in list(link.System.Package):
ctx.ui.debug(_("Running package's pre remove script."))
ctx.ui.debug(_("Running package's pre remove script for \"{}\" package.").format(package_name))
try:
link.System.Package[package_name].preRemove(
timeout=ctx.dbus_timeout)
......@@ -187,7 +183,7 @@ def pre_remove(package_name, metapath, filepath):
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
ctx.ui.debug(_("Calling pre remove handlers."))
ctx.ui.debug(_("Calling pre remove handlers for \"{}\" package.").format(package_name))
for handler in list(link.System.PackageHandler):
try:
link.System.PackageHandler[handler].cleanupPackage(
......@@ -213,7 +209,7 @@ def post_remove(package_name, metapath, filepath, provided_scripts=None):
scripts.add(package_name)
if package_name in list(link.System.Package):
ctx.ui.debug(_("Running package's postremove script."))
ctx.ui.debug(_("Running package's postremove script for \"{}\" package.").format(package_name))
try:
link.System.Package[package_name].postRemove(
timeout=ctx.dbus_timeout)
......@@ -222,7 +218,7 @@ def post_remove(package_name, metapath, filepath, provided_scripts=None):
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
ctx.ui.debug(_("Calling post remove handlers."))
ctx.ui.debug(_("Calling post remove handlers for \"{}\" package.").format(package_name))
for handler in list(link.System.PackageHandler):
try:
link.System.PackageHandler[handler].postCleanupPackage(
......@@ -233,9 +229,10 @@ def post_remove(package_name, metapath, filepath, provided_scripts=None):
if not is_method_missing(exception):
raise Error(_("Script error: {}").format(exception))
ctx.ui.debug(_("Unregistering scom scripts."))
ctx.ui.debug(_("Unregistering scom scripts of \"{}\" package.").format(package_name))
for scr in scripts:
try:
ctx.ui.debug(_("Unregistering {} script.").format(scr))
link.remove(scr, timeout=ctx.dbus_timeout)
except dbus.exceptions.DBusException as exception:
raise Error(_("Script error: {}").format(exception))
......@@ -25,21 +25,22 @@ import platform
import re
import shutil
import struct
try:
import subprocess
except ImportError:
raise Exception(_("Module: \'subprocess\' can not imported."))
import sys
import termios
import unicodedata
import gettext
from functools import reduce
import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
try:
import subprocess
except ImportError:
raise Exception(_("Module: \'subprocess\' can not imported."))
class Singleton(type):
def __init__(cls, name, bases, dict):
......@@ -699,7 +700,7 @@ def do_patch(sourceDir, patchFile, level=0, name=None, reverse=False):
if level is None and len(paths_m) - 1 == paths_m.index(path_m):
level = check_patch_level(sourceDir, path_m)
if not level is None:
ctx.ui.debug("Detected patch level={0} for {1}".format(level, os.path.basename(patchFile)))
ctx.ui.info("Detected patch level={0} for {1}".format(level, os.path.basename(patchFile)), verbose=True)
break
if level is None:
......@@ -1047,7 +1048,7 @@ def config_changed(config_file):
# recursively remove empty dirs starting from dirpath
def rmdirs(dirpath):
if os.path.isdir(dirpath) and not os.listdir(dirpath):
ctx.ui.debug("Removing empty dir: \"{}\"".format(dirpath))
ctx.ui.info(_("Removing empty dir: \"{}\"").format(dirpath),verbose=True)
os.rmdir(dirpath)
rmdirs(os.path.dirname(dirpath))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment