Bug 11107

Summary: Improve docs about SSTATE_MIRROR usage with uninative
Product: [Documentation] Mega Manual Reporter: Mikko Ylinen <mikko.ylinen>
Component: mega-manualAssignee: Scott Rifenbark <srifenbark>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: jon.richardson, scott.branden, srifenbark
Version: unspecified   
Target Milestone: 4.99   
Hardware: x86   
OS: Multiple   
Whiteboard: 23 October 2018: RESOLVED
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Done (doc changes complete)

Description Mikko Ylinen 2017-02-24 15:38:10 UTC
After d36f41e5658bbbb6080ee833027879c119edf3e0 it's no longer obvious how to use the SSTATE_MIRROR setting in the case uninative is enabled.

It could be (and it seems likely) that the server provided sstate universal artifacts are suffixed for an older gcc version and the newer distros developers are running easily get a mismatch in NATIVELSBSTRING and end up building -native bits locally.

An end-user could think one SSTATE_MIRROR setting is enough to get the sstate artifacts from the server but another regexp type of setting is needed to map developer machine's NATIVELSBSTRING to the one that matches what the server provides.

I'm suggesting the usage is described better, e.g., in local.conf.sample.
Comment 1 Scott Branden 2018-10-11 20:16:58 UTC
Yes, please update documentation.  We are always fetching uninative tarball from downloads.yoctoproject.org and need to know how to set it up to use local mirrors if the tarball is available.
Comment 2 Scott Rifenbark 2018-10-16 16:07:24 UTC
Hi, 

Here is the SSTATE_MIRRORS description in the glossary: https://yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#var-SSTATE_MIRRORS.

Here is a section on the uninative.bbclass: https://yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#ref-classes-uninative

Here is the NATIVELSBSTRING variable description in the glossary: https://yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#var-NATIVELSBSTRING

I need some help understanding what an example would look like in local.conf that shows how to map a developer machine's NATIVELSBSTRING to the one that matches what the server provides.  For example, what would SSTATE_MIRRORS and NATIVELSBSTRING need to be set for and why?  I need further explanation. 

Thanks,
Scott
Comment 3 Scott Branden 2018-10-20 00:40:04 UTC
(In reply to comment #2)
> Hi, 
> 
> Here is the SSTATE_MIRRORS description in the glossary:
> https://yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#var-
> SSTATE_MIRRORS.
> 
> Here is a section on the uninative.bbclass:
> https://yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#ref-classes-
> uninative
> 
> Here is the NATIVELSBSTRING variable description in the glossary:
> https://yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#var-
> NATIVELSBSTRING
> 
> I need some help understanding what an example would look like in local.conf
> that shows how to map a developer machine's NATIVELSBSTRING to the one that
> matches what the server provides.  For example, what would SSTATE_MIRRORS
> and NATIVELSBSTRING need to be set for and why?  I need further explanation. 
> 
> Thanks,
> Scott

I don't know why this problem is assigned to me?  I try following the instructions and it doesn't work. Here is was I set:

# Set DL_DIR to a directory outside the project so it can be shared betwen multiple builds.
# All you need to do is checkout all your source trees parallel to eachother
# and this relative path will work
DL_DIR ?= "${TOPDIR}/../../../yocto-cache/downloads"

# Ensure DL_DIR generates tarballs for git repos otherwise yocto will always
# fetch them. This is disabled by default.
BB_GENERATE_MIRROR_TARBALLS = "1"

# Set SSTATE_DIR to a directory outside the project so it can be shared betwen multiple builds.
# All you need to do is checkout all your source trees parallel to eachother
# and this relative path will work
SSTATE_DIR ?= "${TOPDIR}/../../../yocto-cache/sstate-cache"

# We transfer the sstate-cache to a filer so others can access
SSTATE_MIRRORS ?= "\
file://.* file:///projects/ccxsw/yocto/mirror/sstate-cache/PATH"
# And copy the DL_DIR to the filer as well
PREMIRRORS_prepend = "\
git://svcccxswgit@git-ccxsw.rtp.broadcom.com/ git://svcccxswgit@git-ccxsw.rtp.broadcom.com/ \n \
file://.*     file:///projects/ccxsw/yocto/mirror/sources \n \
bzr://.*/.*   file:///projects/ccxsw/yocto/mirror/sources \n \
cvs://.*/.*   file:///projects/ccxsw/yocto/mirror/sources \n \
git://.*/.*   file:///projects/ccxsw/yocto/mirror/sources \n \
gitsm://.*/.* file:///projects/ccxsw/yocto/mirror/sources \n \
hg://.*/.*    file:///projects/ccxsw/yocto/mirror/sources \n \
osc://.*/.*   file:///projects/ccxsw/yocto/mirror/sources \n \
p4://.*/.*    file:///projects/ccxsw/yocto/mirror/sources \n \
svn://.*/.*   file:///projects/ccxsw/yocto/mirror/sources \n \
ftp://.*/.*   file:///projects/ccxsw/yocto/mirror/sources \n \
http://.*/.*  file:///projects/ccxsw/yocto/mirror/sources \n \
https://.*/.* file:///projects/ccxsw/yocto/mirror/sources \n"



EVERYTHING else is fetched properly from the PREMIRRORS.

uninative is fetched outside the first time.  It doesn't pick it up from the PREMIRROR.  But then once it's fetched it does pick it up from the DL_DIR.  So to reproduce you need to make sure you delete it from the DL_DIR.

How do we set UNINATIVE_URL and UNINATIVE_CHECKSUM so uninative is fetched from the PREMIRROR.  Can't figure it out.  Nor why it simply isn't using the uninative prepend.
Comment 4 Mikko Ylinen 2018-10-22 07:09:38 UTC
My original request is only about SSTATE_MIRRORs. If a user wants to use server provided native sstate artifacts, one would need to configure SSTATE_MIRROR regexp so that local search paths get mapped to server provided paths taking the GCC versions into account. This is not mentioned in the documentation.

In my case, it was:
file://universal-4.9/(.*) http://<SERVER_URL_SSTATE_PATH>/universal-4.8/\1 \n 

(the real private URL changed to <SERVER_URL_SSTATE_PATH>)
Comment 5 Scott Rifenbark 2018-10-23 00:29:10 UTC
Mikko, 

See https://yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#var-SSTATE_MIRRORS for an addition to try and cover your initial issue regarding SSTATE_MIRRORS.  I am not confident on how I explained the example or even showed the example.  Please correct me there.

Thanks,
Scott

@Scott Brandon:  The reason you temporarily were assigned the bug is because when I saw it, I changed the status to "NEEDINFO" to get more information on how to describe the fix in the docs.  When a but goes to "NEEDINFO", the triage team will look for an "expert" to re-assign the bug to.  They probably grabbed your name as it was the most recent detailed comment. 

Scott
Comment 6 Mikko Ylinen 2018-10-23 04:46:26 UTC
(In reply to comment #5)
> Mikko, 
> 
> See
> https://yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#var-
> SSTATE_MIRRORS for an addition to try and cover your initial issue regarding
> SSTATE_MIRRORS.  I am not confident on how I explained the example or even
> showed the example.  Please correct me there.


Perhaps change the first sentence to something like:

When pointing to sstate build artifacts on another machine that uses different GCC version for native builds, SSTATE_MIRROR must be configured with a regular expression that maps local search paths to paths.
Comment 7 Scott Rifenbark 2018-10-23 16:27:20 UTC
Mikko, 

Thanks for the comment.  See https://yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#var-SSTATE_MIRRORS.  I just changed your suggested wording a bit to make it more active sentence to conform with the YP document writing style.

Let me know if all is good.

Thanks, 
Scott
Comment 8 Mikko Ylinen 2018-10-23 18:27:02 UTC
This "The server paths must take into account the GCC versions." could be "The paths need to take into account NATIVELSBSTRING set by uninative.bbclass." (with appropriate anchors)
Comment 9 Scott Rifenbark 2018-10-23 19:43:17 UTC
Ok Mikko - see https://yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#var-SSTATE_MIRRORS and let me know.

Thanks,
Scott
Comment 10 Mikko Ylinen 2018-10-23 19:48:55 UTC
"with appropriate anchors" tried to say that make the keywords links (like you did). It does not belong in the description.
Comment 11 Scott Rifenbark 2018-10-23 19:51:32 UTC
Haha - ok.  I should have known that.  I thought it was something special about the pathnames :)

See https://yoctoproject.org/docs/2.6/ref-manual/ref-manual.html#var-SSTATE_MIRRORS
Comment 12 Scott Rifenbark 2018-10-23 21:34:02 UTC
Setting to RESOLVED and putting the doc flag to "done."

Scott