From patchwork Sat Mar 7 03:07:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1250811 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=hnEinKjZ; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Z99S4pTDz9sPK for ; Sat, 7 Mar 2020 14:35:24 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9CD428157E; Sat, 7 Mar 2020 04:33:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="hnEinKjZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9937D813AD; Sat, 7 Mar 2020 04:32:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 49252813D2 for ; Sat, 7 Mar 2020 04:32:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id a6so3920879ilc.4 for ; Fri, 06 Mar 2020 19:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+A8iTqXcwSW+ziJRQEb91xd0LGnLYDrw0XQTg4iClPo=; b=hnEinKjZV47+DrUNncHxr6/Q77UiWYz5HGH4fb22WIIBsKiYSwMEhqjdZsU1BpMUTW GdjaZc640DjyqQC0EpTPW8+FHrsn0X2WwEF7E7I8RFO4zCG45LE2ujh35UHIQgLNUDFA PGFvs1DbW8V1xumJfjCKYFHrs8pt5hOhUsHLM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+A8iTqXcwSW+ziJRQEb91xd0LGnLYDrw0XQTg4iClPo=; b=f7+9NlPw+wurzpAPqtciXeq/icODGeK1B+Patf+Zc7djaLpy6a/xM6JqvItjxXoOgg 4NbkU807jLp4gD5pURrlnAyhbaxhjrnhXA6Dy0HGcao5rpPKgZr8O5WtyIspUZWZmPDV rSWv2wksCecM6CSYjxtqiJdNSF32osS1dbNb8nevx6X0vsRxXa4iR7dAPgCIXrdgo5cZ OWLe2qioZeuOa1dDs39B4JEEeSa1I7rFh+Xs0lyewjaDxDge9LeINOXnQNXAA7y6/oCt rc2f1RUI8xE1PEF5+Fto7WNn1yrJQWZ3JhrXTo+/+6mDaxkNIUB/yrjFuF469MFae3LT 2WbA== X-Gm-Message-State: ANhLgQ1dqsVUuWW2ppqqFcV899KHXUpsaX6M5YMZC/WahZ0eSTTpH2Gb o1yq03tHDhFsDNFe3m7nqrzuEv6A51k= X-Google-Smtp-Source: ADFU+vsCPxF4r5XUN0VGkEmRo5WMtLKjGKaEPhFrJzTG28gGW415GGTf7SFUPlMy1Whb+kcePXZ4pQ== X-Received: by 2002:a92:91c7:: with SMTP id e68mr6201276ill.161.1583551969936; Fri, 06 Mar 2020 19:32:49 -0800 (PST) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id g16sm8571824ioc.13.2020.03.06.19.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2020 19:32:49 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Stephen Warren , Stephen Warren , Tom Rini , Simon Glass Subject: [PATCH 18/20] buildman: Allow building within a subdir of the current dir Date: Fri, 6 Mar 2020 20:07:32 -0700 Message-Id: <20200307030734.237401-14-sjg@chromium.org> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog In-Reply-To: <20200307030734.237401-1-sjg@chromium.org> References: <20200307030734.237401-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean This is useful in some situations, in particular with -w and when building in-tree. Now that we are more careful about what we remove in _PrepareOutputSpace(), it should be save to relax this restriction. Update the progress information also so it is clear what buildman is doing. Remove files can take a long time. Signed-off-by: Simon Glass --- tools/buildman/builder.py | 3 ++- tools/buildman/control.py | 23 ----------------------- tools/buildman/func_test.py | 9 --------- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 30ec4254f8..70c55c588a 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -1560,10 +1560,11 @@ class Builder: """ to_remove = self._GetOutputSpaceRemovals() if to_remove: - Print('Removing %d old build directories' % len(to_remove), + Print('Removing %d old build directories...' % len(to_remove), newline=False) for dirname in to_remove: shutil.rmtree(dirname) + Print('done') def BuildBoards(self, commits, board_selected, keep_outputs, verbose): """Build all commits for a list of boards diff --git a/tools/buildman/control.py b/tools/buildman/control.py index ded4360250..7d31863c63 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -85,28 +85,6 @@ def ShowActions(series, why_selected, boards_selected, builder, options, for warning in board_warnings: print(col.Color(col.YELLOW, warning)) -def CheckOutputDir(output_dir): - """Make sure that the output directory is not within the current directory - - If we try to use an output directory which is within the current directory - (which is assumed to hold the U-Boot source) we may end up deleting the - U-Boot source code. Detect this and print an error in this case. - - Args: - output_dir: Output directory path to check - """ - path = os.path.realpath(output_dir) - cwd_path = os.path.realpath('.') - while True: - if os.path.realpath(path) == cwd_path: - Print("Cannot use output directory '%s' since it is within the current directory '%s'" % - (path, cwd_path)) - sys.exit(1) - parent = os.path.dirname(path) - if parent == path: - break - path = parent - def ShowToolchainInfo(boards, toolchains, print_arch, print_prefix): """Show information about a the tool chain used by one or more boards @@ -331,7 +309,6 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, output_dir = os.path.join(options.output_dir, dirname) if clean_dir and os.path.exists(output_dir): shutil.rmtree(output_dir) - CheckOutputDir(output_dir) builder = Builder(toolchains, output_dir, options.git_dir, options.threads, options.jobs, gnu_make=gnu_make, checkout=True, show_unknown=options.show_unknown, step=options.step, diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index f9f8f80593..2a256a9263 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -534,15 +534,6 @@ class TestFunctional(unittest.TestCase): self.assertEqual(self._builder.count, self._total_builds) self.assertEqual(self._builder.fail, 0) - def testBadOutputDir(self): - """Test building with an output dir the same as out current dir""" - self._test_branch = '/__dev/__testbranch' - with self.assertRaises(SystemExit): - self._RunControl('-b', self._test_branch, '-o', os.getcwd()) - with self.assertRaises(SystemExit): - self._RunControl('-b', self._test_branch, '-o', - os.path.join(os.getcwd(), 'test')) - def testWorkInOutput(self): """Test the -w option which should write directly to the output dir""" board_list = board.Boards()