New issue
Advanced search Search tips

Issue 765701 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Replace get_each_model_conf_value_set impl in cros-unibuild.eclass

Project Member Reported by sjg@chromium.org, Sep 15 2017

Issue description

This function currently has a for loop and calls fdtget inside the loop.

This should use cros_config_host

e.g.:

cros_config_host --get_all <path> <prop>

and it should get the value for that path/prop for each model, and print them one per line, skipping any repeats

 
Status: Started (was: Untriaged)
I think this bug could be much more cleanly implemented with some refactoring to the libcros_config library. As the lib starts encompassing more higher-level functionality I think it would be useful to re-open a discussion about an object oriented refactor like CL:665389 (maybe in smaller steps next time). With an API like that this change would be as simple as:

for (const auto& model in cros_config.GetAllModels()) {
  std::cout << model.GetProperty(...) << std::endl;
}

To implement this as it stands now we can either re-init the library for each model name (after initing it without a model name) or pipe this functionality all the way through the lib with a special "GetPropertyForAll" function. The former feels very fragile to me; someone in the future might not realize that people call Init*() over and over again to 're-init' it just to change model names (Init*() would be called while inited_ = true). The latter is functionality that is built into a clean object oriented API. We wouldn't need modify the lib every time we want to add host-only functionality. It also fixes undesired behavior like being able to call GetString on a library that isn't inited to handle that request. I feel the future goodnesss of a refactor would outweigh any potential security-through-obscurity we might get from doing things this way.

sjg@ I think you want to get this in ASAP so I will hack it in for now, but I would like to re-open the refactoring discussion if you don't mind?

Comment 3 by sjg@chromium.org, Sep 21 2017

That definitely looks like nice code.

But I think we should wait for another 1 or 2 use cases of things that iterate across models before re-architecting the thing. I suspect when you get to implementing sharing (TBD) we might find the need, but it might be a slightly different thing from model. I'll file that bug soon so you have everything in front of you.

I know it is a little ugly - e.g. you could refactor to allow quick changing of the model, but what you have looks good for now.

It's always hard when you are unsure where things are heading, but you have time to tidy up at the end :-)

That sounds like a solid plan! I do keep running across more use cases that change how I'm thinking about what the lib should do :p Happy to shelve the cleanup till the end.

Comment 5 by sjg@chromium.org, Sep 27 2017

Cc: athilenius@chromium.org
 Issue 766785  has been merged into this issue.

Comment 6 by sjg@chromium.org, Sep 27 2017

cros_config_host --get_firmware_uris


Comment 7 Deleted

Comment 8 by sjg@chromium.org, Sep 27 2017

Calculating dependencies \ * SRC_URI !unibuild? (  gs://chromeos-binaries/HOME/bcs-reef-private/overlay-reef-private/chromeos-base/chromeos-firmware-reef/Reef.9042.87.1.tbz2 gs://chromeos-binaries/HOME/bcs-reef-private/overlay-reef-private/chromeos-base/chromeos-firmware-reef/Reef.9042.110.0.tbz2 gs://chromeos-binaries/HOME/bcs-reef-private/overlay-reef-private/chromeos-base/chromeos-firmware-reef/Reef_EC.9042.87.1.tbz2  ) 


bcs-overlay = "overlay-reef-private";

local user="bcs-${overlay#variant-*-}"     reef-private
local overlay="$2"   reef-private

local bcs_url="gs://chromeos-binaries/HOME/${user}/overlay-${overlay}"

CATEGORY=chromeos-base
$board=chromeos-firmware-reef
uri Reef.9042.72.0.tbz2

echo "${bcs_url}/${CATEGORY}/${board}/${uri}"

gs://chromeos-binaries/HOME/bcs-reef-private/overlay-reef-private/chromeos-base/chromeos-firmware-reef/Reef.9042.72.0.tbz2
gs://chromeos-binaries/HOME/  const
bcs-reef-private/             bcs-overlay property in dtb
overlay-reef-private/         bcs-overlay property in dtb
chromeos-base/                const
chromeos-firmware-reef/       chromeos-firmware-${model}
Reef.9042.72.0.tbz2           foreach: *-image (minus bcs://)

for image in main-image main-rw-image ec-image pd-image; do
Project Member

Comment 11 by bugdroid1@chromium.org, Sep 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/6e6ac8bba8f5534d49fe6b9d928ad035b985e13d

commit 6e6ac8bba8f5534d49fe6b9d928ad035b985e13d
Author: Alec Thilenius <athilenius@chromium.org>
Date: Wed Sep 27 19:58:02 2017

chromeos-config: Added get_all flag to cros_config_host

Added a --get_all flag to cros_config_host. This serves the same function as
running cros_config_host multiple times, once for each model to get a string
property for all models.

BUG= chromium:765701 
TEST=Ran all unit tests including newly added

Change-Id: I3d8e98cfeccc0003158fe37f93a0235df40261af
Reviewed-on: https://chromium-review.googlesource.com/677571
Commit-Ready: Alec Thilenius <athilenius@chromium.org>
Tested-by: Alec Thilenius <athilenius@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>

[modify] https://crrev.com/6e6ac8bba8f5534d49fe6b9d928ad035b985e13d/chromeos-config/libcros_config/test.dts
[modify] https://crrev.com/6e6ac8bba8f5534d49fe6b9d928ad035b985e13d/chromeos-config/libcros_config/cros_config_unittest.cc
[modify] https://crrev.com/6e6ac8bba8f5534d49fe6b9d928ad035b985e13d/chromeos-config/cros_config_host_main.cc
[modify] https://crrev.com/6e6ac8bba8f5534d49fe6b9d928ad035b985e13d/chromeos-config/cros_config_host_main_unittest.cc

Project Member

Comment 12 by bugdroid1@chromium.org, Sep 27 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/7d4b7729e3bf5eebd140f663ba4a0ce02170296b

commit 7d4b7729e3bf5eebd140f663ba4a0ce02170296b
Author: Alec Thilenius <athilenius@chromium.org>
Date: Wed Sep 27 23:29:29 2017

chromeos-config: Minor cleanup

Some very minor cleanup to cros_config and libcros_config.

BUG= chromium:765701 
TEST=Ran all unit tests

Change-Id: Idf2f8128d44460c2f72c8ad5f5fbacde8ef985e6
Reviewed-on: https://chromium-review.googlesource.com/679272
Commit-Ready: Alec Thilenius <athilenius@chromium.org>
Tested-by: Alec Thilenius <athilenius@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>

[modify] https://crrev.com/7d4b7729e3bf5eebd140f663ba4a0ce02170296b/chromeos-config/cros_config_main.cc
[modify] https://crrev.com/7d4b7729e3bf5eebd140f663ba4a0ce02170296b/chromeos-config/cros_config_host_main.cc
[modify] https://crrev.com/7d4b7729e3bf5eebd140f663ba4a0ce02170296b/chromeos-config/libcros_config/cros_config.cc

Project Member

Comment 13 by bugdroid1@chromium.org, Sep 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/01cc9eb4e0332d72d83a98b9b2d2d582e9895951

commit 01cc9eb4e0332d72d83a98b9b2d2d582e9895951
Author: Alec Thilenius <athilenius@chromium.org>
Date: Fri Sep 29 21:35:25 2017

chromeos-config: Added get_firmware_uris flag to cros_config_host

Added a --get_firmware_uris flag to cros_config_host. This prints out a
list of space seperated firmware URIs for all models in a dtb database.

BUG= chromium:765701 
TEST=Ran all unit tests including newly added

Change-Id: I0cc2150412445d8580e0a0a7c8797e60dbfdf282
Reviewed-on: https://chromium-review.googlesource.com/687879
Commit-Ready: Alec Thilenius <athilenius@chromium.org>
Tested-by: Alec Thilenius <athilenius@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>

[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/libcros_config/test.dts
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/libcros_config/cros_config.cc
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/libcros_config/fake_cros_config.cc
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/libcros_config/fake_cros_config.h
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/libcros_config/cros_config_interface.h
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/libcros_config/cros_config_unittest.cc
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/cros_config_host_main_unittest.cc
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/chromeos-config.gyp
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/libcros_config/cros_config.h
[modify] https://crrev.com/01cc9eb4e0332d72d83a98b9b2d2d582e9895951/chromeos-config/cros_config_host_main.cc

Status: Fixed (was: Started)

Sign in to add a comment