cros_update_firmware: Split srcuris across lines.

- Should allow easier merging of these files in git.
- Also edit cros_unibuild_config.py to do this.

BUG=b:170505117
TEST=CQ
TEST=cros_update_firmware -b dedede -p drawcia
TEST=cros_update_firmware -b dedede

Change-Id: I2fa04062cd5cfc53044904778cc78a3a559ce509
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2495563
Reviewed-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Tested-by: Andrew Lamb <andrewlamb@chromium.org>
Commit-Queue: Andrew Lamb <andrewlamb@chromium.org>
diff --git a/contrib/cros_unibuild_convert.py b/contrib/cros_unibuild_convert.py
index 7860d45..58b26b1 100755
--- a/contrib/cros_unibuild_convert.py
+++ b/contrib/cros_unibuild_convert.py
@@ -753,7 +753,7 @@
       'chromeos-base/chromeos-config-bsp-private/chromeos-config-bsp-private-9999.ebuild',
       private_bsp_ebuild)
   write_file(overlays.firmware_ebuild_path, firmware_ebuild)
-  write_file(firmware_srcuris_path, firmware_srcuris)
+  write_file(firmware_srcuris_path, ''.join('{}\n'.format(uri) for uri in firmware_srcuris.split()))
   write_file(overlays.public_make_defaults_file, public_make_defaults)
   write_file(overlays.private_make_defaults_file, private_make_defaults)
 
diff --git a/contrib/cros_update_firmware b/contrib/cros_update_firmware
index e683727..0c6a0ea 100755
--- a/contrib/cros_update_firmware
+++ b/contrib/cros_update_firmware
@@ -123,12 +123,13 @@
     for uri in $(cros_config_host -c "${yaml_config}" get-firmware-uris); do
       if ! grep -q "${uri}" "${srcuris}"; then
         # Append uri to the last line of srcuris (srcuris should be a file with
-        # a single line). Escape slashes in uri.
-        sed -i "$ s/$/ ${uri//\//\\/}/" "${srcuris}"
+        # one line per-uri).
+        echo "${uri}" >> "${srcuris}"
       fi
     done
   else
-    cros_config_host -c "${yaml_config}" get-firmware-uris > "${srcuris}"
+    # Put each uri on its own line for easier merging in git.
+    cros_config_host -c "${yaml_config}" get-firmware-uris | tr ' ' '\n' > "${srcuris}"
   fi
 
   touch "${ebuild}"