blob: 16f93ee4cca5dc2835cc8f5e4559f36c0a63532b [file] [log] [blame]
# Copyright 2019 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.
# Clean local portage caches. This is necessary if there are
# cros_workon packages.
sudo rm -rf /var/cache/portage/* /build/*/var/cache/portage/*
# Clean board packages.
for board_root in /build/* ; do
board=${board_root##*/}
[[ "${board}" == "bin" || "${board}" == "dev" || \
"${board}" == "proc" ]] && continue
# Find packages using either protobuf or grpc.
PKGS=( $(qdepends-${board} -qCN -Q dev-libs/protobuf && \
qdepends-${board} -qCN -Q net-libs/grpc | sort -u))
if [[ ${#PKGS[@]} -eq 0 ]]; then
continue
fi
echo "Cleaning packages using protobuf or grpc from ${board}"
PKGDIR=$(portageq-${board} envvar PKGDIR)
cd "${PKGDIR}"
# Remove existing binary packages.
for pkg in "${PKGS[@]}"; do
sudo rm -f "${pkg}"-[0-9]*.tbz2
done
# Unmerge all packages using either protobuf or grpc.
qmerge-${board} -Uqy "${PKGS[@]}"
done