1 | # |
---|
2 | # RTEMS Tools Project (http://www.rtems.org/) |
---|
3 | # Copyright 2010-2014 Chris Johns (chrisj@rtems.org) |
---|
4 | # All rights reserved. |
---|
5 | # |
---|
6 | # This file is part of the RTEMS Tools package in 'rtems-tools'. |
---|
7 | # |
---|
8 | # Permission to use, copy, modify, and/or distribute this software for any |
---|
9 | # purpose with or without fee is hereby granted, provided that the above |
---|
10 | # copyright notice and this permission notice appear in all copies. |
---|
11 | # |
---|
12 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
13 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
14 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
---|
15 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
16 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
---|
17 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
---|
18 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
19 | |
---|
20 | # |
---|
21 | # This code is based on what ever doco about spec files I could find and |
---|
22 | # RTEMS project's spec files. |
---|
23 | # |
---|
24 | |
---|
25 | import pprint |
---|
26 | import os |
---|
27 | |
---|
28 | import check |
---|
29 | import error |
---|
30 | import execute |
---|
31 | |
---|
32 | def load(): |
---|
33 | uname = os.uname() |
---|
34 | psrinfo = '/sbin/psrinfo|wc -l' |
---|
35 | e = execute.capture_execution() |
---|
36 | exit_code, proc, output = e.shell(psrinfo) |
---|
37 | if exit_code == 0: |
---|
38 | ncpus = output |
---|
39 | else: |
---|
40 | ncpus = '1' |
---|
41 | if uname[4] == 'i86pc': |
---|
42 | cpu = 'i386' |
---|
43 | else: |
---|
44 | cpu = uname[4] |
---|
45 | version = uname[2] |
---|
46 | if version.find('-') > 0: |
---|
47 | version = version.split('-')[0] |
---|
48 | defines = { |
---|
49 | '_ncpus': ('none', 'none', ncpus), |
---|
50 | '_os': ('none', 'none', 'solaris'), |
---|
51 | '_host': ('triplet', 'required', cpu + '-pc-solaris2'), |
---|
52 | '_host_vendor': ('none', 'none', 'pc'), |
---|
53 | '_host_os': ('none', 'none', 'solaris'), |
---|
54 | '_host_os_version': ('none', 'none', version), |
---|
55 | '_host_cpu': ('none', 'none', cpu), |
---|
56 | '_host_alias': ('none', 'none', '%{nil}'), |
---|
57 | '_host_arch': ('none', 'none', cpu), |
---|
58 | '_usr': ('dir', 'required', '/usr'), |
---|
59 | '_var': ('dir', 'optional', '/var'), |
---|
60 | '__bash': ('exe', 'optional', '/usr/bin/bash'), |
---|
61 | '__bison': ('exe', 'required', '/usr/bin/bison'), |
---|
62 | '__git': ('exe', 'required', '/usr/bin/git'), |
---|
63 | '__svn': ('exe', 'required', '/usr/bin/svn'), |
---|
64 | '__cvs': ('exe', 'optional', '/usr/bin/cvs'), |
---|
65 | '__xz': ('exe', 'optional', '/usr/bin/xz'), |
---|
66 | '__make': ('exe', 'required', 'gmake'), |
---|
67 | '__patch_opts': ('none', 'none', '-E'), |
---|
68 | '__chown': ('exe', 'required', '/usr/bin/chown'), |
---|
69 | '__install': ('exe', 'required', '/usr/bin/ginstall'), |
---|
70 | '__cc': ('exe', 'required', '/usr/bin/gcc'), |
---|
71 | '__cxx': ('exe', 'required', '/usr/bin/g++'), |
---|
72 | 'with_iconv': ('none', 'none', '0') |
---|
73 | } |
---|
74 | |
---|
75 | defines['_build'] = defines['_host'] |
---|
76 | defines['_build_vendor'] = defines['_host_vendor'] |
---|
77 | defines['_build_os'] = defines['_host_os'] |
---|
78 | defines['_build_cpu'] = defines['_host_cpu'] |
---|
79 | defines['_build_alias'] = defines['_host_alias'] |
---|
80 | defines['_build_arch'] = defines['_host_arch'] |
---|
81 | |
---|
82 | return defines |
---|
83 | |
---|
84 | if __name__ == '__main__': |
---|
85 | pprint.pprint(load()) |
---|