From patchwork Sun Nov 24 23:50:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Kuster X-Patchwork-Id: 180140 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp2443581ilf; Sun, 24 Nov 2019 15:51:59 -0800 (PST) X-Google-Smtp-Source: APXvYqy1sK9ASQnme+9mmoweJqLrw7DMvGWqS/AE/1k2koU2wECifvrqWNiQLUC2mCXJkC1v6fzA X-Received: by 2002:a17:90a:e28a:: with SMTP id d10mr36038877pjz.116.1574639519593; Sun, 24 Nov 2019 15:51:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574639519; cv=none; d=google.com; s=arc-20160816; b=LBzVEheBI5N76o9KH9OIbxV1WmzrEttzlqYWym6oEs+nbqKfgIbksLE+lo5eZSeQ3J x5PzjNZ43lD/3XgbDMAVR/egOwzU6CxzeaVFbTBMQ7gFKojLGKMmV2r+lTQYXdfO8WuQ mHpo9Ioyo4B15cz2Oxie1y7lYY1/dsMGVdfsqRCMrD/8DvJC3Vb9fp0c7bIzkEV2zh71 SwBvugp2Ud9XjwLfEz+5c1IFmYL6fVO40JmOSPIiaW4Y0R7eZOA0FVVAo9CNJWBEAMuK mbfKgTd6A2kaWFFM8l2ZriBv+RoDG1+ne0i6ko19vOqGVQS7XPB+6Yd0E6oWQVQsXauM Oqfg== 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=99M2GOKcW1mvXQUcKj6nnC+XrmVFvR9p3Xzqcyw05NU=; b=tDmAlzfJWbxJMFvqKOf63qG5SVoxG7cH5OEPieU3G8RNNsH82o/wWFjhK05R6mUjwV o83CIwjH9cIchDUdVHTmmKoGWiWMOh2SmbVEySQuiycCFYkpFT05eaclzGzQxyDh+SHl jNleTiAVOpDAyN3tJLGI+JkYQNXpioWHg1Fe+Qt5fyyR7/RqwHiIv+llRpJepHiZaNuD gm1dTrJPwBidmMeEYK/4mEUrjuwvgM/GZquo8P9YbhCwwEi/chluH+kM/iM9JyPqRD8S 06wzdjLypgAsoibBhNbe4xl1raBpKsLuQzRahtn51MUKSyOMTkhJEXKEVX3C8t2TRlWt u75Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=VRYaVwcf; 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 i186si5833144pfc.164.2019.11.24.15.51.59; Sun, 24 Nov 2019 15:51:59 -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=VRYaVwcf; 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 2308F7FC79; Sun, 24 Nov 2019 23:51:11 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mail.openembedded.org (Postfix) with ESMTP id EA7B97FC4F for ; Sun, 24 Nov 2019 23:50:50 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id a10so5592914pju.10 for ; Sun, 24 Nov 2019 15:50:52 -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=QdsOFFcf55iHwXrkU2ltyExxXfLppv7Vff65Lo+JTvI=; b=VRYaVwcf2ZzgdXA0x377nCXoQasmsGxVH2xLTZNZmobcRNi3Dci4cLMBAZJoTRD47T IlYbJDrtbGBK4/ZHh/bKl8HuUa9sRlsp9eA/jupsbwZ/PbI5JNTMQNJcCgrwy+zzAcL7 +P+9PMekWSWRcOCS4cHOu37V9uQFxB12d9UhTsH3o9+FmDRcGsG97XHk6u66Mpt+9qzH nb3c51Oiust895sfHSEbvBPQZYevlIqr3Wx4b6nwqeSavB5qdpI7yBptMNHALgeMkUA1 VbT1hfuHPCywtwKUGk/m/riF8sGqnCLvMBioawl3cVrOxZ/+fb4CrKKGdfO96jt8sbl4 M8CA== 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=QdsOFFcf55iHwXrkU2ltyExxXfLppv7Vff65Lo+JTvI=; b=Y56FGNHz0iPfl+S/J65h1Sz1UICo1yeAh/+M5zCdfDSmd6fc7en4WXXygVp+9v9fJ6 mC+Y9uOThW3iGfkGUW7PsauR5Wl/s2znTznlXsdqwhpe6P6/DYBlyTmRmMDnMlFs7PJz cNqVwzqcbXKngdeAQOTifs1aK4qU13HF32316eu6t9kpMk2E+sEX0Q4NSNBgSCFW7ruh UKvRBwKgd2Wruk08IM3jEs80I31hpYN50PlgrGEudoWp2G80Eu4cGAmS3AnlILTOJER1 JQ7DNIUPgC1lMS9lggsEAyZI3LZA4g5RJhYVqQ4WbL/wFLDMPrElu7QnR+k9JJlBUlOF CqKg== X-Gm-Message-State: APjAAAXgIg5HhF2VKGofKRe9UCs+he3UekLFx4iJDsdNuy8L7hgzAmWL SV5W0WhvD+Ci/8yhcpN7eBRepTaB X-Received: by 2002:a17:902:b118:: with SMTP id q24mr26197603plr.232.1574639451767; Sun, 24 Nov 2019 15:50:51 -0800 (PST) Received: from akuster-ThinkPad-T460s.hsd1.ca.comcast.net ([2601:202:4180:a5c0:69ac:e4d2:e89f:98da]) by smtp.gmail.com with ESMTPSA id q200sm5619783pfq.87.2019.11.24.15.50.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Nov 2019 15:50:51 -0800 (PST) From: Armin Kuster To: openembedded-core@lists.openembedded.org Date: Sun, 24 Nov 2019 15:50:14 -0800 Message-Id: <31a9adf5432c43f8a98b979f5f72956e1fae1592.1574639349.git.akuster808@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [OE-core] [zeus 09/35] 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: Anuj Mittal --- 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]