flatcar-scripts/lib/cros_workon_common.sh
Zdenek Behan e9474900c6 cros_workon: redefine the concept of a "workon" package list to depend on the board
* Modified all workon listing functions to also look for keyword

* Added a fallback to list all workon ebuilds if keyword is not specified, which
is needed for cros_mark_all_as_stable, which does not differentiate between boards.

This, amongst other potential issues, resolves the case when it was possible to
start working on a package not keyworded for the given board, and making
build_packages fail unconditionally.

TEST=below
$ ./cros_workon list --all --board=x86-generic |wc -l
73
$ ./cros_workon list --all --host |wc -l
57
Looking at the lists rather than "|wc -l" looks correct
$ ./cros_mark_all_as_stable
^ Produces satisfactory result

BUG=6700

Change-Id: Ieee92a39febcef5fb95e59cf97b6e63281a7c750

Review URL: http://codereview.chromium.org/3400001
2010-09-15 11:33:54 -07:00

34 lines
960 B
Bash

#!/bin/bash
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Common library for functions used by workon tools.
find_keyword_workon_ebuilds() {
keyword="${1}"
pushd "${BOARD_DIR}"/etc/ 1> /dev/null
source make.conf
popd 1> /dev/null
local CROS_OVERLAYS="${PORTDIR_OVERLAY}"
# NOTE: overlay may be a symlink, and we have to use ${overlay}/
for overlay in ${CROS_OVERLAYS}; do
# only look up ebuilds named 9999 to eliminate duplicates
find ${overlay}/ -name '*9999.ebuild' | \
xargs grep -l "inherit.*cros-workon" | \
xargs grep -l "KEYWORDS=.*${keyword}.*"
done
}
show_workon_ebuilds() {
keyword=$1
find_keyword_workon_ebuilds ${keyword} | \
sed -e 's/.*\/\([^/]*\)\/\([^/]*\)\/.*\.ebuild/\1\/\2/' | \
sort -u
# This changes the absolute path to ebuilds into category/package.
}