[yocto] setting SRC_URI runtime - possible options

Alexander Kanavin alex.kanavin at gmail.com
Tue May 21 03:33:21 PDT 2019


Don't use the config file at all. Just create as many recipes as you
need, put the common bits into the class, and the bits that differ
into the recipes directly.

Example:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/pypi.bbclass

Alex

On Tue, 21 May 2019 at 12:22, Belisko Marek <marek.belisko at gmail.com> wrote:
>
> On Tue, May 21, 2019 at 12:14 PM Alexander Kanavin <alex.kanavin at gmail.com> wrote:
>>
>> You can write a class which sets the template for SRC_URI and then a
>> series of recipes that inherit the class, and define the variable that
>> would turn the template into the actual URI.
>
> OK I think it make sense. So parsing of config file will be done in class and then class will be used in recipes to set correct SRU_URI.
> Do you have any idea what is wrong with actual code I posted? Why it is doing some strange things? Thanks.
>>
>>
>> Alex
>>
>> On Tue, 21 May 2019 at 12:10, Belisko Marek <marek.belisko at gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > On Tue, May 21, 2019 at 12:00 PM Alexander Kanavin <alex.kanavin at gmail.com> wrote:
>> >>
>> >> If you provide some context for why you want this, we might be able to
>> >> suggest a different way.
>> >
>> > Customer wants to have kind of base-os (build in yocto) and then on top of that different flavor python application which should be fetch and added during build based on configuration file. This is only need. Thanks.
>> >>
>> >>
>> >> Alex
>> >>
>> >> On Tue, 21 May 2019 at 08:11, Belisko Marek <marek.belisko at gmail.com> wrote:
>> >> >
>> >> > Hi,
>> >> >
>> >> > I have special need to fetch repo which is defined in config file in form (repo and branch):
>> >> > git at testrepo.com/myrepo mysuperbranch
>> >> >
>> >> > Config file is placed in recipe directory. I've tried to add some bits and pieces but it seems it's not doing right. Snippet from recipe:
>> >> >
>> >> > LICENSE = "CLOSED"
>> >> >
>> >> > SRCREV = "${AUTOREV}"
>> >> > PV = "${SRCPV}"
>> >> >
>> >> > do_fetch_prepend () {
>> >> >
>> >> >     src_uri = d.getVar('SRC_URI')
>> >> >
>> >> >     p = d.getVar("FILE")
>> >> >     idx = p.rfind("/")
>> >> >     p = p[:idx]
>> >> >     p += "/config.txt"
>> >> >
>> >> >     with open(p) as f:
>> >> >         read_data = f.readline().strip().split(" ")
>> >> >         d.setVar('SRC_URI', read_data[0])
>> >> > }
>> >> >
>> >> > SRC_URI = ""
>> >> >
>> >> > S = "${WORKDIR}/git"
>> >> >
>> >> > It looks like that repo is fetched but unpack doesn't put git directory in $WORKDIR and in build directory I get strange directories like:
>> >> >
>> >> > !=
>> >> > bitbake-cookerdaemon.log
>> >> > cache
>> >> > conf
>> >> > ${@d.getVar('S')
>> >> > else
>> >> > if
>> >> > os.path.join('
>> >> > os.path.normpath(d.getVar('S'))
>> >> > os.path.normpath(d.getVar('WORKDIR'))
>> >> > 'patches')}
>> >> > tmp
>> >> >
>> >> > so there is obviously I'm doing something wrong :). My question is if this is the way or should I stick to some variables set in local.conf and then use it in recipe? Thanks a lot for any pointers.
>> >> >
>> >> > BR,
>> >> >
>> >> > marek
>> >> > --
>> >> > as simple and primitive as possible
>> >> > -------------------------------------------------
>> >> > Marek Belisko - OPEN-NANDRA
>> >> > Freelance Developer
>> >> >
>> >> > Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
>> >> > Tel: +421 915 052 184
>> >> > skype: marekwhite
>> >> > twitter: #opennandra
>> >> > web: http://open-nandra.com
>> >> > --
>> >> > _______________________________________________
>> >> > yocto mailing list
>> >> > yocto at yoctoproject.org
>> >> > https://lists.yoctoproject.org/listinfo/yocto
>> >
>> >
>> >
>> > marek
>
>
>
> marek


More information about the yocto mailing list