From patchwork Sun Nov 24 23:50:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Kuster X-Patchwork-Id: 180135 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp2443235ilf; Sun, 24 Nov 2019 15:51:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxBL1EVXKSzp98fOS8qpG2lTbUU9dzmfCum+AUfd7MOjJRkWeyg1KJaaPTBhf9A4JKLkpL/ X-Received: by 2002:aa7:9804:: with SMTP id e4mr31138612pfl.21.1574639481095; Sun, 24 Nov 2019 15:51:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574639481; cv=none; d=google.com; s=arc-20160816; b=fhQ+2WSNjn7D/nON9Cc5HxYuNR/IZ6chH0AY5+7y0/Q3K8IAvMHn125lADx4RTSzU+ /JtYTs8VJ1kcQLOwk6L+6IXORV7CWFxO0UPudXxXDEyJ2Ziww/zWNn/4J/MMTYZ/1MqZ fT0uwPvjE8t2oMZ9rl1/yoaoROPc85QB92RT3Y13tOUoD750PL8ZCgXE5Rcy4uttWxWF QXrFxDJ+/1lHe0d6Yg0N5ElxzFmIjGeqQj3p2JRaeNmr5rS3OhFkWO3x0+X2Kniy7f9j UCww+aEhgfHNIbg+EFF+7Jwj3Mu+CdNOBzDotwT/zpCMel38Io72Unb1gPXlAY7DSHa0 fVkg== 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=g8GCJZ5P0fAm9H+O717g/kw8xvFjkeg0UkiT9nfbexU=; b=uULmSfr+ZXTAGz4Qm9vaR4u4OEy97uGrJ1B4KtaxSoFuFVBwH06p5qD/WxJdn6Dedp cl5duGgjtzithW2cfWHS+cX4hFF5LS9a4blOYbhM2MgREBHm9Xr0shFsegwc17sSVYpk 6tSqP2SYdU68dtmdKS7Aj9CV0+wO1t+Mj0FT8ma5S1AjuUB8+G6hhmjFwe0xgYoy3hBu 2litJRZsN1/s6WcmbVjJz6bFgR1blKskZ1rlYKCp3fbnahOL0p0M1SceG35fEqI76hN9 RgvmhJwvXCzaQXGoQZjPqtLypxr1rnACrImDGwefjy4+3t6aMxz+QAL67XEcg2W5OCYH EDug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=gRjC1nKd; 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 n199si6043404pfd.5.2019.11.24.15.51.20; Sun, 24 Nov 2019 15:51:21 -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=gRjC1nKd; 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 1101A7FCB8; Sun, 24 Nov 2019 23:51:05 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by mail.openembedded.org (Postfix) with ESMTP id AB1737FC0D for ; Sun, 24 Nov 2019 23:50:46 +0000 (UTC) Received: by mail-pg1-f195.google.com with SMTP id k1so6114160pgg.12 for ; Sun, 24 Nov 2019 15:50:48 -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=m6WXuYliFc4NAHX2pyjpHeXX0Z/MRv1j6x95jeDeZpA=; b=gRjC1nKdRAlHj73gON4UkbXErDXPIqJL+ummzwaZPmSCZR6xloZA0ytLKq6n9KZGXv HzMLS8Q11xzxVY9JfM1GeGkRGhXnU95cwM9U5yghbFklvXfQEpVFza8YAypcTpnRfk+C vRym+ZGTG2fk5mQX2bjB74OPpJ58dIbfw53b8OmAz9tNMDj7K1kawUXiUsBia0TFQwxY RAYw2rnNx/V3Zw+3RaLTb80LC+hEO457zg3/l/e7FOIU2nGQYKgsgwh0XG+Z9Dep0Jss i2klR7c+WT8lEBkNz9wa4kOtjQ63zL2b8+HAtMkiXTrpgWrRAInJhUcTyVRatOKwnD0t kLFw== 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=m6WXuYliFc4NAHX2pyjpHeXX0Z/MRv1j6x95jeDeZpA=; b=qe0608AQ7s07Wrjkyl9dLnf4Ck3R2vqBWLw8vQVUst7slq9zda3Kb3U8n7z2PUlYch wjOhDuHCaFk7DqcNOn+EHJKJm9HhE+drSphKxSFblrzr1YDw0RozWAZ2+pz3gg2UHjm4 c2yi4HMvauZ4c0xF588w9lsnUJfQsGZav3mR/TQ+rSIVeWe6fVxIAljf1JK/p46iN87S oieBD7GRUFOIVYyjLEh9baHh5y7pewImK2l0nFmzVj0shQsqSWyaMf5LMk7/ojCoJBff UKgeINaFXuiosXiau2YQYSb6ZaPXImvE7zzjMAQOYHuo5C/TcitZy4M/IthaU46UfivM k+KA== X-Gm-Message-State: APjAAAX3A8APSFMJ+J8bf8jwlU4dwVy783zGoHXFZsOc/uHW0GI+WxqH pPinshCoyM0mohm2Qbv5MC7Z0GrX X-Received: by 2002:a65:46c1:: with SMTP id n1mr29562432pgr.257.1574639447592; Sun, 24 Nov 2019 15:50:47 -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.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 24 Nov 2019 15:50:47 -0800 (PST) From: Armin Kuster To: openembedded-core@lists.openembedded.org Date: Sun, 24 Nov 2019 15:50:09 -0800 Message-Id: <12300501f410c3d1e3c48f1c568ce4098cd3ef5a.1574639349.git.akuster808@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [OE-core] [zeus 04/35] 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: , MIME-Version: 1.0 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.7.4 -- _______________________________________________ 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 2c427a5..19875a4 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