Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e392d76 authored by Matt Mower's avatar Matt Mower Committed by Steve Kondik
Browse files

Edify: Add/Update abort messages for some asserts

* If a bootloader or baseband assert is not satisfied, print the
  versions that are supported by the package as well as the version
  on the device.
* Changes the layout of the device assert in the edify script with some
  more line breaks.
* Cleanup the device abort message and remove extra quoting.

Change-Id: I958d49281c51bd4e60d596a727bb94cfc4a21909
parent 71f0b849
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -93,18 +93,21 @@ class EdifyGenerator(object):
  def AssertDevice(self, device):
  def AssertDevice(self, device):
    """Assert that the device identifier is the given string."""
    """Assert that the device identifier is the given string."""
    cmd = ('assert(' +
    cmd = ('assert(' +
           ' || \0'.join(['getprop("ro.product.device") == "%s" || getprop("ro.build.product") == "%s"'
           ' || \0'.join(['getprop("ro.product.device") == "%s" ||\0getprop("ro.build.product") == "%s"'
                         % (i, i) for i in device.split(",")]) +
                         % (i, i) for i in device.split(",")]) +
           ' || abort("This package is for \\"%s\\" devices; '
           ' ||\0abort("This package is for device: %s; ' +
           'this is a \\"" + getprop("ro.product.device") + "\\".");'
           'this device is " + getprop("ro.product.device") + ".");' +
           ');') % device
           ');') % device
    self.script.append(self._WordWrap(cmd))
    self.script.append(self._WordWrap(cmd))


  def AssertSomeBootloader(self, *bootloaders):
  def AssertSomeBootloader(self, *bootloaders):
    """Asert that the bootloader version is one of *bootloaders."""
    """Assert that the bootloader version is one of *bootloaders."""
    cmd = ("assert(" +
    cmd = ("assert(" +
           " ||\0".join(['getprop("ro.bootloader") == "%s"' % (b,)
           " ||\0".join(['getprop("ro.bootloader") == "%s"' % (b,)
                         for b in bootloaders]) +
                         for b in bootloaders]) +
           ' ||\0abort("This package supports bootloader(s): ' +
           ", ".join(["%s" % (b,) for b in bootloaders]) +
           '; this device has bootloader: " + getprop("ro.bootloader") + ".");' +
           ");")
           ");")
    self.script.append(self._WordWrap(cmd))
    self.script.append(self._WordWrap(cmd))


@@ -113,6 +116,9 @@ class EdifyGenerator(object):
    cmd = ("assert(" +
    cmd = ("assert(" +
           " ||\0".join(['getprop("ro.baseband") == "%s"' % (b,)
           " ||\0".join(['getprop("ro.baseband") == "%s"' % (b,)
                         for b in basebands]) +
                         for b in basebands]) +
           ' ||\0abort("This package supports baseband(s): ' +
           ", ".join(["%s" % (b,) for b in basebands]) +
           '; this device has baseband: " + getprop("ro.baseband") + ".");' +
           ");")
           ");")
    self.script.append(self._WordWrap(cmd))
    self.script.append(self._WordWrap(cmd))