From patchwork Tue Dec 2 00:33:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 416649 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DFF2F1402A9 for ; Tue, 2 Dec 2014 11:44:19 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 824B94B6F6; Tue, 2 Dec 2014 01:44:18 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5Y8JBOXJuGcS; Tue, 2 Dec 2014 01:44:18 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CA9894B6F7; Tue, 2 Dec 2014 01:44:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 96FD34B6FA for ; Tue, 2 Dec 2014 01:44:12 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VGHlYhTVouzH for ; Tue, 2 Dec 2014 01:44:12 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ie0-f202.google.com (mail-ie0-f202.google.com [209.85.223.202]) by theia.denx.de (Postfix) with ESMTPS id 10EED4B6F7 for ; Tue, 2 Dec 2014 01:44:07 +0100 (CET) Received: by mail-ie0-f202.google.com with SMTP id rl12so1241692iec.1 for ; Mon, 01 Dec 2014 16:44:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d+MqE+aPPhP35ecPwNPoaRyz/LioVTJCRD0gf9q7x80=; b=MB/f4wd4uztPgB+TtxDrwgnNau3otkWq8aXwKyLlPVsshXr6KNJZ0FJSCNNdTvtEpY YhutS8UM/0UGrmteAd8w30peIKUHDQnraCIA4JBqoz5cW8NuHEz8KL36reLlegFo0bSj uoSZRuejZ+Wt2B5oxiyyZTQ5BuetLriO3Lv8ky6Tt97xM1Rey8XrnFzR9xAXQUcPZ9Q5 41tErxb3PzY4CPogqENgnPleTMQzrp0O7ZQxdgPSJs1r5krjt07yLzKFLdLnOPojSpOt h7L1cLg5g1t0nTjhnx4iFziTQA+BMgh4QGeetW6JZyALyK7XTpTMhv9Kzi4Ii8lGOb/8 ZtgA== X-Gm-Message-State: ALoCoQn+rxsDEVwmtP7CcQdwexTTfqkJjquo5w4V/JiRR2xTZ0CKWlcgigIlX/etaRSLILczjjF0 X-Received: by 10.182.92.163 with SMTP id cn3mr25847732obb.49.1417481046795; Mon, 01 Dec 2014 16:44:06 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id 26si183788yhj.7.2014.12.01.16.44.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Dec 2014 16:44:06 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id KdnKijBx.1; Mon, 01 Dec 2014 16:44:06 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 1E41F220E1E; Mon, 1 Dec 2014 17:36:16 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Mon, 1 Dec 2014 17:33:55 -0700 Message-Id: <1417480447-5763-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1417480447-5763-1-git-send-email-sjg@chromium.org> References: <1417480447-5763-1-git-send-email-sjg@chromium.org> Cc: Steve Rae , =?UTF-8?q?Marek=20Va=C5=A1ut?= , Jeroen Hofstee , Tom Rini Subject: [U-Boot] [PATCH 05/17] buildman: Add an option to flatten output directory trees X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When building current source for a single board, buildman puts the output in /current/current/. Add an option to make it use / instead. This removes the unnecessary directories in that case, controlled by the --no-subdirs/-N option. Suggested-by: Tom Rini Signed-off-by: Simon Glass --- tools/buildman/builder.py | 12 ++++++++---- tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 8 ++++++-- tools/buildman/test.py | 8 ++++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index 05ebfd2..ca74c36 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -174,7 +174,8 @@ class Builder: self.func_sizes = func_sizes def __init__(self, toolchains, base_dir, git_dir, num_threads, num_jobs, - gnu_make='make', checkout=True, show_unknown=True, step=1): + gnu_make='make', checkout=True, show_unknown=True, step=1, + no_subdirs=False): """Create a new Builder object Args: @@ -213,6 +214,7 @@ class Builder: self._step = step self.in_tree = False self._error_lines = 0 + self.no_subdirs = no_subdirs self.col = terminal.Color() @@ -392,15 +394,17 @@ class Builder: Args: commit_upto: Commit number to use (0..self.count-1) """ + commit_dir = None if self.commits: commit = self.commits[commit_upto] subject = commit.subject.translate(trans_valid_chars) commit_dir = ('%02d_of_%02d_g%s_%s' % (commit_upto + 1, self.commit_count, commit.hash, subject[:20])) - else: + elif not self.no_subdirs: commit_dir = 'current' - output_dir = os.path.join(self.base_dir, commit_dir) - return output_dir + if not commit_dir: + return self.base_dir + return os.path.join(self.base_dir, commit_dir) def GetBuildDir(self, commit_upto, target): """Get the name of the build directory for a commit number diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index 27d3c70..2b75653 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -55,6 +55,8 @@ def ParseArgs(): help='List available tool chains') parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run', default=False, help="Do a dry run (describe actions, but do nothing)") + parser.add_option('-N', '--no-subdirs', action='store_true', dest='no_subdirs', + default=False, help="Don't create subdirectories when building current source for a single board") parser.add_option('-o', '--output-dir', type='string', dest='output_dir', default='..', help='Directory where all builds happen and buildman has its workspace (default is ../)') diff --git a/tools/buildman/control.py b/tools/buildman/control.py index 663c4ce..df24509 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -209,12 +209,16 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, output_dir = options.output_dir if options.branch: dirname = options.branch.replace('/', '_') - output_dir = os.path.join(options.output_dir, dirname) + # As a special case allow the board directory to be placed in the + # output directory itself rather than any subdirectory. + if not options.no_subdirs: + output_dir = os.path.join(options.output_dir, dirname) if clean_dir and os.path.exists(output_dir): shutil.rmtree(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) + show_unknown=options.show_unknown, step=options.step, + no_subdirs=options.no_subdirs) builder.force_config_on_failure = not options.quick if make_func: builder.do_make = make_func diff --git a/tools/buildman/test.py b/tools/buildman/test.py index f16d2fd..c085d2f 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -373,5 +373,13 @@ class TestBuild(unittest.TestCase): build.commit_count = 0 self.CheckDirs(build, '/current') + def testOutputDirNoSubdirs(self): + build = builder.Builder(self.toolchains, BASE_DIR, None, 1, 2, + checkout=False, show_unknown=False, + no_subdirs=True) + build.commits = None + build.commit_count = 0 + self.CheckDirs(build, '') + if __name__ == "__main__": unittest.main()