[Leaf] Cannot get the Legato source by getsrc command

Hey all.

I have a fresh install of the Leaf workflow on my VM and everything went well until the leaf getsrc swi-legato command. I was able to execute the getsrc with the swi-linux but when I try with the swi-legato argument, I get the following output:

ricardo@ricardo-yocto:~/leaf-install$ leaf getsrc legato
Fetching remote legato-stable
Fetching remote legato-dev
Run sync steps for wp76-legato-src_19.02.0

Ready to sync in /home/ricardo/leaf-install/legato-src directory:
repo init -u ssh://ricardo.kannebley@gerrit.legato.io:29418/manifest -m legato/releases/19.02.0/legato.xml ; repo sync

Proceed? (Y/n)
y
Checking credentials...
repo: warning: Python 2 is no longer supported; Please upgrade to Python 3.6+.

... A new version of repo (2.4) is available.
... You should upgrade soon:

    cp /home/ricardo/leaf-install/legato-src/.repo/repo/repo /usr/bin/repo

Traceback (most recent call last):
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/main.py", line 622, in <module>
    _Main(sys.argv[1:])
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/main.py", line 596, in _Main
    result = run()
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/main.py", line 589, in <lambda>
    run = lambda: repo._Run(name, gopts, argv) or 0
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/main.py", line 266, in _Run
    result = cmd.Execute(copts, cargs)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/subcmds/init.py", line 498, in Execute
    self._LinkManifest(opt.manifest_name)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/subcmds/init.py", line 339, in _LinkManifest
    self.manifest.Link(name)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/manifest_xml.py", line 192, in Link
    self.Override(name)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/manifest_xml.py", line 185, in Override
    self._Load()
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/manifest_xml.py", line 510, in _Load
    self._ParseManifest(nodes)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/manifest_xml.py", line 618, in _ParseManifest
    project = self._ParseProject(node)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/manifest_xml.py", line 942, in _ParseProject
    self._ParseLinkFile(project, n)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/manifest_xml.py", line 1096, in _ParseLinkFile
    self._ValidateFilePaths('linkfile', src, dest)
  File "/home/ricardo/leaf-install/legato-src/.repo/repo/manifest_xml.py", line 1077, in _ValidateFilePaths
    '<%s> invalid "src": %s: %s' % (element, src, msg))
error.ManifestInvalidPathError: <linkfile> invalid "src": ../ar7: bad component: ..
ERROR:
  Something went wrong with `repo` command
HINTS:
  Please check connection and credentials
  Then try again leaf getsrc legato
Run sync steps for wp76-linux-src_SWI9X07Y_02.28.03.05

Apparently by reading the code on the manifest_xml.py, the src path cannot contain ‘.’, ‘…’ or ‘.git’ and raises an exception. But this is weird because I didn’t make any changes other than instructed on the official Leaf tutorial.

I triple checked the credentials and even uninstalled everything to try again, but the issue still remains the same.

I was hopping to find something about this on Google but nothing came out. For my project I cannot use the pre-build Legato image.

Could someone help me? Thanks in advance.
Ricardo.

Hi @ricardo.kannebley,

I just pushed a fix that should solve that.
We had a similar issue reported at ManifestInvalidPathError for repo init call · Issue #11 · legatoproject/manifest · GitHub , which I though I had solved but not entirely. Now it should be good.
Please let me know if that works for you.

Thanks!

1 Like

I tried $ leaf getsrc legato and it ran up to this point:

Ready to sync in /home/joe/legato-src directory:
repo init -u ssh://'joe.blow@bigco.com'@gerrit.legato.io:29418/manifest -m legato/releases/19.07.0/legato.xml ; repo sync

Proceed? (Y/n)

Checking credentials...
ssh: connect to host gerrit.legato.io port 29418: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.
ERROR:
  Something went wrong when trying to connect to ssh://'joe.blow@bigco.com'@gerrit.legato.io:29418/manifest
HINTS:
  Please check connection and credentials
  Then try again leaf getsrc legato

It appears that the ssh sever at gerrit.legato.io is not up.

It seems that you are using an email address as username, which is not correct.
You should be using the username set in https://gerrit.legato.io/ instead.
See https://docs.legato.io/latest/toolsGerrit.html#toolsGerrit_setup

Thanks, I set up a user id on gerrit. But leaf is still using “joe.blow@bigco.com”, how do I change that?

Note also that the gerrit setup is referenced fairly far down on the webpage, but the attempt to fetch from gerrit can happen during the leaf setup as described near the top.

Edit: I can see that this user is defined by GERRIT_USER, I will find out where that is defined. Found: ~/.config/leaf/config.json

Edit: still same problem

Ready to sync in /home/paul/legato-src directory:
repo init -u ssh://piinst@gerrit.legato.io:29418/manifest -m legato/releases/19.07.0/legato.xml ; repo sync

Proceed? (Y/n)

Checking credentials...
ssh: connect to host gerrit.legato.io port 29418: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

All good! Could fetch the source with no problem. Thanks!