diff mbox series

[1/1] Added a new cargo-online bbclass for recipes requiring remote crates

Message ID 20241122133140.1627-2-karem.ibrahim46@gmail.com
State New
Headers show
Series *** SUBJECT HERE *** | expand

Commit Message

Kareem Ibrahim Nov. 22, 2024, 1:31 p.m. UTC
- This change was intended to abstract user from having to set compile network flag to get remote crates
- as network access was disabled by default in kirkstone version
- I faced an do_compile error with bitbaking Qualcomm qcrosvm under yocto kirkstone with message "Could not resolve host: github.com"
- And after some hours of debugging I noticed that cargo inherited by recipe needs remote crates during do_compile of the cargo.bbclass
- It was fixed by adding line do_compile[network] = "1" to the recipe
- So I found it more convenient, since cargo build usually need network access, to abstract users from these details of cargo.bbclass do_compile

Signed-off-by: Kareem Ibrahim <karem.ibrahim46@gmail.com>
---
 meta/classes/cargo-online.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 meta/classes/cargo-online.bbclass

Comments

Martin Jansa Nov. 22, 2024, 1:40 p.m. UTC | #1
This isn't a fix, it's just very bad work around, see:
https://git.openembedded.org/openembedded-core/tree/meta/classes-recipe/cargo-update-recipe-crates.bbclass
which you can use to avoid needing the network access during do_compile.

On Fri, Nov 22, 2024 at 2:32 PM Kareem Ibrahim via
lists.openembedded.org
<karem.ibrahim46=gmail.com@lists.openembedded.org> wrote:
>
> - This change was intended to abstract user from having to set compile network flag to get remote crates
> - as network access was disabled by default in kirkstone version
> - I faced an do_compile error with bitbaking Qualcomm qcrosvm under yocto kirkstone with message "Could not resolve host: github.com"
> - And after some hours of debugging I noticed that cargo inherited by recipe needs remote crates during do_compile of the cargo.bbclass
> - It was fixed by adding line do_compile[network] = "1" to the recipe
> - So I found it more convenient, since cargo build usually need network access, to abstract users from these details of cargo.bbclass do_compile
>
> Signed-off-by: Kareem Ibrahim <karem.ibrahim46@gmail.com>
> ---
>  meta/classes/cargo-online.bbclass | 7 +++++++
>  1 file changed, 7 insertions(+)
>  create mode 100644 meta/classes/cargo-online.bbclass
>
> diff --git a/meta/classes/cargo-online.bbclass b/meta/classes/cargo-online.bbclass
> new file mode 100644
> index 0000000000..175c94e09d
> --- /dev/null
> +++ b/meta/classes/cargo-online.bbclass
> @@ -0,0 +1,7 @@
> +# This bbclass is added to abstract recipes writers from
> +# having to set do_compile network flag to 1
> +# if his cargo package need external remote crates
> +# as network access was disabled by default since kirkstone version
> +
> +inherit cargo
> +do_compile[network] = "1"
> \ No newline at end of file
> --
> 2.25.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#207615): https://lists.openembedded.org/g/openembedded-core/message/207615
> Mute This Topic: https://lists.openembedded.org/mt/109721978/3617156
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [martin.jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
patchtest@automation.yoctoproject.org Nov. 22, 2024, 1:46 p.m. UTC | #2
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:

---
Testing patch /home/patchtest/share/mboxes/1-1-Added-a-new-cargo-online-bbclass-for-recipes-requiring-remote-crates.patch

FAIL: test shortlog format: Commit shortlog (first line of commit message) should follow the format "<target>: <summary>" (test_mbox.TestMbox.test_shortlog_format)

PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message presence (test_mbox.TestMbox.test_commit_message_presence)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)

SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: pretest src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.pretest_src_uri_left_files)
SKIP: test CVE check ignore: No modified recipes or older target branch, skipping test (test_metadata.TestMetadata.test_cve_check_ignore)
SKIP: test CVE tag format: No new CVE patches introduced (test_patch.TestPatch.test_cve_tag_format)
SKIP: test Signed-off-by presence: No new CVE patches introduced (test_patch.TestPatch.test_signed_off_by_presence)
SKIP: test Upstream-Status presence: No new CVE patches introduced (test_patch.TestPatch.test_upstream_status_presence_format)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum modified not mentioned: No modified recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test src uri left files: No modified recipes, skipping pretest (test_metadata.TestMetadata.test_src_uri_left_files)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)

---

Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
Kareem Ibrahim Nov. 22, 2024, 3:18 p.m. UTC | #3
Okay, nobody forced you to reply. Your review was terrible. If it is not ok
you could simply say that for a reason, but there were thousands of better
way to say that.

On Fri, 22 Nov 2024, 15:40 Martin Jansa, <martin.jansa@gmail.com> wrote:

> This isn't a fix, it's just very bad work around, see:
>
> https://git.openembedded.org/openembedded-core/tree/meta/classes-recipe/cargo-update-recipe-crates.bbclass
> which you can use to avoid needing the network access during do_compile.
>
> On Fri, Nov 22, 2024 at 2:32 PM Kareem Ibrahim via
> lists.openembedded.org
> <karem.ibrahim46=gmail.com@lists.openembedded.org> wrote:
> >
> > - This change was intended to abstract user from having to set compile
> network flag to get remote crates
> > - as network access was disabled by default in kirkstone version
> > - I faced an do_compile error with bitbaking Qualcomm qcrosvm under
> yocto kirkstone with message "Could not resolve host: github.com"
> > - And after some hours of debugging I noticed that cargo inherited by
> recipe needs remote crates during do_compile of the cargo.bbclass
> > - It was fixed by adding line do_compile[network] = "1" to the recipe
> > - So I found it more convenient, since cargo build usually need network
> access, to abstract users from these details of cargo.bbclass do_compile
> >
> > Signed-off-by: Kareem Ibrahim <karem.ibrahim46@gmail.com>
> > ---
> >  meta/classes/cargo-online.bbclass | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >  create mode 100644 meta/classes/cargo-online.bbclass
> >
> > diff --git a/meta/classes/cargo-online.bbclass
> b/meta/classes/cargo-online.bbclass
> > new file mode 100644
> > index 0000000000..175c94e09d
> > --- /dev/null
> > +++ b/meta/classes/cargo-online.bbclass
> > @@ -0,0 +1,7 @@
> > +# This bbclass is added to abstract recipes writers from
> > +# having to set do_compile network flag to 1
> > +# if his cargo package need external remote crates
> > +# as network access was disabled by default since kirkstone version
> > +
> > +inherit cargo
> > +do_compile[network] = "1"
> > \ No newline at end of file
> > --
> > 2.25.1
> >
> >
> > 
> >
>
Martin Jansa Nov. 22, 2024, 4:28 p.m. UTC | #4
I'm sorry you took it personally, I just wanted to help you. Next time I won't.

On Fri, Nov 22, 2024 at 4:18 PM Karim Ibrahim <karem.ibrahim46@gmail.com> wrote:
>
> Okay, nobody forced you to reply. Your review was terrible. If it is not ok you could simply say that for a reason, but there were thousands of better way to say that.
>
> On Fri, 22 Nov 2024, 15:40 Martin Jansa, <martin.jansa@gmail.com> wrote:
>>
>> This isn't a fix, it's just very bad work around, see:
>> https://git.openembedded.org/openembedded-core/tree/meta/classes-recipe/cargo-update-recipe-crates.bbclass
>> which you can use to avoid needing the network access during do_compile.
>>
>> On Fri, Nov 22, 2024 at 2:32 PM Kareem Ibrahim via
>> lists.openembedded.org
>> <karem.ibrahim46=gmail.com@lists.openembedded.org> wrote:
>> >
>> > - This change was intended to abstract user from having to set compile network flag to get remote crates
>> > - as network access was disabled by default in kirkstone version
>> > - I faced an do_compile error with bitbaking Qualcomm qcrosvm under yocto kirkstone with message "Could not resolve host: github.com"
>> > - And after some hours of debugging I noticed that cargo inherited by recipe needs remote crates during do_compile of the cargo.bbclass
>> > - It was fixed by adding line do_compile[network] = "1" to the recipe
>> > - So I found it more convenient, since cargo build usually need network access, to abstract users from these details of cargo.bbclass do_compile
>> >
>> > Signed-off-by: Kareem Ibrahim <karem.ibrahim46@gmail.com>
>> > ---
>> >  meta/classes/cargo-online.bbclass | 7 +++++++
>> >  1 file changed, 7 insertions(+)
>> >  create mode 100644 meta/classes/cargo-online.bbclass
>> >
>> > diff --git a/meta/classes/cargo-online.bbclass b/meta/classes/cargo-online.bbclass
>> > new file mode 100644
>> > index 0000000000..175c94e09d
>> > --- /dev/null
>> > +++ b/meta/classes/cargo-online.bbclass
>> > @@ -0,0 +1,7 @@
>> > +# This bbclass is added to abstract recipes writers from
>> > +# having to set do_compile network flag to 1
>> > +# if his cargo package need external remote crates
>> > +# as network access was disabled by default since kirkstone version
>> > +
>> > +inherit cargo
>> > +do_compile[network] = "1"
>> > \ No newline at end of file
>> > --
>> > 2.25.1
>> >
>> >
>> > -=-=-=-=-=-=-=-=-=-=-=-
>> > Links: You receive all messages sent to this group.
>> > View/Reply Online (#207615): https://lists.openembedded.org/g/openembedded-core/message/207615
>> > Mute This Topic: https://lists.openembedded.org/mt/109721978/3617156
>> > Group Owner: openembedded-core+owner@lists.openembedded.org
>> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [martin.jansa@gmail.com]
>> > -=-=-=-=-=-=-=-=-=-=-=-
>> >
Richard Purdie Nov. 22, 2024, 5:02 p.m. UTC | #5
On Fri, 2024-11-22 at 15:31 +0200, Kareem Ibrahim via lists.openembedded.org wrote:
> - This change was intended to abstract user from having to set compile network flag to get remote crates
> - as network access was disabled by default in kirkstone version
> - I faced an do_compile error with bitbaking Qualcomm qcrosvm under yocto kirkstone with message "Could not resolve host: github.com"
> - And after some hours of debugging I noticed that cargo inherited by recipe needs remote crates during do_compile of the cargo.bbclass
> - It was fixed by adding line do_compile[network] = "1" to the recipe
> - So I found it more convenient, since cargo build usually need network access, to abstract users from these details of cargo.bbclass do_compile
> 
> Signed-off-by: Kareem Ibrahim <karem.ibrahim46@gmail.com>
> ---
>  meta/classes/cargo-online.bbclass | 7 +++++++
>  1 file changed, 7 insertions(+)
>  create mode 100644 meta/classes/cargo-online.bbclass
> 
> diff --git a/meta/classes/cargo-online.bbclass b/meta/classes/cargo-online.bbclass
> new file mode 100644
> index 0000000000..175c94e09d
> --- /dev/null
> +++ b/meta/classes/cargo-online.bbclass
> @@ -0,0 +1,7 @@
> +# This bbclass is added to abstract recipes writers from
> +# having to set do_compile network flag to 1
> +# if his cargo package need external remote crates
> +# as network access was disabled by default since kirkstone version
> +
> +inherit cargo
> +do_compile[network] = "1"
> \ No newline at end of file
> 

We can't take a change like this unfortunately. Fetching outside
do_fetch means DL_DIR is not populated, our source mirrors would work
and our software/license manifests are incomplete, all things which we
have people relying upon (including for legal review).

As has been mentioned, we have made changes to cargo since kirkstone to
allow all the crates to be specified in SRC_URI so I'd hope there is no
need for this change in more recent versions of the project.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes/cargo-online.bbclass b/meta/classes/cargo-online.bbclass
new file mode 100644
index 0000000000..175c94e09d
--- /dev/null
+++ b/meta/classes/cargo-online.bbclass
@@ -0,0 +1,7 @@ 
+# This bbclass is added to abstract recipes writers from
+# having to set do_compile network flag to 1
+# if his cargo package need external remote crates
+# as network access was disabled by default since kirkstone version
+
+inherit cargo
+do_compile[network] = "1"
\ No newline at end of file