From patchwork Fri Nov 22 11:39:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anuj Mittal X-Patchwork-Id: 180055 Delivered-To: patch@linaro.org Received: by 2002:ac9:2f4d:0:0:0:0:0 with SMTP id c13csp92934ocg; Fri, 22 Nov 2019 03:40:48 -0800 (PST) X-Google-Smtp-Source: APXvYqxkpZA31M3vkIyiBPmS8D5Is6ibAM0pCIT0+A9m9qF2CglEgBOoua+wqtt2FsTU120P/04/ X-Received: by 2002:aa7:848f:: with SMTP id u15mr16718834pfn.124.1574422848395; Fri, 22 Nov 2019 03:40:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574422848; cv=none; d=google.com; s=arc-20160816; b=JWtzO4FiMxAN/rBe6qV4o6d3nt8wSdeBfZwZcYj104F2/h62zwbqtQxrE7TJbkCArn vwqP8Ia4B6r4Y0rzSRQeJ5phCi3DKx/0e0kWAlyj7uXG7bF9hJj0Pj8gBNT4BfWDtEY7 nODcixTjkik1XsBBgY3EQ5QVmGP3ciaxisjgUD6kTgenEKWwuOUzLz8i9vKGvXVZoe9k 8uJyZ21iocI1QdwHN6mbRf25nqUixfy6u67Yxb6vI5VdrOv5PUumz87HCFeqsNwvzAY1 //ENgKGCAjzL/1oSmKw80DJUpmRk+qTSZXXVIaBfjrfCYe4A8wYHpe6vX8gjCZ3CGqjy Xqtg== 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 :delivered-to; bh=nm88BW5g8kpttK4PhSljqPA+G5JTEihnzZKxMYyue7Q=; b=OdLIA/KSYHifXmaUzerSP9d5MRjZLFcO5vgvIZ4aezLjJ0ObSBkNnbM4KVy/j/s8+T dXL/V8b/1dMcuRN8XlSaapUI8u0QS+95gpifApHBYmgE1dOpi727NxReTQuXZAUba8VJ Klk+s4Iiz81gJwAzHJoM6n51DTOjghT2q5WIw5V/6FWSEmeWlIbpUYuzWbcR9rDo077f C2bsoePotP6Qa5xRFGMWOBn565uJmQG5sF6ekftfla07iYzt0Zr6xTCMI30bEdEzYhkA zG291GAnS4qql9/hKtoampiOua3DWuoEcmDcZrNbQVg+4opT56mKAxDjbgfzd8dTQdHw dh9g== ARC-Authentication-Results: i=1; mx.google.com; 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 t5si2926970pjw.88.2019.11.22.03.40.48; Fri, 22 Nov 2019 03:40:48 -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; 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 801D27FCE3; Fri, 22 Nov 2019 11:40:34 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mail.openembedded.org (Postfix) with ESMTP id 4E7087FCAF for ; Fri, 22 Nov 2019 11:40:14 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Nov 2019 03:40:15 -0800 X-IronPort-AV: E=Sophos;i="5.69,229,1571727600"; d="scan'208";a="201485325" Received: from anmitta2-mobl1.gar.corp.intel.com ([10.255.164.245]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Nov 2019 03:40:11 -0800 From: Anuj Mittal To: openembedded-core@lists.openembedded.org Date: Fri, 22 Nov 2019 19:39:03 +0800 Message-Id: <3654b6cc301576805c6eae76603b132d8b8fb5b9.1574422359.git.anuj.mittal@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Subject: [OE-core] [zeus][PATCH 04/15] cve-update-db-native: don't refresh more than once an hour 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 From: Ross Burton We already fetch the yearly CVE metadata and check that for updates before downloading the full data, but we can speed up CVE checking further by only checking the CVE metadata once an hour. (From OE-Core rev: 50d898fd360c58fe85460517d965f62b7654771a) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie Signed-off-by: Anuj Mittal --- meta/recipes-core/meta/cve-update-db-native.bb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.21.0 -- _______________________________________________ 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 2c427a5884..19875a49b1 100644 --- a/meta/recipes-core/meta/cve-update-db-native.bb +++ b/meta/recipes-core/meta/cve-update-db-native.bb @@ -31,8 +31,16 @@ python do_populate_cve_db() { db_dir = os.path.join(d.getVar("DL_DIR"), 'CVE_CHECK') db_file = os.path.join(db_dir, 'nvdcve_1.0.db') json_tmpfile = os.path.join(db_dir, 'nvd.json.gz') - proxy = d.getVar("https_proxy") + # Don't refresh the database more than once an hour + try: + import time + if time.time() - os.path.getmtime(db_file) < (60*60): + return + except OSError: + pass + + proxy = d.getVar("https_proxy") if proxy: # instantiate an opener but do not install it as the global # opener unless if we're really sure it's applicable for all