From patchwork Mon Dec 16 16:00:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Kuster X-Patchwork-Id: 181743 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp4481698och; Mon, 16 Dec 2019 08:02:03 -0800 (PST) X-Google-Smtp-Source: APXvYqw+n7VcUDhZ2+NbHhtYOSsYrKhKObzPCIVyiBjeS9x40oIgWOZAe3CttB0e3ZP0nl5tVN6+ X-Received: by 2002:a63:1945:: with SMTP id 5mr19503028pgz.310.1576512123609; Mon, 16 Dec 2019 08:02:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576512123; cv=none; d=google.com; s=arc-20160816; b=1I+pgvYXpq/iPs8OQ0dqUGhyI9DSiNf0hPUanY46HtbZ2DabUN/AE+ryeAS3Iy99Wi 1EBVfItZDT4a38Bt232wGTWLEPfzA7x/Trt7wfVkwTZTyJhrPhNhiNee/p+JEdk0N7Ax 514R4fIACVLA8BKTI5X4dKTYkitjbY6ww5PVKPqle2oHsaaJ02eHpOM3LqBVP3NWL6n6 /BxxpeDvx5kASZRiabFXjoAOoAIelM3o4P9EqBeeeaTl+O05nct2KQAFutHsCLynHObg j5r/gh8tWwPbHnmYZxoDKSZK/ePmf6/qRY/Y34O5W+A2h7juOilCjH1ZRyJPN4N9zEQ+ K3+w== 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=NvTB6eScUNP3c+dDjD9qnrqPzm+bI8CLSaCxd/OSWX4=; b=VUcpfadk8Q/ALHqZSxB3LEfnmU4DtdKXcT63VmW6rZo8XI1yAT5pWtCmJVP0Ydl6B/ 9rOC5wgoi1WYxgsb2vkveHvCLTdnhzhS+cLPgGq/iYQwIEdqat4HeYh3qcQDmXR05DxR UWhr1J5XgTKU3pyVApwb2N7WhDmfbdzvpVr9IZbzUQprGQ3I5ygiavDdU3R7KwvUKyEW j4IdozvWP+zA8rIfOM/5ndzG0tibh6JaGv5LMw5v6GNQ38gIV/c5JfCuFiEI/8UWe0Lv 1FhWMEnzZyTr9uPh5ou1xmrvmq8Ou+MxZyAgWwFlwK5qKbbW4GTpn30TKCaJL2arpPvV M3XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=bX1CmdYF; 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 u19si16652821pfm.100.2019.12.16.08.02.03; Mon, 16 Dec 2019 08:02:03 -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=bX1CmdYF; 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 33D3C7FE09; Mon, 16 Dec 2019 16:00:45 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by mail.openembedded.org (Postfix) with ESMTP id E3B6F7FDA4 for ; Mon, 16 Dec 2019 16:00:20 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id y206so5828652pfb.0 for ; Mon, 16 Dec 2019 08:00:22 -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=6A2GdUKIpJUnY1JrZ0fhucnm89CqvsL5MZei6drO4Sg=; b=bX1CmdYFB5ZpS/FGUzp5qRgonsDT4ozsq4ps1xSP+NX1CjJpDHMd8narQkHH6MWxd6 CJMldEyWCIGEk5U30c+aTfHzVGOl/FGZS2SZhvtT4ei/v201fiGCPV+h4GPiusbfmE1r ACKJugTxdk3cW6ZCwCbvGtlga43kbWah+xwGqNAcT86siWlG67zxCQBHvzfp6SW4yg48 Ohq8BsQZtmEylhG5UuxM0AlwtoDaL1IZkB1b6ohx+oloB7H+/hbp4VjN9X7UIAYOS/n3 6adVWOlO5HaCcSv193rPNLp6UTrrNXgbsCU7yc64KZGGKfuN52B8KT105ErtfVZ6vG1J nPGg== 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=6A2GdUKIpJUnY1JrZ0fhucnm89CqvsL5MZei6drO4Sg=; b=O8/Y/nfiOWRoVgvPxfINnYu8dj3jUjPeOhVfOJ2LzT1sg15uH44X7xnmflot06wl2/ mmTWWNSrnZXS71XCL6NdM7kT0WuSBsC5TyxIE4j7US/2UOM11q4ycXcd90Ibd6/igoW0 6C5sLqbLGRU/xKGjJsrR/GIwWHhpXzs8S3pp1ptemHY2hlU6ZGk3i5AxnelPlSfkFQEh K/bz/sUVX6rAnh25LcpJFgBlPQGDi/FjSMDbClZnIJoBKjU9RWSzG/LC/knF8AOcvDKW fJ0/ylByJiqQowt1jg6u4O32hFeQ8S1yDqOZRXRXOm04InY7YzokUvw6GopXpvonCpCJ OT2A== X-Gm-Message-State: APjAAAX98YKTsGL+4j4Id7IWpiuzIbyN8a1HBQe2unwLoaeZJD/5Fze+ TQzQ7HC8xgCrQg9wMP0tGnhH7MP2hYU= X-Received: by 2002:a63:d442:: with SMTP id i2mr19646641pgj.349.1576512021851; Mon, 16 Dec 2019 08:00:21 -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.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 16 Dec 2019 08:00:21 -0800 (PST) From: Armin Kuster To: openembedded-core@lists.openembedded.org Date: Mon, 16 Dec 2019 08:00:00 -0800 Message-Id: <091a35cfbd2f3e82a7783ba9c8fd5586433ba59f.1576511913.git.akuster808@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [OE-core] [thud 10/18] 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: Armin Kuster --- 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