diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-02-24 23:49:39 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-02-24 23:49:39 +0100 |
commit | c336792e45b8567746cbb5aa7cf07543aebcd4f7 (patch) | |
tree | c0d8907c36302c9fe02e95919c3bc013f645f700 /data/lib | |
parent | 5b9f263ac1485c0ab18c2d42c5cd18746208bad4 (diff) | |
download | bugzilla-triage-c336792e45b8567746cbb5aa7cf07543aebcd4f7.tar.gz |
Nouveau doesn't dedicated data, so just the Chipset line is parsed.
Diffstat (limited to 'data/lib')
-rw-r--r-- | data/lib/cssUtils.js | 77 | ||||
-rw-r--r-- | data/lib/rhbzpage.js | 100 |
2 files changed, 68 insertions, 109 deletions
diff --git a/data/lib/cssUtils.js b/data/lib/cssUtils.js deleted file mode 100644 index da24aa2..0000000 --- a/data/lib/cssUtils.js +++ /dev/null @@ -1,77 +0,0 @@ -/*global console: false */ -/*jslint onevar: false */ -// Released under the MIT/X11 license -// http://www.opensource.org/licenses/mit-license.php -"use strict"; - -/** - * get CSS style from all styles in the document with given name - * - * @param ruleName String with the identificator of the rule (the same - * used on the page itself) - * @param deleteFlag ??? - * @return ??? (exact type of the object returned FIXME) - * - * e.g., getCSSRule(".tramp") gives particular style - * from http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript - */ -var getCSSRule = exports.getCSSRule = function getCSSRule(ruleName, deleteFlag) { - ruleName=ruleName.toLowerCase(); // style rules are case insensitive - var foundRuleIdx = 0; - - Array.forEach(document.styleSheets, function (sheet) { - var ruleIdx = 0; - foundRule = Array.reduce(sheet.cssRules, function (ruleIdx, curRule, idx) { - if ((foundRuleIdx === 0) && (curRule. - selectorText.toLowerCase() == ruleName)) { - return idx; - } - return foundRuleIdx; - }); - if (foundRules > 0) { - if (deleteFlag === "delete") { - sheet.deleteRule(foundRuleIdx); - return true; - } - return sheet.cssRules[foundRuleIdx]; - } - }); - return false; // we found NOTHING! -}; - -/** - * - */ -exports.killCSSRule = function killCSSRule (ruleName) { - return getCSSRule(ruleName, "delete"); -}; - -/** - * - */ -exports.addCSSRule = function addCSSRule(ruleName, stylesheetTitle) { - var sheets = {}; - if (!getCSSRule(ruleName)) { - if (stylesheetTitle) { - sheets = Array.filter(document.styleSheets,function (sheet) { - return (sheet.title === stylesheetTitle); - }); - } else { - sheets = document.styleSheets; - } - sheets[0].insertRule(ruleName+' { }', 0); - } - return getCSSRule(ruleName); -}; - -/** - * - */ -exports.addCSSStylesheet = function addCSSStylesheet (StylesheetName) { - var cssNode = document.createElement("style"); - cssNode.type = 'text/css'; - cssNode.rel = 'stylesheet'; - cssNode.media = 'screen'; - cssNode.title = StylesheetName; - document.getElementsByTagName("head")[0].appendChild(cssNode); -}; diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js index 026e7ac..8d52174 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -19,16 +19,30 @@ var RawhideColor = new Color(0, 119, 0); // or "green", or RGB 0, 119, 0, or // 120, 0, 23 var RHITColor = new Color(102, 0, 102); // RGB 102, 0, 102; HSL 300, 0, 20 +// [ 126.386] (--) NOUVEAU(0): Chipset: "NVIDIA NVaf" var logAnalyzeLogic = { "AnalyzeInterestingLine": { - "re": "^\\[[ .0-9]+\\]\\s*\\(--\\) PCI:\\*\\([0-9:]+\\)\\s*" + - "([0-9a-f:]+).*$", - "func": chipsetMagic + /* + [ 126.378] (--) PCI:*(0:4:0:0) 10de:08a0:106b:00c2 rev 162, Mem @ 0xd2000000/16777216, \ + 0xc0000000/268435456, 0xd0000000/33554432, I/O @ 0x00001000/128, BIOS @ 0x????????/131072 + */ + re: [ + "^\\[[ .0-9]+\\]\\s*\\(--\\) PCI:\\*\\([0-9:]+\\)\\s*" + + "([0-9a-f:]+).*$", + "^\\s*\\[?[ 0-9.]*\\]?\\s*\\(--\\) "+ + "([A-Za-z]+)\\([0-9]?\\): Chipset: (.*)$", + ], + func: chipsetMagic }, + /* + [ 126.385] (WW) Falling back to old probe method for vesa + [ 126.385] (WW) Falling back to old probe method for fbdev + [ 126.386] (--) NOUVEAU(0): Chipset: "NVIDIA NVaf" + Backtrace: + */ "AnalyzeXorgLogBacktrace": { - "re": "^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.*"+ - " [cC]hipsets?: )|\\s*Backtrace", - "func": analyzeXorg + re: "^\\s*(\\[[0-9 .]*\\])?\\s*(\\((EE|WW)\\)|.* [cC]hipset:.*)|\\s*Backtrace", + func: analyzeXorg } }; @@ -540,25 +554,33 @@ function addCheckXorgLogLink(attList) { * Given line to be parsed, find out which chipset it is and fill in the * whiteboard * - * @param iLine String with the whole unparsed "interesting line" + * @param PCIidArrObj object with two fields + * id Array manufacturer-ID and product-ID (PCI IDs) + * chipsetLine RE * @param driverStr String with the driver name * @return None */ -function fillInWhiteBoard(PCIidArr) { +function fillInWhiteBoard(PCIidArrObj) { var outStr = ""; var cardIDStr = ""; var cardIDArr = []; var cardName = ""; - var PCIid = (PCIidArr[0] + "," + PCIidArr[1]).toUpperCase(); + var PCIid = (PCIidArrObj.id[0] + "," + PCIidArrObj.id[1]).toUpperCase(); - try { - cardName = constantData.chipNames[PCIid][0]; - } catch (e if e instanceof TypeError) { - alert("PCI ID " + PCIid + " is not known!"); - return ; // early termination - } catch (e) { - throw e; + if (PCIidArrObj.id[0].toLowerCase() == "10de") { + cardName = PCIidArrObj.chipsetLine[2].replace(/\s*nvidia\s*/ig,""). + replace('"','','g'); + } else { + try { + cardName = constantData.chipNames[PCIid][0]; + } catch (e if e instanceof TypeError) { + alert("PCI ID " + PCIid + " is not known!"); + return ; // early termination + } catch (e) { + throw e; + } } + clickMouse("editme_action"); var titleElem = document.getElementById('short_desc'); titleElem.value = '[' + cardName + ']\u00A0' + titleElem.value; @@ -579,14 +601,16 @@ function fillInChipMagic(XlogID) { function chipsetMagic (interestingLineArr) { // parse Xorg.0.log - var RE = new RegExp(logAnalyzeLogic['AnalyzeInterestingLine'].re); if (interestingLineArr.length >0) { - var interestingArray = RE.exec(interestingLineArr[0]); + var interestingArray = interestingLineArr[0]; if (interestingArray.length > 1) { var interestingPCIID = interestingArray[1].trim().split(":"); createNewButton("short_desc_nonedit_display", false, { "name": "Fill In", - "chipMagic": interestingPCIID, + "chipMagic": { + "id": interestingPCIID, + "chipsetLine": interestingLineArr[1] + }, }); } } @@ -594,21 +618,20 @@ function chipsetMagic (interestingLineArr) { function analyzeXorg(results) { var innerString = ""; - results = removeDuplicates(results); - // Remove headers - if (results.length >= 1) { - results.splice(0, 1); - } + if (results.length > 0) { - results.forEach(function(l) { - innerString += l + "<br>\n"; + results.splice(0, 1); // remove headers + results.sort(); + + results.forEach(function(lRE) { + innerString += lRE.input + "<br>\n"; }); - // Add a summary innerString += "----------<br>\n" + results.length + " interesting lines found."; } else { innerString += "No matching lines found!"; } + postMessage(new Message("OpenStringInPanel", '<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">' + "<html><head><title>Xorg.0.log analysis</title></head><body><pre>\n" + @@ -624,11 +647,24 @@ function analyzeXorgLog(attachID, backMsg) { } function findInterestingLine(wholeLog, backMsg) { - var RE = new RegExp(logAnalyzeLogic[backMsg].re); - var results = wholeLog.split("\n"). - filter(function(line) { - return (RE.test(line)); - }); + var REstr = logAnalyzeLogic[backMsg].re; + var REarr = []; + if (typeof REstr == "string") { + REarr = [new RegExp(REstr)]; + } else if (Array.isArray(REstr)) { + REarr = REstr.map(function (reone) { + return new RegExp(reone); + }); + } + var results = []; + wholeLog.split("\n"). + forEach(function(line) { + REarr.forEach(function (re, reIdx) { + if (re.test(line)) { + results.push(re.exec(line)); + } + }); + }); logAnalyzeLogic[backMsg].func(results); } |