All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH/autobuild 7/8] autobuild-run: simplify, don't make a dict of config
Date: Sun, 9 Apr 2017 22:51:27 +0200	[thread overview]
Message-ID: <20170409205128.11560-7-arnout@mind.be> (raw)
In-Reply-To: <20170409205128.11560-1-arnout@mind.be>

A toolchain config was defined as a dict with keys url, hostarch,
libc and contents. Of these, only contents and libc were actually
used outside of get_toolchain_configs(). And the use of libc has
been removed in the previous patch.

So there is no reason anymore to make config a dict. Just replace
it with its contents.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
 scripts/autobuild-run | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index 2aa89b4..d17e089 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -252,11 +252,8 @@ class SystemInfo:
 def get_toolchain_configs(**kwargs):
     """Fetch and return the possible toolchain configurations
 
-    This function returns an array of dictionaries, with for each toolchain:
-        - url: the URL of the toolchain defconfig
-        - libc: the C library used by the toolchain
-        - hostarch: the host architecture for which the toolchain is built
-        - contents: an array of lines of the defconfig
+    This function returns an array of toolchain configurations. Each
+    toolchain configuration is itself an array of lines of the defconfig.
     """
     toolchains_url = kwargs['toolchains_url']
 
@@ -271,31 +268,30 @@ def get_toolchain_configs(**kwargs):
 
     for row in csv.reader(l):
         config = {}
-        config["url"] = row[0]
-        config["hostarch"] = row[1]
+        url = row[0]
+        config_hostarch = row[1]
         keep = False
 
         # Keep all toolchain configs that work regardless of the host
         # architecture
-        if config['hostarch'] == "any":
+        if config_hostarch == "any":
             keep = True
 
         # Keep all toolchain configs that can work on the current host
         # architecture
-        if hostarch == config["hostarch"]:
+        if hostarch == config_hostarch:
             keep = True
 
         # Assume that x86 32 bits toolchains work on x86_64 build
         # machines
-        if hostarch == 'x86_64' and config["hostarch"] == "x86":
+        if hostarch == 'x86_64' and config_hostarch == "x86":
             keep = True
 
         if not keep:
             continue
 
-        config["libc"] = row[2]
-        with urlopen_closing(config["url"]) as r:
-            config["contents"] = decode_byte_list(r.readlines())
+        with urlopen_closing(url) as r:
+            config = decode_byte_list(r.readlines())
         configs.append(config)
     return configs
 
@@ -547,7 +543,7 @@ def gen_config(**kwargs):
     i = randint(0, len(configs) - 1)
     config = configs[i]
 
-    configlines = config["contents"]
+    configlines = config
 
     # Amend the configuration with a few things.
     configlines.append("BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y\n")
@@ -574,7 +570,7 @@ def gen_config(**kwargs):
         log_write(log, "ERROR: cannot oldconfig")
         return -1
 
-    if not is_toolchain_usable(config=config["contents"], **kwargs):
+    if not is_toolchain_usable(config=config, **kwargs):
         return -1
 
     # Now, generate the random selection of packages, and fixup
-- 
2.11.0

  parent reply	other threads:[~2017-04-09 20:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-09 20:51 [Buildroot] [PATCH/autobuild 1/8] autobuild-run: fix typo in help text Arnout Vandecappelle
2017-04-09 20:51 ` [Buildroot] [PATCH/autobuild 2/8] autobuild-run: add '-d, --debug' option Arnout Vandecappelle
2017-04-10  8:22   ` Thomas Petazzoni
2017-04-10  8:45     ` Arnout Vandecappelle
2017-04-09 20:51 ` [Buildroot] [PATCH/autobuild 3/8] autobuild-run: use 'olddefconfig' instead of 'oldconfig' Arnout Vandecappelle
2017-04-09 20:51 ` [Buildroot] [PATCH/autobuild 4/8] autobuild-run: remove redundant 'make oldconfig' Arnout Vandecappelle
2017-04-10  8:25   ` Thomas Petazzoni
2017-04-10  8:46     ` Arnout Vandecappelle
2017-04-12  9:27       ` Thomas Petazzoni
2017-04-09 20:51 ` [Buildroot] [PATCH/autobuild 5/8] autobuild-run: check that toolchain config lines are still present Arnout Vandecappelle
2017-04-10  8:28   ` Thomas Petazzoni
2017-04-10  8:48     ` Arnout Vandecappelle
2017-04-09 20:51 ` [Buildroot] [PATCH/autobuild 6/8] autobuild-run: remove check for glibc Arnout Vandecappelle
2017-04-09 20:51 ` Arnout Vandecappelle [this message]
2017-04-09 20:51 ` [Buildroot] [PATCH/autobuild 8/8] autobuild-run: use in-tree toolchain configs Arnout Vandecappelle
2017-04-10  8:49   ` Arnout Vandecappelle
2017-04-10  8:50   ` [Buildroot] [PATCH] " Arnout Vandecappelle

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=20170409205128.11560-7-arnout@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.