ABRT/libreport's bug deduplication should work in a better way if we provide it some more data. Patches 2/3 and 3/3 are needed for that together with the associated patch for python-meh.
PATCH 1/3 just fixes the makeupdates script to place _isys.so where it is expected to be. Maybe we should change the place where it lives (from pyanaconda directory to pyanaconda/isys), but for now let's use this fix.
Vratislav Podzimek (3): Fix _isys.so location in the updates.img Add release number to the result of getAnacondaVersion Tell python-meh architecture of the anaconda package
pyanaconda/exception.py | 1 + pyanaconda/isys/Makefile.am | 2 +- scripts/makeupdates | 5 +---- 3 files changed, 3 insertions(+), 5 deletions(-)
_isys.so is, for some reason, expected to live under pyanaconda/ not pyanaconda/isys.
Also don't copy isys/__init__.py always. This basically reverts the commit 56787f6a49174b14ed9e916d6e022c53305f716c, but leaves some pieces of it in place.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- scripts/makeupdates | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/scripts/makeupdates b/scripts/makeupdates index 1ffb166..783b410 100755 --- a/scripts/makeupdates +++ b/scripts/makeupdates @@ -227,18 +227,15 @@ def copyUpdatedIsys(updates, cwd): # $updatedir/run/install/updates. tmpupdates = updates.rstrip('/') if not tmpupdates.endswith("/run/install/updates/pyanaconda"): - tmpupdates = os.path.join(tmpupdates, "run/install/updates/pyanaconda/isys") + tmpupdates = os.path.join(tmpupdates, "run/install/updates/pyanaconda")
if not os.path.isdir(tmpupdates): os.makedirs(tmpupdates)
isysmodule = os.path.realpath(cwd + '/pyanaconda/isys/.libs/_isys.so') - isysinit = os.path.realpath(cwd + '/pyanaconda/isys/__init__.py')
if os.path.isfile(isysmodule): shutil.copy2(isysmodule, tmpupdates) - if os.path.isfile(isysinit): - shutil.copy2(isysinit, tmpupdates)
def copyUpdatedWidgets(updates, cwd): os.chdir(cwd)
python-meh can make use of it and it only adds a piece of information to logs.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/isys/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/isys/Makefile.am b/pyanaconda/isys/Makefile.am index 35e9206..adffcbb 100644 --- a/pyanaconda/isys/Makefile.am +++ b/pyanaconda/isys/Makefile.am @@ -25,7 +25,7 @@ ISYS_SRCS = devices.c lang.c \
dist_noinst_HEADERS = *.h
-ISYS_CFLAGS = -DVERSION='"$(PACKAGE_VERSION)"' \ +ISYS_CFLAGS = -DVERSION='"$(PACKAGE_VERSION)-$(PACKAGE_RELEASE)"' \ $(NETWORKMANAGER_CFLAGS) $(LIBNL_CFLAGS) $(LIBNM_GLIB_CFLAGS) \ $(SELINUX_CFLAGS) ISYS_LIBS = $(RESOLV_LIBS) $(ZLIB_LIBS) \
I believe it's safe to use uname as we will hardly ever run x86 anaconda on x86_64 kernel.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/exception.py | 1 + 1 file changed, 1 insertion(+)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index cfb84ed..5a9c816 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -166,6 +166,7 @@ def initExceptionHandling(anaconda):
conf = Config(programName="anaconda", programVersion=isys.getAnacondaVersion(), + programArch=os.uname()[4], attrSkipList=["_intf._actions", "_intf._currentAction._xklwrapper", "_intf._currentAction.language.translations",
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Wed, 3 Apr 2013 13:13:53 +0200 Vratislav Podzimek vpodzime@redhat.com wrote:
I believe it's safe to use uname as we will hardly ever run x86 anaconda on x86_64 kernel.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/exception.py | 1 + 1 file changed, 1 insertion(+)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index cfb84ed..5a9c816 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -166,6 +166,7 @@ def initExceptionHandling(anaconda):
conf = Config(programName="anaconda", programVersion=isys.getAnacondaVersion(),
programArch=os.uname()[4], attrSkipList=["_intf._actions", "_intf._currentAction._xklwrapper", "_intf._currentAction.language.translations",
this wont work for arm,
uname -m will give you armv7l but the rpm arch is armv7hl maybe not a huge deal since we are not supporting armv7l going forward
Dennis
On Sat, 2013-04-06 at 11:11 -0500, Dennis Gilmore wrote:
On Wed, 3 Apr 2013 13:13:53 +0200 Vratislav Podzimek vpodzime@redhat.com wrote:
I believe it's safe to use uname as we will hardly ever run x86 anaconda on x86_64 kernel.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/exception.py | 1 + 1 file changed, 1 insertion(+)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index cfb84ed..5a9c816 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -166,6 +166,7 @@ def initExceptionHandling(anaconda):
conf = Config(programName="anaconda", programVersion=isys.getAnacondaVersion(),
programArch=os.uname()[4], attrSkipList=["_intf._actions", "_intf._currentAction._xklwrapper", "_intf._currentAction.language.translations",this wont work for arm,
uname -m will give you armv7l but the rpm arch is armv7hl maybe not a huge deal since we are not supporting armv7l going forward
Dennis
I hope it is not a huge deal, but good to know anyway. Thanks! I'll bother with that in case it is needed. And maybe it should be fixed in a different place.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- meh/handler.py | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/meh/handler.py b/meh/handler.py index 6427656..20f5bad 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -239,6 +239,9 @@ class ExceptionHandler(object): #skip files we cannot read continue
+ # tell ABRT this is a Python exception report + params["analyzer"] = "Python" + signature = report.createPythonUnhandledExceptionSignature(**params)
# We don't want to automatically quit here since the user may wish to
Bad file, you can ignore this one.
It needs it for better deduplication.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- meh/__init__.py | 6 ++++++ meh/dump.py | 34 +++++++++++++++++++++------------- meh/handler.py | 33 +++++++++++++++++++++++++++++---- 3 files changed, 56 insertions(+), 17 deletions(-)
diff --git a/meh/__init__.py b/meh/__init__.py index d09a131..c24636d 100644 --- a/meh/__init__.py +++ b/meh/__init__.py @@ -77,6 +77,7 @@ class Config(object): Both programName and programVersion are used throughout the exception handler, so must be set. + programArch -- The architecture of the erroring program. """ self.attrSkipList = [] self.fileList = [] @@ -84,6 +85,7 @@ class Config(object): self.callbackDict = dict() self.programName = None self.programVersion = None + self.programArch = None
# Override the defaults set above with whatever's passed in as an # argument. Unknown arguments get thrown away. @@ -135,3 +137,7 @@ ExceptionInfo = namedtuple("ExceptionInfo", ["type", "value", "stack"])
# ExceptionInfo instance plus the object that should be dumped DumpInfo = namedtuple("DumpInfo", ["exc_info", "object"]) + +# information about a package (as provided e.g. by rpm) +PackageInfo = namedtuple("PackageInfo", ["name", "version", "release", "epoch", + "arch"]) diff --git a/meh/dump.py b/meh/dump.py index 4639327..7024341 100644 --- a/meh/dump.py +++ b/meh/dump.py @@ -29,6 +29,7 @@ import traceback import types import sys import codecs +from meh import PackageInfo
class ExceptionDump(object): """This class represents a traceback and contains several useful methods @@ -128,8 +129,8 @@ class ExceptionDump(object):
@param file_: filename @type file_: string - @return: tuple containing package name and component name for the file - @rtype: tuple with 2 items + @return: tuple containing package info and component name for the file + @rtype: (PackageInfo, str) @throws RPMinfoError: if package and component for the file cannot be found
""" @@ -142,8 +143,9 @@ class ExceptionDump(object): except StopIteration: raise RPMinfoError("Cannot get package and component for file "+ "{0}".format(file_)) - package = "{0}-{1}-{2}.{3}".format(header["name"], header["version"], - header["release"], header["arch"]) + pkg_info = PackageInfo(header["name"], header["version"], + header["release"], header["epoch"], + header["arch"])
# cuts the name from the NVR format: foo-blah-2.8.8-2.fc17.src.rpm name_end = len(header["sourcerpm"]) @@ -156,7 +158,7 @@ class ExceptionDump(object):
component = header["sourcerpm"][:name_end]
- return (package, component) + return (pkg_info, component)
def get_release_version(): """Returns release version (according to RELEASE_NAME_FILE)""" @@ -180,12 +182,18 @@ class ExceptionDump(object):
for (frame, fn, lineno, func, ctx, idx) in self.stack: try: - packages.add(get_package_and_component(fn)[0]) + pkg_info = get_package_and_component(fn)[0] + package = "{0.name}-{0.version}-{0.release}.{0.arch}".format( + pkg_info) + packages.add(package) except RPMinfoError: continue
try: - packages.discard(get_package_and_component()[0]) + pkg_info = get_package_and_component()[0] + package = "{0.name}-{0.version}-{0.release}.{0.arch}".format( + pkg_info) + packages.discard(package) except RPMinfoError: pass return packages @@ -209,11 +217,10 @@ class ExceptionDump(object):
#--begining of the method _get_environment_info-- - package, component = None, None try: - package, component = get_package_and_component() + pkg_info, component = get_package_and_component() except RPMinfoError as rpmierr: - package = None + pkg_info = None component = None
release_ver = get_release_version() @@ -228,10 +235,11 @@ class ExceptionDump(object): ret["component"] = component ret["executable"] = sys.argv[0] ret["kernel"] = os.uname()[2] - if package: - ret["package"] = package + if pkg_info: + ret["pkg_info"] = pkg_info ret["release"] = get_release_version() - ret["other involved packages"] = other_packages + if other_packages: + ret["other involved packages"] = other_packages ret["environ"] = "\n".join(get_environment_variables())
return ret diff --git a/meh/handler.py b/meh/handler.py index 20f5bad..b4ec4c7 100644 --- a/meh/handler.py +++ b/meh/handler.py @@ -23,6 +23,7 @@ from network import hasActiveNetDev import signal import sys import report +import traceback
import gettext _ = lambda x: gettext.ldgettext("python-meh", x) @@ -203,12 +204,33 @@ class ExceptionHandler(object):
params = dict() params.update(self.exn.environment_info) + pkg_info = params.pop("pkg_info", None) + #if rpmdb queries fail (anaconda), use self.conf.* values if "component" not in params: params["component"] = self.conf.programName - if "package" not in params: - params["package"] = \ - "{0.programName}-{0.programVersion}".format(self.conf) + + if pkg_info: + params["pkg_name"] = pkg_info.name + params["pkg_version"] = pkg_info.version + params["pkg_release"] = pkg_info.release + params["pkg_epoch"] = pkg_info.epoch + params["pkg_arch"] = pkg_info.arch + params["package"] = "%s-%s-%s.%s" % (pkg_info.name, pkg_info.version, + pkg_info.release, pkg_info.arch) + else: + params["pkg_name"] = self.conf.programName + version, release = self.conf.programVersion.rsplit("-", 1) + params["pkg_version"] = version + params["pkg_release"] = release + # we don't support specifying epoch in the config object and only + # the anaconda which is not using epochs doesn't have the RPMdb to + # query + params["pkg_epoch"] = "0" + params["pkg_arch"] = self.conf.programArch + params["package"] = "{0.programName}-{0.programVersion}".format( + self.conf) + params["hashmarkername"] = self.conf.programName params["duphash"] = self.exn.hash params["reason"] = self.exn.desc @@ -239,8 +261,11 @@ class ExceptionHandler(object): #skip files we cannot read continue
- # tell ABRT this is a Python exception report + # tell ABRT some more things it requires params["analyzer"] = "Python" + params["backtrace"] = "".join(traceback.format_exception(exc_info.type, + exc_info.value, + exc_info.stack))
signature = report.createPythonUnhandledExceptionSignature(**params)
ABRT/libreport's bug deduplication should work in a better way if we provide it some more data. Patches 2/3 and 3/3 are needed for that together with the associated patch for python-meh.
PATCH 1/3 just fixes the makeupdates script to place _isys.so where it is expected to be. Maybe we should change the place where it lives (from pyanaconda directory to pyanaconda/isys), but for now let's use this fix.
These look fine.
- Chris
anaconda-patches@lists.fedorahosted.org