Skip to contentSkip to conversation

Move crate fetcher to OE_IMPORTS

PATCH In review Matt Madison 4 participants 13 messages Dec 17, 2021 – Jan 14, 2022 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover Move crate fetcher to OE_IMPORTS

This patch series switches to using the OE_IMPORTS mechanism for installing the crate fetcher. This simplifies the addition and clears up issues with interactions between SRCPV and the shared-state fetching logic.

Matt Madison (4):
lib/crate.py: install crate fetcher on import base.bbclass: add crate to OE_IMPORTS cargo_common.bbclass: remove inherit of crate-fetch
classes: remove crate-fetch.bbclass

 meta/classes/base.bbclass         |  2 +-
 meta/classes/cargo_common.bbclass |  2 --
 meta/classes/crate-fetch.bbclass  | 28 ----------------------------
 meta/lib/crate.py                 |  2 ++
 4 files changed, 3 insertions(+), 31 deletions(-)
 delete mode 100644 meta/classes/crate-fetch.bbclass
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/4 lib/crate.py: install crate fetcher on import

to enable the move to using OE_IMPORTS for adding
this fetcher.

---
 meta/lib/crate.py | 2 ++
 1 file changed, 2 insertions(+)
meta/lib/crate.py +2 -0
index d10f441875..f9db7c28cd 100644
@@ -147,3 +147,5 @@ class Crate(Wget):
             mdpath = os.path.join(bbpath, cratepath, mdfile)
             with open(mdpath, "w") as f:
                 json.dump(metadata, f)
+
+bb.fetch2.methods.append(Crate())
Signature · 1 line
2.32.0
#2 lore raw

PATCH 2/4 base.bbclass: add crate to OE_IMPORTS

In reply to Matt Madison

to install the crate:// fetch handler.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +1 -1
index b709777f24..ee9950f207 100644
@@ -12,7 +12,7 @@ inherit logging
 
 OE_EXTRA_IMPORTS ?= ""
 
-OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible ${OE_EXTRA_IMPORTS}"
+OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible crate ${OE_EXTRA_IMPORTS}"
 OE_IMPORTS[type] = "list"
 
 PACKAGECONFIG_CONFARGS ??= ""
Signature · 1 line
2.32.0
#3 lore raw

Re: [OE-core][PATCH 2/4] base.bbclass: add crate to OE_IMPORTS

Should this be named oe.crate for consistency and avoiding potential clashes?

Alex

Quoted 39 lines · Matt Madison

to install the crate:// fetch handler.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +0 -1
index b709777f24..ee9950f207 100644
@@ -12,7 +12,7 @@ inherit logging
 
 OE_EXTRA_IMPORTS ?= ""
 
-OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package

oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible ${OE_EXTRA_IMPORTS}"
+OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible crate ${OE_EXTRA_IMPORTS}"
OE_IMPORTS[type] = "list"

PACKAGECONFIG_CONFARGS ??= ""
--
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#159830):
https://lists.openembedded.org/g/openembedded-core/message/159830
Mute This Topic: https://lists.openembedded.org/mt/87791269/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

Re: [OE-core][PATCH 2/4] base.bbclass: add crate to OE_IMPORTS

Quoted 2 lines · Alexander Kanavin

Should this be named oe.crate for consistency and avoiding potential clashes?

I retained the existing name for this change set. The same thought had occurred to me, though.

-Matt

Quoted 37 lines

Alex

Quoted 33 lines · Matt Madison

to install the crate:// fetch handler.

---
 meta/classes/base.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/base.bbclass +1 -2
index b709777f24..ee9950f207 100644
@@ -12,7 +12,7 @@ inherit logging
 
 OE_EXTRA_IMPORTS ?= ""
 
-OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible ${OE_EXTRA_IMPORTS}"
+OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible crate ${OE_EXTRA_IMPORTS}"
 OE_IMPORTS[type] = "list"
 
 PACKAGECONFIG_CONFARGS ??= ""
--

2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#159830): https://lists.openembedded.org/g/openembedded-core/message/159830
Mute This Topic: https://lists.openembedded.org/mt/87791269/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw

PATCH 3/4 cargo_common.bbclass: remove inherit of crate-fetch

In reply to Matt Madison

No longer needed now that the crate fetcher is
installed via OE_IMPORTS.

---
 meta/classes/cargo_common.bbclass | 2 --
 1 file changed, 2 deletions(-)
meta/classes/cargo_common.bbclass +0 -2
index 23d82aa6ab..c403591434 100644
@@ -8,8 +8,6 @@
 ## is used by cargo.bbclass and Rust
 ##
 
-# add crate fetch support
-inherit crate-fetch
 inherit rust-common
 
 # Where we download our registry and dependencies to
Signature · 1 line
2.32.0
#6 lore raw

PATCH 4/4 classes: remove crate-fetch.bbclass

In reply to Matt Madison

No longer required now that the crate fetcher
gets installed via OE_IMPORTS.

---
 meta/classes/crate-fetch.bbclass | 28 ----------------------------
 1 file changed, 28 deletions(-)
 delete mode 100644 meta/classes/crate-fetch.bbclass
meta/classes/crate-fetch.bbclass deleted +0 -28
deleted file mode 100644
index a7fa22b2a0..0000000000
@@ -1,28 +0,0 @@
-#
-# crate-fetch class
-#
-# Registers 'crate' method for Bitbake fetch2.
-#
-# Adds support for following format in recipe SRC_URI:
-# crate://<packagename>/<version>
-#
-
-def import_crate(d):
-    import crate
-    if not getattr(crate, 'imported', False):
-        bb.fetch2.methods.append(crate.Crate())
-        crate.imported = True
-
-python crate_import_handler() {
-    import_crate(d)
-}
-
-addhandler crate_import_handler
-crate_import_handler[eventmask] = "bb.event.RecipePreFinalise"
-
-def crate_get_srcrev(d):
-    import_crate(d)
-    return bb.fetch2.get_srcrev(d)
-
-# Override SRCPV to make sure it imports the fetcher first
-SRCPV = "${@crate_get_srcrev(d)}"
Signature · 1 line
2.32.0
#7 lore raw
In reply to Matt Madison
Quoted 11 lines · Matt Madison

This patch series switches to using the OE_IMPORTS mechanism for installing the crate fetcher. This simplifies the addition and clears up issues with interactions between SRCPV and the shared-state fetching logic.

Matt Madison (4):
lib/crate.py: install crate fetcher on import base.bbclass: add crate to OE_IMPORTS cargo_common.bbclass: remove inherit of crate-fetch
classes: remove crate-fetch.bbclass

Quoted 7 lines
  meta/classes/base.bbclass         |  2 +-
  meta/classes/cargo_common.bbclass |  2 --
  meta/classes/crate-fetch.bbclass  | 28 ----------------------------
  meta/lib/crate.py                 |  2 ++
  4 files changed, 3 insertions(+), 31 deletions(-)

delete mode 100644 meta/classes/crate-fetch.bbclass

Would a better solution here be to move the crate fetcher into lib/bb/fetch2/ in bitbake?

Signature · 6 lines
Paul Barker
Principal Software Engineer
SanCloud Ltd

e: [email protected]
w: https://sancloud.co.uk/
#8 lore raw
Quoted 20 lines · Paul Barker
Quoted 11 lines · Matt Madison

This patch series switches to using the OE_IMPORTS mechanism for installing the crate fetcher. This simplifies the addition and clears up issues with interactions between SRCPV and the shared-state fetching logic.

Matt Madison (4):
lib/crate.py: install crate fetcher on import base.bbclass: add crate to OE_IMPORTS cargo_common.bbclass: remove inherit of crate-fetch
classes: remove crate-fetch.bbclass

Quoted 7 lines
  meta/classes/base.bbclass         |  2 +-
  meta/classes/cargo_common.bbclass |  2 --
  meta/classes/crate-fetch.bbclass  | 28 ----------------------------
  meta/lib/crate.py                 |  2 ++
  4 files changed, 3 insertions(+), 31 deletions(-)

delete mode 100644 meta/classes/crate-fetch.bbclass

Quoted 2 lines

Would a better solution here be to move the crate fetcher into lib/bb/fetch2/ in bitbake?

I've been wondering about this too.

Does anyone remember how the fetcher lines up against the general fetcher requirements we have and is there a list of anything that remained to be done before it could be added to bitbake?

Cheers,

Richard

#9 lore raw
Quoted 21 lines · Richard Purdie
Quoted 20 lines · Paul Barker
Quoted 18 lines · Matt Madison

This patch series switches to using the OE_IMPORTS mechanism for installing the crate fetcher. This simplifies the addition and clears up issues with interactions between SRCPV and the shared-state fetching logic.

Matt Madison (4):
lib/crate.py: install crate fetcher on import base.bbclass: add crate to OE_IMPORTS cargo_common.bbclass: remove inherit of crate-fetch
classes: remove crate-fetch.bbclass

   meta/classes/base.bbclass         |  2 +-
   meta/classes/cargo_common.bbclass |  2 --
   meta/classes/crate-fetch.bbclass  | 28 ----------------------------
   meta/lib/crate.py                 |  2 ++
   4 files changed, 3 insertions(+), 31 deletions(-)

delete mode 100644 meta/classes/crate-fetch.bbclass

Quoted 8 lines
Quoted 2 lines

Would a better solution here be to move the crate fetcher into lib/bb/fetch2/ in bitbake?

I've been wondering about this too.

Does anyone remember how the fetcher lines up against the general fetcher requirements we have and is there a list of anything that remained to be done before it could be added to bitbake?

If I remember correctly, it just needed some test cases writing. The crate fetcher is a subclass of the wget fetcher with changes to how urldata is set up and how unpack is handled, so it should integrate well into bitbake.

Thanks,

Signature · 6 lines
Paul Barker
Principal Software Engineer
SanCloud Ltd

e: [email protected]
w: https://sancloud.co.uk/
#10 lore raw
Quoted 28 lines · Paul Barker
Quoted 26 lines · Richard Purdie
Quoted 20 lines · Paul Barker
Quoted 11 lines · Matt Madison

This patch series switches to using the OE_IMPORTS mechanism for installing the crate fetcher. This simplifies the addition and clears up issues with interactions between SRCPV and the shared-state fetching logic.

Matt Madison (4):
lib/crate.py: install crate fetcher on import base.bbclass: add crate to OE_IMPORTS cargo_common.bbclass: remove inherit of crate-fetch
classes: remove crate-fetch.bbclass

Quoted 7 lines
   meta/classes/base.bbclass         |  2 +-
   meta/classes/cargo_common.bbclass |  2 --
   meta/classes/crate-fetch.bbclass  | 28 ----------------------------
   meta/lib/crate.py                 |  2 ++
   4 files changed, 3 insertions(+), 31 deletions(-)

delete mode 100644 meta/classes/crate-fetch.bbclass

Quoted 2 lines

Would a better solution here be to move the crate fetcher into lib/bb/fetch2/ in bitbake?

I've been wondering about this too.

Quoted 8 lines
Quoted 3 lines

Does anyone remember how the fetcher lines up against the general fetcher requirements we have and is there a list of anything that remained to be done before it could be added to bitbake?

If I remember correctly, it just needed some test cases writing. The crate fetcher is a subclass of the wget fetcher with changes to how urldata is set up and how unpack is handled, so it should integrate well into bitbake.

One thing I see that's a bit worrisome is that it disables recommends_checksum for the downloaded files,
and populates metadata for use (I assume) by cargo with the calculated SHA256 on the download.

-Matt

Quoted 10 lines

Thanks,

--
Paul Barker
Principal Software Engineer
SanCloud Ltd

e: [email protected]
w: https://sancloud.co.uk/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw
Quoted 39 lines · Matt Madison via lists.openembedded.org
Quoted 28 lines · Paul Barker
Quoted 26 lines · Richard Purdie
Quoted 20 lines · Paul Barker
Quoted 11 lines · Matt Madison

This patch series switches to using the OE_IMPORTS mechanism for installing the crate fetcher. This simplifies the addition and clears up issues with interactions between SRCPV and the shared-state fetching logic.

Matt Madison (4):
lib/crate.py: install crate fetcher on import base.bbclass: add crate to OE_IMPORTS cargo_common.bbclass: remove inherit of crate-fetch
classes: remove crate-fetch.bbclass

Quoted 7 lines
   meta/classes/base.bbclass         |  2 +-
   meta/classes/cargo_common.bbclass |  2 --
   meta/classes/crate-fetch.bbclass  | 28 ----------------------------
   meta/lib/crate.py                 |  2 ++
   4 files changed, 3 insertions(+), 31 deletions(-)

delete mode 100644 meta/classes/crate-fetch.bbclass

Quoted 2 lines

Would a better solution here be to move the crate fetcher into lib/bb/fetch2/ in bitbake?

I've been wondering about this too.

Quoted 8 lines
Quoted 3 lines

Does anyone remember how the fetcher lines up against the general fetcher requirements we have and is there a list of anything that remained to be done before it could be added to bitbake?

If I remember correctly, it just needed some test cases writing. The crate fetcher is a subclass of the wget fetcher with changes to how urldata is set up and how unpack is handled, so it should integrate well into bitbake.

Quoted 4 lines

One thing I see that's a bit worrisome is that it disables recommends_checksum for the downloaded files,
and populates metadata for use (I assume) by cargo with the calculated SHA256 on the download.

Any other thoughts on this? I've modified my distro to work around the problem that led me to propose these patches, but something needs to be fixed here. crate-fetch.bbclass should not be setting SRCPV.

Thanks,
-Matt

Quoted 22 lines

-Matt

Quoted 10 lines

Thanks,

--
Paul Barker
Principal Software Engineer
SanCloud Ltd

e: [email protected]
w: https://sancloud.co.uk/

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#159928): https://lists.openembedded.org/g/openembedded-core/message/159928
Mute This Topic: https://lists.openembedded.org/mt/87791267/3618418
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#13 lore raw
Quoted 42 lines · Matt Madison
Quoted 39 lines · Matt Madison via lists.openembedded.org
Quoted 36 lines · Paul Barker
Quoted 21 lines · Richard Purdie
Quoted 20 lines · Paul Barker
Quoted 18 lines · Matt Madison

This patch series switches to using the OE_IMPORTS mechanism for installing the crate fetcher. This simplifies the addition and clears up issues with interactions between SRCPV and the shared-state fetching logic.

Matt Madison (4):
lib/crate.py: install crate fetcher on import base.bbclass: add crate to OE_IMPORTS cargo_common.bbclass: remove inherit of crate-fetch
classes: remove crate-fetch.bbclass

   meta/classes/base.bbclass         |  2 +-
   meta/classes/cargo_common.bbclass |  2 --
   meta/classes/crate-fetch.bbclass  | 28 ----------------------------
   meta/lib/crate.py                 |  2 ++
   4 files changed, 3 insertions(+), 31 deletions(-)

delete mode 100644 meta/classes/crate-fetch.bbclass

Quoted 8 lines
Quoted 2 lines

Would a better solution here be to move the crate fetcher into lib/bb/fetch2/ in bitbake?

I've been wondering about this too.

Does anyone remember how the fetcher lines up against the general fetcher requirements we have and is there a list of anything that remained to be done before it could be added to bitbake?

If I remember correctly, it just needed some test cases writing. The crate fetcher is a subclass of the wget fetcher with changes to how urldata is set up and how unpack is handled, so it should integrate well into bitbake.

Quoted 8 lines
Quoted 4 lines

One thing I see that's a bit worrisome is that it disables recommends_checksum for the downloaded files,
and populates metadata for use (I assume) by cargo with the calculated SHA256 on the download.

Any other thoughts on this? I've modified my distro to work around the problem that led me to propose these patches, but something needs to be fixed here. crate-fetch.bbclass should not be setting SRCPV.

My thoughts are that we should look to getting this merged into bitbake. To do that we need some tests and then we can probably make it happen.

I am worried about your comments on the checksum and that may be something we need to fix before it can be merged.

Cheers,

Richard