From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6693487099162656768 X-Received: by 2002:a50:bc15:: with SMTP id j21mr91219444edh.163.1558703189469; Fri, 24 May 2019 06:06:29 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:2f91:: with SMTP id w17ls2125832eji.16.gmail; Fri, 24 May 2019 06:06:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2FJEuGjzpr6fSPTgenZ/qTOdMXyvPvxAlXYsUc5q3Di55O4qNHZAqHexb6mvm+d3BRDsW X-Received: by 2002:a17:906:eb97:: with SMTP id mh23mr82479453ejb.69.1558703189010; Fri, 24 May 2019 06:06:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558703189; cv=none; d=google.com; s=arc-20160816; b=UDiC6HwZfK39+Fja0md69I0PU7UXqNOUjUC4alHDKO9HJh3a0JZ+fWAfAQZ5v7nO9V pv1qHHHYB+Pg8cAhNQTIpwnbfH73R6cs/fnI2QN8eHh0qnRL59zkASMssOe6CdROYJvZ z8NFTFRJUayuGJpvg9xcQDAfxQBHx2Yh+k3WkqrYoQ0EzrObzc3NZ5fBPzsorP+PBtA/ 56OQ8Zg4729mIOXvHBqOPvl/UkLVE/2yff3yIBZZa0OW9HOUBNcd/UQFK1vrvxYnzr6v 3iS355Yza+3O5jBlEd9Sq3MC15tSrvce81zBP9fLxk3xlTlss3dM5YiP566T/OosGhS/ /KyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:references:cc:to :subject; bh=RQuknpzhEzLkiHhsWZt7Vfi11K4fBn8CbTmqVN/B+vk=; b=cEUOIOqP2TFze6AhTS6I2y35lZEe9/WzaQMtVXmyaabR0ypVMN7M/ByUn22Q6xan4b 6R05s+DhB+iar9ZimNwkY0WXjWgUIguFecgYZjLlnGXiZZlawGH3M9jD2JrTwR8JWLQ1 G/+1+ldxCItPtULZ0OAV0Q4+GWuhXSg1C2p5XeI0MyvQzkGGWC9MtrTigctCkfCj0+oU /DE5oKY7Gh6S3M85Qvcu0LOKCP0enafddVAcR2nddASXSQJx9lr7cEIz3mAsiY5kU0cv G1DvGvir10ur/Yfrp5iWXnXu9/FsNXuZlJrO1rGi/r3LA8WpVle8HprdTB/nbmNiwsaI i0fw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of mosipov@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id l30si158923edd.4.2019.05.24.06.06.28 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 May 2019 06:06:28 -0700 (PDT) Received-SPF: pass (google.com: domain of mosipov@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of mosipov@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=mosipov@ilbers.de Received: from [192.168.1.3] (195.165-131-109.adsl-dyn.isp.belgacom.be [109.131.165.195] (may be forged)) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id x4OD6QXc014188 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 May 2019 15:06:26 +0200 Subject: Re: [PATCH] image.bbclass: remove 'get_image_name' function To: claudius.heine.ext@siemens.com, isar-users@googlegroups.com Cc: Claudius Heine References: <20190521142818.25505-1-claudius.heine.ext@siemens.com> From: "Maxim Yu. Osipov" Organization: ilbers GmbH Message-ID: Date: Fri, 24 May 2019 15:06:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190521142818.25505-1-claudius.heine.ext@siemens.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-TUID: BUavNob/vN2M On 5/21/19 4:28 PM, claudius.heine.ext@siemens.com wrote: > From: Claudius Heine > > This function is only used in 'do_copy_boot_files' where a simple shell > function fits better. Applied to the 'next'. Maxim. > Signed-off-by: Claudius Heine > --- > meta/classes/image.bbclass | 33 ++++++--------------------------- > 1 file changed, 6 insertions(+), 27 deletions(-) > > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index 3eb261f..45ed8ba 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -64,29 +64,6 @@ inherit image-postproc-extension > # Extra space for rootfs in MB > ROOTFS_EXTRA ?= "64" > > -def get_image_name(d, name_link): > - S = d.getVar("IMAGE_ROOTFS", True) > - path_link = os.path.join(S, name_link) > - > - # If path_link does not exist, it might be a symlink > - # in the target rootfs. This block attempts to resolve > - # it relative to the rootfs location. > - if not os.path.exists(path_link): > - path_link = os.path.join( > - S, > - os.path.relpath( > - os.path.realpath(path_link), > - "/", > - ), > - ) > - > - if os.path.exists(path_link): > - base = os.path.basename(os.path.realpath(path_link)) > - full = d.getVar("IMAGE_FULLNAME", True) + "." + base > - return [base, full] > - > - return ["", ""] > - > def get_rootfs_size(d): > import subprocess > rootfs_extra = int(d.getVar("ROOTFS_EXTRA", True)) > @@ -149,12 +126,14 @@ addtask rootfs_install before do_build after do_unpack > > do_copy_boot_files[dirs] = "${DEPLOY_DIR_IMAGE}" > do_copy_boot_files() { > - if [ -n "${KERNEL_IMAGE}" ]; then > - cp -f ${IMAGE_ROOTFS}/boot/${@get_image_name(d, 'vmlinuz')[0]} ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE} > + kernel="$(realpath -q '${IMAGE_ROOTFS}/vmlinuz')" > + if [ -n "$kernel" ]; then > + cp -f "$kernel" '${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE}' > fi > > - if [ -n "${INITRD_IMAGE}" ]; then > - sudo cp -f ${IMAGE_ROOTFS}/boot/${@get_image_name(d, 'initrd.img')[0]} ${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE} > + initrd="$(realpath -q '${IMAGE_ROOTFS}/initrd.img')" > + if [ -n "$initrd" ]; then > + cp -f "$initrd" '${DEPLOY_DIR_IMAGE}/${INITRD_IMAGE}' > fi > > # Check DTB_FILE via inline python to handle unset case: > -- Maxim Osipov ilbers GmbH Maria-Merian-Str. 8 85521 Ottobrunn Germany +49 (151) 6517 6917 mosipov@ilbers.de http://ilbers.de/ Commercial register Munich, HRB 214197 General Manager: Baurzhan Ismagulov