Skip to content

Commit

Permalink
put mic version to build log
Browse files Browse the repository at this point in the history
Signed-off-by: Gui Chen <[email protected]>
  • Loading branch information
Gui Chen committed Jul 10, 2012
1 parent 7e3624f commit a210561
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
22 changes: 0 additions & 22 deletions mic/rt_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,13 @@
import string
import shutil
import re
import platform

from mic import bootstrap
from mic import msger
from mic.conf import configmgr
from mic.utils import errors
import mic.utils.misc as misc

SUPPORT_DISTS = (
'SuSE',
'debian',
'fedora',
'redhat',
'centos',
'meego',
'moblin',
'tizen',
)

# detect linux distribution, support "meego"
def linux_distribution():
try:
(dist, ver, id) = platform.linux_distribution( \
supported_dists = SUPPORT_DISTS)
except:
(dist, ver, id) = platform.dist( \
supported_dists = SUPPORT_DISTS)
return (dist, ver, id)

def runmic_in_runtime(runmode, opts, ksfile, argv=None):
if not runmode or "MeeGo" == linux_distribution()[0]:
return
Expand Down
25 changes: 25 additions & 0 deletions mic/utils/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import glob
import hashlib
import subprocess
import platform
import rpmmisc

try:
Expand Down Expand Up @@ -54,6 +55,30 @@
RPM_FMT = "%(name)s.%(arch)s %(ver_rel)s"
SRPM_RE = re.compile("(.*)-(\d+.*)-(\d+\.\d+).src.rpm")

SUPPORT_DISTS = (
'SuSE',
'debian',
'fedora',
'redhat',
'centos',
'meego',
'moblin',
'tizen',
)

get_machine = platform.machine

# detect linux distribution, support "meego"
def get_distro():
try:
(dist, ver, id) = platform.linux_distribution( \
supported_dists = SUPPORT_DISTS)
except:
(dist, ver, id) = platform.dist( \
supported_dists = SUPPORT_DISTS)

return (dist, ver, id)

def extract_rpm(rpmfile, targetdir):
rpm2cpio = find_binary_path("rpm2cpio")
cpio = find_binary_path("cpio")
Expand Down
4 changes: 4 additions & 0 deletions tools/mic
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ class MicCmd(cmdln.Cmdln):

if __name__ == "__main__":
try:
distro = ' '.join(misc.get_distro()).strip()
machin = misc.get_machine()
msger.raw("mic %s (%s %s)" % (VERSION, distro, machin))

mic = MicCmd()
sys.exit(mic.main())

Expand Down

0 comments on commit a210561

Please sign in to comment.