summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/linux.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2020-10-03 21:53:04 +1000
committerChris Johns <chrisj@rtems.org>2020-10-06 12:00:21 +1100
commit158ad680aed1c4fd00f00d5b0e269391597872ef (patch)
treeb3c448838c3471d418cfbc8a49b38b1ba32a7211 /source-builder/sb/linux.py
parentfreebsd: FreeBSD 12.1 does not build gcc (diff)
downloadrtems-source-builder-158ad680aed1c4fd00f00d5b0e269391597872ef.tar.bz2
sb: Back port the RTEMS 5 and 6 RSB engine.
- Build GDb first as we do for RTEMS 5 and later - Update GDB to 9.1 for all archs expect SPARC. The SIS patches only apply to 7.9. Disable Python for SPARC Closes #4111
Diffstat (limited to 'source-builder/sb/linux.py')
-rw-r--r--source-builder/sb/linux.py48
1 files changed, 22 insertions, 26 deletions
diff --git a/source-builder/sb/linux.py b/source-builder/sb/linux.py
index e6c5470..d89377b 100644
--- a/source-builder/sb/linux.py
+++ b/source-builder/sb/linux.py
@@ -22,29 +22,15 @@
# RTEMS project's spec files.
#
+import multiprocessing
+import platform
import pprint
import os
-import platform
-import execute
-import path
+from . import path
def load():
uname = os.uname()
- smp_mflags = ''
- processors = '/bin/grep processor /proc/cpuinfo'
- e = execute.capture_execution()
- exit_code, proc, output = e.shell(processors)
- ncpus = 0
- if exit_code == 0:
- try:
- for l in output.split('\n'):
- count = l.split(':')[1].strip()
- if int(count) > ncpus:
- ncpus = int(count)
- except:
- pass
- ncpus = str(ncpus + 1)
if uname[4].startswith('arm'):
cpu = 'arm'
else:
@@ -52,7 +38,7 @@ def load():
version = uname[2]
defines = {
- '_ncpus': ('none', 'none', ncpus),
+ '_ncpus': ('none', 'none', str(multiprocessing.cpu_count())),
'_os': ('none', 'none', 'linux'),
'_host': ('triplet', 'required', cpu + '-linux-gnu'),
'_host_vendor': ('none', 'none', 'gnu'),
@@ -69,13 +55,17 @@ def load():
'__tar': ('exe', 'required', '/bin/tar')
}
- # Works for LSB distros
- try:
- distro = platform.dist()[0]
- distro_ver = float(platform.dist()[1])
- except ValueError:
- # Non LSB distro found, use failover"
- pass
+ # platform.dist() was removed in Python 3.8
+ if hasattr(platform, 'dist'):
+ # Works for LSB distros
+ try:
+ distro = platform.dist()[0]
+ distro_ver = float(platform.dist()[1])
+ except ValueError:
+ # Non LSB distro found, use failover"
+ pass
+ else:
+ distro = ''
# Non LSB - fail over to issue
if distro == '':
@@ -94,7 +84,7 @@ def load():
distro = 'redhat'
elif distro in ['centos', 'fedora']:
distro = 'redhat'
- elif distro in ['Ubuntu', 'ubuntu', 'LinuxMint', 'linuxmint']:
+ elif distro in ['Ubuntu', 'ubuntu', 'MX', 'LinuxMint', 'linuxmint']:
distro = 'debian'
elif distro in ['Arch']:
distro = 'arch'
@@ -120,6 +110,12 @@ def load():
'__chown': ('exe', 'required', '/usr/bin/chown') },
'suse' : { '__chgrp': ('exe', 'required', '/usr/bin/chgrp'),
'__chown': ('exe', 'required', '/usr/sbin/chown') },
+ 'gentoo' : { '__bzip2': ('exe', 'required', '/bin/bzip2'),
+ '__chgrp': ('exe', 'required', '/bin/chgrp'),
+ '__chown': ('exe', 'required', '/bin/chown'),
+ '__gzip': ('exe', 'required', '/bin/gzip'),
+ '__grep': ('exe', 'required', '/bin/grep'),
+ '__sed': ('exe', 'required', '/bin/sed') },
}
if distro in variations: