From patchwork Fri Aug 16 09:20:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dechesne X-Patchwork-Id: 19211 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 97D69248E6 for ; Fri, 16 Aug 2013 09:21:09 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id ox1sf2205232veb.8 for ; Fri, 16 Aug 2013 02:21:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=er7rPEbdfrq/AQKaG0OcR/Jc16LiOIk89Q3PMsmjWLk=; b=ASQrwmTPZ64P5o9h/BK60uI+d1PB6BOnuk4qATkOtsCafE6PhsLVttx3VLC/H1g4qL vb6GEvr91rkKRCc6/tZ9QOpOXF15kx0thimDNmNcOjPNcWmmHc3ehBfyh1MDh45Ye4c1 DWZdq0GGBf3e8NmBoz5Z3DNnQQ6wK1fz1FywrNdrnbfYZQmsqZvijf3+ewB9Rx9W4JHL Os+FCmMSZA4CfdKp74vGKbNz1gN/i3nkJUSFo68JL8IWbPePpeGBhMdFeL0Wm5exIgfQ 0Pj6DU3n/8tyyaPf+LoXKVsBM5xkNf94Z3V3cKINpuBwfl8SjMZ0F9bkEI8GjuABVz9T W02w== X-Received: by 10.236.0.229 with SMTP id 65mr229997yhb.15.1376644868946; Fri, 16 Aug 2013 02:21:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.82.74 with SMTP id g10ls722399qey.60.gmail; Fri, 16 Aug 2013 02:21:08 -0700 (PDT) X-Received: by 10.52.180.229 with SMTP id dr5mr275159vdc.20.1376644868812; Fri, 16 Aug 2013 02:21:08 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id ci9si121722vcb.106.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 02:21:08 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ha11so1263160vcb.35 for ; Fri, 16 Aug 2013 02:21:08 -0700 (PDT) X-Gm-Message-State: ALoCoQnzRb9uts1GToC8EeNfE+QAQmN3gs5a6SVVAG0aAu1o26SP9lVCdjaXNng53U2F9cuGqSmJ X-Received: by 10.52.244.78 with SMTP id xe14mr269631vdc.30.1376644868507; Fri, 16 Aug 2013 02:21:08 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp58735vcz; Fri, 16 Aug 2013 02:21:07 -0700 (PDT) X-Received: by 10.194.240.129 with SMTP id wa1mr393907wjc.31.1376644867351; Fri, 16 Aug 2013 02:21:07 -0700 (PDT) Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com [74.125.82.47]) by mx.google.com with ESMTPS id ga19si163326wic.74.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 02:21:07 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.47 is neither permitted nor denied by best guess record for domain of nicolas.dechesne@linaro.org) client-ip=74.125.82.47; Received: by mail-wg0-f47.google.com with SMTP id j13so1333474wgh.2 for ; Fri, 16 Aug 2013 02:21:06 -0700 (PDT) X-Received: by 10.195.18.39 with SMTP id gj7mr68792wjd.53.1376644866757; Fri, 16 Aug 2013 02:21:06 -0700 (PDT) Received: from localhost.localdomain (gau06-1-78-243-126-63.fbx.proxad.net. [78.243.126.63]) by mx.google.com with ESMTPSA id bt8sm789126wib.8.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Aug 2013 02:21:05 -0700 (PDT) From: Nicolas Dechesne To: bitbake-devel@lists.openembedded.org Cc: patches@linaro.org, Nicolas Dechesne Subject: [RFC PATCH] build.py: create symlink for run.do_xxx scripts Date: Fri, 16 Aug 2013 11:20:59 +0200 Message-Id: <1376644859-11034-1-git-send-email-nicolas.dechesne@linaro.org> X-Mailer: git-send-email 1.8.1.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nicolas.dechesne@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The 'courtesy' symlink for log.do_xxx are quite useful when debugging, so with this commit, we now get similar 'courtesy' symlink for run.do_xxx scripts. We only create symlink for tasks, not individual functions. The symlink is create right before the actual runfile is created, indeed we cannot create the symlink right after running the task since a failure or execption can happen, in which case the symlink wouldn't be created, and symlink are particularely useful when the task failed! Another option would be create the symlink after the runfile is created, and before the script is executed, but that means we need to duplicate the code in case of Shell vs Python task. Signed-off-by: Nicolas Dechesne --- lib/bb/build.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/bb/build.py b/lib/bb/build.py index d91ff53..0977ea7 100644 --- a/lib/bb/build.py +++ b/lib/bb/build.py @@ -190,6 +190,20 @@ def exec_func(func, d, dirs = None): runfile = os.path.join(tempdir, runfn) bb.utils.mkdirhier(os.path.dirname(runfile)) + # Setup the courtesy link to the runfn, only for tasks + # we create the link 'just' before the run script is created + # if we create it after, and if the run script fails, then the + # link won't be created as an exception would be fired. + if task == func: + runlink = os.path.join(tempdir, 'run.{0}'.format(task)) + if runlink: + bb.utils.remove(runlink) + + try: + os.symlink(runfn, runlink) + except OSError: + pass + with bb.utils.fileslocked(lockfiles): if ispython: exec_func_python(func, d, runfile, cwd=adir)