From 9e391937824df979077f09d873fb83a73a7e73c8 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 18 Jul 2010 19:56:43 +0200 Subject: Add a tool to analyze Xorg.0.log files Fixes #1 --- jsons/Config_data.json | 4 ++-- lib/bzpage.js | 6 ++++++ lib/main.js | 11 ++++++---- lib/rhbzpage.js | 54 +++++++++++++++++++++++++++++++++++++++----------- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/jsons/Config_data.json b/jsons/Config_data.json index ff4c8f1..2b9e957 100644 --- a/jsons/Config_data.json +++ b/jsons/Config_data.json @@ -101,9 +101,9 @@ "suspiciousComponents": [ ], - "downloadJSON": { + "downloadJSON": [ - }, + ], "objectStyle": "RH", "matches": [ "https://bugzilla.redhat.com/show_bug.cgi.*", diff --git a/lib/bzpage.js b/lib/bzpage.js index 9fa02c0..019547a 100644 --- a/lib/bzpage.js +++ b/lib/bzpage.js @@ -79,6 +79,12 @@ var BZPage = function BZPage(win, config) { this.suspiciousComponents = config.gJSONData.configData.suspiciousComponents; } + if ("XorgLogAnalysis" in config.gJSONData.configData) { + console.log("configData = " + config.gJSONData.configData); + console.log("XorgLogAnalysis = " + config.gJSONData.configData.XorgLogAnalysis); + this.xorglogAnalysis = config.gJSONData.configData.XorgLogAnalysis; + } + if ("submitsLogging" in config.gJSONData.configData && config.gJSONData.configData.submitsLogging) { this.log = config.logger; diff --git a/lib/main.js b/lib/main.js index 66f90f9..c5df73d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -86,14 +86,17 @@ function initialize(callback) { // Get additional tables if ("downloadJSON" in config.gJSONData.configData) { var URLsList = config.gJSONData.configData.downloadJSON; - for (var dwnldObj in URLsList) { + var dwnldObj = ""; + URLsList.forEach(function (arr) { + var title = arr[0]; + var url = arr[1]; Request({ - url: URLsList[dwnldObj], + url: url, onComplete: function() { - config[dwnldObj] = this.response.json; + config[title] = this.response.json; } }).get(); - } + }, this); } if (!myStorage.logs) { diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index 6fa16ea..ddee250 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -69,6 +69,8 @@ var RHBugzillaPage = function RHBugzillaPage(win, config) { this.chipMagicInterestingLine = ""; this.login = this.getLogin(); + this.maintCCAddr = util.filterByRegexp(this.constantData.CCmaintainer, + this.component); var ITbutton = this.doc.getElementById("cf_issuetracker"); this.its = ITbutton ? ITbutton.value.trim() : ""; @@ -111,9 +113,8 @@ var RHBugzillaPage = function RHBugzillaPage(win, config) { this.checkComments(); // TODO Get compiz bugs as well - if ((config.gJSONData.configData.PCIIDsURL - && (config.PCI_ID_Array.length > 0)) - && this.maintCCAddr === "xgl-maint@redhat.com") { + if (config.PCI_ID_Array && + (this.maintCCAddr == "xgl-maint@redhat.com")) { // Add find chip magic button var whiteboard_string = this.doc.getElementById("status_whiteboard").value; if (!/card_/.test(whiteboard_string)) { @@ -219,6 +220,7 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) this.markBugTriaged(); break; case "chipMagic": + // it's true, not array ??? FIXME var splitArr = cmdParams.split("\t"); this.fillInWhiteBoard(splitArr[0], splitArr[1]); break; @@ -404,7 +406,7 @@ RHBugzillaPage.prototype.setBranding = function() { } // we should make visible whether maintCCAddr is in CCList - if (util.isInList(this.maintCCAddr, this.CCList)) { + if (util.isInList(this.doc.getElementById("assigned_to").value, this.CCList)) { var ccEditBoxElem = this.doc.getElementById("cc_edit_area_showhide"); // ccEditBoxElem.textContent = "*"+ccEditBoxElem.textContent; ccEditBoxElem.style.color = "navy"; @@ -527,6 +529,19 @@ RHBugzillaPage.prototype.fillInChipMagic = function () { return; } + // FIXME add this.XorgLogAttList.forEach(addCheckButton) when configured so + // in this.config + if (this.xorglogAnalysis) { + this.XorgLogAttList.forEach(function (row) { + var elemS = row[4].getElementsByTagName("td"); + var elem = elemS[elemS.length - 1]; + elem.innerHTML += "
cX"; + elem.addEventListener("click", function(x) { + that.analyzeXorgLog(row[1]); + }, false); + }, this); + }; + XorgLogAttID = this.XorgLogAttList[this.XorgLogAttListIndex][1]; attURL = "https://bugzilla.redhat.com/attachment.cgi?id="+XorgLogAttID; @@ -619,7 +634,6 @@ RHBugzillaPage.prototype.queryForSelection = function() { * Search simple query in the upstream bugzilla appropriate for the component. */ RHBugzillaPage.prototype.queryUpstream = function() { - console.log("Querying upstream!"); var text = this.getSelectionOrClipboard(); if (text) { text = encodeURIComponent(text.trim()); @@ -627,10 +641,6 @@ RHBugzillaPage.prototype.queryUpstream = function() { var urlBase = util.filterByRegexp(queryUpstreamBugsURLArray, this.component); tabs.open({ url: urlBase + text, - inBackground: true, - onOpen: function (t) { - t.activate(); - } }); } }; @@ -695,6 +705,29 @@ RHBugzillaPage.prototype.parseAttachmentLine = function(inElem) { return [ attName, id, MIMEtype, size, inElem ]; }; +RHBugzillaPage.prototype.analyzeXorgLog = function analyzeXorgLog(attachID) { + var infoWin = this.win.open("", "Check att. " + attachID, + "width=512,height=640,status=no,location=no"); + var doc = infoWin.document; + doc.body.innerHTML = "
";
+    var preElem = doc.getElementById("textPre");
+    var soughtLinesRE = /^\s*(\[[0-9 .]*\])?\s*\((EE|WW)\)|\s*Backtrace"/;
+
+    attURL = "https://bugzilla.redhat.com/attachment.cgi?id=" + attachID;
+    var that = this;
+    Request({
+        url: attURL,
+        onComplete: function() {
+            var logArr = this.response.text.split("\n");
+            logArr.forEach(function (line) {
+                if (soughtLinesRE.test(line)) {
+                    preElem.innerHTML += line+"\n";
+                }
+            });
+        }
+    }).get();
+};
+
 /**
  * Return string with the ID for the external_id SELECT for external bugzilla
  *
@@ -791,9 +824,6 @@ RHBugzillaPage.prototype.fixAttachById = function(id, type, email) {
  * @return button fixing all bad Attachments
  */
 RHBugzillaPage.prototype.createFixAllButton = function(list) {
-    if (!xrpc.XMLRPCMessage) {
-        return;
-    }
     var that = this;
     var elem = this.doc.createElement("a");
     elem.setAttribute("href", "");
-- 
cgit