[linux-signed] 02/09: Replace use of os.system() with subprocess.check_call()
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Sat Apr 16 01:04:20 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository linux-signed.
commit a0575d4c252bdd85c0bba372c348cdbe56d9b612
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Fri Apr 15 16:14:57 2016 +0100
Replace use of os.system() with subprocess.check_call()
---
debian/bin/sign.py | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/debian/bin/sign.py b/debian/bin/sign.py
index deb3afc..7322024 100755
--- a/debian/bin/sign.py
+++ b/debian/bin/sign.py
@@ -3,7 +3,7 @@
import sys
sys.path.append(sys.argv[1] + "/lib/python")
-import os, os.path, shutil, tempfile
+import os, os.path, shutil, subprocess, tempfile
from debian_linux.config import ConfigCoreDump
from debian_linux.debian import VersionLinux
@@ -17,9 +17,8 @@ def get_package(name, version, arch):
# verification
os.makedirs(packages_dir, exist_ok=True)
if not os.path.isfile(package_file):
- if os.system('debsnap -d %s -f --binary -a %s %s %s' %
- (packages_dir, arch, name, version)):
- raise Exception('debsnap failed')
+ subprocess.check_call(['debsnap', '-d', packages_dir, '-f', '--binary',
+ '-a', arch, name, str(version)])
if not os.path.isdir(unpack_dir):
# Unpack to a temporary directory before moving into place, so we
@@ -28,8 +27,7 @@ def get_package(name, version, arch):
if os.path.isdir(unpack_temp_dir):
shutil.rmtree(unpack_temp_dir)
os.makedirs(unpack_temp_dir)
- if os.system('dpkg-deb -x %s %s' % (package_file, unpack_temp_dir)):
- raise Exception('dpkg-deb failed')
+ subprocess.check_call(['dpkg-deb', '-x', package_file, unpack_temp_dir])
os.rename(unpack_temp_dir, unpack_dir)
return unpack_dir
@@ -46,10 +44,9 @@ def detach_sig(unsigned_name, signed_file, signature_name):
def sign_module(kbuild_dir, module_name, signature_name, privkey_name,
cert_name):
with tempfile.NamedTemporaryFile() as signed_module:
- if os.system('%s/scripts/sign-file sha256 %s %s %s %s' %
- (kbuild_dir, privkey_name, cert_name, module_name,
- signed_module.name)):
- raise Exception('sign-file failed')
+ subprocess.check_call(['%s/scripts/sign-file' % kbuild_dir, 'sha256',
+ privkey_name, cert_name, module_name,
+ signed_module.name])
detach_sig(module_name, signed_module, signature_name)
def sign_modules(kbuild_dir, modules_dir, signature_dir, privkey_name,
@@ -69,10 +66,10 @@ def sign_image_efi(image_name, signature_name, privkey_name, cert_name):
print('I: Signing image %s' % image_name)
print('I: Storing detached signature as %s' % signature_name)
os.makedirs(os.path.dirname(signature_name), exist_ok=True)
- if (os.system('sbsign --key %s --cert %s --detached --output %s %s' %
- (privkey_name, cert_name, signature_name, image_name)) or
- # Work around bug #819987
- not os.path.isfile(signature_name)):
+ subprocess.check_call(['sbsign', '--key', privkey_name, '--cert', cert_name,
+ '--detached', '--output', signature_name, image_name])
+ # Work around bug #819987
+ if not os.path.isfile(signature_name):
raise Exception('sbsign failed')
def sign(config_name, imageversion_str, modules_privkey_name, modules_cert_name,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux-signed.git
More information about the Kernel-svn-changes
mailing list