[Starlingx-discuss] repo error

Scott Little scott.little at windriver.com
Wed Dec 9 16:24:09 UTC 2020


Some of you may be seeing error from the 'repo' tool ...

*e.g.*
**00:30:01* repo init -u 'https://opendev.org/starlingx/manifest' -b 
'master' 00:30:01* Traceback (most recent call last):
*00:30:01*    File "/var/lib/jenkins/stx-repo/master/.repo/repo/main.py", line 56, in <module>
*00:30:01*      from subcmds.version import Version
*00:30:01*    File "/var/lib/jenkins/stx-repo/master/.repo/repo/subcmds/__init__.py", line 38, in <module>
*00:30:01*      ['%s' % name])
*00:30:01*    File "/var/lib/jenkins/stx-repo/master/.repo/repo/subcmds/upload.py", line 27, in <module>
*00:30:01*      from hooks import RepoHook
*00:30:01*    File "/var/lib/jenkins/stx-repo/master/.repo/repo/hooks.py", line 472
*00:30:01*      file=sys.stderr)
*00:30:01*          ^
*00:30:01* SyntaxError: invalid syntax

repo put out an update that has broken python 2 compatibility. To get it 
working again, you may need to install python3 on your system.

If you still encounter errors, It may be because repo uses ...

#!/usr/bin/env python


Which means that it will use the first 'python' it finds in your PATH,

and there are various ways that 'python' might map to python2 or

python3 depending on your system. If your system is defaulting to

python2 and it otherwise is working for you, I'm reluctant to recommend

making python3 the default.


It might be safer to edit 'repo' and force it to use python3.


REPO=$(which repo)

PY3=$(which python3)

echo " $REPO $PY3"
/usr/local/bin/repo /usr/bin/python3


# If everything looks sane ...

sudo cp ${REPO} ${REPO}.original

sudo sed "s%#\!/usr/bin/env python%#\!${PY3}%" -i ${REPO}


# Did it work ?

head -n1 $REPO
     #!/usr/bin/python3


I'll be testing our build container, and if required posting an update 
to our Dockerfile.

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.starlingx.io/pipermail/starlingx-discuss/attachments/20201209/eb36ae2f/attachment.html>


More information about the Starlingx-discuss mailing list