From patchwork Thu Nov 7 23:58:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 178837 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp1837879ilf; Thu, 7 Nov 2019 15:59:13 -0800 (PST) X-Google-Smtp-Source: APXvYqyp24LB1k+r3cZ/3kIECF7QmRIWLOuHTwIRXBeEA5RngIN0PW17roEMqAmb2F0tm7YduS6d X-Received: by 2002:a17:902:ac8d:: with SMTP id h13mr2502156plr.180.1573171152889; Thu, 07 Nov 2019 15:59:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573171152; cv=none; d=google.com; s=arc-20160816; b=OLSDYr1XbKO6qVbSvi6NQoRqX/Tsm3KcoRrNogonxHurJWs0y/MYjHuheTkicY5rxI m3YknsVbMyQRzUGPnkOaPBfe53YhED4BwJZAyB7tv1J81dXyy9XEnXQ6Nx6PR6dnXlYM 4zt975j0CXmYxSAa6sTD0mIlzuORdrGVnl7M62lS7hH1OQBwnDGkl+nxA69nO5+MP0eB kGYkA9kEp09Lw9AVhLL3RRn6tTHQe36COqpbZz1oUHiNsRRt52gB+59lV5XVaggoSDgr /sF7OJTbqHkts3ZWZ4CChgns34NkF+NlrgU0lQgdbdaTO01yp0qAIO1/Csdp19IzWjUZ tYVg== 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=YjwmO/W8N2UPfWTi+EKW0j8ZqbTz1mtqfJebhy/z3iQ=; b=pJEPHjmDvTs7zybk3tjcPyavEnKFSFuCkGSLnGuLQK9epOex3bjve6sAabrgXWGfGD INAS8cQYvfQAqYPDRh9OT0NRE0CwmorRDr9YjsgGerN+TPoVN6y8mrCRrxF7plL8vMOn kftZS2Yh/dKGQxJmBkF8DKeVexDPVHlbekW24r5/pNvVNQnmV2iVuJXWcx3htxrNAzh6 3G4geAf4P+Dwjfh9JW5qaZDyuOJB6e5EPp2oqk1rFH46UhLxStuopwL02H95in/GtjLq +8+UOp4iwh4ESHdol+pb7s9WPLroQVgjwO8XCBMXjdlrWMZ0ggpYZdmOfcy6AMv1xxTY FAmw== 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=1ZvVMCVm; 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 d10si4368645pgv.562.2019.11.07.15.59.12; Thu, 07 Nov 2019 15:59:12 -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=1ZvVMCVm; 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 9A98D7FC05; Thu, 7 Nov 2019 23:58:54 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by mail.openembedded.org (Postfix) with ESMTP id C6DA67FAA5 for ; Thu, 7 Nov 2019 23:58:37 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id b11so4364895wmb.5 for ; Thu, 07 Nov 2019 15:58:39 -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=Cmq6F7kofldvo7dFqvfcQdjOLuAEqxo2Ly99Wk7oQd0=; b=1ZvVMCVmPfiFTdw/XeYcZ8rxcQLFUl/uV/h+2JrP+Ror3JV4/rW0aMZeLrcpdSZA1e rX1zsDqrQgzesyYDbkrJ374PEVbZSv8Ao9Xv5luxMrv8vS+o37e1lyaGSe5XsP/uMqA2 +7HZZAhzBRoXDfgsI74mYppWFt7iqRDfPTM925er3WuvC3QmrOJFP5miWP4JDcdkke1s pm0rueqDITsMP0Y5sFSPAtWFYcda1W2TIWvbXavHAbSepHUkfmgu9xaROM4+FYfJbJqT dPsQPuH7vInv2DaaS+qBbOq11n/HjgB9CpD6LjamApSnxGj8JvRBXBVcJey0bWwBqN2G hq4w== 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=Cmq6F7kofldvo7dFqvfcQdjOLuAEqxo2Ly99Wk7oQd0=; b=TIapQEz82EbvPC2qlA4qKD3kgLPaqN358XkPOs6xmSQf8vDkH8zUoIFwmigKIewrfW ZvyVjIRcsGb2PdDcyvOFQ8avpcMT1iCswLNOx7DpCAhVPxsyeu3ftkY86LWJPh3itp50 9t/Ou3VJRfXajHMFA/X8yqMAsnxh6QNjdP8+pqJ3csjKbFRTzekvkat+Nn4+PIATZ0gk qmf509gLMnKNSA5XwssOXKU/8bbBRivxW6ZivKXoZDy3aUMl0XWV4etuqwlPl4BA4AaF aO3Lce3o/RIROpTDZw7j8NmIg70VX2CJTDFDuR1I9znGtBAhXd4VwLG+REoAYmQe1JiU M1IA== X-Gm-Message-State: APjAAAWLBnPZZ9qRZx4IvshaGATCp7Z+M2j2ib0Pglx10vnSz3nwOvcE jsU0Z82sF5+K3BuIjFaE5joONDKDka8= X-Received: by 2002:a7b:c10c:: with SMTP id w12mr5746421wmi.114.1573171118399; Thu, 07 Nov 2019 15:58:38 -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 f13sm3702821wrq.96.2019.11.07.15.58.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Nov 2019 15:58:37 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Thu, 7 Nov 2019 23:58:30 +0000 Message-Id: <20191107235830.26644-5-ross.burton@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191107235830.26644-1-ross.burton@intel.com> References: <20191107235830.26644-1-ross.burton@intel.com> MIME-Version: 1.0 Subject: [OE-core] [PATCH 5/5] 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 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. Signed-off-by: Ross Burton --- meta/recipes-core/meta/cve-update-db-native.bb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 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 2c427a5884f..19875a49b1c 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