From patchwork Mon Nov 18 16:46:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 179593 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp3126909ilf; Mon, 18 Nov 2019 08:47:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyt3f2Tcb4jiOTL8+QMOM08DO+7oBvbZv1kMX/Ie6xIOOshfZfWCtruRgEVZBPSkrAhDVjF X-Received: by 2002:a63:5508:: with SMTP id j8mr219124pgb.97.1574095621409; Mon, 18 Nov 2019 08:47:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574095621; cv=none; d=google.com; s=arc-20160816; b=rW54EgWiSwr9/oi1cprJHl+HiwWRJUtKXlZ4yy70D7SsuBiRyWU3qLf8wzWTrnr2TF NdPO0qgpMyw+8OLvZ6fNC2bJ9xAaheY96yq1OJYFMPaiOFN/feo2ADykNug/mh589dKK 6gdkrJoAlA7Gactb0vCiwPka3IEeYCR0W6ZQo0l11ZJ69PE7WpzJnRgsMBuHy83JhrZP vd9ZKqFddqOtdv0IQbQPjDF0V3Eb1WKhzX7USyutxBkEiNIy6ERgGOxpT3sq22zmETIJ GGObxP775LdnKHJnGeE7V+ME3IS5GMSmY6gcDV74RUMw1N8aKutB6Y6dwaKvuDDwiEBo LhWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:delivered-to; bh=0JeXNvaxsH4lEEd0w8gx9VtmlrweWozjF0hKkwx/z30=; b=seg0KUqC0HtlEfSC+JkTeFP5fY03n8YQ0zK0OqA73rdsTv0YAi48Pg66EN5WQzw5hT iRvEBiOmDngAN3cKRoXI1Ai1F7yemMCHR/OGl1GZ8gPr82V0Po5kwzWPIR8y/r8nY1JW zSklZVh/bMOmd8oYLFCQe7RB/Q8wZXUQ9Dh6GMJRnXQjYmRJ4a8aphFCpdbbZWbiBJeU /ItiXGA2PmvenAAy7TS94Jh5cG5osr3hDwCOKHGu9vlx76rDY8chVCofsspCn6z/ZLNS xQdkdGgFccsTcO9Alu3yhgSb7VsanGTfz+bzTpmhft1q7d/0aK1BddGbVbmgH4ZeZA1p sFdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=mPheYBGy; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id f8si19175385plo.142.2019.11.18.08.47.01; Mon, 18 Nov 2019 08:47:01 -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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=mPheYBGy; 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=NONE dis=NONE) header.from=intel.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 68FC07F8BB; Mon, 18 Nov 2019 16:46:57 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mail.openembedded.org (Postfix) with ESMTP id C19C07F8A0 for ; Mon, 18 Nov 2019 16:46:53 +0000 (UTC) Received: by mail-wr1-f46.google.com with SMTP id a15so20334338wrf.9 for ; Mon, 18 Nov 2019 08:46:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=M4ctuwA6cZs27fmHe6BG8al2Ng7rxmll+fGGZm4Bf/M=; b=mPheYBGy7AJJQE34JQMAAYW550m7zMmvWaaRrdaXK56dhjaVQoptQhX1w7ovXiQsrp p3lxWeMpTYPHpgz8eqb8rfJdk9yrwLJPrSJTaYnhYHR0eGxnB9pM2hwuzOY+brjUGeRR 2pP9s65VGKfbkD+b8ybZiU4oPzmpuopmUXVeXs/V6pfvk+RGA2fDjLqSi3mpPPNcEtex RymCHt+if9D2KKoOTEzK6oZQiQticp2wO/Eq9UXnmdVu0+796vQQW07pE6PPiQeX8HjA F6MGLpd5ZKJOqJ46G8Ny8necS45VYCEeoq93EAqb2xAJU/lHscaJ8oN4aR0Tk7Vh8qWq DDCg== 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:mime-version:content-transfer-encoding; bh=M4ctuwA6cZs27fmHe6BG8al2Ng7rxmll+fGGZm4Bf/M=; b=sH8FyDWaPbaB1n6+P//U2pzE64KYE4WMhoUasFF63gHPhjULcPiWvCVTnTaVMQu9X2 acyrZhVKoBSMAxx3s9z1Q3dYPdfUDnq4her/SJeC5FiNncOJRmptjjNBhReTFbEkwWQl iPf7QXmsREmozAkS1F6zaiQVJBN2wO4R31QFQL2r+LOSCMlro+fVA5v+qXmaOBSluAZ6 cQ5EgaGsyEdGd8iPmeVS5Rzy0XrmIbK6fei8glPIEW4qCtXlOcX4e/LktNDIB6RhTYEM IBpWa5kKQpyL4mrqO0wIxM10p8YzAQXBynkLh+bqma9rFaLrHoo/jwk6750POPDzFvg5 XBmA== X-Gm-Message-State: APjAAAXxGDq/WfiB2Zadq6tR0GO1YQceoYgR65pMIXJljta5oodd4vGK p98lR00KtKaHWgpjpXyIYso19NaBKRM= X-Received: by 2002:a5d:67ce:: with SMTP id n14mr31034305wrw.67.1574095614265; Mon, 18 Nov 2019 08:46:54 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id y189sm20936208wmb.13.2019.11.18.08.46.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 08:46:53 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Mon, 18 Nov 2019 16:46:43 +0000 Message-Id: <20191118164647.29409-2-ross.burton@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191118164647.29409-1-ross.burton@intel.com> References: <20191118164647.29409-1-ross.burton@intel.com> MIME-Version: 1.0 Subject: [OE-core] [PATCH 2/6] cve-update-db-native: add an index on the CVE ID column 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: , Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Create an index on the PRODUCTS table which contains a row for each CPE, drastically increasing the performance of lookups for a specific CVE. Signed-off-by: Ross Burton --- meta/recipes-core/meta/cve-update-db-native.bb | 3 +++ 1 file changed, 3 insertions(+) -- 2.20.1 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/recipes-core/meta/cve-update-db-native.bb b/meta/recipes-core/meta/cve-update-db-native.bb index c15534de08b..08b18f064f0 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb @@ -120,11 +120,14 @@ python do_populate_cve_db() { def initialize_db(c): c.execute("CREATE TABLE IF NOT EXISTS META (YEAR INTEGER UNIQUE, DATE TEXT)") + c.execute("CREATE TABLE IF NOT EXISTS NVD (ID TEXT UNIQUE, SUMMARY TEXT, \ SCOREV2 TEXT, SCOREV3 TEXT, MODIFIED INTEGER, VECTOR TEXT)") + c.execute("CREATE TABLE IF NOT EXISTS PRODUCTS (ID TEXT, \ VENDOR TEXT, PRODUCT TEXT, VERSION_START TEXT, OPERATOR_START TEXT, \ VERSION_END TEXT, OPERATOR_END TEXT)") + c.execute("CREATE INDEX IF NOT EXISTS PRODUCT_ID_IDX on PRODUCTS(ID);") def parse_node_and_insert(c, node, cveId): # Parse children node if needed