From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6609939533494484992 X-Received: by 2002:adf:add4:: with SMTP id w78-v6mr2046789wrc.26.1538996477956; Mon, 08 Oct 2018 04:01:17 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:1d3:: with SMTP id 202-v6ls58190wmb.1.gmail; Mon, 08 Oct 2018 04:01:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV63i3WotmPZo/WJ/nTt4d8BSd4khkN5Ro6EdDj2DvkO++4qCy/n137aTCj6kBp3MSYQ3UmY9 X-Received: by 2002:a1c:8681:: with SMTP id i123-v6mr891073wmd.13.1538996477390; Mon, 08 Oct 2018 04:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538996477; cv=none; d=google.com; s=arc-20160816; b=T3dcAb136WfVFbPhz6kjJ6pl+9D36T1f7cFCWtc5Yvk8YdqESLE9UmKD40vsd9jSgH aF9v3tU2Hy40zt75Xqyo9ST9A/JD6CHyxRZbUPpmyJxkN7nfA+RQEdbmfK7URYfd08kV 6iELdgQY50tWi1InEzF19gt/afKMSx8oJ54n4uF28PRWuEjyPqhjq2ZcPHaoU+A6BvHm iVpukSq2q1CINFeSZgHCMu9CGXkyJU9trfy2XWkr4b2VuzRP9LUUDGUo3seog89vF4Lk IPyHTn6iqc3TWqZnG+a0v1/WKipJ79E59+2NPBKHGXYuwyGPf4nms9skqk9kALH70keU 4K2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:to:from; bh=hKqYJBZGtad4lRfBDvLhF/3Tch5vGXtEtcC84PPM6kI=; b=0AV4hjbAbYfJmu/OjB/bpwvkem8dqMpbPJGQAYnD9mcOd6DNjXjH7Btxu3I0mh7kX4 Vhyh8KxjZSkdobpNY4G0ncQJVIowcqJyfLyOO7HhUX70kNiQEoWo7TevszLBK/jF1uLV cPwmRgRJLV3GgLiecnefinpqHHtjVO5izNc0goWWkhtxvs9WVOVoLKEYkhSsD4bGMpQA cLlWzsS2mUf+my1cp3Bu5ImRz3P3gpUedX0E41y0/TKKI0qvxCRnA70bkijtqfetS5Yk fl4zY4SQdJcoZKG2DSzvt8GeGgJMt5mtthGUEVQRqVSZN24XUxn0tUzIapuGwlVSvstI sKYg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Return-Path: Received: from david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id v6-v6si64052wrn.0.2018.10.08.04.01.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Oct 2018 04:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.14 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id w98B1Ghm017353 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 8 Oct 2018 13:01:16 +0200 Received: from md1f2u6c.ad001.siemens.net ([167.87.48.216]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id w98B1ExO014631 for ; Mon, 8 Oct 2018 13:01:16 +0200 From: Jan Kiszka To: isar-users Subject: [PATCH 04/10] meta: Add bbclass to retrieve selected WKS file Date: Mon, 8 Oct 2018 13:01:08 +0200 Message-Id: <9b53505c786d87a28cbe4238d1f0ae97f25e92f2.1538996473.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: References: In-Reply-To: References: X-TUID: 38d0flBdbCUm From: Jan Kiszka This implements a lookup service for the target's WKS_FILE. The goal is to concentrate the search in a single place in order to provide a consistent logic. In addition to permitting absolute paths, get_wks_full_path() implements almost all search paths of OE: - /wic - /scripts/lib/wic/canned-wks - /scripts/lib/wic/canned-wks It does not support THISDIR for wic-image recipes because that would restrict the visibility of that file to a single recipe while we would like to use it freely, also in other recipes such as u-boot-script. Signed-off-by: Jan Kiszka --- meta/classes/wks-file.bbclass | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 meta/classes/wks-file.bbclass diff --git a/meta/classes/wks-file.bbclass b/meta/classes/wks-file.bbclass new file mode 100644 index 0000000..493fea7 --- /dev/null +++ b/meta/classes/wks-file.bbclass @@ -0,0 +1,30 @@ +# This software is a part of ISAR. +# Copyright (C) 2018 Siemens AG +# +# SPDX-License-Identifier: MIT + +def get_wks_full_path(d): + if (d.getVar('IMAGE_TYPE', True) or '') != 'wic-img': + return "" + + wks_full_path = None + + wks_file = d.getVar('WKS_FILE', True) + if not wks_file.endswith('.wks'): + wks_file += '.wks' + + if os.path.isabs(wks_file): + if os.path.exists(wks_file): + wks_full_path = wks_file + else: + bbpaths = d.getVar('BBPATH', True).split(':') + corebase = d.getVar('COREBASE', True) + search_path = ':'.join('%s/wic' % p for p in bbpaths) + ':' + \ + ':'.join('%s/scripts/lib/wic/canned-wks' % l \ + for l in (bbpaths + [corebase])) + wks_full_path = bb.utils.which(search_path, wks_file) + + if not wks_full_path: + bb.fatal("WKS_FILE '%s' not found" % wks_file) + + return wks_full_path -- 2.16.4