#!/bin/bash
# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# See generated commit message for details on script.

project=$1
name=restructure-platform-config

changes=$(git status | grep "sw_build_config")
if [[ -n "${changes}" ]]; then
  echo "For ${project}, uploading: ${changes}"
  git add -u
  git commit -m"
${project}: Regenerated platform config structure

With multi cros_workon projects in portage, only one directory per
project can be watched.  This creates a problem for intermixing manually
crafted files (e.g. audio config, thermal config, etc...) and
autogenerated config files.

To support this and keep it obvious as to what's autogenerated at what's
not, the directory structure is being inverted for sw_build_config where
generated will be pushed down to the lower layers in the file tree so
that other manually crafted files can also be managed as necessary.

cros_workon will then watch the entire chromeos-config structure.

This also starts generated the arc config files (since all projects are being updated).

BUG=None
TEST=cq
"

  repo upload --no-verify --ht="${name}"
fi
