Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5C6D6E00D30; Thu, 20 Oct 2016 07:36:17 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.220.175 listed in list.dnswl.org] Received: from mail-qk0-f175.google.com (mail-qk0-f175.google.com [209.85.220.175]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id ECB67E00D07 for ; Thu, 20 Oct 2016 07:36:11 -0700 (PDT) Received: by mail-qk0-f175.google.com with SMTP id f128so93799956qkb.1 for ; Thu, 20 Oct 2016 07:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=eJi+JFP73VW9qGtFRXuT2t18XwM/LPSs53DBzildmQw=; b=PVwDyb7YmMuiu0SZGpec7tQPV7EEzyWp2sIxV+z+C8Br5v7wjJe9sJNdAE6krQxSeq Ow/gN0MsRzSGFfpqxp0dULP6XAJY0ArCOflXRwfzLzv2/sBSHmRI2R0PC0+qaZT6i2PB gqYsB1qEfy72tRFqh2ugZ4+cBwTKKfoLZb6AnTO2DCSaPJY9K3nNQxk7oPrd4ebKrxBW mP8cv5vt0lwMIewTXlN6WO6LoyQfKrVOBnDLbvJAnWZFsH1SjQtgllEPmZNW8dcBNc3x 9fGR0eRPqnL2mamvayj1RgnP+t/GAn0sBQ9BEs78afQysKQDo/CeG/0iT1qny5lAOdAB dFhg== 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; bh=eJi+JFP73VW9qGtFRXuT2t18XwM/LPSs53DBzildmQw=; b=VpR2eTLcoZ0ad5yP5sl8QaJ+1OzMmxBUPpVkggHnf2qFOk5CGsSBRALiV35U850M7K JiEBH/Kn+QT1v9iFYCGtZaOUZZXhE99qZ4JkEU8p4pl5sZec9h7TuW95qCFRfPEV7cHz q5wHuW9NJvqo+BuwPx+SojcwfHzglmPsu8WU3fu7fbwQNHhrE3CnmExifn+T+H3LtgJv pybrk/d0hhWX3a45eDVTQJe0xxvsLIGeNWcl5MQDR3oSV/2eG6CUdO6oe36A1/i9EEi+ kl8QLUWWN3tkhXboRl1rf6MEIV/UPWbwL7WjgTDI0hQY1+1g6BZVIFBdPG/zKI+N/mkc pM3A== X-Gm-Message-State: AA6/9RmVE9/UVXboLMxkq8TigJajTBUn+oZwuOkq8htC4fRsgTs39FdbPHCnWXoYQt1ZjALz X-Received: by 10.194.175.166 with SMTP id cb6mr621169wjc.84.1476974169604; Thu, 20 Oct 2016 07:36:09 -0700 (PDT) Received: from orion.home (host31-48-249-102.range31-48.btcentralplus.com. [31.48.249.102]) by smtp.gmail.com with ESMTPSA id o1sm79361289wjh.9.2016.10.20.07.36.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Oct 2016 07:36:08 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 20 Oct 2016 15:36:06 +0100 Message-Id: <1476974166-8004-1-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 Cc: brian avery Subject: [PATCH] toaster: buildinfohelper Handle regex pattern paths X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Oct 2016 14:36:17 -0000 From: brian avery We were presuming that all the layer dependency information was of the form "^/path/to/layer" to we were just stripping the leading "^" off of the layer information when we were matching the layer priorities to the toaster database. This patch splits out the priorities layer match which gets a regex from the task/recipe match which is gets a path. Signed-off-by: brian avery --- bitbake/lib/bb/ui/buildinfohelper.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 5b69660..30adfc8 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -982,6 +982,27 @@ class BuildInfoHelper(object): pass return task_information + def _get_layer_version_for_dependency(self, pathRE): + self._ensure_build() + + def _slkey_interactive(layer_version): + assert isinstance(layer_version, Layer_Version) + return len(layer_version.local_path) + + # we don't care if we match the trailing slashes + p = re.compile(re.sub("/[^/]*?$","",pathRE)) + # Heuristics: we always match recipe to the deepest layer path in the discovered layers + for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_slkey_interactive): + if p.fullmatch(lvo.local_path): + return lvo + if lvo.layer.local_source_dir: + if p.fullmatch(lvo.layer.local_source_dir): + return lvo + #if we get here, we didn't read layers correctly; dump whatever information we have on the error log + logger.warning("Could not match layer dependency for path %s : %s", path, self.orm_wrapper.layer_version_objects) + + + def _get_layer_version_for_path(self, path): self._ensure_build() @@ -1372,7 +1393,7 @@ class BuildInfoHelper(object): if 'layer-priorities' in event._depgraph.keys(): for lv in event._depgraph['layer-priorities']: (_, path, _, priority) = lv - layer_version_obj = self._get_layer_version_for_path(path[1:]) # paths start with a ^ + layer_version_obj = self._get_layer_version_for_dependency(path) assert layer_version_obj is not None layer_version_obj.priority = priority layer_version_obj.save() -- 2.7.4