Changeset 5717

Show
Ignore:
Timestamp:
07/07/10 17:43:25 (3 years ago)
Author:
qsy
Message:

Modified scripts/cppm -- now can build and run PM with dev version of BTSniffer in PM_copy. (Done for Ubuntu LTS 10.04)

Location:
packet-manipulator/branches/BTSniff
Files:
12 added
1 modified

Legend:

Unmodified
Added
Removed
  • packet-manipulator/branches/BTSniff/scripts/cppm

    r5425 r5717  
    11#! /usr/bin/env python 
    22 
     3##      This file contains a hacked version of a build script for now 
     4#       TODO: write the equivalent in bash script or find a good build tool 
     5#       like make that works well with Python to accomplish the same 
    36import os, sys 
     7import shutil 
    48 
     9# build and setup commands 
     10CMD_BUILD               = 'python setup.py build' 
     11CMD_DEL_OLD             = 'svn del PM_copy/umit/pm/backend/bt_sniffer/* --force' 
     12CMD_ADD_NEW             = 'svn add PM_copy/umit/pm/backend/bt_sniffer/*' 
     13CMD_CP_PINCRACK = 'svn copy btpincrack-v0.3 PM_copy/' 
     14 
     15PATH_BUILD                      = 'build/' 
     16WANTED_FILE_EXTS        = ['py', 'so'] 
     17PATH_BT_BACKEND         = 'PM_copy/umit/pm/backend/bt_sniffer/' 
     18PATH_BT_PINCRACK        = 'PM_copy/btpincrack-v0.3' 
     19 
     20 
     21def _cpfunc(arg, dirname, flist): 
     22        if dirname.startswith('lib.linux'): 
     23                #gotcha 
     24                for f in flist: 
     25                        #print '_cpfunc: looking at %s' % f 
     26                        if f[f.rfind('.') + 1:] in WANTED_FILE_EXTS: 
     27                                srcfile = os.path.join(dirname, f) 
     28                                shutil.copy2(srcfile, PATH_BT_BACKEND) 
     29                                #print 'Copied %s to %s' % (srcfile, PATH_BT_BACKEND) 
     30 
     31# Only runs on Linux 
    532if sys.platform == 'linux2': 
    6         os.system('python setup.py build') 
    7         wanted_file_exts = [ 'py' , 'so' ] 
    8          
    9         os.system('svn del PM_copy/umit/pm/backend/bt_sniffer/* --force') 
    10          
    11         for ext in wanted_file_exts:     
    12                 os.system('cp build/lib.linux-i686-2.6/umit/bluetooth/*.%s PM_copy/umit/pm/backend/bt_sniffer/' % ext) 
     33 
     34        os.system(CMD_BUILD) 
     35        os.system(CMD_DEL_OLD) 
     36        #print 'Walking %s' % PATH_BUILD 
     37        os.path.walk(PATH_BUILD, _cpfunc, None) 
    1338                 
    14         os.system('svn add PM_copy/umit/pm/backend/bt_sniffer/*')        
    15                  
    16         # os.system('cp -r btpincrack-v0.3 PacketManipulator/') 
    17         if not os.path.exists('PM_copy/btpincrack-v0.3'): 
    18                 os.system('svn copy btpincrack-v0.3 PM_copy/') 
     39        os.system(CMD_ADD_NEW)   
     40        if not os.path.exists(PATH_BT_PINCRACK): 
     41                os.system(CMD_CP_PINCRACK) 
    1942else: 
    20         print 'Sorry no can do' 
     43        print   'Many apologies. This is not possible at this stage.' 
     44                        'Devt of BTSniffer is still limited to Linux. Thank ' 
     45                        'you for trying nonetheless.' 
    2146 
    2247