Notice
Recent Posts
Recent Comments
«   2024/09   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

웹프로그래밍

리눅스(linux)에서 SVN 서버(server)설정 본문

리눅스Linux

리눅스(linux)에서 SVN 서버(server)설정

공부모드 2016. 7. 13. 05:27

VN 설정

SVN 디렉터리 생성
 sudo mkdir /home/svn
 cd /home/svn

저장소 생성
 sudo svnadmin create --fs-type fsfs MSPlayReady

권한 변경
 sudo chmod -R o+w MSPlayReady

SVN Server실행
 sudo svnserve -d -r /home/svn

사용자인증 설정
 cd /home/svn/MSPlayReady/conf
시작===========================================================================================
svnserve.conf 파일을 아래와 같이 설정 합니다.

### This file controls the configuration of the svnserve daemon, if you
### use it to allow access to this repository.  (If you only allow
### access through http: and/or file: URLs, then this file is
### irrelevant.)

### Visit http://subversion.tigris.org/ for more information.

[general]
### These options control access to the repository for unauthenticated
### and authenticated users.  Valid values are "write", "read",
### and "none".  The sample settings below are the defaults.
anon-access = none
auth-access = write
### The password-db option controls the location of the password
### database file.  Unless you specify a path starting with a /,
### the file's location is relative to the conf directory.
### The format of the password database is similar to this file.
### It contains one section labelled [users]. The name and
### password for each user follow, one account per line. The
### format is
###    USERNAME = PASSWORD
### Please note that both the user name and password are case
### sensitive. There is no default for the password file.
password-db = passwd
### This option specifies the authentication realm of the repository.
### If two repositories have the same authentication realm, they should
### have the same password database, and vice versa.  The default realm
### is repository's uuid.
끝===============================================================================================

password파일을 수정
 username = passwd

 

post commit 메일 보내기

 

Subversion 저장소안에는 hooks 라는 디렉토리가 있습니다. 이 디렉토리 안에서 커밋을 했을때 실행할 것들을 설정 합니다.
hooks 디렉토리 안의 post-commit.tmpl 파일을 post-commit이라고 복사합니다. .tmpl 파일은 아무 일도 하지 않는 파일입니다. 그리고 실행 권한을 줍니다.
# cp post-commit.tmpl post-commit
# chmod 755 post-commit
같은 디렉토리에 있는 pre-revprop-change.tmpl파일도 pre-revprop-change로 복사한 뒤 실행권한을 줍니다.
# cp pre-revprop-change.tmpl pre-revprop-change
# chmod 755 pre-revprop-change
post-commit수정
47 REPOS="$1"
48 REV="$2"
49
50 "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/hooks/mailer.conf
mailer.py, mailer.conf파일을 찾아서 hooks디렉터리로 복사

그리고 mailer.conf.example를 mailer.conf 이름을 바꾸고 내용 Gmail에 맞게 설정을 합니다.

# This option specifies the hostname for delivery via SMTP.
smtp_hostname = smtp.gmail.com:587

# Username and password for SMTP servers requiring authorisation.
smtp_username = example@gmail.com
smtp_password = (이메일 암호)

아래 값들도 본인에 맞게 셋팅한다

from_addr =

to_addr =

generate_diffs =

truncate_subject =


다른 설정은 자신의 환경에 맞게 설정합니다.

mailer.py의

SMTPOutput 클래스 finish 함수를 아래와 같이 수정합니다.

def finish(self):
  server = smtplib.SMTP(self.cfg.general.smtp_hostname)
  if self.cfg.is_set('general.smtp_username'):
    server.ehlo()         # 추가된 부분
    server.starttls()     # 추가된 부분
    server.ehlo()         # 추가된 부분
    server.login(self.cfg.general.smtp_username, self.cfg.general.smtp_password)
  server.sendmail(self.from_addr, self.to_addrs, self.buffer.getvalue())
  server.close()          # server.quit()를 server.close()로 수정.


이렇게 하면 Gmail SMTP 서버를 통해서 커밋 로그 메일을 보낼 수 있습니다.
Gmail은 TLS 인증을 사용하기 때문에 starttls()함수를 호출해 줘야 로그인이 됩니다.

test 방법
./post-commit "리포이름" "리비전넘버"
# ./post-commit "/repos/sample" "20"

 

 dump_load

 

1. dump
svnadmin.exe dump d:\Repositories\CIPLUS -r 4:152 > CIPLS_R152.dump

2. 필요한 부분만 추출
svndumpfilter.exe include CIPLUS\ST7111_CXIA_Merge_CIPLS\ < CIPLS_R152.dump > CIPLS_SOURCE_R512.dump

3. svn 저장소에 CIPLUS 디렉터리 생성 후  load
svnadmin.exe load d:\repositories\ST7111_CXIA_Merge_CIPLS < CIPLS_SOURCE_R512.dump

 

 

Comments