[poky] [PATCH 10/11] bb.fetch2: add git unpack

Bruce Ashfield bruce.ashfield at gmail.com
Tue Jan 25 20:43:15 PST 2011


On Tue, Jan 25, 2011 at 11:41 PM, Yu Ke <ke.yu at intel.com> wrote:
> On Jan 25, 14:39, Bruce Ashfield wrote:
>> On Tue, Jan 25, 2011 at 1:07 PM, Richard Purdie
>> <richard.purdie at linuxfoundation.org> wrote:
>> > Hi Ke,
>> >
>> > On Wed, 2011-01-19 at 01:48 +0800, Yu Ke wrote:
>> >> git download will clone git repo to local, and git unpack just do a clone with referrence to the original repo
>> >>
>> >> Signed-off-by: Yu Ke <ke.yu at intel.com>
>> >> ---
>> >>  bitbake/lib/bb/fetch2/git.py |   16 ++++++++++++++++
>> >>  1 files changed, 16 insertions(+), 0 deletions(-)
>> >>
>> >> diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
>> >> index 438756a..bb62a87 100644
>> >> --- a/bitbake/lib/bb/fetch2/git.py
>> >> +++ b/bitbake/lib/bb/fetch2/git.py
>> >> @@ -193,6 +193,22 @@ class Git(Fetch):
>> >>          os.chdir(ud.clonedir)
>> >>          bb.utils.prunedir(codir)
>> >>
>> >> +    def unpack(self, ud, destdir, d):
>> >> +        """ unpack the downloaded src to destdir"""
>> >> +        subdir = ud.parm.get("subpath", "")
>> >> +        if subdir != "":
>> >> +            readpathspec = ":%s" % (subdir)
>> >> +        else:
>> >> +            readpathspec = ""
>> >> +
>> >> +        # extract to ${WORKDIR}/git
>> >> +        destdir = destdir + "/git/"
>> >> +
>> >> +        os.chdir(ud.clonedir)
>> >> +        runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.tag, readpathspec), d)
>> >> +        runfetchcmd("%s checkout-index -q -f --prefix=%s -a" % (ud.basecmd, destdir), d)
>> >> +        return 1
>> >> +
>> >>      def supports_srcrev(self):
>> >>          return True
>> >
>> > I know we talked about this via email and you revised the description
>> > to:
>> >
>> > http://git.pokylinux.org/cgit/cgit.cgi/poky-contrib/commit/?h=kyu3/fetcher-api-v3&id=6df3037ea3679b804c2679afba8377b7e3796aca
>> >
>> > I'm wondering if we could optimise this cp command to be a "git clone
>> > -l" or a "git clone -s" (see man git-clone). I'm cc'ing Bruce for his
>> > thoughts on this and whether the linux-yocto tools would have a problem
>> > with either of these.
>>
>> Neither will pose a problem, and for what it is worth, I think using git
>> for the copy from src/dest is a good idea. In other build systems, I'm
>> doing the same thing with --shared (so I know for sure that works), and
>> --local should also be fine.
>
> "git clone" is my first try when cooking the patch, unfortunately I meet one issue here. the git clone target dir is ${WORKDIR}, while git requires the target dir to be empty, which is not true for ${WORKDIR}, so git clone will fail. so I fall back to cp approach.
>
> But I agree that git clone is better. So I'd like use this apprach: git clone to {WORKDIR}/git/, and modify the kernel-yocto.bbclass:do_kernel_checkout() to use the new layout.
>                                                                                                                                                                                                                                                                                                        I will revise the patch accordingly for review.
>                                                                                                                                                                                                                                                                                                        Regards
> Ke

This may be problematic. The kernel checkout needs to be done in a very
specific way. After the clone, you must have all branches local (no origin/)
and in the 'linux' directory. There are other tools that depend on
this particular
layout.

The most efficient way to do this has proven to be to do a bare clone
and then forcibly convert it to a non-bare clone. That gets you the
instantiation
and local branches in a single clone + minor fix ups to the directory.

Just some things to consider, I'll wait to see the patches before commenting
further.

Bruce

>
>>
>> >
>> > The idea would be one central checkout with the references in and then
>> > the subcomponents would all just reference the one local clone saving
>> > diskspace and time.
>>
>> Absolutely. And if someone does something to the central checkout,
>> minor errors ensue, but that can be recovered as well.
>>
>> Cheers,
>>
>> Bruce
>>
>> >
>> > Cheers,
>> >
>> > Richard
>> >
>> >
>> >
>> > _______________________________________________
>> > poky mailing list
>> > poky at yoctoproject.org
>> > https://lists.yoctoproject.org/listinfo/poky
>> >
>>
>>
>>
>> --
>> "Thou shalt not follow the NULL pointer, for chaos and madness await
>> thee at its end"
>> _______________________________________________
>> poky mailing list
>> poky at yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/poky
>



-- 
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"



More information about the poky mailing list