GitLab import

Amlogic SDK 저장소는 릴리즈 후 유효기간이 1달이기 때문에, 회사 GitLab 서버로 덤프하는 방법을 간단히 정리한다.

 

Amlogic SDK download

Amlogic SDK 202207 버전을 ref-sdk-202207 디렉토리에 mirror 옵션을 사용하여 아래와 같이 다운받는다.

$ mkdir ref-sdk-202207
$ cd ref-sdk-202207
$ repo init -u ssh://git@openlinux.amlogic.com/yocto/manifest.git -b master -m yocto-dunfell-202207.xml --repo-url=ssh://git@openlinux.amlogic.com/repo.git --repo-branch=v2.9 --mirror

 

GitLab 경로 설정

사내 GitLab 저장소에 업로드 경로와 동일하게 다운받은 SDK 경로를 동일하게 설정해야 한다. 만약 amlogic/ref-sdk-202207 위치에 소스를 올릴 경우 위 SDK를 아래와 같이 변경하도록 한다.

$ mkdir -p mirror_src/amlogic
$ mv ref-sdk-202207 mirror_src/amlogic
$ cd mirror_src/amlogic/ref-sdk-202207

 

Amlogic SDK mainifest 구성

Amlogic SDK manifest 구성을 보면 아래와 같은 여러 서버에서 소스를 받는 것을 확인할 수 있다.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote fetch=".." name="amlogic"/>
  <remote fetch="ssh://git@openlinux2.amlogic.com/yocto" name="amlogic-yocto"/>
  <remote fetch="https://github.com" name="github"/>
  <remote fetch="http://git.linaro.org" name="linaro"/>
  <remote fetch="git://git.openembedded.org/" name="openembedded"/>
  <remote fetch="http://git.yoctoproject.org/git" name="yocto"/>
  
  <project path="aml-patches" name="rdk/aml-patches" revision="yocto-202207" remote="amlogic-yocto"/>
  <project dest-branch="linux-rdk" name="DTVKit/releaseDTVKit" path="aml-comp/prebuilt/dtvkit-release" remote="amlogic-yocto" revision="xxxx" upstream="linux-rdk"/>
  ...

리모트 서버 이름은 그대로 유지하고, fetch 서버를 사내 GitLab 서버 주소를 아래와 같이 변경한다.

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <remote fetch="ssh://git@10.10.10.134/amlogic/ref-sdk-202207" name="amlogic-yocto"/>
  <remote fetch="ssh://git@10.10.10.134/amlogic/ref-sdk-202207" name="github"/>
  <remote fetch="ssh://git@10.10.10.134/amlogic/ref-sdk-202207" name="linaro"/>
  <remote fetch="ssh://git@10.10.10.134/amlogic/ref-sdk-202207" name="openembedded"/>
  <remote fetch="ssh://git@10.10.10.134/amlogic/ref-sdk-202207" name="yocto"/>

  <project path="aml-patches" name="rdk/aml-patches" revision="yocto-202207" remote="amlogic-yocto"/>
  ...

위와 같이 변경하면 Amlogic 또는 오픈소스 저장소에서 소스를 내려받는 것이 아니라, 사내 GitLab 서버에서 소스를 받는다.

 

Amlogic SDK 덤프(업로드)

로컬소스 디렉토리와 동일하게 GitLab 저장소에 생성되기 때문에 로컬소스 디렉토리 구성을 잘 생각해야 한다. 상위 디렉토리는 자동으로 그룹으로 생성되고, 디렉토리 이름이 중복될 경우 업로드가 되지 않기 때문에 주의해야 한다.

$ sudo chown git:git -R mirror_src
$ sudo gitlab-rake gitlab:import:repos["/home/gon/mirror_src"]

위 명령어로 mirror_src 하위 디렉토리 내용이 사내 GitLab 저장소에 동일한 디렉토리 구성으로 업로드되는 것을 확인할 수 있다.