ソースを参照

class: add function to get file size

This adds swupdate_get_size, the only actual usage is the
case of ubifs encryption to calcualte the size of original
unecnrypted ubifs volume.

Signed-off-by: Ayoub Zaki <ayoub.zaki@embexus.com>
Ayoub Zaki 3 年 前
コミット
07f875d023
1 ファイル変更7 行追加0 行削除
  1. 7 0
      classes/swupdate-lib.bbclass

+ 7 - 0
classes/swupdate-lib.bbclass

@@ -40,6 +40,13 @@ def swupdate_get_sha256(d, s, filename):
             m.update(data)
     return m.hexdigest()
 
+def swupdate_get_size(d, s, filename):
+    import os
+
+    fname = os.path.join(s, filename)
+    fsize = os.path.getsize(fname)
+    return str(fsize)
+
 def swupdate_sign_file(d, s, filename):
     import subprocess
     import magic