pmb.helpers.apk: fix crash computing progress from apk3

Fixes:

tot = float(cur_tot[1])
      ^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: '5383561 download'

Because this line now includes " download" at the end:

  ipdb> p line
  '10727/5383561 download\n'

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2635
This commit is contained in:
Clayton Craft 2025-07-01 08:37:20 -07:00 committed by Newbyte
parent a8988872b6
commit f9add1b6d2
No known key found for this signature in database
GPG key ID: ACD854892B38D898

View file

@ -124,7 +124,7 @@ def _compute_progress(line: str) -> float:
""" """
if not line: if not line:
return 1 return 1
cur_tot = line.rstrip().split("/") cur_tot = line.split(" ")[0].rstrip().split("/")
if len(cur_tot) != 2: if len(cur_tot) != 2:
return 0 return 0
cur = float(cur_tot[0]) cur = float(cur_tot[0])