Message ID | 20231230154843.8086-1-alex.kiernan@gmail.com |
---|---|
State | New |
Headers | show |
Series | [bitbake-devel] fetch2/crate: Unpack into CARGO_VENDORING_DIRECTORY | expand |
On Sat, 2023-12-30 at 15:48 +0000, Alex Kiernan wrote: > The vendor directory is set in cargo_common, to work with rust 1.75.0 we > need to change the location, so use CARGO_VENDORING_DIRECTORY here. > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> > --- > Is this change allowed, or am I coupling repos in a bad way and should > hardcode `registry/src` (which is what I need it to be) here instead? We really need to find a better way. Bitbake isn't supposed to have "knowledge" of OE-Core outside the key variables it expects from bitbake.conf. CARGO* from class files aren't included in that. What we probably should do is set this in bitbake in the fetcher and then read the value in OE-Core. Cheers, Richard
On Sat, Dec 30, 2023 at 11:50 PM Richard Purdie <richard.purdie@linuxfoundation.org> wrote: > > On Sat, 2023-12-30 at 15:48 +0000, Alex Kiernan wrote: > > The vendor directory is set in cargo_common, to work with rust 1.75.0 we > > need to change the location, so use CARGO_VENDORING_DIRECTORY here. > > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> > > --- > > Is this change allowed, or am I coupling repos in a bad way and should > > hardcode `registry/src` (which is what I need it to be) here instead? > > We really need to find a better way. Bitbake isn't supposed to have > "knowledge" of OE-Core outside the key variables it expects from > bitbake.conf. CARGO* from class files aren't included in that. > > What we probably should do is set this in bitbake in the fetcher and > then read the value in OE-Core. > Thanks, that makes sense. In fact if we can move the generation of the cargo vendor fragment into the fetcher then I think we isolate the details of our implementation in one place; I'll see if that works.
On Sat, 2023-12-30 at 15:48 +0000, Alex Kiernan wrote: > The vendor directory is set in cargo_common, to work with rust 1.75.0 we > need to change the location, so use CARGO_VENDORING_DIRECTORY here. > Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> > --- > Is this change allowed, or am I coupling repos in a bad way and should > hardcode `registry/src` (which is what I need it to be) here instead? > > bitbake/lib/bb/fetch2/crate.py | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/bitbake/lib/bb/fetch2/crate.py b/bitbake/lib/bb/fetch2/crate.py > index 01d49435c3e8..06963294ef35 100644 > --- a/bitbake/lib/bb/fetch2/crate.py > +++ b/bitbake/lib/bb/fetch2/crate.py > @@ -23,8 +23,8 @@ class Crate(Wget): > > """Class to fetch crates via wget""" > > - def _cargo_bitbake_path(self, rootdir): > - return os.path.join(rootdir, "cargo_home", "bitbake") > + def _cargo_bitbake_path(self, d): > + return d.getVar('CARGO_VENDORING_DIRECTORY') > > def supports(self, ud, d): > """ > @@ -103,7 +103,7 @@ class Crate(Wget): > cmd = "tar -xz --no-same-owner -f %s" % thefile > ud.unpack_tracer.unpack("crate-extract", rootdir) > else: > - cargo_bitbake = self._cargo_bitbake_path(rootdir) > + cargo_bitbake = self._cargo_bitbake_path(d) > ud.unpack_tracer.unpack("cargo-extract", cargo_bitbake) > > cmd = "tar -xz --no-same-owner -f %s -C %s" % (thefile, cargo_bitbake) > @@ -134,7 +134,7 @@ class Crate(Wget): > # if we have metadata to write out.. > if len(metadata) > 0: > cratepath = os.path.splitext(os.path.basename(thefile))[0] > - bbpath = self._cargo_bitbake_path(rootdir) > + bbpath = self._cargo_bitbake_path(d) > mdfile = '.cargo-checksum.json' > mdpath = os.path.join(bbpath, cratepath, mdfile) > with open(mdpath, "w") as f: FWIW this also breaks bitbake-selftest: https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6261/steps/11/logs/stdio Cheers, Richard
diff --git a/bitbake/lib/bb/fetch2/crate.py b/bitbake/lib/bb/fetch2/crate.py index 01d49435c3e8..06963294ef35 100644 --- a/bitbake/lib/bb/fetch2/crate.py +++ b/bitbake/lib/bb/fetch2/crate.py @@ -23,8 +23,8 @@ class Crate(Wget): """Class to fetch crates via wget""" - def _cargo_bitbake_path(self, rootdir): - return os.path.join(rootdir, "cargo_home", "bitbake") + def _cargo_bitbake_path(self, d): + return d.getVar('CARGO_VENDORING_DIRECTORY') def supports(self, ud, d): """ @@ -103,7 +103,7 @@ class Crate(Wget): cmd = "tar -xz --no-same-owner -f %s" % thefile ud.unpack_tracer.unpack("crate-extract", rootdir) else: - cargo_bitbake = self._cargo_bitbake_path(rootdir) + cargo_bitbake = self._cargo_bitbake_path(d) ud.unpack_tracer.unpack("cargo-extract", cargo_bitbake) cmd = "tar -xz --no-same-owner -f %s -C %s" % (thefile, cargo_bitbake) @@ -134,7 +134,7 @@ class Crate(Wget): # if we have metadata to write out.. if len(metadata) > 0: cratepath = os.path.splitext(os.path.basename(thefile))[0] - bbpath = self._cargo_bitbake_path(rootdir) + bbpath = self._cargo_bitbake_path(d) mdfile = '.cargo-checksum.json' mdpath = os.path.join(bbpath, cratepath, mdfile) with open(mdpath, "w") as f:
The vendor directory is set in cargo_common, to work with rust 1.75.0 we need to change the location, so use CARGO_VENDORING_DIRECTORY here. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> --- Is this change allowed, or am I coupling repos in a bad way and should hardcode `registry/src` (which is what I need it to be) here instead? bitbake/lib/bb/fetch2/crate.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)