Skip to contentSkip to conversation

rteval: Fix Popen for python3.6 where text=True is not available

PATCH New John Kacur 1 participant 2 messages Mar 9, 2022

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/2 rteval: Fix Popen for python3.6 where text=True is not available

Fix using text=True in Popen for python-3.6 by using encoding='utf-8' instead

---
 rteval/sysinfo/services.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
rteval/sysinfo/services.py +4 -4
index e5de22efc342..c85980e19165 100644
@@ -62,11 +62,11 @@ class SystemServices:
             if not [1 for p in reject if fnmatch.fnmatch(servicename, p)] \
                     and os.access(service, os.X_OK):
                 cmd = '%s -qs "\(^\|\W\)status)" %s' % (getcmdpath('grep'), service)
-                c = subprocess.Popen(cmd, shell=True, text=True)
+                c = subprocess.Popen(cmd, shell=True, encoding='utf-8')
                 c.wait()
                 if c.returncode == 0:
                     cmd = ['env', '-i', 'LANG="%s"' % os.environ['LANG'], 'PATH="%s"' % os.environ['PATH'], 'TERM="%s"' % os.environ['TERM'], service, 'status']
-                    c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
+                    c = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
                     c.wait()
                     if c.returncode == 0 and (c.stdout.read() or c.stderr.read()):
                         ret_services[servicename] = 'running'
@@ -81,7 +81,7 @@ class SystemServices:
         ret_services = {}
         cmd = '%s list-unit-files -t service --no-legend' % getcmdpath('systemctl')
         self.__log(Log.DEBUG, "cmd: %s" % cmd)
-        c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
+        c = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
         for p in c.stdout:
             # p are lines like b'servicename.service status'
             v = p.strip().split()
@@ -91,7 +91,7 @@ class SystemServices:
 
     def services_get(self):
         cmd = [getcmdpath('ps'), '-ocomm=', '1']
-        c = subprocess.Popen(cmd, stdout=subprocess.PIPE, text=True)
+        c = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding='utf-8')
         self.__init = c.stdout.read().strip()
         if self.__init == 'systemd':
             self.__log(Log.DEBUG, "Using systemd to get services status")
Signature · 1 line
2.35.1
author
#1 lore raw

PATCH 2/2 rteval: Fix allmodconfig build on machines that don't allow sha1 signing

rteval compiles the kernel using allmodconfig as a load. This can be a problem if sha1 signing of modules is disabled. Fix this by signing with sha512

---
 rteval/modules/loads/kcompile.py | 1 +
 1 file changed, 1 insertion(+)
rteval/modules/loads/kcompile.py +1 -0
index 8f97d38eca56..367f8dc1ca86 100644
@@ -66,6 +66,7 @@ class KBuildJob:
 
         self.runcmd = f"make O={self.objdir} -C {self.kdir} -j{self.jobs}"
         self.cleancmd = f"make O={self.objdir} -C {self.kdir} clean allmodconfig"
+        self.cleancmd += f"&& pushd {self.objdir} && {self.kdir}/scripts/config -d CONFIG_MODULE_SIG_SHA1 -e CONFIG_MODULE_SIG_SHA512 && popd && make O={self.objdir} -C {self.kdir} olddefconfig"
         if self.binder:
             self.runcmd = self.binder + " " + self.runcmd
             self.cleancmd = self.binder + " " + self.cleancmd
Signature · 1 line
2.35.1