ReviewBoard 설치하기
개요
- ReviewBoard는 오픈소스 코드 리뷰 툴임
- https://www.reviewboard.org/
- Pre-commit 리뷰를 지원하기 위해 명령줄에서 동작하는 클라이언트 툴을 제공함
- 클라이언트 툴이 변경된 코드의 diff를 생성해 서버에 올리는 방식임
- Perforce와 연동되고 pre-commit 리뷰를 지원하는 코드 리뷰 툴이 필요해서 테스트해 보게 되었음
서버 설치
- Bitnami ReviewBoard Powerpack 3.0.8-2 기준이므로 당연한 얘기지만 이후 버전에서는 설치과정이 약간 달라질 수도 있음
- Bitnami ReviewBoard 설치
- https://bitnami.com/stack/reviewboard-plus-powerpack
- 설치해보면 지원하는 SCM 목록에 Perforce가 안 보임
- 업그레이드 필요
- P4Python 패키지 환경 설정을 하려 했는데 왠지 오류가 남
- 설치하려는 네트워크 환경이 보안상의 이유로 외부와 SSL 핸드셰이킹이 안되어 오류가 발생하는것을 확인하여 SSL 접속을 생략
- https://stackoverflow.com/questions/25981703/pip-install-fails-with-connection-error-ssl-certificate-verify-failed-certi
You may want to add the trusted hosts and proxy to your config file.
- pip.ini에 설정하여 특정 사이트에 대한 SSL 접속을 끌 수 있다
- https://pip.pypa.io/en/stable/user_guide/?highlight=appdata#config-file
- C:\ProgramData\pip\pip.ini 생성
[global]
trusted-host = pypi.python.org
pypi.org
files.pythonhosted.org
- PIP 업그레이드
- https://github.com/pypa/pip/issues/5343
- 버전업이 한번에 안 되므로 지우고 새로 깐다
python -m pip uninstall pip
easy_install -U pip
- 서버에 P4V 및 Command line tools 설치
- https://cdist2.perforce.com/perforce/
- P4Python 설치
pip install p4python
- ReviewBoard Upgrade
- https://docs.bitnami.com/installer/apps/reviewboard-plus-powerpack/#how-to-upgrade-review-board
- Apache 종료, MySQL 실행중 상태에서 다음과 같이 실행하여 업그레이드
easy_install -U ReviewBoard
rb-site upgrade installdir/apps/reviewboard/rb-sites/reviewboard/
- Repository 설정
- Perforce 설정하고 Advanced Settings - Encoding을 cp949 지정
- 이렇게 하면 ReviewBoard가 웹에서 diff를 디스플레이할 때 내부적으로 처리하는 코드페이지가 cp949가 되므로 코드의 한글 주석 등이 잘 보이지만, ReviewBoard 서버가 Perforce 서버에 명령어를 보낼 때 cp949로 명령어를 보내므로(왜 굳이???) 동작에 문제가 생긴다
- 별 수 없이 ReviewBoard의 파이썬 코드를 수정
- E:\Bitnami\reviewboardpowerpack-3.0.8-2\python\Lib\site-packages\p4.py의 run 함수 (line 594)
# if encoding is set, translate to Bytes
if hasattr(self,"encoding") and self.encoding and not self.encoding == 'raw':
result = []
for s in flatArgs:
result.append( s.encode(self.encoding) )
flatArgs = result
- 이렇게 주석처리한다
# if encoding is set, translate to Bytes
'''if hasattr(self,"encoding") and self.encoding and not self.encoding == 'raw':
result = []
for s in flatArgs:
result.append( s.encode(self.encoding) )
flatArgs = result'''
- E:\Bitnami\reviewboardpowerpack-3.0.8-2\python\Lib\site-packages\ReviewBoard-3.0.8-py2.7.egg\reviewboard\scmtools\perforce.py의 __init__ 함수 (line 270)
self.encoding = encoding
- 이렇게 변경한다
self.encoding = ''
- Apache 끄고 해당 소스의 컴파일된 바이너리인 p4.pyc 파일과 perforce.pyc 파일을 각각 지우고 Apache 재시작하면 반영됨
- 이것으로 서버 설치 완료
- 이후 설정은 알아서
클라이언트 설정
- RBTools 설치
- https://www.reviewboard.org/downloads/rbtools/
- GNUdiff 설치
- ReviewBoard는 P4diff와 형식이 다른 GNUdiff만을 지원하므로 귀찮지만 설치
- http://gnuwin32.sourceforge.net/packages/diffutils.htm
- 환경변수에 GNUdiff 경로 등록
- 컴퓨터 > 설정 > 고급 시스템 설정 > 환경 변수 > Path에 GNUdiff 경로 추가
- .reviewboardrc 환경파일 생성
- https://www.reviewboard.org/docs/rbtools/1.0/rbt/configuration/repositories/#rbtools-repo-config
- REPOSITORY는 ReviewBoard 서버에 지정된 repository 이름
- P4_CLIENT는 P4가 사용하는 workspace 이름
REVIEWBOARD_URL="http://rbserver:81/"
USERNAME="user"
PASSWORD="password"
REPOSITORY="MyProject"
REPOSITORY_TYPE="perforce"
P4_CLIENT="my-dev-work"
- 이것으로 클라이언트 설치 완료
댓글
댓글 쓰기