본문 바로가기

Tools/GIT

repo를 이용한 프로젝트 관리

repository가 많은 프로젝트를 진행하면 해당 프로젝트를 제대로 관리하기 하기 힘들어진다.

android 개발팀도 이런 우려에서 repo라는 scrip를 이용한 유틸리티를 만들어서 제공한다.

repo는 여러 repository를 하나의 xml 파일에 기술하여 해당 repository의 sync를 맞춘다.

보다 자세한 설명은 아래 링크를 참조하자.

https://source.android.com/source/using-repo.html


그렇다면 이러한 repo는 어떻게 사용해야 할까?

우선 manifest.xml 파일을 기술해야 한다.

다음은 realtek project를 진행하면서 만들었는 manifest.xml을 살펴보자.


우선 해당 프로젝트의 repository는 다음과 같다.

ssh://git@218.155.2.80:22926/sw3/dmt_1605ln_manifest.git
ssh://git@218.155.2.80:22926/sw3/dmt_1605ln_bootcode.git
ssh://git@218.155.2.80:22926/sw3/dmt_1605ln_krf.git
ssh://git@218.155.2.80:22926/sw3/dmt_1605ln_downloader.git
ssh://git@218.155.2.80:22926/sw3/dmt_1605ln_factorysw.git
ssh://git@218.155.2.80:22926/sw3/dmt_1605ln_tvexthal.git

여기에서 'dmt_1605ln_manifest.git' repository에 default.xml이라는 manifest 파일을 만들어서 등록한다.

manifest.xml

첨부는 'manifest.xml'이지만 'dmt_1605ln_manifest.git'에 커밋할 때는 'default.xml'이라고 커밋한다.

<?xml version="1.0" encoding="UTF-8"?>

<manifest>

<remote name="tvstorm"

fetch="ssh://git@git.tvstorm.com"/>


  <remote name="dmt"

  fetch="ssh://git@218.155.2.80:22926/"/>


<default revision="master"

remote="tvstorm"

sync-j="2"

sync-c="true" />


<project path="build_script" name="rtk/build_script.git" />

<project path="common_sirius" name="rtk/common_sirius.git" />

<project path="system" name="rtk/system.git" />

<project path="DtvStub/common_sirius" name="rtk/common_sirius.git" />

<project path="DtvStub/system" name="rtk/system.git" />

<project path="image_file_creator" name="rtk/image_file_creator.git" />

<project path="kernel/android/KK" name="rtk/kernel_android.git" />

<project path="kernel/linux/linux-2.6.34" name="rtk/kernel_secure.git" />

<project path="kernel/linux/linux-3.7.2" name="rtk/kernel_host.git" /> 

<project path="kernel/system" name="rtk/kernel_system.git" />

<project path="kernel/ksystem" name="rtk/kernel_system.git" />

<project path="SQA_DailyBuild" name="rtk/sqa_dailybuild.git" />


<!-- for dmt -->

<project path="dmt/bootcode" name="sw3/dmt_1605ln_bootcode.git" remote="dmt" />

<project path="dmt/krf" name="sw3/dmt_1605ln_krf.git" remote="dmt" />

<project path="dmt/downloader" name="sw3/dmt_1605ln_downloader.git" remote="dmt" />

<project path="dmt/factory" name="sw3/dmt_1605ln_factorysw.git" remote="dmt" />

<project path="kernel/android/KK/vender/dmt/tvexthal" name="sw3/dmt_1605ln_tvexthal.git" remote="dmt" />

</manifest>


이제 눈 여겨 볼 것은 두개의 'remote'가 존재하고(tvstorm, dmt), 'default', 그리고 많은 'project'가 존재한다.

여기서 'remote'는 실제 repository가 존재하는 위치의 경로를 기술하고, 'default'는 sync를 맞추는 방법 또는 기본 'remote' 위치 등을 기술한다.

'project'는 이렇게 기술된 'remote'와 'default'를 토대로 실제 repository를 설정한다.

눈 여겨 봐야 할 것은 'for dmt'로 설정한 부분이다. 여기서는 2개의 'remote'가 있기 때문에 어느곳의 'remote'를 가져와 할 지 정해야 한다. 그것이 바로 'project' 항목의 'remote' 지정자다.

이렇게 지정하면 원하는 곳에서 내려 받게 되고, 지정하지 않으면 default에 기록된 곳에서 내려 받게 된다.


이렇게 manifest.xml을 기술하고 commit 한 이후에 실제로 repo를 이용해서 모든 프로젝트의 sync를 맞추려면 다음과 같이 한다.

$ mkdir rtk_project

$ cd rtk_project

$ repo init -u ssh://git@218.155.2.80:22926/sw3/dmt_1605ln_manifest.git

$ repo sync


더 자세한 내용은 아래 싸이트를 참고하자.

https://gerrit.googlesource.com/git-repo/+/master/docs/manifest-format.txt

http://blog.udinic.com/2014/05/24/aosp-part-1-get-the-code-using-the-manifest-and-repo

'Tools > GIT' 카테고리의 다른 글

Ubuntu 16.04에 Gitlab 설치  (0) 2017.11.21
git branch 삭제.  (0) 2016.08.26
유용하게 사용할 git 명령어  (0) 2016.07.27
Git : 빈 디렉토리 추가하기  (0) 2015.12.08
empty 폴더를 커밋하고자 할 때..  (0) 2015.06.10