Yocto Project Discussions
 help / color / mirror / Atom feed
From: benjamin.esquivel@gmail.com
To: yocto@lists.yoctoproject.org
Cc: tarxf@esquibits.com, Benjamin Esquivel <benjamin.esquivel@gmail.com>
Subject: [yocto-autobuilder-helper][PATCH] prepare-shared-repos: create missing dirs
Date: Wed, 21 Sep 2022 19:39:48 -0700	[thread overview]
Message-ID: <20220922023948.387053-1-benjamin.esquivel@gmail.com> (raw)

From: Benjamin Esquivel <benjamin.esquivel@gmail.com>

on new autobuilder setups, the tmp and destination tar repo dir are
not created anywhere and this makes the step fail.

also a forward looking change to remove /home/pokybuild* instances in
the script to reduce maintenance while getting these paths from
config.

Signed-off-by: Benjamin Esquivel <benjamin.esquivel@gmail.com>
---
 config.json                     |  2 ++
 scripts/prepare-shared-repos    |  8 ++++++--
 scripts/summarize_top_output.py | 13 +++++++++----
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/config.json b/config.json
index 9dcc1db..cee0675 100644
--- a/config.json
+++ b/config.json
@@ -24,6 +24,8 @@
     "BUILDPERF_STATEDIR" : "${BASE_HOMEDIR}/buildperf",
     "BUILDPERF_RESULTSDIR" : "${BASE_HOMEDIR}/buildperf-results",
 
+    "WORKER_DIR" : "${BASE_HOMEDIR}/yocto-worker",
+
     "defaults" : {
         "NEEDREPOS" : ["poky"],
         "DISTRO" : "poky",
diff --git a/scripts/prepare-shared-repos b/scripts/prepare-shared-repos
index b855d18..e8b123d 100755
--- a/scripts/prepare-shared-repos
+++ b/scripts/prepare-shared-repos
@@ -35,8 +35,12 @@ with open(args.repojson) as f:
     repos = json.load(f)
 
 stashdir = utils.getconfig("REPO_STASH_DIR", ourconfig)
+basetmpdir = os.path.join(utils.getconfig("BASE_HOMEDIR", ourconfig), "tmp")
+sharedsrcdir = os.path.abspath(args.sharedsrcdir)
+utils.mkdir(basetmpdir)
+utils.mkdir(sharedsrcdir)
 
-with tempfile.TemporaryDirectory(prefix="shared-repo-temp-", dir="/home/pokybuild/tmp") as tempdir:
+with tempfile.TemporaryDirectory(prefix="shared-repo-temp-", dir=basetmpdir) as tempdir:
     for repo in sorted(repos.keys()):
         utils.printheader("Intially fetching repo %s" % repo)
         # shallow clones disabled as it doesn't work correctly with revision numbers in the result repo leading to release build failures.
@@ -48,4 +52,4 @@ with tempfile.TemporaryDirectory(prefix="shared-repo-temp-", dir="/home/pokybuil
             utils.publishrepo(tempdir, repo, args.publish_dir)
 
     utils.printheader("Creating shared src tarball")
-    subprocess.check_call("tar -I zstd -cf " + args.sharedsrcdir.rstrip("/") + ".tar.zst ./*", shell=True, cwd=tempdir)
+    subprocess.check_call("tar -I zstd -cf " + sharedsrcdir + ".tar.zst ./*", shell=True, cwd=tempdir)
diff --git a/scripts/summarize_top_output.py b/scripts/summarize_top_output.py
index 618cde1..a0c039c 100755
--- a/scripts/summarize_top_output.py
+++ b/scripts/summarize_top_output.py
@@ -5,8 +5,13 @@
 
 import os, sys, glob
 
+import utils
+
+ourconfig = utils.loadconfig()
+
 # constants
-HOME = "/home/pokybuild/yocto-worker/"
+
+workerdir = utils.getconfig("WORKER_DIR", ourconfig)
 top_header = 7
 max_cols = 11
 cpu_hoggers = 5
@@ -18,7 +23,7 @@ special_cmds = ["rm", "tar", "qemu"]
 
 # string substitution to make things easier to read
 subs = {
-    "/home/pokybuild/yocto-worker/" : "~/",
+    workerdir : "~/",
     "/build/build/tmp/work/" : "/...WORK_DIR.../"
 }
 
@@ -64,8 +69,8 @@ def summarize_top(top_outs, target):
         short_summary = top_out[:top_header + cpu_hoggers]
         for line in top_out[top_header:]:
             cmd = line.split(maxsplit=max_cols)[-1]
-            if cmd.startswith(HOME):
-                b = cmd.split(HOME)[1].split("/")[0]
+            if cmd.startswith(workerdir):
+                b = cmd.split(workerdir)[1].split("/")[0]
                 if b not in other_builds:
                     other_builds.append(b)
             if cmd[0] == "[" and cmd[-1] == "]":    # kernel processes
-- 
2.30.2



                 reply	other threads:[~2022-09-22  2:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220922023948.387053-1-benjamin.esquivel@gmail.com \
    --to=benjamin.esquivel@gmail.com \
    --cc=tarxf@esquibits.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox