From e30ca8dab6b94453ea559c3ea02035d2ae88908c Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 2 Jul 2024 11:17:19 +0200 Subject: [PATCH 1/3] flatcar_workon: Bring back the --host flag Telling flatcar_workon to work on SDK instead of a board could be implemented either by passing an empty value for --board flag and modifying `${FLAGS_board+foo}` to `${FLAGS_board:+foo}` or by adding the `--host` boolean flag and killing the value of `--board` flag when `--host` is true. I went with the latter as it clearly conveys meaning at the call sites. --- flatcar_workon | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flatcar_workon b/flatcar_workon index 157c89d1c1..857cb64e19 100755 --- a/flatcar_workon +++ b/flatcar_workon @@ -6,6 +6,8 @@ DEFINE_string board "${DEFAULT_BOARD}" \ "The board to set package keywords for." +DEFINE_boolean host "${FLAGS_FALSE}" \ + "Uses the host instead of board" FLAGS_HELP="usage: $0 [flags] commands: @@ -17,6 +19,13 @@ eval set -- "${FLAGS_ARGV}" set -euo pipefail +# If both board and host are specified, just use host, because board +# does not have to be specified and may come from default, in which +# case there's no way to override. +if [[ -n ${FLAGS_board} ]] && [[ ${FLAGS_host} = "${FLAGS_TRUE}" ]]; then + unset FLAGS_board # kill board +fi + # /etc/portage under either / or /build/. ETC_PORTAGE=${FLAGS_board+/build/${FLAGS_board}}/etc/portage From eba755d96b9281f3683390fed75dd6c0f669caff Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 2 Jul 2024 11:20:40 +0200 Subject: [PATCH 2/3] update_chroot: Call flatcar_workon with --host We want to possibly update workon packages on SDK, not on the default board. --- update_chroot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update_chroot b/update_chroot index 2065da7175..af57a729b5 100755 --- a/update_chroot +++ b/update_chroot @@ -235,7 +235,7 @@ fi # Build flatcar_workon packages when they are changed. WORKON_PKGS=() if [[ ${FLAGS_workon} -eq "${FLAGS_TRUE}" ]]; then - mapfile -t WORKON_PKGS < <("${SRC_ROOT}"/scripts/flatcar_workon list) + mapfile -t WORKON_PKGS < <("${SRC_ROOT}"/scripts/flatcar_workon --host list) fi if [[ ${#WORKON_PKGS[@]} -gt 0 ]]; then From d29ffa08a7bd301ebe1a843f8f71863338f9ba7a Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 2 Jul 2024 12:51:32 +0200 Subject: [PATCH 3/3] flatcar_workon: Simplify condition Co-authored-by: James Le Cuirot --- flatcar_workon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flatcar_workon b/flatcar_workon index 857cb64e19..19bbee4eb0 100755 --- a/flatcar_workon +++ b/flatcar_workon @@ -22,7 +22,7 @@ set -euo pipefail # If both board and host are specified, just use host, because board # does not have to be specified and may come from default, in which # case there's no way to override. -if [[ -n ${FLAGS_board} ]] && [[ ${FLAGS_host} = "${FLAGS_TRUE}" ]]; then +if [[ -n ${FLAGS_board} && ${FLAGS_host} = "${FLAGS_TRUE}" ]]; then unset FLAGS_board # kill board fi