[elbe-devel] [PATCH 07/13] Change os.sytem to call_check for "debpkg.py"

dion at linutronix.de dion at linutronix.de
Mon Jun 24 12:48:47 CEST 2019


From: Olivier Dion <dion at linutronix.de>

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/debpkg.py | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/elbepack/debpkg.py b/elbepack/debpkg.py
index ede724cc..a3342238 100644
--- a/elbepack/debpkg.py
+++ b/elbepack/debpkg.py
@@ -7,6 +7,7 @@
 import os
 import string
 
+from subprocess import check_call
 from tempfile import mkdtemp
 
 control_template_string = """Package: ${name}
@@ -55,7 +56,7 @@ def build_binary_deb(
     pkgfname = "%s_%s_%s" % (name, version, arch)
     pkgdir = os.path.join(tmpdir, pkgfname)
 
-    os.system('mkdir -p "%s"' % os.path.join(pkgdir, "DEBIAN"))
+    check_call('mkdir -p "%s"' % os.path.join(pkgdir, "DEBIAN"), shell=True)
     write_file(
         os.path.join(
             pkgdir,
@@ -71,19 +72,15 @@ def build_binary_deb(
 
     for (fname, instpath) in files:
         full_instpath = os.path.join(pkgdir, instpath)
-        os.system('mkdir -p "%s"' % full_instpath)
-        os.system('cp -a "%s" "%s"' % (fname, full_instpath))
+        check_call('mkdir -p "%s"' % full_instpath, shell=True)
+        check_call('cp -a "%s" "%s"' % (fname, full_instpath), shell=True)
 
-    os.system('dpkg-deb --build "%s"' % pkgdir)
+    check_call('dpkg-deb --build "%s"' % pkgdir, shell=True)
 
-    os.system(
-        'cp -v "%s" "%s"' %
-        (os.path.join(
-            tmpdir,
-            pkgfname +
-            ".deb"),
-            target_dir))
+    check_call('cp -v "%s" "%s"' % (os.path.join(tmpdir, pkgfname + ".deb"),
+                                    target_dir),
+               shell=True)
 
-    os.system('rm -r "%s"' % tmpdir)
+    check_call('rm -r "%s"' % tmpdir, shell=True)
 
     return pkgfname + ".deb"
-- 
2.11.0




More information about the elbe-devel mailing list