From patchwork Thu Dec 13 21:38:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Kuster X-Patchwork-Id: 153701 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1322791ljp; Thu, 13 Dec 2018 13:41:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/WPdHOesi/N+PvaSQp3IVWiS8VkDmRI5fDkIlt/HBbGm38vad8esXgarXihF96P7xHo25yg X-Received: by 2002:a63:e302:: with SMTP id f2mr425692pgh.320.1544737284410; Thu, 13 Dec 2018 13:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544737284; cv=none; d=google.com; s=arc-20160816; b=HR6drWpGxQ5p8psmAQi2Wxca7dMWSY0Ahne4Un592P3zK5ltiAarO7OWWPXVQqhoDK nBd1dg4ZiSba3bbepXcbVpfh5miE/Vbw3GzDfOc9LjN2VJESuxtPj6a2kpDMx4tGSuQm cQRU9dikvkEoTChOlXUYgVQ6arBkCA0vqPeo8rknT607BVCiDRfIB0wpsHv3thO/nSrv WSam+9i1Jeq4yaaCNcbzejHolKf3Vk88UJ5C5/horXnZ1NcC1OU09cwPxPERViNb5ePj IwwAPB7CTTDlgoaHyb36ynIOTfa6AErW94Wzkl5t/rckU3ibLXsDlRv3kD35ksX/fu9n yd3g== 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=cMnVzdJWr8lBrdHrGe8JHx/Eq4RndZzN6eBNchy4nO0=; b=T7H31HLdHal87aySJFRny8X3LEG6kYD+w4d1z2b3zB+gjU7j4/jvN+frfSO5t2GV/W T0GXq/HwmkndW+qaO1l0OH0nZO3yIJaSpHRJ+XW7ALIqjhgi2Abkot5apgoAK7a2bxr1 2jp2e0KNL4oY6Mw46PgnOqR/0O0XpUlBc2Km2GImVODoWz1CkpbJSOqIgoHGlLnj5QFu XO6Y+qwY9LdE2x5h0KUS8X6BofjtVpKHo8h8r4DbHOeSkkTMva5nVUZJoRFNhao8vQO/ obDysyPZxkwHJMN9jSR7By1dl0j7BHTV3JgJxp+5Se8zBVb7zoVzE/ExAQQGqL9rtlcx rSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=TziNw+Yx; 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 i1si2360388pgi.480.2018.12.13.13.41.24; Thu, 13 Dec 2018 13:41:24 -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=TziNw+Yx; 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 165.28.230.35.bc.googleusercontent.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 6A03079E2C; Thu, 13 Dec 2018 21:39:43 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by mail.openembedded.org (Postfix) with ESMTP id 975CB6D576 for ; Thu, 13 Dec 2018 21:39:21 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id y1so1657139plp.9 for ; Thu, 13 Dec 2018 13:39:23 -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=K/5bKjVnKlCTqXuMV4c83POTaRjsiWK3hZnwUOH6U7g=; b=TziNw+Yxgvah4gunt26OcttQj49H9FfM9jbEAU+4p9R3HNPpPdk+ceJG2z1gCQE28a 8u4vrCvCF+beUJVp4qGf2AMEQkjo1tgurpq/ekeBS9tPSyoLDRIn7IHwQhr7OsNxZGgU eUpU4Kbt/5QRrRbGM6eWuFdNXjz/4gKP5GBPNQms0Z93bbBTMAO3EBXJvfVYpft52ehH XEWe2Aw0FJD9lVKc5kjt1ozssS5Egp4SVMhP0INSHM0ms2qdcnp+2sFrZQAjMrhMFRrN KoRV6KY4UIk1Ru+4R7KLlvt1TggghiDK6ypwKPhDQCygrjUvsj8Nq5XgA/NJrmYnkk3Q gddw== 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=K/5bKjVnKlCTqXuMV4c83POTaRjsiWK3hZnwUOH6U7g=; b=m43oM0/yBJi8coBNngpiYEFf5dj8iwsId7CjDkVVZAU/DZ0b2WXo2/ILu0c0NYsl1K 7e0R8BdX6T5UBxPgK8zJQ6eK4OWYVd8DWaZbxhXyvQlb1GXh2B4LzCCb/imUzAlDw+0v a6qGl1EW1GVydRLa1IzG+fDmcyHhO+6Br2MHIK0ZpPqizlfpLgfB/CtW8iQm2tdz0FLl jm6gzF5z0tOOB9ZXLC80JCOlnJVOVChIL8aWWwthtciCI9P6VirSfhowgjJvwy33JNJz 7ZENIIr/+mnYuBcXSolxyeIv7VDzeuj7hxJubS6RILOMCGR06OvH1EMrf+c1WrE1wW9N GkwA== X-Gm-Message-State: AA+aEWb2hauWg6osSQxsd+T9in/2Yozik2C/e4gpEyao3fd/8/tgiCuN T+VsnmOHgTb9nNFGqN7bd5TxyarL X-Received: by 2002:a17:902:784d:: with SMTP id e13mr462463pln.188.1544737162493; Thu, 13 Dec 2018 13:39:22 -0800 (PST) Received: from akuster-ThinkPad-T460s.hsd1.ca.comcast.net ([2601:202:4180:c33:79af:1f36:1822:3801]) by smtp.gmail.com with ESMTPSA id b9sm3288912pfi.118.2018.12.13.13.39.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 13 Dec 2018 13:39:21 -0800 (PST) From: Armin Kuster To: openembedded-core@lists.openembedded.org, akuster808@gmail.com Date: Thu, 13 Dec 2018 13:38:26 -0800 Message-Id: <0ed89f2d5860bfdcea61796de17f152f0b37fc8f.1544735897.git.akuster808@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: Subject: [OE-core] [PATCH 18/45] oeqa: don't litter /tmp with temporary directories 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 If we need to create a temporary directory in targetbuild or buildproject use tempfile.TemporaryDirectory so that when the test case is finished, the directory is deleted. Also synchronise the logic and don't possibly store the temporary directory in self.tmpdir as nothing uses that. (From OE-Core rev: db0e658097130d146752785d0d45f46a3e0bad71) (From OE-Core rev: d39252324a13580cc96f0694b88bc10515e030a0) Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/buildproject.py | 3 ++- meta/lib/oeqa/utils/targetbuild.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) -- 2.7.4 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/lib/oeqa/utils/buildproject.py b/meta/lib/oeqa/utils/buildproject.py index 721f35d..88e7b7f 100644 --- a/meta/lib/oeqa/utils/buildproject.py +++ b/meta/lib/oeqa/utils/buildproject.py @@ -17,7 +17,8 @@ class BuildProject(metaclass=ABCMeta): self.uri = uri self.archive = os.path.basename(uri) if not tmpdir: - tmpdir = tempfile.mkdtemp(prefix='buildproject') + self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-') + tmpdir = self.tempdirobj.name self.localarchive = os.path.join(tmpdir, self.archive) self.dl_dir = dl_dir if foldername: diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py index 1202d57..b8db7b2 100644 --- a/meta/lib/oeqa/utils/targetbuild.py +++ b/meta/lib/oeqa/utils/targetbuild.py @@ -20,8 +20,9 @@ class BuildProject(metaclass=ABCMeta): if not tmpdir: tmpdir = self.d.getVar('WORKDIR') if not tmpdir: - tmpdir = tempfile.mkdtemp(prefix='buildproject') - self.localarchive = os.path.join(tmpdir,self.archive) + self.tempdirobj = tempfile.TemporaryDirectory(prefix='buildproject-') + tmpdir = self.tempdirobj.name + self.localarchive = os.path.join(tmpdir, self.archive) if foldername: self.fname = foldername else: