Script to refactor all private model.yaml files
Iterates over all private overlays, finds config files that match a
certain refactoring pattern (for this, removing touch present field) and
then generates a cl for the refactor.
BUG=None
TEST=None
Change-Id: I077116f7228e197b57acb1e49e233f78f8372adf
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2175674
Commit-Queue: C Shapiro <shapiroc@chromium.org>
Tested-by: C Shapiro <shapiroc@chromium.org>
Reviewed-by: David Burger <dburger@chromium.org>
Auto-Submit: C Shapiro <shapiroc@chromium.org>
diff --git a/contrib/refactor/remove_touch_present_all_private_overlays.sh b/contrib/refactor/remove_touch_present_all_private_overlays.sh
new file mode 100755
index 0000000..954d054
--- /dev/null
+++ b/contrib/refactor/remove_touch_present_all_private_overlays.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+# Copyright 2020 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.
+
+# Iterates over all private overlays, finds every model.yaml file that has the
+# legacy /touch present cros_config attribute present, deletes the line and then
+# generates a CL for each private repo.
+
+cd ../../../../private-overlays
+for overlay in *; do
+ cd "${overlay}"
+ to_refactor=$(grep -r 'present: "' ./ -l | grep model.yaml)
+ if [ -n "${to_refactor}" ]; then
+ echo "Updating: ${to_refactor}"
+ sed -i '/present: "/d' "${to_refactor}"
+ overlay_name=$(echo "${overlay}" | cut -d '-' -f2)
+ repo start remove-touch-present
+ git add -u
+ git commit -m"
+${overlay_name}: Remove unused touch fields
+
+These probe fields were never used, so removing and instead will provide
+probe config that aligns to factory/hwid schema around touch component
+probing (which will also be available config if needed somewhere on
+platform/build).
+
+BUG=None
+TEST=cq
+"
+ repo upload --ht remove-touch-present
+ fi
+
+ cd ..
+done