From patchwork Mon Dec 16 16:00:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Kuster X-Patchwork-Id: 181748 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp4482649och; Mon, 16 Dec 2019 08:02:47 -0800 (PST) X-Google-Smtp-Source: APXvYqyf5MgpcfSueQ5BAY97TsLMyd7xuM35l4srcmgHTc+5DMV0n4cCNoT7vxBjTMxPNEVGgMlq X-Received: by 2002:a62:a515:: with SMTP id v21mr16791284pfm.128.1576512167383; Mon, 16 Dec 2019 08:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576512167; cv=none; d=google.com; s=arc-20160816; b=KwuvYDfF6N7hnfsmYVdtMwa0IXWVPVLAL/YL0OvQT3np4OZK+cQZMkcpFdECrQIsmr v3rlAdZNH+JBlI+LtgR2qcX7e65kXwxP022rPbRHWMESkSkSrCJ0tS9sbwzcCZ9U75ip tl5bsuqtzKGoy5+P9d7wv0LFGYUjRdFqhwlvDFdEkq/PUGkfRO5+s8zyAknbIZaAmHA1 J5CcESmpxVs9Uf0k/a3ufWpildMQi/8P4jK6xziiiZ4hY0OIZwKfi7V8J0J9PDDhvQ3k 6kjEinucYlFKFe3TSnifrnXN2KsBKuu/U8GpCPt1hQVtvZyFKSiw9DuDUFYT5GbZvHKD w+JA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=D9n1YvEhURD3MSU85xI9ylEmYh+jhu3TnuQZNV+Yvmw=; b=uBCTsBx8YDIUC24L8w8ArbSWsVY6Ap1Sl++HXSxYUw4ZYktzIDL86ZNBQy7iY2fMkX U52INud8/8KEFyYBri+UbUs7OlPR0YrCNiYFv1uXkbUBfFS1gmndAKrcSRzu8xpSuMjB zJz3VeqQE9CTM12cET46q/SFP2EsAdnPFiFTklCfL5sKrMIjgMbTtyjb9/F74PZFwjZN cPWCiyKiSprvAbsp29IF1tGtfWk+xrfySvLM5WIAN6j8ZthRzhhn15Khq0kNcTWTXIFM sSbtztodpDtW4Yy3WGOS9ZS3BxrjCQOQ9ZzuerDalP7vIMhPoqr/Y9c9lVkKyAsmQ8zj cHTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=p+BTI0jF; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id x14si19019713pfd.68.2019.12.16.08.02.46; Mon, 16 Dec 2019 08:02:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=p+BTI0jF; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ec2-34-214-78-129.us-west-2.compute.amazonaws.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 4457C7FE1E; Mon, 16 Dec 2019 16:00:51 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mail.openembedded.org (Postfix) with ESMTP id D22C07FDA4 for ; Mon, 16 Dec 2019 16:00:25 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id j11so3174267pjs.1 for ; Mon, 16 Dec 2019 08:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Ff/S15i2jB8nQJDaYpdbvIQwA8T9LvpAqbxfrmOPTVQ=; b=p+BTI0jFHOGFfSLnyA2IFU2lbuBAs0pa7/cujAXaGWiTS02iuxTir+plwozcdWWZ1s /l3izxVIgYwj8PEq4rnNRBhxCy7X0wgVIIOnhMYt/uu+h8qOUF6NUhGebxPLKviKdz3O RKkLGNnPQJOekWXeVjRFdHgTCDunlQ0XCYVLzNqGZMVPF4AwElve+PHbTjPTzrdrPNyY nk1uyRIa9pFHusbaocn9ytm8p5y/UcHZYILot69tj2l3yfiJMatxFOE77MmEelUdTtsL SoOQtTLlOXjxrNqRnpriHE2obVUULmCnPx88I25PWIptAGdeqWLHSa1txO1tMgBR/aid pDEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Ff/S15i2jB8nQJDaYpdbvIQwA8T9LvpAqbxfrmOPTVQ=; b=msdc9p2yD17Mlq8NaF9haR/Rywl/Bj5CJ1SO3SfIZGAmFZLLvfhrKcZY1/pC6DNQfw 2HLD0fdt87JUrVEh8XRJR6FIDohSxUt3w+SyGf+VBeriCWVDUsQJEVBwIlMeq6q6GzzE bjR55mKFSICzKc6+YCctIlcwQwOVxz+iTDTGCDRT/S/6qnLG7IAyCNLaPU+FwZfP809K WK5JDhwc0Olj5fMxXtCRpWgVpa++zddpQy2T8maUBgtJ/y7N/tF1EBW2JrqLc6YLH4mL Cxv5om8KWU7bZLqRHTvEyHSkYqyufe9PwTodp0Tknl7lxXXaR8MyTo2wbIP1cwXHJLrs xh9Q== X-Gm-Message-State: APjAAAWj6H5BJ7ti9p8n+v/iyNxy6/rvXTUIAB+ilOkrs+QXq2aYZLyb 0oMTIIr4zhD5z/b3Hgi/V2EJU0gXV5E= X-Received: by 2002:a17:902:8601:: with SMTP id f1mr2802420plo.308.1576512026494; Mon, 16 Dec 2019 08:00:26 -0800 (PST) Received: from akuster-ThinkPad-T460s.mvista.com ([2601:202:4180:a5c0:e5c5:31c9:a010:f145]) by smtp.gmail.com with ESMTPSA id g6sm19568697pjl.25.2019.12.16.08.00.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Dec 2019 08:00:25 -0800 (PST) From: Armin Kuster To: openembedded-core@lists.openembedded.org Date: Mon, 16 Dec 2019 08:00:05 -0800 Message-Id: <1f3863bc31e03207856f55591cbf17543e188587.1576511913.git.akuster808@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [OE-core] [thud 15/18] cve-check: neaten get_cve_info X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org From: Ross Burton Remove obsolete Python 2 code, and use convenience methods for neatness. (From OE-Core rev: f19253cc9e70c974a8e21a142086c13d7cde04ff) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster --- meta/classes/cve-check.bbclass | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) -- 2.7.4 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/classes/cve-check.bbclass b/meta/classes/cve-check.bbclass index c1cbdbd..e95716d 100644 --- a/meta/classes/cve-check.bbclass +++ b/meta/classes/cve-check.bbclass @@ -261,23 +261,15 @@ def check_cves(d, patched_cves): def get_cve_info(d, cves): """ Get CVE information from the database. - - Unfortunately the only way to get CVE info is set the output to - html (hard to parse) or query directly the database. """ - try: - import sqlite3 - except ImportError: - from pysqlite2 import dbapi2 as sqlite3 + import sqlite3 cve_data = {} - db_file = d.getVar("CVE_CHECK_DB_FILE") - placeholder = ",".join("?" * len(cves)) - query = "SELECT * FROM NVD WHERE id IN (%s)" % placeholder - conn = sqlite3.connect(db_file) - cur = conn.cursor() - for row in cur.execute(query, tuple(cves)): + conn = sqlite3.connect(d.getVar("CVE_CHECK_DB_FILE")) + placeholders = ",".join("?" * len(cves)) + query = "SELECT * FROM NVD WHERE id IN (%s)" % placeholders + for row in conn.execute(query, tuple(cves)): cve_data[row[0]] = {} cve_data[row[0]]["summary"] = row[1] cve_data[row[0]]["scorev2"] = row[2]