| OLD | NEW |
| 1 """ | 1 """ |
| 2 DO NOT import this file directly - import client/bin/utils.py, | 2 DO NOT import this file directly - import client/bin/utils.py, |
| 3 which will mix this in | 3 which will mix this in |
| 4 | 4 |
| 5 Convenience functions for use by tests or whomever. | 5 Convenience functions for use by tests or whomever. |
| 6 | 6 |
| 7 Note that this file is mixed in by utils.py - note very carefully the | 7 Note that this file is mixed in by utils.py - note very carefully the |
| 8 precedence order defined there | 8 precedence order defined there |
| 9 """ | 9 """ |
| 10 import os, shutil, sys, signal, commands, pickle, glob, statvfs | 10 import os, shutil, sys, signal, commands, pickle, glob, statvfs |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 elif file_contains_pattern(issue, 'SUSE'): | 238 elif file_contains_pattern(issue, 'SUSE'): |
| 239 return 'SUSE' | 239 return 'SUSE' |
| 240 elif file_contains_pattern(issue, 'Ubuntu'): | 240 elif file_contains_pattern(issue, 'Ubuntu'): |
| 241 return 'Ubuntu' | 241 return 'Ubuntu' |
| 242 elif file_contains_pattern(issue, 'Debian'): | 242 elif file_contains_pattern(issue, 'Debian'): |
| 243 return 'Debian' | 243 return 'Debian' |
| 244 else: | 244 else: |
| 245 return 'Unknown' | 245 return 'Unknown' |
| 246 | 246 |
| 247 | 247 |
| 248 def get_cc(): |
| 249 try: |
| 250 return os.environ['CC'] |
| 251 except KeyError: |
| 252 return 'gcc' |
| 253 |
| 254 |
| 248 def get_vmlinux(): | 255 def get_vmlinux(): |
| 249 """Return the full path to vmlinux | 256 """Return the full path to vmlinux |
| 250 | 257 |
| 251 Ahem. This is crap. Pray harder. Bad Martin. | 258 Ahem. This is crap. Pray harder. Bad Martin. |
| 252 """ | 259 """ |
| 253 vmlinux = '/boot/vmlinux-%s' % utils.system_output('uname -r') | 260 vmlinux = '/boot/vmlinux-%s' % utils.system_output('uname -r') |
| 254 if os.path.isfile(vmlinux): | 261 if os.path.isfile(vmlinux): |
| 255 return vmlinux | 262 return vmlinux |
| 256 vmlinux = '/lib/modules/%s/build/vmlinux' % utils.system_output('uname -r') | 263 vmlinux = '/lib/modules/%s/build/vmlinux' % utils.system_output('uname -r') |
| 257 if os.path.isfile(vmlinux): | 264 if os.path.isfile(vmlinux): |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 """ | 741 """ |
| 735 'pgrep name' misses all python processes and also long process names. | 742 'pgrep name' misses all python processes and also long process names. |
| 736 'pgrep -f name' gets all shell commands with name in args. | 743 'pgrep -f name' gets all shell commands with name in args. |
| 737 So look only for command whose initial pathname ends with name. | 744 So look only for command whose initial pathname ends with name. |
| 738 Name itself is an egrep pattern, so it can use | etc for variations. | 745 Name itself is an egrep pattern, so it can use | etc for variations. |
| 739 """ | 746 """ |
| 740 return utils.system("pgrep -f '^([^ /]*/)*(%s)([ ]|$)'" % name_pattern, | 747 return utils.system("pgrep -f '^([^ /]*/)*(%s)([ ]|$)'" % name_pattern, |
| 741 ignore_status=True) == 0 | 748 ignore_status=True) == 0 |
| 742 | 749 |
| 743 | 750 |
| OLD | NEW |