[poky] PREMIRRORS in yocto, do they actually work?

Yu Ke ke.yu at intel.com
Thu Jan 6 03:07:02 PST 2011


On Jan 06, 08:39, Frans Meulenbroeks wrote:
> 2011/1/6 Yu Ke <ke.yu at intel.com>:
> > On Jan 02, 10:15, Gary Thomas wrote:
> >> On 01/02/2011 10:08 AM, Koen Kooi wrote:
> >> >Hi,
> >> >
> >> >I would like to have the fetchter try my PREMIRROS first before trying to fetch from git. In OE I have the following in a bbclass:
> >> >
> >> >PREMIRRORS_append () {
> >> >git://.*/.* http://www.angstrom-distribution.org/unstable/sources/
> >> >}
> >> >
> >> >When used in OE that works, but in yocto it doesn't. So I tried to do it poky style in a .inc:
> >> >
> >> >PREMIRRORS_append = "\
> >> >git://.*/.*   http:/www.angstrom-distribution.org/sources/ \n"
> >> >
> >> >Which also doesn't work since it doesn't try to fetch from there, but it does mention "http:/www.angstrom-distribution.org/sources/" in the fetch error message when git read-tree fails.
> >> >
> >> >So my question: how do I make it work in yocto like it works in OE?
> >>
> >> I too have been struggling with this as I'd like to have
> >> a local repository to hold the current source set.  Sadly,
> >> as you've observed, it doesn't work, at least not as expected.
> >
> > I've tried to use file:///some/dir as PREMIRROR, and found it does has issue. The main reason is that the local.py fetcher does not do real copy in go() method. Although it make sense in normal fetch case, it does cause trouble in try_mirror() case.
> >
> > I don't have simple idea to address this issue yet and I will take care of it in the coming fetcher change. As a quick workaround, could you try this approach: use http://local/some/dir as PREMIRROR? e.g. if you use /opt/source as mirror, you can add to meta/conf/distro/poky.conf:
> > PREMIRRORS_append = "\
> > git://.*/.*   http://local/opt/source/ \n \
> > svn://.*/.*   http://local/opt/source/ \n \
> > ...
> > "
> >
> > in this case, wget.py fetcher will be used, and it works fine in try_mirror() case. Also the /opt/source can be read-only.
> >
> > Regards
> > Ke
> 
> Thanks for the info Ke.
> One additional question on this topic.
> is it also possible to block fetching from the original source?
> I'm looking for an easy, automated way to verify that all sources for
> our products are indeed on our public server (to verify GPL
> compliance).

sorry taht I am not aware of such way, maybe other people has ideas.

If it is for one time verification, probably you can try the following patch. But I am not sure if it is desirable for upstream checked in.

Regards
Ke

diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index 67e5add..eb053e1 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -286,6 +286,8 @@ def go(d, urls = None):
         if m.forcefetch(u, ud, d) or not localpath:
             # Next try fetching from the original uri, u
             try:
+                if bb.data.getVar("BB_FETCH_MIRROR_ONLY", d, True) == "1":
+                    raise FetchError("Only allow to fetch from mirror")
                 m.go(u, ud, d)
                 localpath = ud.localpath
             except FetchError:

> 
> Frans
> _______________________________________________
> poky mailing list
> poky at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky



More information about the poky mailing list