From patchwork Sun Dec 8 18:35:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niko Mauno X-Patchwork-Id: 180966 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp3449050ile; Sun, 8 Dec 2019 10:40:19 -0800 (PST) X-Google-Smtp-Source: APXvYqyLqoi+NjsxJeRGzijeOo5T4L6BhO285ip1W8rrjqNoo/jQfby9Nse37DfOogJ2TvnEGGqi X-Received: by 2002:a17:902:aa92:: with SMTP id d18mr25352373plr.157.1575830418664; Sun, 08 Dec 2019 10:40:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575830418; cv=none; d=google.com; s=arc-20160816; b=Tb7BTGF3+QXNSL1UHjmtgZRb3lCtFaQT8QRx8vFTXF1gsDDoT3U1Wz1afUYHvgVKUd FIO8gmtKSntUavxNsJ4bGXah0PKza1aLuxWe4WU2IbnglmDVhVf4As1vWt6NXxWDvi7f NSPwKqjBtFUtahQdreSkegzt5Gu/9LBnzX1zt37OhDl+7LV+tfM1BOCC/yXS4F1bK7Lg V4hRmTfIdoe7YKFWF1ZFn+0lMTBHjsm1Skqe1L5RN10SoQWMYkW3gzbQQi351SL845DB mKk+V/xdOk7ZOtNHrNQ2/FVUhwE/4AmUWqGdDGjlZ9OSJAtgGL1gl9s85jN0kSLGaWkY Rxhw== 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=wdB5DBxhAqI+E8RHKOCEkNv2RklrDglJ/PHEAsSjbUg=; b=q1HraVeAkRrtLc+GYP7bvJgPxP1m7JIKYxTwc5HTA2kjA/SgqOrcIwOS0BMKK0Uu6G ZQzb254Ari6Dne+6Zxng12VI/1DjV7msRbWWWXjoV3qlAheH501OPwCkWX3FXKLhD7lL +zAjipI2xqeIrdIpJtv6mwuzeE+Ts8j2tvtGR0QAq4W9Ww/a1psvhRrU1q0wUkv+FLoQ V0IsMuaMAaRdn5eS2Y64v1YxDlC69cwyaxLO8coS+oLZdHkiplIqH4isGUU94x/rEbF/ AzqEgjGfhtCwXNueVrDGURlXty7/bsDmjLUhf3N/2hpa93OD+vw69FL7T8j/lT3fdggO an3Q== 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=iki.fi Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id u127si16979705pgu.147.2019.12.08.10.40.17; Sun, 08 Dec 2019 10:40:18 -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=iki.fi 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 1F22E7FBAC; Sun, 8 Dec 2019 18:40:16 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from tulikuusama2.dnainternet.net (tulikuusama3.dnainternet.net [83.102.40.155]) by mail.openembedded.org (Postfix) with ESMTP id C40157F9B4 for ; Sun, 8 Dec 2019 18:40:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by tulikuusama2.dnainternet.net (Postfix) with ESMTP id 9C9D7291B3; Sun, 8 Dec 2019 20:40:15 +0200 (EET) X-Virus-Scanned: DNA Internet at dnainternet.net X-Spam-Flag: NO X-Spam-Score: 0.653 X-Spam-Level: X-Spam-Status: No, score=0.653 tagged_above=-9999 required=6 tests=[SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.652] autolearn=disabled Received: from tulikuusama2.dnainternet.net ([83.102.40.155]) by localhost (tulikuusama2.dnainternet.net [127.0.0.1]) (DNA Internet, port 10041) with ESMTP id UVgJmpui5RHG; Sun, 8 Dec 2019 20:40:15 +0200 (EET) Received: from luumupuu2.dnainternet.net (luumupuu2.dnainternet.net [83.102.40.55]) by tulikuusama2.dnainternet.net (Postfix) with ESMTP id 24185293FA; Sun, 8 Dec 2019 20:40:15 +0200 (EET) Received: from localhost.localdomain (62-78-161-185.bb.dnainternet.fi [62.78.161.185]) by luumupuu2.dnainternet.net (Postfix) with ESMTP id 49C4E74; Sun, 8 Dec 2019 20:40:09 +0200 (EET) From: Niko Mauno To: openembedded-core@lists.openembedded.org Date: Sun, 8 Dec 2019 20:35:51 +0200 Message-Id: <20191208183557.32589-5-niko.mauno@iki.fi> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191208183557.32589-1-niko.mauno@iki.fi> References: <20191208183557.32589-1-niko.mauno@iki.fi> MIME-Version: 1.0 Subject: [OE-core] [thud-next][PATCH 05/11] 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 --- 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 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