aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bugzillaBugTriage.js117
1 files changed, 85 insertions, 32 deletions
diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js
index 0058531..0836121 100644
--- a/bugzillaBugTriage.js
+++ b/bugzillaBugTriage.js
@@ -33,6 +33,8 @@ var TriagedDistro = 12;
var jsonDataURL = myConfig.JSONURL ? myConfig.JSONURL :
"http://mcepl.fedorapeople.org/scripts/BugZappers_data.json";
var PCIIDsURL = "http://mcepl.fedorapeople.org/scripts/drm_pciids.json";
+var abrtQueryURL = "https://bugzilla.redhat.com/buglist.cgi"+
+ "?cmdtype=runnamed&namedcmd=all%20NEW%20abrt%20crashes";
//var debug = GM_getValue("debug",false);
var reqCounter = 0;
var msgStrs = {};
@@ -41,6 +43,9 @@ var CommentRe = new RegExp("^\\s*#");
var BlankLineRe = new RegExp("^\\s*$");
var ChipsetRE = new RegExp("^\\(--\\) ([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$");
var ATIgetIDRE = new RegExp("^.*\\(ChipID = 0x([0-9a-fA-F]+)\\).*$");
+var AbrtRE = new RegExp("^\\s*\\[abrt\\]");
+var signalHandlerRE = new RegExp("^\\s*#[0-9]*\\s*<signal handler called>");
+var frameNoRE = new RegExp("^\\s*#([0-9]*)\\s");
// For identification of graphics card
var manuChipStrs = [
@@ -418,7 +423,6 @@ bzPage.prototype.getVersion = function () {
} else {
verNo = Number(verStr);
}
- console.log("getVersion verStr = " + verStr + ", verNo = " + verNo);
return verNo;
};
@@ -506,7 +510,6 @@ bzPage.prototype.setBranding = function () {
brandColor = RHColor;
}
} else if (new RegExp("Fedora").test(this.product)) {
- console.log("version = " + this.version);
if (this.version == 999) {
brandColor = RawhideColor;
} else {
@@ -574,10 +577,8 @@ bzPage.prototype.groupIDs = function (manStr,cardStrID) {
* @return array with chip string and optinoal variants
*/
bzPage.prototype.checkChipStringFromID = function (manufacturerNo,cardNo) {
- console.log("This is the card ID: " + cardNo + " manufactured by " + manufacturerNo);
var soughtID = (manufacturerNo+","+cardNo).toUpperCase();
var outList = PCI_ID_Array[soughtID];
- console.log("nalezeno = " + outList.toSource());
if (outList) {
return outList;
} else {
@@ -597,9 +598,6 @@ bzPage.prototype.fillInWhiteBoard = function (iLine, driverStr) {
var cardIDStr = "";
var cardIDArr = [];
- console.log("driverStr = " + driverStr);
- console.log("iLine: " + iLine);
-
chipSwitchboard:
if (driverStr === "RADEON") {
var cardID = iLine.replace(ATIgetIDRE,"$1");
@@ -609,12 +607,10 @@ bzPage.prototype.fillInWhiteBoard = function (iLine, driverStr) {
if (cardIDArr[1]) {
optionStr = cardIDArr[1];
outStr = this.groupIDs(driverStr,cardIDStr)+"/" + optionStr;
- console.log("cardIDArr = " + cardIDArr.toSource() + ", outStr = "+outStr);
} else {
outStr = this.groupIDs(driverStr,cardIDStr);
optionStr = "";
}
- console.log("found IDs: " + cardIDStr + "," + optionStr);
} else {
outStr = "**** FULLSTRING: " + iLine;
}
@@ -623,7 +619,6 @@ bzPage.prototype.fillInWhiteBoard = function (iLine, driverStr) {
cardIDArr = manuChipStrs.filter(function (el, ind, arr) {
return new RegExp(el[0],"i").test(iLine);
});
- console.log("cardIDArr = " + cardIDArr.toSource());
if (cardIDArr && (cardIDArr.length > 0)) {
cardIDArr = cardIDArr[0];
} else {
@@ -726,15 +721,13 @@ bzPage.prototype.fillInChipMagic = function () {
XorgLogAttID = this.XorgLogAttList[this.XorgLogAttListIndex][1];
attURL = "https://bugzilla.redhat.com/attachment.cgi?id="+XorgLogAttID;
that = this;
- $.get(attURL,function (ret){
+ $.get(attURL,function (ret) {
var interestingLineArr = ret.split("\n").filter(function (v,i,a) {
return ChipsetRE.test(v);
});
if (interestingLineArr.length >0) {
interestingArray = ChipsetRE.exec(interestingLineArr[0]);
interestingLine = $.trim(interestingArray[2].replace(/[\s"]+/g," "));
- console.log("interestingArray = " + interestingArray.toSource() +
- ", interestingLine = " + interestingLine);
var whiteboardInput = $("#status_whiteboard",that.doc);
that.addNewButton(whiteboardInput,"chipmagic","Fill In",
"","CHIPMAGIC",
@@ -782,11 +775,12 @@ bzPage.prototype.queryInNewTab = function(text,component,product) {
* function this.queryInNewTab, and run it.
*/
bzPage.prototype.queryForSelection = function() {
- var text = $.trim(jetpack.selection.text);
- if (text.length < 1) {
+ var text = jetpack.selection.text;
+ console.log("selection = " + text);
+ if (!text) {
text = jetpack.clipboard.get();
}
- if (text.length > 0) {
+ if (text) {
this.queryInNewTab(text, this.component);
}
};
@@ -854,7 +848,6 @@ bzPage.prototype.selectOption = function(id,label) {
*/
bzPage.prototype.hasKeyword = function(str) {
var kwd = $.trim($('#keywords',this.doc).val());
- console.log("Keywords = " + kwd);
return (new RegExp(str).test(kwd));
};
@@ -886,7 +879,6 @@ bzPage.prototype.changeOwner = function(newAssignee) {
* current owner is added to CC list.
* Switch off setting to the default assignee
*/
- console.log("Changing owner of the bug to " + newAssignee);
if (!isInList(newAssignee, this.CCList)) {
$("#newcc",this.doc).text(newAssignee);
}
@@ -1000,7 +992,6 @@ Update the attachment mime type of an attachment. The first argument is a data h
};
*/
bzPage.prototype.createXMLRPCMessage = function(login,password,attachId,mimeType,email) {
- console.log("mimeType = " + mimeType);
if (mimeType === undefined) {
mimeType = "text/plain";
}
@@ -1126,7 +1117,6 @@ bzPage.prototype.addClosingUpstream = function() {
// Fix missing ID on the external_id SELECT
$("select[name='external_id']:first",this.doc).attr("id","external_id");
- console.log("inputBox = " + inputBox.val());
if (inputBox.val().match(/^http.*/)) {
var helpAElem = this.doc.get(0).createElement("a");
wholeURL = inputBox.val();
@@ -1134,13 +1124,10 @@ bzPage.prototype.addClosingUpstream = function() {
var paramsArr = helpAElem.search.replace(/^\?/,'').split('&');
// get ID#
var params = {}, s = [];
- for (var i = 0, ii = paramsArr.length; i < ii; i++) {
- if (!paramsArr[i]) {
- continue;
- }
- s = paramsArr[i].split('=');
+ paramsArr.forEach(function (par,idx,arr) {
+ s = par.split('=');
params[s[0]] = s[1];
- }
+ });
if (params.id) {
externalBugID = parseInt(params.id,10);
inputBox.val(externalBugID);
@@ -1157,8 +1144,6 @@ bzPage.prototype.addClosingUpstream = function() {
// the previous commit?
}
- console.log("refs = " + refs.length);
- console.log("externalBugID = " + externalBugID);
// It is not good to close bug as UPSTREAM, if there is no reference
// to the upstream bug.
if ((externalBugID > 0) || (refs.length > 2)) {
@@ -1276,6 +1261,40 @@ bzPage.prototype.generalPurposeCureForAllDisease = function
};
/**
+ *
+ */
+bzPage.prototype.parseBacktrace = function (ret) {
+ var splitArray = ret.split("\n");
+ var i = 0, ii = splitArray.length;
+ var outStr = "", curLine = "", numStr = "";
+ var lineCounter = 0, endLineNo = 0;
+
+ while ( i < ii ) {
+ if (signalHandlerRE.test(splitArray[i])) {
+ break;
+ }
+ i++;
+ }
+
+ if (i < ii) {
+ lineCounter = parseInt(frameNoRE.exec(splitArray[i])[1],10);
+ endLineNo = lineCounter + 10;
+ curLine = splitArray[i];
+ while ((lineCounter < endLineNo) &&
+ ($.trim(curLine).length >0) && (i < ii)) {
+ outStr += curLine + '\n';
+ numStr = frameNoRE.exec(curLine);
+ if (numStr) {
+ lineCounter = parseInt(numStr[1],10);
+ }
+ i++;
+ curLine = splitArray[i];
+ }
+ }
+ return outStr;
+}
+
+/**
* Main executable functioning actually building all buttons on the page --
* separated into function, so that
* it could be called from onload method of the XMLHTTPRequest.
@@ -1313,8 +1332,8 @@ bzPage.prototype.buildButtons = function (above,below) {
this.fillInChipMagic();
}
}
+
// Add setting default assignee
- console.log("defaultAssignee = " + this.defaultAssignee + ", owner = " + this.owner);
if ((this.defaultAssignee.length > 0) &&
(this.defaultAssignee !== this.owner)) {
this.addNewButton($("#bz_assignee_edit_container", this.doc),
@@ -1349,7 +1368,8 @@ function bzPage(doc) {
this.its = $.trim($("#cf_issuetracker", this.doc).val());
this.CCList = $.makeArray($("#cc", this.doc).val());
this.owner = $("#bz_assignee_edit_container .fn:first", this.doc).text();
- this.defaultAssignee = filterByRegexp(defAssigneeList, this.component).toLowerCase();
+ this.defaultAssignee = filterByRegexp(defAssigneeList,
+ this.component).toLowerCase();
this.maintCCAddr = filterByRegexp(AddrArray,this.component).toLowerCase();
this.XorgLogAttList = [];
@@ -1366,14 +1386,47 @@ function bzPage(doc) {
});
if (badAttachments.length > 0) {
- console.log("we have " + badAttachments.length + " bad attachments.");
var titleElement = $(".bz_alias_short_desc_container:first",this.doc).
- css("background-color","olive").append($(this.createFixAllButton(badAttachments)));
+ css("background-color","olive").
+ append($(this.createFixAllButton(badAttachments)));
badAttachments.forEach(function (x) {
that.addTextLink(x);
});
}
+ // Dig out backtrace
+ this.btSnippet = "";
+
+ var bugTitle = $("#short_desc_nonedit_display", this.doc).text();
+ if (AbrtRE.test(bugTitle)) {
+ $(".bz_alias_short_desc_container:first", this.doc).
+ append("<a href=''>Abrt bugs</a>").click(function() {
+ jetpack.tabs.open(abrtQueryURL);
+ });
+ if (!this.hasKeyword("Triaged")) {
+ var btAttachments = this.attachments.filter(function (att,idx,arr) {
+ return (/backtrace/.test(att[0]));
+ });
+ // TODO we need to go through all backtrace attachments, but
+ // just the first one will do for now, we would need to do async parsing
+ that = this;
+ btAttachments.forEach(function (x) {
+ attURL = "https://bugzilla.redhat.com/attachment.cgi?id=" + x[1];
+ console.log("attURL = " + attURL);
+ console.log("btSnippet = " + that.btSnippet);
+ if (!that.btSnippet) {
+ var btRaw = $.get(attURL,function (ret) {
+ that.btSnippet = that.parseBacktrace(ret);
+ console.log("btSnippet = " + that.btSnippet.length);
+ if (that.btSnippet) {
+ that.addTextToComment(that.btSnippet);
+ }
+ });
+ }
+ });
+ }
+ }
+
// Take care of signature for Fedora bugzappers
if (signatureFedoraString.length > 0) {
// (or a form named "changeform")