지금까진 빌드할 때 VNC로 빌드 서버에 들어가 빌드 배치 파일을 직접 실행시켰는데, 그것도 귀찮아 MSN bot으로 빌드를 자동적으로 할 수 있게 만들었다.
만들어놓고 보니 장단점이 하나씩 생겼는데, 장점은 아티스트,기획자 아무나 쉽게 빌드해서 새 버전을 받아보기 쉽다는 거랑 단점은 보순이가 너무 귀여워서 아무나 시도때도 없이 빌드를 시켜버리는 문제가 생겼다. -_-;; 뭐 일장일단...
우리팀의 귀염둥이..보순이..>.<
준비물
빌드 배치 파일
!buildall_and_commit.bat
!build.bat
MSN bot 만들기
파이썬의 msnlib을 이용하면 MSN bot을 쉽게 만들 수 있다. 소스는 말 그대로 동작만 하는 수준이고 이것을 기반으로 자신에게 맞게 수정하면 된다. 에러 처리나 명령어 관리 등이 필요함.
만들어놓고 보니 장단점이 하나씩 생겼는데, 장점은 아티스트,기획자 아무나 쉽게 빌드해서 새 버전을 받아보기 쉽다는 거랑 단점은 보순이가 너무 귀여워서 아무나 시도때도 없이 빌드를 시켜버리는 문제가 생겼다. -_-;; 뭐 일장일단...

준비물
- 빌드 배치 파일
- 파이썬
- msnlib
빌드 배치 파일
!buildall_and_commit.bat
@echo off
: SVN 업데이트
CALL "!svn_update"
: 빌드
CALL "!build"
: Copy runtime
SET root_path=%CD%
SET target_path=.
: 클라이언트 실행파일 복사
copy %target_path%\Game\Runtime\Game_r.exe %target_path%\Game\Runtime\Game.exe /y
copy %target_path%\Game\Runtime\Game_r.pdb %target_path%\Game\Runtime\Game.pdb /y
: 서버 실행파일 복사
copy %target_path%\Game\Runtime\Dev\GameServer\GameServer_r.exe %target_path%\Game\Runtime\Dev\GameServer\GameServer.exe /y
copy %target_path%\Game\Runtime\Dev\GameServer\GameServer_r.pdb %target_path%\Game\Runtime\Dev\GameServer\GameServer.pdb /y
: 커밋
CALL "!commit_game"
CALL "!commit_gameserver"
:END
: SVN 업데이트
CALL "!svn_update"
: 빌드
CALL "!build"
: Copy runtime
SET root_path=%CD%
SET target_path=.
: 클라이언트 실행파일 복사
copy %target_path%\Game\Runtime\Game_r.exe %target_path%\Game\Runtime\Game.exe /y
copy %target_path%\Game\Runtime\Game_r.pdb %target_path%\Game\Runtime\Game.pdb /y
: 서버 실행파일 복사
copy %target_path%\Game\Runtime\Dev\GameServer\GameServer_r.exe %target_path%\Game\Runtime\Dev\GameServer\GameServer.exe /y
copy %target_path%\Game\Runtime\Dev\GameServer\GameServer_r.pdb %target_path%\Game\Runtime\Dev\GameServer\GameServer.pdb /y
: 커밋
CALL "!commit_game"
CALL "!commit_gameserver"
:END
!build.bat
@echo off
SET root_path=%CD%
SET target_path=.
call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall"
del "%target_path%\Game\Runtime\Game_r.exe"
del "%target_path%\Game\Runtime\Game_r.pdb"
if not ("%1" == "clean") goto :NO_GAME_CLEAN
: 클라이언트 빌드
echo "클라이언트 클린"
devenv /clean release "%target_path%\Game\Game.sln"
:NO_GAME_CLEAN
devenv /build release "%target_path%\Game\Game.sln"
: Build 결과에 exe 파일을 검출
IF NOT EXIST "%root_path%\%target_path%\Game\Runtime\Game_r.exe" (
: EXE가 없으면 Build 가 실패했으므로 Log 를 자동으로 연다
"C:\Program Files\Internet Explorer\iexplore.exe" "%root_path%\%target_path%\Game\Release\BuildLog.htm"
GOTO END
)
del "%target_path%\Game\Runtime\Dev\GameServer\GameServer_r.exe"
del "%target_path%\Game\Runtime\Dev\GameServer\GameServer_r.pdb"
if not ("%1" == "clean") goto :NO_GAMESERVER_CLEAN
: 서버 빌드
devenv /clean release "%target_path%\Server\GameServer\GameServer.sln"
:NO_GAMESERVER_CLEAN
devenv /build release "%target_path%\Server\GameServer\GameServer.sln"
: Build 결과에 exe 파일을 검출
IF NOT EXIST "%root_path%\%target_path%\Game\Runtime\Dev\GameServer\GameServer_r.exe" (
: EXE가 없으면 Build 가 실패했으므로 Log 를 자동으로 열어주자.
"C:\Program Files\Internet Explorer\iexplore.exe" "%root_path%\%target_path%\Server\GameServer\Release\BuildLog.htm"
GOTO END
)
:END
SET root_path=%CD%
SET target_path=.
call "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall"
del "%target_path%\Game\Runtime\Game_r.exe"
del "%target_path%\Game\Runtime\Game_r.pdb"
if not ("%1" == "clean") goto :NO_GAME_CLEAN
: 클라이언트 빌드
echo "클라이언트 클린"
devenv /clean release "%target_path%\Game\Game.sln"
:NO_GAME_CLEAN
devenv /build release "%target_path%\Game\Game.sln"
: Build 결과에 exe 파일을 검출
IF NOT EXIST "%root_path%\%target_path%\Game\Runtime\Game_r.exe" (
: EXE가 없으면 Build 가 실패했으므로 Log 를 자동으로 연다
"C:\Program Files\Internet Explorer\iexplore.exe" "%root_path%\%target_path%\Game\Release\BuildLog.htm"
GOTO END
)
del "%target_path%\Game\Runtime\Dev\GameServer\GameServer_r.exe"
del "%target_path%\Game\Runtime\Dev\GameServer\GameServer_r.pdb"
if not ("%1" == "clean") goto :NO_GAMESERVER_CLEAN
: 서버 빌드
devenv /clean release "%target_path%\Server\GameServer\GameServer.sln"
:NO_GAMESERVER_CLEAN
devenv /build release "%target_path%\Server\GameServer\GameServer.sln"
: Build 결과에 exe 파일을 검출
IF NOT EXIST "%root_path%\%target_path%\Game\Runtime\Dev\GameServer\GameServer_r.exe" (
: EXE가 없으면 Build 가 실패했으므로 Log 를 자동으로 열어주자.
"C:\Program Files\Internet Explorer\iexplore.exe" "%root_path%\%target_path%\Server\GameServer\Release\BuildLog.htm"
GOTO END
)
:END
MSN bot 만들기
파이썬의 msnlib을 이용하면 MSN bot을 쉽게 만들 수 있다. 소스는 말 그대로 동작만 하는 수준이고 이것을 기반으로 자신에게 맞게 수정하면 된다. 에러 처리나 명령어 관리 등이 필요함.
#!/usr/bin/env python
# *-* coding: utf-8 -*-
import sys
import os
import subprocess
import time
import select
import socket
import string
import thread
import msnlib
import msncb
os.environ["LANG"] = "ko_KR.utf-8"
def null(s):
"Null function, useful to void debug ones"
pass
m = msnlib.msnd()
m.cb = msncb.cb()
m.encoding="UTF-8"
# message
def cb_msg(md, type, tid, params, sbd):
t = string.split(tid)
email = t[0]
# messages from hotmail are only when we connect, and send things
# regarding, aparently, hotmail issues. we ignore them (basically
# because i couldn't care less; however if somebody has intrest in
# these and provides some debug output i'll be happy to implement
# parsing).
if email == 'Hotmail':
return
# parse
lines = string.split(params, '\n')
headers = {}
eoh = 1
for i in lines:
# end of headers
if i == '\r':
break
tv = string.split(i, ':')
type = tv[0]
value = string.join(tv[1:], ':')
value = string.strip(value)
headers[type] = value
eoh += 1
if lines[4] == 'build' or lines[4] == '빌드' or lines[4] == '빌드해':
m.change_status("busy")
buf = '알았어 오빠~~'
m.sendmsg(email, buf)
p = subprocess.Popen([r"E:/ForAutoCommit/Develop/!buildall_and_commit.bat"], shell=True,cwd="E:/ForAutoCommit/Develop",stdout=subprocess.PIPE)
output = p.stdout.read()
print output
p.wait()
buf = '끝났어 오빠..~'
m.sendmsg(email, buf)
m.change_status("away")
msncb.cb_msg(md, type, tid, params, sbd)
m.cb.msg = cb_msg
# get the login email and password from the parameters
try:
m.email = sys.argv[1]
m.pwd = sys.argv[2]
except:
print "Use: msnbot email password"
sys.exit(1)
msnlib.debug = null
msncb.debug = null
print "Logging In"
m.login()
print "Sync"
# this makes the server send you the contact list, and it's recommended that
# you do it because you can get in trouble when getting certain events from
# people that are not on your list; and it's not that expensive anyway
m.sync()
print "Changing Status"
# any non-offline status will do, otherwise we'll get an error from msn when
# sending a message
m.change_status("away")
m.change_nick("보순이에용.. 빌드는 나에게 맡기셔요..ㅎㅎ")
def quit():
try:
m.disconnect()
except:
pass
print "Exit"
sys.exit(0)
# we loop over the network socket to get events
print "Loop"
while 1:
# we get pollable fds
t = m.pollable()
infd = t[0]
outfd = t[1]
# we select, waiting for events
try:
fds = select.select(infd, outfd, [], 0)
except:
quit()
for i in fds[0] + fds[1]: # see msnlib.msnd.pollable.__doc__
try:
m.read(i)
except ('SocketError', socket.error), err:
if i != m:
# user closed a connection
# note that messages can be lost here
m.close(i)
else:
# main socket closed
quit()
# sleep a bit so we don't take over the cpu
time.sleep(1)
# *-* coding: utf-8 -*-
import sys
import os
import subprocess
import time
import select
import socket
import string
import thread
import msnlib
import msncb
os.environ["LANG"] = "ko_KR.utf-8"
def null(s):
"Null function, useful to void debug ones"
pass
m = msnlib.msnd()
m.cb = msncb.cb()
m.encoding="UTF-8"
# message
def cb_msg(md, type, tid, params, sbd):
t = string.split(tid)
email = t[0]
# messages from hotmail are only when we connect, and send things
# regarding, aparently, hotmail issues. we ignore them (basically
# because i couldn't care less; however if somebody has intrest in
# these and provides some debug output i'll be happy to implement
# parsing).
if email == 'Hotmail':
return
# parse
lines = string.split(params, '\n')
headers = {}
eoh = 1
for i in lines:
# end of headers
if i == '\r':
break
tv = string.split(i, ':')
type = tv[0]
value = string.join(tv[1:], ':')
value = string.strip(value)
headers[type] = value
eoh += 1
if lines[4] == 'build' or lines[4] == '빌드' or lines[4] == '빌드해':
m.change_status("busy")
buf = '알았어 오빠~~'
m.sendmsg(email, buf)
p = subprocess.Popen([r"E:/ForAutoCommit/Develop/!buildall_and_commit.bat"], shell=True,cwd="E:/ForAutoCommit/Develop",stdout=subprocess.PIPE)
output = p.stdout.read()
print output
p.wait()
buf = '끝났어 오빠..~'
m.sendmsg(email, buf)
m.change_status("away")
msncb.cb_msg(md, type, tid, params, sbd)
m.cb.msg = cb_msg
# get the login email and password from the parameters
try:
m.email = sys.argv[1]
m.pwd = sys.argv[2]
except:
print "Use: msnbot email password"
sys.exit(1)
msnlib.debug = null
msncb.debug = null
print "Logging In"
m.login()
print "Sync"
# this makes the server send you the contact list, and it's recommended that
# you do it because you can get in trouble when getting certain events from
# people that are not on your list; and it's not that expensive anyway
m.sync()
print "Changing Status"
# any non-offline status will do, otherwise we'll get an error from msn when
# sending a message
m.change_status("away")
m.change_nick("보순이에용.. 빌드는 나에게 맡기셔요..ㅎㅎ")
def quit():
try:
m.disconnect()
except:
pass
print "Exit"
sys.exit(0)
# we loop over the network socket to get events
print "Loop"
while 1:
# we get pollable fds
t = m.pollable()
infd = t[0]
outfd = t[1]
# we select, waiting for events
try:
fds = select.select(infd, outfd, [], 0)
except:
quit()
for i in fds[0] + fds[1]: # see msnlib.msnd.pollable.__doc__
try:
m.read(i)
except ('SocketError', socket.error), err:
if i != m:
# user closed a connection
# note that messages can be lost here
m.close(i)
else:
# main socket closed
quit()
# sleep a bit so we don't take over the cpu
time.sleep(1)

::: 사람과 사람의 교감! 人터넷의 첫 시작! 댓글을 달아주세요! :::
왠지 덕후삘이 나는 bot 이군요 T_T;;
쫌 그렇죠? :) 그래도 이래야 사람들이 좋아해서요..ㅠ.ㅠ
이거 멋진데요?? 정말 빌드 걸고 싶게 만드는 봇이로군요.
보순이가 빌드 깨졌을 때, 담당자에게 개인 메시지를 보내면 더욱 효과가 있을지도.. :D
아..그거 좋네요..ㅎㅎ
생각해보면 재밌는 것들 많이 추가할 수 있을 것 같아요. :)
"너는 이미 빌드를 걸고 있다!"
=_=
퍼갈께요~
대박이다!! ^^;;
알아써 오빠!!!
끈나써 오빠!!!
ㅋㅋㅋ
ㅋㅋ
슬슬 세미나 준비 해볼까? -_-ㅋ
나가요삘인데 -_- ;;;
그래서 사람들이 좋아하나봐요..-_;;
하하 대박입니다. 저도 하나 따라서 만들어봐야겠어요.
네..재밌습니다. :)