summaryrefslogtreecommitdiff
path: root/scripts/tizen/sd_fusing.py
diff options
context:
space:
mode:
authorMateusz Majewski <m.majewski2@samsung.com>2024-06-07 12:44:44 +0200
committerJaehoon Chung <jh80.chung@samsung.com>2024-06-13 13:22:43 +0900
commit3184ca768e390fb7f33c81516a12da2b6fcb66a7 (patch)
tree617785d08dba9d1b22ef2df30d678d1b6d80df7d /scripts/tizen/sd_fusing.py
parentaccc1cf3dbea53015f0c0092e8ce11c1ea4b577c (diff)
downloadu-boot-3184ca768e390fb7f33c81516a12da2b6fcb66a7.tar.gz
u-boot-3184ca768e390fb7f33c81516a12da2b6fcb66a7.tar.bz2
u-boot-3184ca768e390fb7f33c81516a12da2b6fcb66a7.zip
scripts: sd_fusing: handle lsblk errors better
This makes the error handling a bit more consistent with the rest of the script by logging an error and doing a sys.exit(1). Returning an error by returning None would mean that it would need to be handled elsewhere. However this does not happen, resulting in a confusing runtime error TypeError: can only concatenate str (not "NoneType") to str as well as warnings in some editors. Change-Id: I6b3f382e93846c3165d1a8221e2faf7dbf295a86
Diffstat (limited to 'scripts/tizen/sd_fusing.py')
-rwxr-xr-xscripts/tizen/sd_fusing.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/tizen/sd_fusing.py b/scripts/tizen/sd_fusing.py
index ef0e754896..2513bdc078 100755
--- a/scripts/tizen/sd_fusing.py
+++ b/scripts/tizen/sd_fusing.py
@@ -975,24 +975,29 @@ def get_partition_device(device, idx):
stdout=subprocess.PIPE)
if proc.returncode != 0:
logging.error("lsblk has failed")
- return None
+ sys.exit(1)
part_re = re.compile(f"^part\s+(.*[^0-9]{idx})$")
for l in proc.stdout.decode('utf-8').splitlines():
match = part_re.match(l)
if match:
return match[1]
- return None
+ logging.error("device entry not found")
+ sys.exit(1)
def get_device_kname(device):
argv = ['lsblk', device, '-o', 'TYPE,KNAME']
logging.debug(" ".join(argv))
proc = subprocess.run(argv,
stdout=subprocess.PIPE)
+ if proc.returncode != 0:
+ logging.error("lsblk has failed")
+ sys.exit(1)
for l in proc.stdout.decode('utf-8').splitlines():
match = re.search(f"^(disk|loop)\s+(.*)", l)
if match:
return match[2]
- return None
+ logging.error("kname entry not found")
+ sys.exit(1)
def do_fuse_file(f, name, target):
indexes = target.get_partition_index_list(name)