cros_unibuild_convert: add wallpaper property

Detect if there is a pre-unibuild custom wallpaper.  This replicates
the logic in chromeos-assets-9999.ebuild: we search the wallpaper
source directory to see if there is a wallpaper under the board
name (or model, as some older boards have the variant naming) and use
that.

Under private overlay, as the wallpapers are in chromeos_interal
repo.  No use handing this out in public overlay.

BUG=chromium:1098942
TEST=generated unibuild config for atlas, wallpaper set to "atlas"

Change-Id: If7e242f11966a0e926d44971507cbd93ca1024f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2265260
Tested-by: Jack Rosenthal <jrosenth@chromium.org>
Auto-Submit: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Sean McAllister <smcallis@google.com>
Commit-Queue: Sean McAllister <smcallis@google.com>
diff --git a/contrib/cros_unibuild_convert.py b/contrib/cros_unibuild_convert.py
index bae6804..ff57865 100755
--- a/contrib/cros_unibuild_convert.py
+++ b/contrib/cros_unibuild_convert.py
@@ -263,6 +263,7 @@
   ]
 
   def __init__(self, board_name, checkout, mosys_platform):
+    self.checkout = checkout
     self.board_name = board_name
     self.mosys_platform = mosys_platform
     self.public_overlay = (checkout / 'src' / 'overlays'
@@ -521,6 +522,16 @@
   return device.whitelabel_tag or None
 
 
+def genconf_wallpaper_id(device, overlay):
+  wallpapers_dir = (overlay.checkout / 'src' / 'platform' / 'chromeos-assets'
+                    / 'wallpaper' / 'large')
+  assert wallpapers_dir.is_dir()
+  for wallpaper_id in (overlay.board_name, device.model):
+    if (wallpapers_dir / f'{wallpaper_id}.jpg').is_file():
+      return wallpaper_id
+  return None
+
+
 M_PUBLIC = (1 << 0)
 M_PRIVATE = (1 << 1)
 
@@ -586,6 +597,7 @@
         'whitelabel-tag': (M_PUBLIC, genconf_whitelabel_tag),
     },
     'power': (M_PUBLIC, genconf_powerd_settings),
+    'wallpaper': (M_PRIVATE, genconf_wallpaper_id),
 }