반응형

Ctrl + F로 에러를 검색하면 쉽게 찾을 수 있습니다.

 

repo는 구글이 git 저장소들을 관리하기 위해 만든 도구임. 이 repo는  안드로이드 개발 과정의 일부를 자동화함.

repo 명령실행 가능한 파이썬 스크립트임을 명심하자.

 

아래의 명령어는 ~/bin이라는 특정 경로를 명령어가 접근 가능하도록 PATH를 추가하는 명령어들이다.

$ mkdir ~/bin

$ PATH=~/bin:$PATH

 

 

문제/에러:  error: repo is not installed. Use "repo init" to install it here

$ repo --version 입력 시 위와 같은 에러를 만나는 경우이다.

 

예상원인

기본 python 버전이 낮으면 저런 에러가 나오는 것으로 예상하고 있다.

 

해결방법

명시적으로 python3을 붙여주고 which repo의 명령어 결과로 나오는 절대 경로를 함께 써주어 명령어를 입력한다.

 

$ python3 ~/bin/repo --version

<repo not installed>
repo launcher version 2.15
    (from /home/~~)
git 2.7.4
Python 3.8.3 (default,
...

 


문제/에러:  file=sys.stderr ^)

root@a3ce4f9f160e:~# repo sync -j24 
 File "/root/.repo/repo/main.py", line 79 
 file=sys.stderr) 
 ^ 
SyntaxError: invalid syntax

 

repo 명령어 실행 시 아래와 같은 에러 발생.
(도커 환경에서, repo 다운로드 받으려고 할 때, 자주 발생함)

원인

python과 repo 버전 불일치해서 발생하는 문제이다.

 

해결방법 1.  Python 3.x 설치 / Repo를 신규 설치

Python 3.x 설치

Bash:

sudo apt-get install python3 python3-pip python3-pexpect python3-git python3-jinja2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1

 

Repo 신규 설치

Bash:

curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
PATH="~/bin:$PATH"

 

해결방법 2. python3 을 명시해서 repo 명령어를 실행할 것

아래의 명령어를 입력하자.

# python3 ~/bin/repo sync

... A new version of repo (2.21) is available.
... You should upgrade soon:
cp /root/.repo/repo/repo /root/bin/repo
Receiving objects: 100% (331/331), 105.63 KiB | 13.20 MiB/s, done.
Resolving deltas: 100% (16/16), done.

 

명시적으로 python버전을 설정하기 위해, repo 명령어 앞에 python3 을 붙여준다.
미리 다운받은 full 경로의 repo를 실행한다. ~/bin/repo


만약 ~/bin/repo에 repo 프로그램을 다운로드 받지 않을 경우,
아래의 명령어를 통해, 최신 repo 프로그램을 다운로드 받자.

 

Bash:

mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x ~/bin/repo

 

해결방법 3. repo 신규 설치

I have tried to repo init the source code Ubuntu build machine and it is successfully able to clone the code.
repo init -u git@github.com:xxx/xx_manifest.git -b xxx
Now I am trying repo init the source code in VM Ubuntu machine.
In between getting the error like below:

curl https://storage.googleapis.com/git-repo-downloads/repo-1 > ~/bin/repo
chmod a+x ~/bin/repo
python3 ~/bin/repo init -u git@....

 


Repo 설치

출처:

https://gerrit.googlesource.com/git-repo 

Install

Many distros include repo, so you might be able to install from there.

# Debian/Ubuntu.
$ sudo apt-get install repo

# Gentoo.
$ sudo emerge dev-vcs/repo

You can install it manually as well as it's a single script.

$ mkdir -p ~/.bin
$ PATH="${HOME}/.bin:${PATH}"
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
$ chmod a+rx ~/.bin/repo


참고하면 좋을 자료

https://stackoverflow.com/questions/65193998/syntaxerror-invalid-syntax-to-repo-init-in-the-aosp-code

 

http://dreamlog.tistory.com/2

 

https://coinpipe.tistory.com/96

 

git config 설정을 통한 에러 해결 방법

https://khd0801.tistory.com/m/34

 

 

 

시간을 절약했으면 아래의 좋아요 부탁드립니다.

 

반응형