New issue
Advanced search Search tips

Issue 874986 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 28
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Feature



Sign in to add a comment

cros_choose_profile: move to chromite

Project Member Reported by vapier@chromium.org, Aug 16

Issue description

we should be able to do a straight port of cros_choose_profile to chromite.  steps:
(1) implement chromite/scripts/cros_choose_profile.py that provides same functionality as src/platform/dev/host/cros_choose_profile
(2) make sure nothing references cros_choose_profile via absolute path (everything should only use $PATH).  can use cs/ to find users.
(3) delete cros_choose_profile from chromeos-base/cros-devutils ebuild
(4) delete cros_choose_profile from src/platform/dev/host/
 
Status: Started (was: Available)
The old cros_choose_profile has several sudo calls at the end - rm and ln in cros_choose_profile, and a touch, sed, and tee in common.sh behind the set_variable call. I have a few questions about implementing these.

In particular, the calls behind set_variable can all be avoided if there's something like a WriteKeyValueFile counterpart to cros_build_lib.LoadKeyValueFile.

The rm and ln would be doable with their respective os calls if the script requires being run as root, but that's not a requirement of the original script.

Do we have anything in place to execute any of these operations that I've missed?

It's not a problem to either just explicitly do SudoRunCommand ports for most of the operations, or write in a function to encapsulate building out the SudoRunCommand, but I wanted to double check that I'm not just missing existing implementations before I do that.

As a follow up if there is not an existing implementation for a "WriteKeyValueFile" type of function; do I need to worry about preserving comments in the sysroot cache file (/build/{board}/var/cache/edb/chromeos)? Using the load function, changing the value, and using the existing set file contents function in the sudo module is easy, but would wipe any comments as is.
osutils.SafeUnlink & osutils.SafeSymlink & osutils.WriteFile have a sudo=True option.  i believe those are all the primitives you need to do this.

however, for this particular cache file, i think the code already exists.  checkout chromite.lib.sysroot_lib.Sysroot.[GS]etCachedField.
Excellent, thank you, I thought it seemed odd that those wouldn't have existed already.
Project Member

Comment 6 by bugdroid1@chromium.org, Sep 11

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/d7ee4bb9a0e7d8fdb941fae2c2247f966b2f042a

commit d7ee4bb9a0e7d8fdb941fae2c2247f966b2f042a
Author: Alex Klein <saklein@chromium.org>
Date: Tue Sep 11 07:40:50 2018

Remove bash cros_choose_profile installation.

The chromite version of the script has been created and
the bash version deleted. We cannot copy in the file
since it does not exist.

BUG= chromium:874986 
TEST=precq
CQ-DEPEND=CL:1184972, CL:1184973

Change-Id: I0eda3905c587c6a07e0f4b01d94bd00af6075069
Reviewed-on: https://chromium-review.googlesource.com/1194647
Commit-Ready: Alex Klein <saklein@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/d7ee4bb9a0e7d8fdb941fae2c2247f966b2f042a/chromeos-base/cros-devutils/cros-devutils-9999.ebuild

Project Member

Comment 7 by bugdroid1@chromium.org, Sep 11

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/dev-util/+/73e66de2923c198396dd767234225f746fe905ad

commit 73e66de2923c198396dd767234225f746fe905ad
Author: Alex Klein <saklein@chromium.org>
Date: Tue Sep 11 07:40:49 2018

Remove bash cros_choose_profile script.

BUG= chromium:874986 
TEST=manual tests, new unit tests
CQ-DEPEND=CL:1184972, CL:1194647

Change-Id: Ida4fed1558ae3e4c1fff7e672356dec2d4189222
Reviewed-on: https://chromium-review.googlesource.com/1184973
Commit-Ready: Alex Klein <saklein@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[delete] https://crrev.com/95240f6930e4624d00856c86f67741828c6396ed/host/cros_choose_profile

Project Member

Comment 8 by bugdroid1@chromium.org, Sep 28

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/chromite/+/5ff03caf7ab3dc903170a80f06d9d5cd327f0ac3

commit 5ff03caf7ab3dc903170a80f06d9d5cd327f0ac3
Author: Alex Klein <saklein@chromium.org>
Date: Fri Sep 28 17:10:40 2018

cros_choose_profile: remove unused argument

BUG= chromium:874986 
TEST=manual, precq
CQ-DEPEND=CL:1188525, CL:1231357

Change-Id: Idcdc0a2faa52a6635c46c5e1998a00a2a7daf627
Reviewed-on: https://chromium-review.googlesource.com/1219826
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/5ff03caf7ab3dc903170a80f06d9d5cd327f0ac3/scripts/cros_choose_profile.py

Project Member

Comment 9 by bugdroid1@chromium.org, Sep 28

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/chromite/+/0ee11386c0215c7d03fde11ff22e2a1956a86932

commit 0ee11386c0215c7d03fde11ff22e2a1956a86932
Author: Alex Klein <saklein@chromium.org>
Date: Fri Sep 28 17:10:39 2018

build_stages.InitSDKStage: update chroot

InitSDKStage called run_chroot_version_hooks, but the update_chroot
script is currently only called in setup_board. Builders that do
not use setup_board (e.g. master-paladin) then never have their
chroot fully updated after it is created.

BUG= chromium:874986 
TEST=precq

Change-Id: I647d94190c2d1763822ee2e99ede1273b711256b
Reviewed-on: https://chromium-review.googlesource.com/1231357
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/0ee11386c0215c7d03fde11ff22e2a1956a86932/cbuildbot/stages/build_stages.py
[modify] https://crrev.com/0ee11386c0215c7d03fde11ff22e2a1956a86932/cbuildbot/stages/build_stages_unittest.py

Project Member

Comment 10 by bugdroid1@chromium.org, Sep 28

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform/crosutils/+/04dc2ed7f855093c3864c796ec610f6f6ea80bca

commit 04dc2ed7f855093c3864c796ec610f6f6ea80bca
Author: Alex Klein <saklein@chromium.org>
Date: Fri Sep 28 17:10:40 2018

cros_choose_profile: Update CLI argument usages.

Update the command line arguments to match the names in the
new chromite python version of the script.

BUG= chromium:874986 
TEST=precq
CQ-DEPEND=CL:1184972, CL:1184973, CL:1231357

Change-Id: I86de7abcf66cbee12dcd112001215de15276e7bb
Reviewed-on: https://chromium-review.googlesource.com/1188525
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Alex Klein <saklein@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/04dc2ed7f855093c3864c796ec610f6f6ea80bca/setup_board

Status: Fixed (was: Started)

Sign in to add a comment