From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7007434304848396288 X-Received: by 2002:a05:6402:389:: with SMTP id o9mr13307400edv.213.1631545443878; Mon, 13 Sep 2021 08:04:03 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a17:906:1644:: with SMTP id n4ls2993572ejd.7.gmail; Mon, 13 Sep 2021 08:04:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwn/Mv0WE1cMnr620z+GqSoMnfu6xwINLLMpU2XWZ5jwNAlgMJAPtGU+dZjTpkNxl9nj406 X-Received: by 2002:a17:906:4784:: with SMTP id cw4mr13530959ejc.160.1631545442771; Mon, 13 Sep 2021 08:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631545442; cv=none; d=google.com; s=arc-20160816; b=vp0I4MXmQWcGrwA76sw+Ab01eCklXFdDP4Z2VcmC0xp30AFgtoYoR5zY+5jmg+ANYc Wla85MGq0IhgIF6fDZN8tOj2E2TDuuM0l04qNbglhgF2peHyg1+5eBntPCDP4PkhfcW3 sT46F64Vi+oBdQePcOdCZSkKRg/5W3442tQyNJbcWFycKGYExAE3+6mgftCiWwBMLQfT BnmYO5e42tSyzxjfOjh7tSEBBsTw/W1b2eslzqLSyGf78Zrqip35XZFCD06NRSrF/RjQ D83kxZjHCFTpi7+NX0EqGz5s/Ao3ND1gJwIxn5/uH494ZEMcJGneZPR91OLLp+u1ppu2 IP0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=uZzrEOZibEW5yR+Efi8P3PinM/TrSw7LMtE+wy0hkII=; b=nciSrdprYcx5lkKsQJnzS4jem70GrENCXHimFwASekS9sPC1G7a1j/sNwS4Xuzc+UF cXeawxe8jcrxlx4l54LJRf5zaCXYb74Ud+GcXBPayOPZEIiYhWu9zxqV3PkNcsYF0nOy BeTTGVeizrPed7ebjizHKCXdyNr1yfEGXquMJLJr1Gge+83fX4K0YSW3n74fFwunT6kL kGODmrzmJTE6VUVrgvMrnO5jvKmoJhJTZUuDAtYpL/xiXHJ0LOaSfwkc4i8o1RtuL1DR QwXKKR2oyQNcmfpZyxWEULDHlflWg8W1K6LzLdlLa+Va9ccQj+gUGgraQN/GQOriR+BJ kwsg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id w12si966779edj.5.2021.09.13.08.04.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Sep 2021 08:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ubely@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 ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from baighyz.m.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 18DF3tTO009770 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 13 Sep 2021 17:04:00 +0200 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH 2/4] buildstats: Fix bbclass to work with ISAR Date: Mon, 13 Sep 2021 17:03:53 +0200 Message-Id: <20210913150355.9973-3-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210913150355.9973-1-ubely@ilbers.de> References: <20210913150355.9973-1-ubely@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: JL8fbIGNXkyb 1. rootfs may be empty that causes exception. 2. sudo required to calculate rootfs disk usage. 3. sys.path modification to make meta/lib available. Signed-off-by: Uladzimir Bely --- meta/classes/buildstats.bbclass | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass index 0de6052..e2db8f6 100644 --- a/meta/classes/buildstats.bbclass +++ b/meta/classes/buildstats.bbclass @@ -242,9 +242,9 @@ python run_buildstats () { bs = os.path.join(bsdir, "build_stats") with open(bs, "a") as f: rootfs = d.getVar('IMAGE_ROOTFS') - if os.path.isdir(rootfs): + if rootfs and os.path.isdir(rootfs): try: - rootfs_size = subprocess.check_output(["du", "-sh", rootfs], + rootfs_size = subprocess.check_output(["sudo", "du", "-sh", rootfs], stderr=subprocess.STDOUT).decode('utf-8') f.write("Uncompressed Rootfs size: %s" % rootfs_size) except subprocess.CalledProcessError as err: @@ -270,6 +270,9 @@ addhandler run_buildstats run_buildstats[eventmask] = "bb.event.BuildStarted bb.event.BuildCompleted bb.event.HeartbeatEvent bb.build.TaskStarted bb.build.TaskSucceeded bb.build.TaskFailed" python runqueue_stats () { + import sys + oe_lib_path = os.path.join(d.getVar('LAYERDIR_core'), 'lib') + sys.path.insert(0, oe_lib_path) import buildstats from bb import event, runqueue # We should not record any samples before the first task has started, -- 2.20.1