[Replicant] [vendor_replicant-scripts] [PATCH 7/9] add_adb_root: get rid of mktemp shell commands

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Fri Oct 1 17:47:57 UTC 2021


Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 images/add_adb_root/add_adb_root.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/images/add_adb_root/add_adb_root.py b/images/add_adb_root/add_adb_root.py
index 02afaae..3bfc185 100755
--- a/images/add_adb_root/add_adb_root.py
+++ b/images/add_adb_root/add_adb_root.py
@@ -18,9 +18,7 @@ import os
 import re
 import sh
 import sys
-
-# TODO:
-# import tempfile
+import tempfile
 
 import files_checksums
 
@@ -38,9 +36,7 @@ class Bootimage(object):
         self._path = path
         self._metadata = self._get_metadata()
 
-        # TODO:
-        # tempfile.TemporaryDirectory().name
-        self._tmpdir = str(sh.mktemp("-d")).replace(os.linesep, "")
+        self._tmpdir = tempfile.mkdtemp()
 
         self._kernel = self._tmpdir + os.sep + "kernel.img"
         self._ramdisk = self._tmpdir + os.sep + "ramdisk.cpio.gz"
@@ -165,7 +161,7 @@ def identify_image_type(path):
     return ImageType.bootimage
 
 def add_adb_to_zImage(input_file, output_file):
-    tmpdir = str(sh.mktemp("-d")).replace(os.linesep, "")
+    tmpdir = tempfile.mkdtemp()
 
     uncompressed_Image = None
     ramdisk = None
-- 
2.33.0



More information about the Replicant mailing list