All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-07-25 21:09 Richard Purdie
  2012-07-25 22:12 ` McClintock Matthew-B29882
  2012-08-02 13:53   ` Martin Jansa
  0 siblings, 2 replies; 18+ messages in thread
From: Richard Purdie @ 2012-07-25 21:09 UTC (permalink / raw)
  To: openembedded-devel

Currently all sstate files are placed into one directory. This does not scale and
causes a variety of filesystem issues. This patch adds a two character subdirectory
to the layout (based on the first two characters of the hash) so that files
can be split into several directories.

This should help performance of sstate in most cases by avoding creating directories with 
huge numbers of files.

The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
the addition of a PATH item, for example:

SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"

This change also sets the scene for using things like lsb-release in
the 

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 570b371..d00779a 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -4,16 +4,21 @@ SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
 SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-"
 SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}"
 
+def generate_sstatefn(spec, hash, d):
+    if not hash:
+        hash = "INVALID"
+    return hash[:2] + "/" + spec + hash
 
 SSTATE_PKGARCH    = "${PACKAGE_ARCH}"
 SSTATE_PKGSPEC    = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-${PV}-${PR}-${SSTATE_PKGARCH}-${SSTATE_VERSION}-"
-SSTATE_PKGNAME    = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
+SSTATE_PKGNAME    = "${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC', True), d.getVar('BB_TASKHASH', True), d)}"
 SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
+SSTATE_PATHSPEC   = "${SSTATE_DIR}/*/${SSTATE_PKGSPEC}"
 
 SSTATE_SCAN_FILES ?= "*.la *-config *_config"
 SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f'
 
-BB_HASHFILENAME = "${SSTATE_PKGNAME}"
+BB_HASHFILENAME = "${SSTATE_PKGSPEC}"
 
 SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
 
@@ -158,10 +163,11 @@ def sstate_installpkg(ss, d):
         oe.path.remove(dir)
 
     sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['name'])
+    sstatefetch = d.getVar('SSTATE_PKGNAME', True) + '_' + ss['name'] + ".tgz"
     sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz"
 
     if not os.path.exists(sstatepkg):
-       pstaging_fetch(sstatepkg, d)
+       pstaging_fetch(sstatefetch, sstatepkg, d)
 
     if not os.path.isfile(sstatepkg):
         bb.note("Staging package %s does not exist" % sstatepkg)
@@ -223,8 +229,7 @@ def sstate_installpkg(ss, d):
 def sstate_clean_cachefile(ss, d):
     import oe.path
 
-    sstatepkgdir = d.getVar('SSTATE_DIR', True)
-    sstatepkgfile = sstatepkgdir + '/' + d.getVar('SSTATE_PKGSPEC', True) + "*_" + ss['name'] + ".tgz*"
+    sstatepkgfile = d.getVar('SSTATE_PATHSPEC', True) + "*_" + ss['name'] + ".tgz*"
     bb.note("Removing %s" % sstatepkgfile)
     oe.path.remove(sstatepkgfile)
 
@@ -417,7 +422,7 @@ def sstate_package(ss, d):
 
     return
 
-def pstaging_fetch(sstatepkg, d):
+def pstaging_fetch(sstatefetch, sstatepkg, d):
     import bb.fetch2
 
     # Only try and fetch if the user has configured a mirror
@@ -430,7 +435,7 @@ def pstaging_fetch(sstatepkg, d):
     bb.data.update_data(localdata)
 
     dldir = localdata.expand("${SSTATE_DIR}")
-    srcuri = "file://" + os.path.basename(sstatepkg)
+    srcuri = "file://" + sstatefetch
 
     bb.mkdirhier(dldir)
 
@@ -519,8 +524,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
     }
 
     for task in range(len(sq_fn)):
-        sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
-        sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
+        sstatefile = d.expand("${SSTATE_DIR}/" + generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
         if os.path.exists(sstatefile):
             bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
             ret.append(task)
@@ -544,10 +548,9 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
             if task in ret:
                 continue
 
-            sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
-            sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
+            sstatefile = d.expand(generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
 
-            srcuri = "file://" + os.path.basename(sstatefile)
+            srcuri = "file://" + sstatefile
             localdata.setVar('SRC_URI', srcuri)
             bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
 






^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-07-25 21:09 [PATCH] sstate: Add a two character subdirectory to the sstate directory layout Richard Purdie
@ 2012-07-25 22:12 ` McClintock Matthew-B29882
  2012-08-02 13:53   ` Martin Jansa
  1 sibling, 0 replies; 18+ messages in thread
From: McClintock Matthew-B29882 @ 2012-07-25 22:12 UTC (permalink / raw)
  To: openembedded-devel; +Cc: openembedded-devel

On Wed, Jul 25, 2012 at 4:09 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> Currently all sstate files are placed into one directory. This does not scale and
> causes a variety of filesystem issues. This patch adds a two character subdirectory
> to the layout (based on the first two characters of the hash) so that files
> can be split into several directories.
>
> This should help performance of sstate in most cases by avoding creating directories with
> huge numbers of files.
>
> The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> the addition of a PATH item, for example:
>
> SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
>
> This change also sets the scene for using things like lsb-release in
> the
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

What about backwards compatibility?

-M

> ---
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 570b371..d00779a 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -4,16 +4,21 @@ SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
>  SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-"
>  SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}"
>
> +def generate_sstatefn(spec, hash, d):
> +    if not hash:
> +        hash = "INVALID"
> +    return hash[:2] + "/" + spec + hash
>
>  SSTATE_PKGARCH    = "${PACKAGE_ARCH}"
>  SSTATE_PKGSPEC    = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-${PV}-${PR}-${SSTATE_PKGARCH}-${SSTATE_VERSION}-"
> -SSTATE_PKGNAME    = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
> +SSTATE_PKGNAME    = "${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC', True), d.getVar('BB_TASKHASH', True), d)}"
>  SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
> +SSTATE_PATHSPEC   = "${SSTATE_DIR}/*/${SSTATE_PKGSPEC}"
>
>  SSTATE_SCAN_FILES ?= "*.la *-config *_config"
>  SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f'
>
> -BB_HASHFILENAME = "${SSTATE_PKGNAME}"
> +BB_HASHFILENAME = "${SSTATE_PKGSPEC}"
>
>  SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
>
> @@ -158,10 +163,11 @@ def sstate_installpkg(ss, d):
>          oe.path.remove(dir)
>
>      sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['name'])
> +    sstatefetch = d.getVar('SSTATE_PKGNAME', True) + '_' + ss['name'] + ".tgz"
>      sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz"
>
>      if not os.path.exists(sstatepkg):
> -       pstaging_fetch(sstatepkg, d)
> +       pstaging_fetch(sstatefetch, sstatepkg, d)
>
>      if not os.path.isfile(sstatepkg):
>          bb.note("Staging package %s does not exist" % sstatepkg)
> @@ -223,8 +229,7 @@ def sstate_installpkg(ss, d):
>  def sstate_clean_cachefile(ss, d):
>      import oe.path
>
> -    sstatepkgdir = d.getVar('SSTATE_DIR', True)
> -    sstatepkgfile = sstatepkgdir + '/' + d.getVar('SSTATE_PKGSPEC', True) + "*_" + ss['name'] + ".tgz*"
> +    sstatepkgfile = d.getVar('SSTATE_PATHSPEC', True) + "*_" + ss['name'] + ".tgz*"
>      bb.note("Removing %s" % sstatepkgfile)
>      oe.path.remove(sstatepkgfile)
>
> @@ -417,7 +422,7 @@ def sstate_package(ss, d):
>
>      return
>
> -def pstaging_fetch(sstatepkg, d):
> +def pstaging_fetch(sstatefetch, sstatepkg, d):
>      import bb.fetch2
>
>      # Only try and fetch if the user has configured a mirror
> @@ -430,7 +435,7 @@ def pstaging_fetch(sstatepkg, d):
>      bb.data.update_data(localdata)
>
>      dldir = localdata.expand("${SSTATE_DIR}")
> -    srcuri = "file://" + os.path.basename(sstatepkg)
> +    srcuri = "file://" + sstatefetch
>
>      bb.mkdirhier(dldir)
>
> @@ -519,8 +524,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
>      }
>
>      for task in range(len(sq_fn)):
> -        sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
> -        sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
> +        sstatefile = d.expand("${SSTATE_DIR}/" + generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
>          if os.path.exists(sstatefile):
>              bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
>              ret.append(task)
> @@ -544,10 +548,9 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
>              if task in ret:
>                  continue
>
> -            sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
> -            sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
> +            sstatefile = d.expand(generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
>
> -            srcuri = "file://" + os.path.basename(sstatefile)
> +            srcuri = "file://" + sstatefile
>              localdata.setVar('SRC_URI', srcuri)
>              bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
>
>
>
>
>
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-07-25 21:09 [PATCH] sstate: Add a two character subdirectory to the sstate directory layout Richard Purdie
@ 2012-08-02 13:53   ` Martin Jansa
  2012-08-02 13:53   ` Martin Jansa
  1 sibling, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-02 13:53 UTC (permalink / raw)
  To: openembedded-devel; +Cc: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 7392 bytes --]

On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> Currently all sstate files are placed into one directory. This does not scale and
> causes a variety of filesystem issues. This patch adds a two character subdirectory
> to the layout (based on the first two characters of the hash) so that files
> can be split into several directories.
> 
> This should help performance of sstate in most cases by avoding creating directories with 
> huge numbers of files.
> 
> The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> the addition of a PATH item, for example:
> 
> SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> 
> This change also sets the scene for using things like lsb-release in
> the 

Is it possible to create 2nd level cache with this?

I have some server with slow upload but fully populated sstate-cache.

So on server with faster upload which could be used as offical
SSTATE_MIRROR for SHR distro I would like to add

SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"

And then sync my sstate-cache directory to public accessible web root (with rsync).

Problem is that now sstate-cache has all files in slightly different 
layout then original sstate-cache on slow server. From what I see I guess 
it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
directly to sstate-cache dir (and adds .done)

OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
-rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
-rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done

And then creates symlink in right prefix back to absolute path of sstate-cache/file:
OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
/OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz

But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
all those symlinks point nowhere and public sstate-cache is unusable.

Can we have relative paths used in symlinks or even instruct fetcher to download that 
file directly to right prefix?

Cheers,

> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 570b371..d00779a 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -4,16 +4,21 @@ SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
>  SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-"
>  SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}"
>  
> +def generate_sstatefn(spec, hash, d):
> +    if not hash:
> +        hash = "INVALID"
> +    return hash[:2] + "/" + spec + hash
>  
>  SSTATE_PKGARCH    = "${PACKAGE_ARCH}"
>  SSTATE_PKGSPEC    = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-${PV}-${PR}-${SSTATE_PKGARCH}-${SSTATE_VERSION}-"
> -SSTATE_PKGNAME    = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
> +SSTATE_PKGNAME    = "${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC', True), d.getVar('BB_TASKHASH', True), d)}"
>  SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
> +SSTATE_PATHSPEC   = "${SSTATE_DIR}/*/${SSTATE_PKGSPEC}"
>  
>  SSTATE_SCAN_FILES ?= "*.la *-config *_config"
>  SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f'
>  
> -BB_HASHFILENAME = "${SSTATE_PKGNAME}"
> +BB_HASHFILENAME = "${SSTATE_PKGSPEC}"
>  
>  SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
>  
> @@ -158,10 +163,11 @@ def sstate_installpkg(ss, d):
>          oe.path.remove(dir)
>  
>      sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['name'])
> +    sstatefetch = d.getVar('SSTATE_PKGNAME', True) + '_' + ss['name'] + ".tgz"
>      sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz"
>  
>      if not os.path.exists(sstatepkg):
> -       pstaging_fetch(sstatepkg, d)
> +       pstaging_fetch(sstatefetch, sstatepkg, d)
>  
>      if not os.path.isfile(sstatepkg):
>          bb.note("Staging package %s does not exist" % sstatepkg)
> @@ -223,8 +229,7 @@ def sstate_installpkg(ss, d):
>  def sstate_clean_cachefile(ss, d):
>      import oe.path
>  
> -    sstatepkgdir = d.getVar('SSTATE_DIR', True)
> -    sstatepkgfile = sstatepkgdir + '/' + d.getVar('SSTATE_PKGSPEC', True) + "*_" + ss['name'] + ".tgz*"
> +    sstatepkgfile = d.getVar('SSTATE_PATHSPEC', True) + "*_" + ss['name'] + ".tgz*"
>      bb.note("Removing %s" % sstatepkgfile)
>      oe.path.remove(sstatepkgfile)
>  
> @@ -417,7 +422,7 @@ def sstate_package(ss, d):
>  
>      return
>  
> -def pstaging_fetch(sstatepkg, d):
> +def pstaging_fetch(sstatefetch, sstatepkg, d):
>      import bb.fetch2
>  
>      # Only try and fetch if the user has configured a mirror
> @@ -430,7 +435,7 @@ def pstaging_fetch(sstatepkg, d):
>      bb.data.update_data(localdata)
>  
>      dldir = localdata.expand("${SSTATE_DIR}")
> -    srcuri = "file://" + os.path.basename(sstatepkg)
> +    srcuri = "file://" + sstatefetch
>  
>      bb.mkdirhier(dldir)
>  
> @@ -519,8 +524,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
>      }
>  
>      for task in range(len(sq_fn)):
> -        sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
> -        sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
> +        sstatefile = d.expand("${SSTATE_DIR}/" + generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
>          if os.path.exists(sstatefile):
>              bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
>              ret.append(task)
> @@ -544,10 +548,9 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
>              if task in ret:
>                  continue
>  
> -            sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
> -            sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
> +            sstatefile = d.expand(generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
>  
> -            srcuri = "file://" + os.path.basename(sstatefile)
> +            srcuri = "file://" + sstatefile
>              localdata.setVar('SRC_URI', srcuri)
>              bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
>  
> 
> 
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-02 13:53   ` Martin Jansa
  0 siblings, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-02 13:53 UTC (permalink / raw)
  To: openembedded-devel; +Cc: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 7392 bytes --]

On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> Currently all sstate files are placed into one directory. This does not scale and
> causes a variety of filesystem issues. This patch adds a two character subdirectory
> to the layout (based on the first two characters of the hash) so that files
> can be split into several directories.
> 
> This should help performance of sstate in most cases by avoding creating directories with 
> huge numbers of files.
> 
> The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> the addition of a PATH item, for example:
> 
> SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> 
> This change also sets the scene for using things like lsb-release in
> the 

Is it possible to create 2nd level cache with this?

I have some server with slow upload but fully populated sstate-cache.

So on server with faster upload which could be used as offical
SSTATE_MIRROR for SHR distro I would like to add

SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"

And then sync my sstate-cache directory to public accessible web root (with rsync).

Problem is that now sstate-cache has all files in slightly different 
layout then original sstate-cache on slow server. From what I see I guess 
it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
directly to sstate-cache dir (and adds .done)

OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
-rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
-rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done

And then creates symlink in right prefix back to absolute path of sstate-cache/file:
OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
/OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz

But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
all those symlinks point nowhere and public sstate-cache is unusable.

Can we have relative paths used in symlinks or even instruct fetcher to download that 
file directly to right prefix?

Cheers,

> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
> diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
> index 570b371..d00779a 100644
> --- a/meta/classes/sstate.bbclass
> +++ b/meta/classes/sstate.bbclass
> @@ -4,16 +4,21 @@ SSTATE_MANIFESTS ?= "${TMPDIR}/sstate-control"
>  SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-"
>  SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}"
>  
> +def generate_sstatefn(spec, hash, d):
> +    if not hash:
> +        hash = "INVALID"
> +    return hash[:2] + "/" + spec + hash
>  
>  SSTATE_PKGARCH    = "${PACKAGE_ARCH}"
>  SSTATE_PKGSPEC    = "sstate-${PN}-${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}-${PV}-${PR}-${SSTATE_PKGARCH}-${SSTATE_VERSION}-"
> -SSTATE_PKGNAME    = "${SSTATE_PKGSPEC}${BB_TASKHASH}"
> +SSTATE_PKGNAME    = "${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC', True), d.getVar('BB_TASKHASH', True), d)}"
>  SSTATE_PKG        = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
> +SSTATE_PATHSPEC   = "${SSTATE_DIR}/*/${SSTATE_PKGSPEC}"
>  
>  SSTATE_SCAN_FILES ?= "*.la *-config *_config"
>  SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f'
>  
> -BB_HASHFILENAME = "${SSTATE_PKGNAME}"
> +BB_HASHFILENAME = "${SSTATE_PKGSPEC}"
>  
>  SSTATE_MANMACH ?= "${SSTATE_PKGARCH}"
>  
> @@ -158,10 +163,11 @@ def sstate_installpkg(ss, d):
>          oe.path.remove(dir)
>  
>      sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['name'])
> +    sstatefetch = d.getVar('SSTATE_PKGNAME', True) + '_' + ss['name'] + ".tgz"
>      sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['name'] + ".tgz"
>  
>      if not os.path.exists(sstatepkg):
> -       pstaging_fetch(sstatepkg, d)
> +       pstaging_fetch(sstatefetch, sstatepkg, d)
>  
>      if not os.path.isfile(sstatepkg):
>          bb.note("Staging package %s does not exist" % sstatepkg)
> @@ -223,8 +229,7 @@ def sstate_installpkg(ss, d):
>  def sstate_clean_cachefile(ss, d):
>      import oe.path
>  
> -    sstatepkgdir = d.getVar('SSTATE_DIR', True)
> -    sstatepkgfile = sstatepkgdir + '/' + d.getVar('SSTATE_PKGSPEC', True) + "*_" + ss['name'] + ".tgz*"
> +    sstatepkgfile = d.getVar('SSTATE_PATHSPEC', True) + "*_" + ss['name'] + ".tgz*"
>      bb.note("Removing %s" % sstatepkgfile)
>      oe.path.remove(sstatepkgfile)
>  
> @@ -417,7 +422,7 @@ def sstate_package(ss, d):
>  
>      return
>  
> -def pstaging_fetch(sstatepkg, d):
> +def pstaging_fetch(sstatefetch, sstatepkg, d):
>      import bb.fetch2
>  
>      # Only try and fetch if the user has configured a mirror
> @@ -430,7 +435,7 @@ def pstaging_fetch(sstatepkg, d):
>      bb.data.update_data(localdata)
>  
>      dldir = localdata.expand("${SSTATE_DIR}")
> -    srcuri = "file://" + os.path.basename(sstatepkg)
> +    srcuri = "file://" + sstatefetch
>  
>      bb.mkdirhier(dldir)
>  
> @@ -519,8 +524,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
>      }
>  
>      for task in range(len(sq_fn)):
> -        sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
> -        sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
> +        sstatefile = d.expand("${SSTATE_DIR}/" + generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
>          if os.path.exists(sstatefile):
>              bb.debug(2, "SState: Found valid sstate file %s" % sstatefile)
>              ret.append(task)
> @@ -544,10 +548,9 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
>              if task in ret:
>                  continue
>  
> -            sstatefile = d.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz")
> -            sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task])
> +            sstatefile = d.expand(generate_sstatefn(sq_hashfn[task], sq_hash[task], d) + "_" + mapping[sq_task[task]] + ".tgz")
>  
> -            srcuri = "file://" + os.path.basename(sstatefile)
> +            srcuri = "file://" + sstatefile
>              localdata.setVar('SRC_URI', srcuri)
>              bb.debug(2, "SState: Attempting to fetch %s" % srcuri)
>  
> 
> 
> 
> 
> _______________________________________________
> Openembedded-devel mailing list
> Openembedded-devel@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-08-02 13:53   ` Martin Jansa
@ 2012-08-02 14:14     ` Martin Jansa
  -1 siblings, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-02 14:14 UTC (permalink / raw)
  To: openembedded-devel; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 3483 bytes --]

On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > Currently all sstate files are placed into one directory. This does not scale and
> > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > to the layout (based on the first two characters of the hash) so that files
> > can be split into several directories.
> > 
> > This should help performance of sstate in most cases by avoding creating directories with 
> > huge numbers of files.
> > 
> > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > the addition of a PATH item, for example:
> > 
> > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > 
> > This change also sets the scene for using things like lsb-release in
> > the 
> 
> Is it possible to create 2nd level cache with this?
> 
> I have some server with slow upload but fully populated sstate-cache.
> 
> So on server with faster upload which could be used as offical
> SSTATE_MIRROR for SHR distro I would like to add
> 
> SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> 
> And then sync my sstate-cache directory to public accessible web root (with rsync).
> 
> Problem is that now sstate-cache has all files in slightly different 
> layout then original sstate-cache on slow server. From what I see I guess 
> it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> directly to sstate-cache dir (and adds .done)
> 
> OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> 
> And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> 
> But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> all those symlinks point nowhere and public sstate-cache is unusable.
> 
> Can we have relative paths used in symlinks or even instruct fetcher to download that 
> file directly to right prefix?

2 more ideas:

1) would be great to also download file.sigdata if it exists, to be able
   to compare them when they change even on machine which downloaded
   older sstate file from remote url
2) if the reason for this patch was number of files in shared
   sstate-cache directory, then fetcher creating .done files makes
   number double too (would be fine if fetcher stores all 3 files
   (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
   right prefix instead of symlinks.

Cheers,

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-02 14:14     ` Martin Jansa
  0 siblings, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-02 14:14 UTC (permalink / raw)
  To: openembedded-devel; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 3483 bytes --]

On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > Currently all sstate files are placed into one directory. This does not scale and
> > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > to the layout (based on the first two characters of the hash) so that files
> > can be split into several directories.
> > 
> > This should help performance of sstate in most cases by avoding creating directories with 
> > huge numbers of files.
> > 
> > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > the addition of a PATH item, for example:
> > 
> > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > 
> > This change also sets the scene for using things like lsb-release in
> > the 
> 
> Is it possible to create 2nd level cache with this?
> 
> I have some server with slow upload but fully populated sstate-cache.
> 
> So on server with faster upload which could be used as offical
> SSTATE_MIRROR for SHR distro I would like to add
> 
> SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> 
> And then sync my sstate-cache directory to public accessible web root (with rsync).
> 
> Problem is that now sstate-cache has all files in slightly different 
> layout then original sstate-cache on slow server. From what I see I guess 
> it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> directly to sstate-cache dir (and adds .done)
> 
> OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> 
> And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> 
> But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> all those symlinks point nowhere and public sstate-cache is unusable.
> 
> Can we have relative paths used in symlinks or even instruct fetcher to download that 
> file directly to right prefix?

2 more ideas:

1) would be great to also download file.sigdata if it exists, to be able
   to compare them when they change even on machine which downloaded
   older sstate file from remote url
2) if the reason for this patch was number of files in shared
   sstate-cache directory, then fetcher creating .done files makes
   number double too (would be fine if fetcher stores all 3 files
   (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
   right prefix instead of symlinks.

Cheers,

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-08-02 14:14     ` Martin Jansa
@ 2012-08-02 15:53       ` Richard Purdie
  -1 siblings, 0 replies; 18+ messages in thread
From: Richard Purdie @ 2012-08-02 15:53 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > Currently all sstate files are placed into one directory. This does not scale and
> > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > to the layout (based on the first two characters of the hash) so that files
> > > can be split into several directories.
> > > 
> > > This should help performance of sstate in most cases by avoding creating directories with 
> > > huge numbers of files.
> > > 
> > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > the addition of a PATH item, for example:
> > > 
> > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > 
> > > This change also sets the scene for using things like lsb-release in
> > > the 
> > 
> > Is it possible to create 2nd level cache with this?
> > 
> > I have some server with slow upload but fully populated sstate-cache.
> > 
> > So on server with faster upload which could be used as offical
> > SSTATE_MIRROR for SHR distro I would like to add
> > 
> > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > 
> > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > 
> > Problem is that now sstate-cache has all files in slightly different 
> > layout then original sstate-cache on slow server. From what I see I guess 
> > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > directly to sstate-cache dir (and adds .done)
> > 
> > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > 
> > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > 
> > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > all those symlinks point nowhere and public sstate-cache is unusable.
> > 
> > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > file directly to right prefix?
> 
> 2 more ideas:
> 
> 1) would be great to also download file.sigdata if it exists, to be able
>    to compare them when they change even on machine which downloaded
>    older sstate file from remote url
> 2) if the reason for this patch was number of files in shared
>    sstate-cache directory, then fetcher creating .done files makes
>    number double too (would be fine if fetcher stores all 3 files
>    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
>    right prefix instead of symlinks.

I'm aware of the problem. The main issue is that we probably need to
start enforcing complete paths for all downloads in DL_DIR, including
http:// urls. This would resolve conflicts like:

SRC_URI = "http://server1.org/somefile.patch \
           http://server2.org/somefile.patch"

where the two files are different. The trouble is it will pretty much
break all the source mirrors :(.

Cheers,

Richard








^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [OE-core] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-02 15:53       ` Richard Purdie
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Purdie @ 2012-08-02 15:53 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > Currently all sstate files are placed into one directory. This does not scale and
> > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > to the layout (based on the first two characters of the hash) so that files
> > > can be split into several directories.
> > > 
> > > This should help performance of sstate in most cases by avoding creating directories with 
> > > huge numbers of files.
> > > 
> > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > the addition of a PATH item, for example:
> > > 
> > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > 
> > > This change also sets the scene for using things like lsb-release in
> > > the 
> > 
> > Is it possible to create 2nd level cache with this?
> > 
> > I have some server with slow upload but fully populated sstate-cache.
> > 
> > So on server with faster upload which could be used as offical
> > SSTATE_MIRROR for SHR distro I would like to add
> > 
> > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > 
> > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > 
> > Problem is that now sstate-cache has all files in slightly different 
> > layout then original sstate-cache on slow server. From what I see I guess 
> > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > directly to sstate-cache dir (and adds .done)
> > 
> > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > 
> > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > 
> > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > all those symlinks point nowhere and public sstate-cache is unusable.
> > 
> > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > file directly to right prefix?
> 
> 2 more ideas:
> 
> 1) would be great to also download file.sigdata if it exists, to be able
>    to compare them when they change even on machine which downloaded
>    older sstate file from remote url
> 2) if the reason for this patch was number of files in shared
>    sstate-cache directory, then fetcher creating .done files makes
>    number double too (would be fine if fetcher stores all 3 files
>    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
>    right prefix instead of symlinks.

I'm aware of the problem. The main issue is that we probably need to
start enforcing complete paths for all downloads in DL_DIR, including
http:// urls. This would resolve conflicts like:

SRC_URI = "http://server1.org/somefile.patch \
           http://server2.org/somefile.patch"

where the two files are different. The trouble is it will pretty much
break all the source mirrors :(.

Cheers,

Richard








^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-08-02 15:53       ` [OE-core] " Richard Purdie
@ 2012-08-02 15:59         ` Chris Larson
  -1 siblings, 0 replies; 18+ messages in thread
From: Chris Larson @ 2012-08-02 15:59 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, Aug 2, 2012 at 8:53 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
>> On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
>> > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
>> > > Currently all sstate files are placed into one directory. This does not scale and
>> > > causes a variety of filesystem issues. This patch adds a two character subdirectory
>> > > to the layout (based on the first two characters of the hash) so that files
>> > > can be split into several directories.
>> > >
>> > > This should help performance of sstate in most cases by avoding creating directories with
>> > > huge numbers of files.
>> > >
>> > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
>> > > the addition of a PATH item, for example:
>> > >
>> > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
>> > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
>> > >
>> > > This change also sets the scene for using things like lsb-release in
>> > > the
>> >
>> > Is it possible to create 2nd level cache with this?
>> >
>> > I have some server with slow upload but fully populated sstate-cache.
>> >
>> > So on server with faster upload which could be used as offical
>> > SSTATE_MIRROR for SHR distro I would like to add
>> >
>> > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
>> >
>> > And then sync my sstate-cache directory to public accessible web root (with rsync).
>> >
>> > Problem is that now sstate-cache has all files in slightly different
>> > layout then original sstate-cache on slow server. From what I see I guess
>> > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it
>> > directly to sstate-cache dir (and adds .done)
>> >
>> > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
>> > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
>> > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
>> >
>> > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
>> > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
>> > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz ->
>> > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
>> >
>> > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed,
>> > all those symlinks point nowhere and public sstate-cache is unusable.
>> >
>> > Can we have relative paths used in symlinks or even instruct fetcher to download that
>> > file directly to right prefix?
>>
>> 2 more ideas:
>>
>> 1) would be great to also download file.sigdata if it exists, to be able
>>    to compare them when they change even on machine which downloaded
>>    older sstate file from remote url
>> 2) if the reason for this patch was number of files in shared
>>    sstate-cache directory, then fetcher creating .done files makes
>>    number double too (would be fine if fetcher stores all 3 files
>>    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
>>    right prefix instead of symlinks.
>
> I'm aware of the problem. The main issue is that we probably need to
> start enforcing complete paths for all downloads in DL_DIR, including
> http:// urls. This would resolve conflicts like:
>
> SRC_URI = "http://server1.org/somefile.patch \
>            http://server2.org/somefile.patch"
>
> where the two files are different. The trouble is it will pretty much
> break all the source mirrors :(.

I think we need to stop the tendency to use DL_DIR as is as a mirror,
and instead create a task or something to populate a mirror directory
from the DL_DIR. This would avoid potential issues with licensing if
it uses license filtering to control what gets populated, as well.
-- 
Christopher Larson



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [OE-core] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-02 15:59         ` Chris Larson
  0 siblings, 0 replies; 18+ messages in thread
From: Chris Larson @ 2012-08-02 15:59 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, Aug 2, 2012 at 8:53 AM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
>> On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
>> > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
>> > > Currently all sstate files are placed into one directory. This does not scale and
>> > > causes a variety of filesystem issues. This patch adds a two character subdirectory
>> > > to the layout (based on the first two characters of the hash) so that files
>> > > can be split into several directories.
>> > >
>> > > This should help performance of sstate in most cases by avoding creating directories with
>> > > huge numbers of files.
>> > >
>> > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
>> > > the addition of a PATH item, for example:
>> > >
>> > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
>> > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
>> > >
>> > > This change also sets the scene for using things like lsb-release in
>> > > the
>> >
>> > Is it possible to create 2nd level cache with this?
>> >
>> > I have some server with slow upload but fully populated sstate-cache.
>> >
>> > So on server with faster upload which could be used as offical
>> > SSTATE_MIRROR for SHR distro I would like to add
>> >
>> > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
>> >
>> > And then sync my sstate-cache directory to public accessible web root (with rsync).
>> >
>> > Problem is that now sstate-cache has all files in slightly different
>> > layout then original sstate-cache on slow server. From what I see I guess
>> > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it
>> > directly to sstate-cache dir (and adds .done)
>> >
>> > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
>> > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
>> > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
>> >
>> > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
>> > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
>> > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz ->
>> > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
>> >
>> > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed,
>> > all those symlinks point nowhere and public sstate-cache is unusable.
>> >
>> > Can we have relative paths used in symlinks or even instruct fetcher to download that
>> > file directly to right prefix?
>>
>> 2 more ideas:
>>
>> 1) would be great to also download file.sigdata if it exists, to be able
>>    to compare them when they change even on machine which downloaded
>>    older sstate file from remote url
>> 2) if the reason for this patch was number of files in shared
>>    sstate-cache directory, then fetcher creating .done files makes
>>    number double too (would be fine if fetcher stores all 3 files
>>    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
>>    right prefix instead of symlinks.
>
> I'm aware of the problem. The main issue is that we probably need to
> start enforcing complete paths for all downloads in DL_DIR, including
> http:// urls. This would resolve conflicts like:
>
> SRC_URI = "http://server1.org/somefile.patch \
>            http://server2.org/somefile.patch"
>
> where the two files are different. The trouble is it will pretty much
> break all the source mirrors :(.

I think we need to stop the tendency to use DL_DIR as is as a mirror,
and instead create a task or something to populate a mirror directory
from the DL_DIR. This would avoid potential issues with licensing if
it uses license filtering to control what gets populated, as well.
-- 
Christopher Larson



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-08-02 15:59         ` [OE-core] " Chris Larson
@ 2012-08-02 16:15           ` Richard Purdie
  -1 siblings, 0 replies; 18+ messages in thread
From: Richard Purdie @ 2012-08-02 16:15 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, 2012-08-02 at 08:59 -0700, Chris Larson wrote:
> On Thu, Aug 2, 2012 at 8:53 AM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> >> 2 more ideas:
> >>
> >> 1) would be great to also download file.sigdata if it exists, to be able
> >>    to compare them when they change even on machine which downloaded
> >>    older sstate file from remote url
> >> 2) if the reason for this patch was number of files in shared
> >>    sstate-cache directory, then fetcher creating .done files makes
> >>    number double too (would be fine if fetcher stores all 3 files
> >>    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> >>    right prefix instead of symlinks.
> >
> > I'm aware of the problem. The main issue is that we probably need to
> > start enforcing complete paths for all downloads in DL_DIR, including
> > http:// urls. This would resolve conflicts like:
> >
> > SRC_URI = "http://server1.org/somefile.patch \
> >            http://server2.org/somefile.patch"
> >
> > where the two files are different. The trouble is it will pretty much
> > break all the source mirrors :(.
> 
> I think we need to stop the tendency to use DL_DIR as is as a mirror,
> and instead create a task or something to populate a mirror directory
> from the DL_DIR. This would avoid potential issues with licensing if
> it uses license filtering to control what gets populated, as well.

I agree, there are some issues in that area and we shoudl encourage
people to think about this.

Having said that, I'm worried we are going to hit conflicts over DL_DIR
regardless of that.

Perhaps making this change might be a way to remind people of that....

Cheers,

Richard




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [OE-core] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-02 16:15           ` Richard Purdie
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Purdie @ 2012-08-02 16:15 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, 2012-08-02 at 08:59 -0700, Chris Larson wrote:
> On Thu, Aug 2, 2012 at 8:53 AM, Richard Purdie
> <richard.purdie@linuxfoundation.org> wrote:
> > On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> >> 2 more ideas:
> >>
> >> 1) would be great to also download file.sigdata if it exists, to be able
> >>    to compare them when they change even on machine which downloaded
> >>    older sstate file from remote url
> >> 2) if the reason for this patch was number of files in shared
> >>    sstate-cache directory, then fetcher creating .done files makes
> >>    number double too (would be fine if fetcher stores all 3 files
> >>    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> >>    right prefix instead of symlinks.
> >
> > I'm aware of the problem. The main issue is that we probably need to
> > start enforcing complete paths for all downloads in DL_DIR, including
> > http:// urls. This would resolve conflicts like:
> >
> > SRC_URI = "http://server1.org/somefile.patch \
> >            http://server2.org/somefile.patch"
> >
> > where the two files are different. The trouble is it will pretty much
> > break all the source mirrors :(.
> 
> I think we need to stop the tendency to use DL_DIR as is as a mirror,
> and instead create a task or something to populate a mirror directory
> from the DL_DIR. This would avoid potential issues with licensing if
> it uses license filtering to control what gets populated, as well.

I agree, there are some issues in that area and we shoudl encourage
people to think about this.

Having said that, I'm worried we are going to hit conflicts over DL_DIR
regardless of that.

Perhaps making this change might be a way to remind people of that....

Cheers,

Richard




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-08-02 15:53       ` [OE-core] " Richard Purdie
@ 2012-08-02 19:40         ` Martin Jansa
  -1 siblings, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-02 19:40 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 5067 bytes --]

On Thu, Aug 02, 2012 at 04:53:12PM +0100, Richard Purdie wrote:
> On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> > On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > > Currently all sstate files are placed into one directory. This does not scale and
> > > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > > to the layout (based on the first two characters of the hash) so that files
> > > > can be split into several directories.
> > > > 
> > > > This should help performance of sstate in most cases by avoding creating directories with 
> > > > huge numbers of files.
> > > > 
> > > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > > the addition of a PATH item, for example:
> > > > 
> > > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > > 
> > > > This change also sets the scene for using things like lsb-release in
> > > > the 
> > > 
> > > Is it possible to create 2nd level cache with this?
> > > 
> > > I have some server with slow upload but fully populated sstate-cache.
> > > 
> > > So on server with faster upload which could be used as offical
> > > SSTATE_MIRROR for SHR distro I would like to add
> > > 
> > > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > > 
> > > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > > 
> > > Problem is that now sstate-cache has all files in slightly different 
> > > layout then original sstate-cache on slow server. From what I see I guess 
> > > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > > directly to sstate-cache dir (and adds .done)
> > > 
> > > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > > 
> > > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > 
> > > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > > all those symlinks point nowhere and public sstate-cache is unusable.
> > > 
> > > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > > file directly to right prefix?
> > 
> > 2 more ideas:
> > 
> > 1) would be great to also download file.sigdata if it exists, to be able
> >    to compare them when they change even on machine which downloaded
> >    older sstate file from remote url
> > 2) if the reason for this patch was number of files in shared
> >    sstate-cache directory, then fetcher creating .done files makes
> >    number double too (would be fine if fetcher stores all 3 files
> >    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> >    right prefix instead of symlinks.
> 
> I'm aware of the problem. The main issue is that we probably need to

And what about .sigdata files?

I have sort shell script to replace symlinks with real files in prefixed
dirs, would it be worth it integrating to 
openembedded-core/scripts/sstate-cache-management.sh
which doesn't work with new layout anyway?


> start enforcing complete paths for all downloads in DL_DIR, including
> http:// urls. This would resolve conflicts like:
> 
> SRC_URI = "http://server1.org/somefile.patch \
>            http://server2.org/somefile.patch"

In two separate recipes right?

> where the two files are different. The trouble is it will pretty much
> break all the source mirrors :(.

So you would store them in DL_DIR/server1.org/somefile.patch path? 

That would make oposite scenario where the BIG.tgz is available 
(or even requested by different recipes) from different location less
efficient.

And not creating .done files for local files fetched from file:// whould
also help for:

foo.bb: SRC_URI = "file://somefile.patch"
bar.bb: SRC_URI = "http://server2.org/somefile.patch" 

Which now ignores checksums for samefile.patch downloaded for bar.bb if
foo.bb was built before.

Cheers,

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [OE-core] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-02 19:40         ` Martin Jansa
  0 siblings, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-02 19:40 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 5067 bytes --]

On Thu, Aug 02, 2012 at 04:53:12PM +0100, Richard Purdie wrote:
> On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> > On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > > Currently all sstate files are placed into one directory. This does not scale and
> > > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > > to the layout (based on the first two characters of the hash) so that files
> > > > can be split into several directories.
> > > > 
> > > > This should help performance of sstate in most cases by avoding creating directories with 
> > > > huge numbers of files.
> > > > 
> > > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > > the addition of a PATH item, for example:
> > > > 
> > > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > > 
> > > > This change also sets the scene for using things like lsb-release in
> > > > the 
> > > 
> > > Is it possible to create 2nd level cache with this?
> > > 
> > > I have some server with slow upload but fully populated sstate-cache.
> > > 
> > > So on server with faster upload which could be used as offical
> > > SSTATE_MIRROR for SHR distro I would like to add
> > > 
> > > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > > 
> > > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > > 
> > > Problem is that now sstate-cache has all files in slightly different 
> > > layout then original sstate-cache on slow server. From what I see I guess 
> > > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > > directly to sstate-cache dir (and adds .done)
> > > 
> > > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > > 
> > > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > 
> > > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > > all those symlinks point nowhere and public sstate-cache is unusable.
> > > 
> > > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > > file directly to right prefix?
> > 
> > 2 more ideas:
> > 
> > 1) would be great to also download file.sigdata if it exists, to be able
> >    to compare them when they change even on machine which downloaded
> >    older sstate file from remote url
> > 2) if the reason for this patch was number of files in shared
> >    sstate-cache directory, then fetcher creating .done files makes
> >    number double too (would be fine if fetcher stores all 3 files
> >    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> >    right prefix instead of symlinks.
> 
> I'm aware of the problem. The main issue is that we probably need to

And what about .sigdata files?

I have sort shell script to replace symlinks with real files in prefixed
dirs, would it be worth it integrating to 
openembedded-core/scripts/sstate-cache-management.sh
which doesn't work with new layout anyway?


> start enforcing complete paths for all downloads in DL_DIR, including
> http:// urls. This would resolve conflicts like:
> 
> SRC_URI = "http://server1.org/somefile.patch \
>            http://server2.org/somefile.patch"

In two separate recipes right?

> where the two files are different. The trouble is it will pretty much
> break all the source mirrors :(.

So you would store them in DL_DIR/server1.org/somefile.patch path? 

That would make oposite scenario where the BIG.tgz is available 
(or even requested by different recipes) from different location less
efficient.

And not creating .done files for local files fetched from file:// whould
also help for:

foo.bb: SRC_URI = "file://somefile.patch"
bar.bb: SRC_URI = "http://server2.org/somefile.patch" 

Which now ignores checksums for samefile.patch downloaded for bar.bb if
foo.bb was built before.

Cheers,

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-08-02 19:40         ` [OE-core] " Martin Jansa
@ 2012-08-02 19:57           ` Richard Purdie
  -1 siblings, 0 replies; 18+ messages in thread
From: Richard Purdie @ 2012-08-02 19:57 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, 2012-08-02 at 21:40 +0200, Martin Jansa wrote:
> On Thu, Aug 02, 2012 at 04:53:12PM +0100, Richard Purdie wrote:
> > On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> > > On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > > > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > > > Currently all sstate files are placed into one directory. This does not scale and
> > > > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > > > to the layout (based on the first two characters of the hash) so that files
> > > > > can be split into several directories.
> > > > > 
> > > > > This should help performance of sstate in most cases by avoding creating directories with 
> > > > > huge numbers of files.
> > > > > 
> > > > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > > > the addition of a PATH item, for example:
> > > > > 
> > > > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > > > 
> > > > > This change also sets the scene for using things like lsb-release in
> > > > > the 
> > > > 
> > > > Is it possible to create 2nd level cache with this?
> > > > 
> > > > I have some server with slow upload but fully populated sstate-cache.
> > > > 
> > > > So on server with faster upload which could be used as offical
> > > > SSTATE_MIRROR for SHR distro I would like to add
> > > > 
> > > > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > > > 
> > > > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > > > 
> > > > Problem is that now sstate-cache has all files in slightly different 
> > > > layout then original sstate-cache on slow server. From what I see I guess 
> > > > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > > > directly to sstate-cache dir (and adds .done)
> > > > 
> > > > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > > > 
> > > > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > > > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > > > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > 
> > > > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > > > all those symlinks point nowhere and public sstate-cache is unusable.
> > > > 
> > > > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > > > file directly to right prefix?
> > > 
> > > 2 more ideas:
> > > 
> > > 1) would be great to also download file.sigdata if it exists, to be able
> > >    to compare them when they change even on machine which downloaded
> > >    older sstate file from remote url
> > > 2) if the reason for this patch was number of files in shared
> > >    sstate-cache directory, then fetcher creating .done files makes
> > >    number double too (would be fine if fetcher stores all 3 files
> > >    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> > >    right prefix instead of symlinks.
> > 
> > I'm aware of the problem. The main issue is that we probably need to
> 
> And what about .sigdata files?
> 
> I have sort shell script to replace symlinks with real files in prefixed
> dirs, would it be worth it integrating to 
> openembedded-core/scripts/sstate-cache-management.sh
> which doesn't work with new layout anyway?
> 
> 
> > start enforcing complete paths for all downloads in DL_DIR, including
> > http:// urls. This would resolve conflicts like:
> > 
> > SRC_URI = "http://server1.org/somefile.patch \
> >            http://server2.org/somefile.patch"
> 
> In two separate recipes right?
> 
> > where the two files are different. The trouble is it will pretty much
> > break all the source mirrors :(.
> 
> So you would store them in DL_DIR/server1.org/somefile.patch path?

I've wondered about:

DL_DIR/server1.org/somepath/somefile.patch

> That would make oposite scenario where the BIG.tgz is available 
> (or even requested by different recipes) from different location less
> efficient.

Not necessarily with the right mirror/premirror configuration.

> And not creating .done files for local files fetched from file:// whould
> also help for:
> 
> foo.bb: SRC_URI = "file://somefile.patch"
> bar.bb: SRC_URI = "http://server2.org/somefile.patch" 
> 
> Which now ignores checksums for samefile.patch downloaded for bar.bb if
> foo.bb was built before.

That is a pain but we've basically always assumed no namespace
collision. I'm not saying that is a good thing, just the way it is.

Not creating done files for local urls causes a variety of problems, not
least that you then have to special case local urls in the generic
fetcher code, it also hits performance. I've been trying to get the
fetcher away from a set of special cases...

Cheers,

Richard




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [OE-core] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-02 19:57           ` Richard Purdie
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Purdie @ 2012-08-02 19:57 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

On Thu, 2012-08-02 at 21:40 +0200, Martin Jansa wrote:
> On Thu, Aug 02, 2012 at 04:53:12PM +0100, Richard Purdie wrote:
> > On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> > > On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > > > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > > > Currently all sstate files are placed into one directory. This does not scale and
> > > > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > > > to the layout (based on the first two characters of the hash) so that files
> > > > > can be split into several directories.
> > > > > 
> > > > > This should help performance of sstate in most cases by avoding creating directories with 
> > > > > huge numbers of files.
> > > > > 
> > > > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > > > the addition of a PATH item, for example:
> > > > > 
> > > > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > > > 
> > > > > This change also sets the scene for using things like lsb-release in
> > > > > the 
> > > > 
> > > > Is it possible to create 2nd level cache with this?
> > > > 
> > > > I have some server with slow upload but fully populated sstate-cache.
> > > > 
> > > > So on server with faster upload which could be used as offical
> > > > SSTATE_MIRROR for SHR distro I would like to add
> > > > 
> > > > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > > > 
> > > > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > > > 
> > > > Problem is that now sstate-cache has all files in slightly different 
> > > > layout then original sstate-cache on slow server. From what I see I guess 
> > > > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > > > directly to sstate-cache dir (and adds .done)
> > > > 
> > > > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > > > 
> > > > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > > > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > > > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > 
> > > > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > > > all those symlinks point nowhere and public sstate-cache is unusable.
> > > > 
> > > > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > > > file directly to right prefix?
> > > 
> > > 2 more ideas:
> > > 
> > > 1) would be great to also download file.sigdata if it exists, to be able
> > >    to compare them when they change even on machine which downloaded
> > >    older sstate file from remote url
> > > 2) if the reason for this patch was number of files in shared
> > >    sstate-cache directory, then fetcher creating .done files makes
> > >    number double too (would be fine if fetcher stores all 3 files
> > >    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> > >    right prefix instead of symlinks.
> > 
> > I'm aware of the problem. The main issue is that we probably need to
> 
> And what about .sigdata files?
> 
> I have sort shell script to replace symlinks with real files in prefixed
> dirs, would it be worth it integrating to 
> openembedded-core/scripts/sstate-cache-management.sh
> which doesn't work with new layout anyway?
> 
> 
> > start enforcing complete paths for all downloads in DL_DIR, including
> > http:// urls. This would resolve conflicts like:
> > 
> > SRC_URI = "http://server1.org/somefile.patch \
> >            http://server2.org/somefile.patch"
> 
> In two separate recipes right?
> 
> > where the two files are different. The trouble is it will pretty much
> > break all the source mirrors :(.
> 
> So you would store them in DL_DIR/server1.org/somefile.patch path?

I've wondered about:

DL_DIR/server1.org/somepath/somefile.patch

> That would make oposite scenario where the BIG.tgz is available 
> (or even requested by different recipes) from different location less
> efficient.

Not necessarily with the right mirror/premirror configuration.

> And not creating .done files for local files fetched from file:// whould
> also help for:
> 
> foo.bb: SRC_URI = "file://somefile.patch"
> bar.bb: SRC_URI = "http://server2.org/somefile.patch" 
> 
> Which now ignores checksums for samefile.patch downloaded for bar.bb if
> foo.bb was built before.

That is a pain but we've basically always assumed no namespace
collision. I'm not saying that is a good thing, just the way it is.

Not creating done files for local urls causes a variety of problems, not
least that you then have to special case local urls in the generic
fetcher code, it also hits performance. I've been trying to get the
fetcher away from a set of special cases...

Cheers,

Richard




^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [oe] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
  2012-08-02 19:57           ` [OE-core] " Richard Purdie
@ 2012-08-06  7:09             ` Martin Jansa
  -1 siblings, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-06  7:09 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 6479 bytes --]

On Thu, Aug 02, 2012 at 08:57:50PM +0100, Richard Purdie wrote:
> On Thu, 2012-08-02 at 21:40 +0200, Martin Jansa wrote:
> > On Thu, Aug 02, 2012 at 04:53:12PM +0100, Richard Purdie wrote:
> > > On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> > > > On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > > > > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > > > > Currently all sstate files are placed into one directory. This does not scale and
> > > > > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > > > > to the layout (based on the first two characters of the hash) so that files
> > > > > > can be split into several directories.
> > > > > > 
> > > > > > This should help performance of sstate in most cases by avoding creating directories with 
> > > > > > huge numbers of files.
> > > > > > 
> > > > > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > > > > the addition of a PATH item, for example:
> > > > > > 
> > > > > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > > > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > > > > 
> > > > > > This change also sets the scene for using things like lsb-release in
> > > > > > the 
> > > > > 
> > > > > Is it possible to create 2nd level cache with this?
> > > > > 
> > > > > I have some server with slow upload but fully populated sstate-cache.
> > > > > 
> > > > > So on server with faster upload which could be used as offical
> > > > > SSTATE_MIRROR for SHR distro I would like to add
> > > > > 
> > > > > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > > > > 
> > > > > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > > > > 
> > > > > Problem is that now sstate-cache has all files in slightly different 
> > > > > layout then original sstate-cache on slow server. From what I see I guess 
> > > > > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > > > > directly to sstate-cache dir (and adds .done)
> > > > > 
> > > > > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > > > > 
> > > > > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > > > > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > > > > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > > 
> > > > > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > > > > all those symlinks point nowhere and public sstate-cache is unusable.
> > > > > 
> > > > > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > > > > file directly to right prefix?
> > > > 
> > > > 2 more ideas:
> > > > 
> > > > 1) would be great to also download file.sigdata if it exists, to be able
> > > >    to compare them when they change even on machine which downloaded
> > > >    older sstate file from remote url
> > > > 2) if the reason for this patch was number of files in shared
> > > >    sstate-cache directory, then fetcher creating .done files makes
> > > >    number double too (would be fine if fetcher stores all 3 files
> > > >    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> > > >    right prefix instead of symlinks.
> > > 
> > > I'm aware of the problem. The main issue is that we probably need to
> > 
> > And what about .sigdata files?

Added
https://bugzilla.yoctoproject.org/show_bug.cgi?id=2898

> > I have sort shell script to replace symlinks with real files in prefixed
> > dirs, would it be worth it integrating to 
> > openembedded-core/scripts/sstate-cache-management.sh
> > which doesn't work with new layout anyway?

Added
https://bugzilla.yoctoproject.org/show_bug.cgi?id=2897

> > > start enforcing complete paths for all downloads in DL_DIR, including
> > > http:// urls. This would resolve conflicts like:
> > > 
> > > SRC_URI = "http://server1.org/somefile.patch \
> > >            http://server2.org/somefile.patch"
> > 
> > In two separate recipes right?
> > 
> > > where the two files are different. The trouble is it will pretty much
> > > break all the source mirrors :(.
> > 
> > So you would store them in DL_DIR/server1.org/somefile.patch path?
> 
> I've wondered about:
> 
> DL_DIR/server1.org/somepath/somefile.patch
> 
> > That would make oposite scenario where the BIG.tgz is available 
> > (or even requested by different recipes) from different location less
> > efficient.
> 
> Not necessarily with the right mirror/premirror configuration.
> 
> > And not creating .done files for local files fetched from file:// whould
> > also help for:
> > 
> > foo.bb: SRC_URI = "file://somefile.patch"
> > bar.bb: SRC_URI = "http://server2.org/somefile.patch" 
> > 
> > Which now ignores checksums for samefile.patch downloaded for bar.bb if
> > foo.bb was built before.
> 
> That is a pain but we've basically always assumed no namespace
> collision. I'm not saying that is a good thing, just the way it is.
> 
> Not creating done files for local urls causes a variety of problems, not
> least that you then have to special case local urls in the generic
> fetcher code, it also hits performance. I've been trying to get the
> fetcher away from a set of special cases...
> 
> Cheers,
> 
> Richard
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [OE-core] [PATCH] sstate: Add a two character subdirectory to the sstate directory layout
@ 2012-08-06  7:09             ` Martin Jansa
  0 siblings, 0 replies; 18+ messages in thread
From: Martin Jansa @ 2012-08-06  7:09 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: openembedded-core, openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 6479 bytes --]

On Thu, Aug 02, 2012 at 08:57:50PM +0100, Richard Purdie wrote:
> On Thu, 2012-08-02 at 21:40 +0200, Martin Jansa wrote:
> > On Thu, Aug 02, 2012 at 04:53:12PM +0100, Richard Purdie wrote:
> > > On Thu, 2012-08-02 at 16:14 +0200, Martin Jansa wrote:
> > > > On Thu, Aug 02, 2012 at 03:53:35PM +0200, Martin Jansa wrote:
> > > > > On Wed, Jul 25, 2012 at 10:09:22PM +0100, Richard Purdie wrote:
> > > > > > Currently all sstate files are placed into one directory. This does not scale and
> > > > > > causes a variety of filesystem issues. This patch adds a two character subdirectory
> > > > > > to the layout (based on the first two characters of the hash) so that files
> > > > > > can be split into several directories.
> > > > > > 
> > > > > > This should help performance of sstate in most cases by avoding creating directories with 
> > > > > > huge numbers of files.
> > > > > > 
> > > > > > The SSTATE_MIRRORS syntax needs updating to account for the extra path element by
> > > > > > the addition of a PATH item, for example:
> > > > > > 
> > > > > > SSTATE_MIRRORS = "file://.* file:///some/path/to/sstate-cache/PATH"
> > > > > > SSTATE_MIRRORS = "file://.* http://192.168.1.23/sstate-cache/PATH"
> > > > > > 
> > > > > > This change also sets the scene for using things like lsb-release in
> > > > > > the 
> > > > > 
> > > > > Is it possible to create 2nd level cache with this?
> > > > > 
> > > > > I have some server with slow upload but fully populated sstate-cache.
> > > > > 
> > > > > So on server with faster upload which could be used as offical
> > > > > SSTATE_MIRROR for SHR distro I would like to add
> > > > > 
> > > > > SSTATE_MIRRORS ?= "file://.* http://slow-server/sstate-cache/PATH"
> > > > > 
> > > > > And then sync my sstate-cache directory to public accessible web root (with rsync).
> > > > > 
> > > > > Problem is that now sstate-cache has all files in slightly different 
> > > > > layout then original sstate-cache on slow server. From what I see I guess 
> > > > > it finds URL with correct prefix "sstate-cache/Gentoo-2.1/0d" and downloads it 
> > > > > directly to sstate-cache dir (and adds .done)
> > > > > 
> > > > > OE @ ~/oe-core $ ll sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > > -rw-r--r-- 1 bitbake bitbake 9257 Jul 30 12:31 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > > -rw-r--r-- 1 bitbake bitbake    0 Aug  2 15:40 sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz.done
> > > > > 
> > > > > And then creates symlink in right prefix back to absolute path of sstate-cache/file:
> > > > > OE @ ~/oe-core $ ll sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-*populate-lic*
> > > > > lrwxrwxrwx 1 bitbake bitbake 123 Aug  2 15:40 sstate-cache/Gentoo-2.1/0d/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz -> 
> > > > > /OE/oe-core/sstate-cache/sstate-apr-native-x86_64-linux-1.4.6-r1-x86_64-2-0d2ed24b90d50bf83e5fe94536596e50_populate-lic.tgz
> > > > > 
> > > > > But after sstate-cache directory is rsynced somewhere else and oe-core/sstate-cache is removed, 
> > > > > all those symlinks point nowhere and public sstate-cache is unusable.
> > > > > 
> > > > > Can we have relative paths used in symlinks or even instruct fetcher to download that 
> > > > > file directly to right prefix?
> > > > 
> > > > 2 more ideas:
> > > > 
> > > > 1) would be great to also download file.sigdata if it exists, to be able
> > > >    to compare them when they change even on machine which downloaded
> > > >    older sstate file from remote url
> > > > 2) if the reason for this patch was number of files in shared
> > > >    sstate-cache directory, then fetcher creating .done files makes
> > > >    number double too (would be fine if fetcher stores all 3 files
> > > >    (.tgz, .tgz.sigdata, .tgz.done) in right prefix, or moves them to
> > > >    right prefix instead of symlinks.
> > > 
> > > I'm aware of the problem. The main issue is that we probably need to
> > 
> > And what about .sigdata files?

Added
https://bugzilla.yoctoproject.org/show_bug.cgi?id=2898

> > I have sort shell script to replace symlinks with real files in prefixed
> > dirs, would it be worth it integrating to 
> > openembedded-core/scripts/sstate-cache-management.sh
> > which doesn't work with new layout anyway?

Added
https://bugzilla.yoctoproject.org/show_bug.cgi?id=2897

> > > start enforcing complete paths for all downloads in DL_DIR, including
> > > http:// urls. This would resolve conflicts like:
> > > 
> > > SRC_URI = "http://server1.org/somefile.patch \
> > >            http://server2.org/somefile.patch"
> > 
> > In two separate recipes right?
> > 
> > > where the two files are different. The trouble is it will pretty much
> > > break all the source mirrors :(.
> > 
> > So you would store them in DL_DIR/server1.org/somefile.patch path?
> 
> I've wondered about:
> 
> DL_DIR/server1.org/somepath/somefile.patch
> 
> > That would make oposite scenario where the BIG.tgz is available 
> > (or even requested by different recipes) from different location less
> > efficient.
> 
> Not necessarily with the right mirror/premirror configuration.
> 
> > And not creating .done files for local files fetched from file:// whould
> > also help for:
> > 
> > foo.bb: SRC_URI = "file://somefile.patch"
> > bar.bb: SRC_URI = "http://server2.org/somefile.patch" 
> > 
> > Which now ignores checksums for samefile.patch downloaded for bar.bb if
> > foo.bb was built before.
> 
> That is a pain but we've basically always assumed no namespace
> collision. I'm not saying that is a good thing, just the way it is.
> 
> Not creating done files for local urls causes a variety of problems, not
> least that you then have to special case local urls in the generic
> fetcher code, it also hits performance. I've been trying to get the
> fetcher away from a set of special cases...
> 
> Cheers,
> 
> Richard
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 205 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2012-08-06  7:21 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 21:09 [PATCH] sstate: Add a two character subdirectory to the sstate directory layout Richard Purdie
2012-07-25 22:12 ` McClintock Matthew-B29882
2012-08-02 13:53 ` [oe] " Martin Jansa
2012-08-02 13:53   ` Martin Jansa
2012-08-02 14:14   ` [oe] " Martin Jansa
2012-08-02 14:14     ` Martin Jansa
2012-08-02 15:53     ` [oe] " Richard Purdie
2012-08-02 15:53       ` [OE-core] " Richard Purdie
2012-08-02 15:59       ` [oe] " Chris Larson
2012-08-02 15:59         ` [OE-core] " Chris Larson
2012-08-02 16:15         ` [oe] " Richard Purdie
2012-08-02 16:15           ` [OE-core] " Richard Purdie
2012-08-02 19:40       ` [oe] " Martin Jansa
2012-08-02 19:40         ` [OE-core] " Martin Jansa
2012-08-02 19:57         ` [oe] " Richard Purdie
2012-08-02 19:57           ` [OE-core] " Richard Purdie
2012-08-06  7:09           ` [oe] " Martin Jansa
2012-08-06  7:09             ` [OE-core] " Martin Jansa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.