summaryrefslogtreecommitdiffstats
path: root/src/retrace
diff options
context:
space:
mode:
authorMichal Toman <mtoman@redhat.com>2011-03-07 11:45:35 +0100
committerMichal Toman <mtoman@redhat.com>2011-03-07 11:45:35 +0100
commit1e2ccb9242a76abeb27ce98aa44c08b3449cccfb (patch)
tree29e07c1e57ab2b3f83cef15cd3da95eb5def3382 /src/retrace
parent89e25718030bc713314e996ef386f8f295fe9b0f (diff)
downloadabrt-1e2ccb9242a76abeb27ce98aa44c08b3449cccfb.tar.gz
abrt-1e2ccb9242a76abeb27ce98aa44c08b3449cccfb.tar.xz
abrt-1e2ccb9242a76abeb27ce98aa44c08b3449cccfb.zip
retrace server: do not require 'architecture' file
Diffstat (limited to 'src/retrace')
-rw-r--r--src/retrace/retrace.py15
-rwxr-xr-xsrc/retrace/worker.py35
2 files changed, 29 insertions, 21 deletions
diff --git a/src/retrace/retrace.py b/src/retrace/retrace.py
index 08acfb89..46adb740 100644
--- a/src/retrace/retrace.py
+++ b/src/retrace/retrace.py
@@ -8,7 +8,7 @@ import sqlite3
from webob import Request
from subprocess import *
-REQUIRED_FILES = ["architecture", "coredump", "executable", "package"]
+REQUIRED_FILES = ["coredump", "executable", "package"]
DF_BIN = "/bin/df"
DU_BIN = "/usr/bin/du"
@@ -96,6 +96,19 @@ def unpacked_size(archive):
pipe.close()
return None
+def guess_arch(coredump_path):
+ pipe = Popen(["file", coredump_path], stdout=PIPE).stdout
+ output = pipe.read()
+ pipe.close()
+
+ if "x86-64" in output:
+ return "x86_64"
+
+ if "80386" in output:
+ return "i386"
+
+ return None
+
def gen_task_password(taskdir):
generator = random.SystemRandom()
taskpass = ""
diff --git a/src/retrace/worker.py b/src/retrace/worker.py
index 9b04b799..2bb33237 100755
--- a/src/retrace/worker.py
+++ b/src/retrace/worker.py
@@ -60,20 +60,14 @@ if __name__ == "__main__":
LOG.close()
sys.exit(15)
- # read architecture file
- try:
- arch_file = open("%s/crash/architecture" % savedir, "r")
- arch = repoarch = arch_file.read()
- arch_file.close()
- except Exception as ex:
- LOG.write("Unable to read architecture from 'architecture' file: %s.\n" % ex)
+ # read architecture from coredump
+ arch = guess_arch("%s/crash/coredump" % savedir)
+
+ if not arch:
+ LOG.write("Unable to read architecture from 'coredump' file.\n")
LOG.close()
sys.exit(16)
- # required hack for public repos
- if arch == "i686":
- repoarch = "i386"
-
# read release, distribution and version from release file
release_path = "%s/crash/os_release" % savedir
if not os.path.isfile(release_path):
@@ -111,11 +105,12 @@ if __name__ == "__main__":
LOG.close()
sys.exit(19)
+ packages = crash_package
+
# read required packages from coredump
- packages = "%s.%s" % (crash_package, arch)
try:
# ToDo: deal with not found build-ids
- pipe = Popen(["/usr/share/abrt-retrace/coredump2packages.py", "%s/crash/coredump" % savedir, "--repos=retrace-%s-%s-%s*" % (distribution, version, repoarch)], stdout=PIPE).stdout
+ pipe = Popen(["/usr/share/abrt-retrace/coredump2packages.py", "%s/crash/coredump" % savedir, "--repos=retrace-%s-%s-%s*" % (distribution, version, arch)], stdout=PIPE).stdout
section = 0
crash_package_or_component = None
for line in pipe.readlines():
@@ -163,38 +158,38 @@ if __name__ == "__main__":
mockcfg.write("\n")
mockcfg.write("[fedora]\n")
mockcfg.write("name=fedora\n")
- mockcfg.write("baseurl=file://%s/%s-%s-%s/\n" % (CONFIG["RepoDir"], distribution, version, repoarch))
+ mockcfg.write("baseurl=file://%s/%s-%s-%s/\n" % (CONFIG["RepoDir"], distribution, version, arch))
mockcfg.write("failovermethod=priority\n")
mockcfg.write("\n")
mockcfg.write("[fedora-debuginfo]\n")
mockcfg.write("name=fedora-debuginfo\n")
- mockcfg.write("baseurl=file://%s/%s-%s-%s-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, repoarch))
+ mockcfg.write("baseurl=file://%s/%s-%s-%s-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, arch))
mockcfg.write("failovermethod=priority\n")
mockcfg.write("\n")
mockcfg.write("[updates]\n")
mockcfg.write("name=updates\n")
- mockcfg.write("baseurl=file://%s/%s-%s-%s-updates/\n" % (CONFIG["RepoDir"], distribution, version, repoarch))
+ mockcfg.write("baseurl=file://%s/%s-%s-%s-updates/\n" % (CONFIG["RepoDir"], distribution, version, arch))
mockcfg.write("failovermethod=priority\n")
mockcfg.write("\n")
mockcfg.write("[updates-debuginfo]\n")
mockcfg.write("name=updates-debuginfo\n")
- mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, repoarch))
+ mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, arch))
mockcfg.write("failovermethod=priority\n")
mockcfg.write("\n")
mockcfg.write("[updates-testing]\n")
mockcfg.write("name=updates-testing\n")
- mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-testing/\n" % (CONFIG["RepoDir"], distribution, version, repoarch))
+ mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-testing/\n" % (CONFIG["RepoDir"], distribution, version, arch))
mockcfg.write("failovermethod=priority\n")
mockcfg.write("\n")
mockcfg.write("[updates-testing-debuginfo]\n")
mockcfg.write("name=updates-testing-debuginfo\n")
- mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-testing-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, repoarch))
+ mockcfg.write("baseurl=file://%s/%s-%s-%s-updates-testing-debuginfo/\n" % (CONFIG["RepoDir"], distribution, version, arch))
mockcfg.write("failovermethod=priority\n")
mockcfg.write("\n")
# custom ABRT repo with ABRT 2.0 binaries - obsolete after release of ABRT 2.0
mockcfg.write("[abrt]\n")
mockcfg.write("name=abrt\n")
- mockcfg.write("baseurl=http://repos.fedorapeople.org/repos/mtoman/abrt20/%s-%s/%s/\n" % (distribution, version, repoarch))
+ mockcfg.write("baseurl=http://repos.fedorapeople.org/repos/mtoman/abrt20/%s-%s/%s/\n" % (distribution, version, arch))
mockcfg.write("failovermethod=priority\n")
mockcfg.write("\n")
mockcfg.write("\"\"\"\n")