Beispiel #1
0
def compile_hwc(branch):
    ret = 1
    os.chdir(repo[branch]["HWC"])

    try:
        thread = mythread(1, process_bar)
        thread.start()
        (ret,
         log) = spawn_exec(r'sudo bash /home/reaper/mylib/build_hwc.sh %s' %
                           repo[branch]["HWC"])
    finally:
        thread.stop(ret)
        thread.join()
        if en_log == True:
            print(log)

    if ret != 0:
        result["hwc_composer.zx2000.so"] = "compile failed"
        raise Exception("compile hwc failed")

    os.chdir("../../../../")
    print('''\n\nmd5info:
             * hwcomposer.zx2000.so: %s

             copy....
     ''' % (md5sum(
        "out/target/product/zx2000/system/vendor/lib/hw/hwcomposer.zx2000.so"),
            ))
    shutil.copy2(
        "out/target/product/zx2000/system/vendor/lib/hw/hwcomposer.zx2000.so",
        repo[branch]["OUT"])

    result["hwc_composer.zx2000.so"] = md5sum(
        "out/target/product/zx2000/system/vendor/lib/hw/hwcomposer.zx2000.so")
Beispiel #2
0
def compile_kernel(branch, bsp, force):
    bsp_changed = False
    ret = 1
    pattern = r"(^BSP_VERSION \?=) (\d{2}\.\d{2}\.\d{2}[a-zA-Z]?$)"
    result["kernel"] = bsp
    os.chdir(repo[branch]["KERNEL"])

    #modify the bsp version
    for line in fileinput.input("Makefile"):
        what = re.match(pattern, line.rstrip())
        if what is not None and what.group(2) != bsp:
            bsp_changed = True

    if bsp_changed or force:
        for line in fileinput.input("Makefile", inplace=True):
            print(
                re.sub(r"(^BSP_VERSION \?=) (\d{2}\.\d{2}\.\d{2}[a-zA-Z]?$)",
                       r'\1 ' + bsp, line.rstrip()))

        try:
            thread = mythread(2, process_bar)
            thread.start()
            (ret, log) = spawn_exec("sudo ./build_zx2000.sh")
        finally:
            thread.stop(ret)
            thread.join()
            if en_log == True:
                print(log)

    else:
        ret = 0
        print(
            "NOTICE: BSP Version unchanged, no need to compile kernel again\n")
        time.sleep(2)

    if ret != 0:
        result["kernel"] = "compile failed"
        print("\nERROR>> compile error : %d" % ret)
        raise Exception("compile kernel error")
Beispiel #3
0
def compile_uboot(branch):
    ret = 1

    os.chdir(repo[branch]["UBOOT"])

    try:
        thread = mythread(0.5, process_bar)
        thread.start()
        (ret, log) = spawn_exec("./build_zx2000.sh")
    finally:
        thread.stop(ret)
        thread.join()
        if en_log == True:
            print(log)

    if ret != 0:
        result["u-boot.toc"] = "compile failed"
        print("\nERROR>> compile uboot error : %d" % ret)
        raise Exception("compile uboot error")

    os.chdir("../secureboot-zx2000/utils/SigningTool")
    print("\n\nstart signing for the u-boot.bin")
    (ret, log) = spawn_exec(
        "sudo ./secureboot.py -f ../../../uboot -k keys.lt_eng -B u-boot.toc")
    if ret != 0:
        result["u-boot.toc"] = "signing failed"
        print("\nERROR>> signing uboot error : %d" % ret)
        raise Exception("signing uboot error")

    print("Signing uboot over.\n")

    print('''md5info:
             * u-boot.toc: %s

             copy....
     ''' % (md5sum("output/u-boot.toc"), ))
    shutil.copy2("output/u-boot.toc", repo[branch]["OUT"])

    result["u-boot.toc"] = md5sum("output/u-boot.toc")
Beispiel #4
0
def compile_drv(branch):
    ret = 1
    os.chdir(repo[branch]["CBIOS"])

    for line in fileinput.input("build_arm.sh", inplace=True):
        print(
            re.sub(r"(^make) LINUXDIR=(\S+) (.*)",
                   r'\1 LINUXDIR=' + repo[branch]["KERNEL"] + r' \3',
                   line.rstrip()))

    try:
        thread = mythread(0.1, process_bar)
        thread.start()
        (ret, log) = spawn_exec("bash ./build_arm.sh")
    finally:
        thread.stop(ret)
        thread.join()
        if en_log == True:
            print(log)

    if ret != 0:
        print("ERROR>> compile driver error : %d" % ret)
        result["s3g.ko"] = "compile failed"
        result["s3g_core.ko"] = "compile failed"
        raise Exception("compile driver failed")

    print('''\nmd5info:
             * s3g.ko: %s
             * s3g_core.ko: %s

             copy....
     ''' % (md5sum("s3g.ko"), md5sum("s3g_core.ko")))
    shutil.copy2("s3g.ko", repo[branch]["OUT"])
    shutil.copy2("s3g_core.ko", repo[branch]["OUT"])

    result["s3g.ko"] = md5sum("s3g.ko")
    result["s3g_core.ko"] = md5sum("s3g_core.ko")
Beispiel #5
0
#!/usr/bin/python
#coding=utf-8
from dytt8.dytt8 import dytt8
from xunbo.xunbo import xunbo
from mythread    import mythread

#dytt8 = dytt8(5)

print "开始抓取迅播前三页的电影链接。。。"
xunbo = xunbo(3)

mythread(xunbo)
Beispiel #6
0
po1_loc = [(850, 550), (950, 550), (1050, 550)]
po2_loc = [(550, 550), (650, 550), (750, 550)]
po3_loc = [(250, 550), (350, 550), (450, 550)]
po4_loc = [(100, 355), (100, 430), (100, 505)]
po5_loc = [(100, 130), (100, 205), (100, 280)]
po6_loc = [(250, 60), (350, 60), (450, 60)]
po7_loc = [(550, 60), (650, 60), (750, 60)]
po8_loc = [(850, 60), (950, 60), (1050, 60)]
po9_loc = [(1190, 130), (1190, 205), (1190, 280)]
po10_loc = [(1190, 355), (1190, 430), (1190, 505)]

status_loc = (390, 250)
broken_loc = (650, 330)
b_status_loc = (650, 435)

draw_policy_thread = mythread.mythread(1, screen, blue_flag_image, green_flag_image)

green_win_num = 0
blue_win_num = 0
player_num = 10
policy_card_ini_num = 3
broken_num = 0
green_policy_num = 0
blue_policy_num = 0
already_set_policy_num = 0
# 3: triple score, 0: ini
triple_s = 0
president = -1
chancellor = -1
pre_president = -1
pre_chancellor = -1
Beispiel #7
0
#coding=utf-8
from dytt8.dytt8 import dytt8
from xunbo.xunbo import xunbo
from mythread    import mythread
import sqlite3
'''
	本文件是将抓取到的链接写入sqlite 数据库的版本
'''

db = sqlite3.connect('./spider.db')

link = db.cursor()

link.execute('select * from sqlite_master where type="table" and name="ftp_url";')
if not link.fetchone():

    link.execute("""CREATE TABLE `ftp_url` ( `id` INTEGER PRIMARY KEY  NOT NULL , `url` varchar(120) DEFAULT NULL)""")
    db.commit()

print "开始抓取迅播前三页的电影链接。。。"
xunbo = xunbo(3)

urls = mythread(xunbo)
for url in urls:
    sql = """INSERT INTO `ftp_url` values(NULL,'%s' );""" %(url)
    link.execute(sql)

db.commit()

db.close()
Beispiel #8
0
	try:
		urlopen(url)
		print '%s 下载好了 ' %(url)
	except:
		pass

if __name__ == '__main__':
	domain = ''
	proxy_ip = ''
	if len(sys.argv) > 2:
		domain = sys.argv[1]
		proxy_ip = sys.argv[2]
	else:
		print ' Useage: python  %s  domain  proxy_ip ' %(sys.argv[0])
		print ' Example:  python  pre_down.py www.sina.com.cn  221.130.162.34'
		sys.exit(1)

	if not domain.startswith('http://'):
		domain = 'http://' + domain
	
	extract_url(domain)	

	ok = []

	for url in urls:
		if url.startswith('http:'):
			ok.append(url)
	mythread.mythread(list(set(ok)),pre_down,40)

			
Beispiel #9
0
from mythread import mythread
import sqlite3
'''
	本文件是将抓取到的链接写入sqlite 数据库的版本
'''

db = sqlite3.connect('./spider.db')

link = db.cursor()

link.execute(
    'select * from sqlite_master where type="table" and name="ftp_url";')
if not link.fetchone():

    link.execute(
        """CREATE TABLE `ftp_url` ( `id` INTEGER PRIMARY KEY  NOT NULL , `url` varchar(120) DEFAULT NULL)"""
    )
    db.commit()

print "开始抓取迅播前三页的电影链接。。。"
xunbo = xunbo(3)

urls = mythread(xunbo)
for url in urls:
    sql = """INSERT INTO `ftp_url` values(NULL,'%s' );""" % (url)
    link.execute(sql)

db.commit()

db.close()
Beispiel #10
0
#!/usr/bin/python
#coding=utf-8
from dytt8.dytt8 import dytt8
from xunbo.xunbo import xunbo
from mythread    import mythread

dytt8 = dytt8(5)

#print "开始抓取迅播前三页的电影链接。。。"
#xunbo = xunbo(3)

print "begin print"

ftp_urls = mythread(dytt8)
file = open('test.txt','w+')
for ftp_url in ftp_urls:
	file.write((ftp_url + '\n').encode('utf-8'))
file.flush()
file.close()