Bug 7945

Summary: Toaster startup script assumes it's in a git repository
Product: [Build System, Metadata & Runtime] Toaster Reporter: Michael Wood <michael.g.wood>
Component: toasterAssignee: David Reyna <david.reyna>
Status: RESOLVED OBSOLETE QA Contact:
Severity: major    
Priority: Medium CC: alexandru.damian, belen.barros.pena, bluelightning, brian.avery, cristiana.voicu, dl9pf, jessica.zhang, richard.purdie
Version: unspecified   
Target Milestone: Future   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Yes (doc changes required)
Bug Depends on: 7963    
Bug Blocks:    

Description Michael Wood 2015-07-02 11:14:31 UTC
The toaster startup script assumes it's inside a git repository, when loading the toasterconf.json this is called:

 def _read_git_url_from_local_repository(address):
            url = None
            # we detect the remote name at runtime
            import subprocess
            (remote, remote_name) = address.split(":", 1)
            cmd = subprocess.Popen("git remote -v", shell=True, cwd = os.path.dirname(filepath), stdout=subprocess.PIPE, stderr = subprocess.PIPE)

in bitbake/lib/toaster/bldcontrol/loadconf.py:11


This means that if you download a poky release tar archive Toaster will be unable to be configured/start.
Comment 1 Jan-Simon Moeller 2015-07-02 14:08:02 UTC
This applies to the "Build Mode".  
The simple "Analysis Mode" still works with the tarball.
Comment 2 Alexandru Damian 2015-07-07 14:56:16 UTC
The root cause is that the toasterconf.json file we supply by default references the local git url under which it is cloned. If the toasterconf.json is not cloned from GIT, toaster properly detects this, but throws an indescribable error message which doesn't tell the user.

The patch at 

https://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=adamian/20150707_bugs

replaces throwing out exception with properly documented error messages.


Bug 7963 tracks infrastructure changes needed for tarball generation to generate valid sources.
Comment 3 Paul Eggleton 2015-07-07 15:56:25 UTC
Could we simply fall back within the Toaster code to a copy rather than a clone if the source isn't a git repository?
Comment 4 Alexandru Damian 2015-07-07 16:04:59 UTC
Toaster code deals in layers hosted in Git repos.

The fallback you mention requires either:
- creating a on-the-fly git repo out of the tarball; the way an automated repo would work is sketchy, at best, and a hack at worst

- rewrite checkout code for Toaster to use layers outside git repos; this brings in multiple problems related to releases - there is no way to differentiate master to fido, e.g. outside a git branch; i.e. projects created from tarball sources would work in very different ways from projects using git repos; significant implementation work is needed here
Comment 5 Belen Barros Pena 2015-07-09 10:42:42 UTC
Changed the documentation status. Since the proper fix for this issue depends on bug 6683 and bug 7963, all we can do for the moment, on top of improving the error message, is updating the 1.8 manual in the Yocto Project website to let people know that, in order to use the build functionality, they need to clone the Yocto Project repository, not download the release tarball.
Comment 6 brian avery 2017-06-15 15:16:32 UTC
Is this still broken? if so, is Bug 6683 still the right way to fix it?
Comment 7 brian avery 2017-06-15 15:50:03 UTC
removing Bug 6683 as it is no longer relevant to toaster setup.
Comment 8 David Reyna 2017-06-27 01:56:07 UTC
The current Toaster code now allows "git remote -v" for Toaster to be optional. 

If present, the tracked repositories are cached and used to skip a git pull, otherwise a git pull is executed.

See "localhostbecontroller.py" in the method "setLayers()".

FYI, here are the typical values for a Toaster development pull:
  [build]$ git remote -v
  origin	git://git.yoctoproject.org/poky (fetch)
  origin	git://git.yoctoproject.org/poky (push)
  poky-contrib	ssh://git@git.yoctoproject.org/poky-contrib (fetch)
  poky-contrib	ssh://git@git.yoctoproject.org/poky-contrib (push)
  [build]$ 

I am marking this defect as obsolete.