bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
To: bitbake-devel@lists.openembedded.org
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Subject: [PATCH, v2] fetch2/crate: create versioned 'name' entries
Date: Wed,  5 Apr 2023 14:21:25 +0200	[thread overview]
Message-ID: <20230405122125.3358972-1-enrico.scholz@sigma-chemnitz.de> (raw)
In-Reply-To: <20230405101609.3309660-1-enrico.scholz@sigma-chemnitz.de>

From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>

It is common for rust packages to depend on different versions of the
same crate.  E.g.

|    crate://crates.io/windows_x86_64_msvc/0.42.2 \
|    crate://crates.io/windows_x86_64_msvc/0.48.0 \

Identification only by the plain crate name makes the sha256sum
ambiguous

| SRC_URI[windows_x86_64_msvc.sha256sum] = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
| SRC_URI[windows_x86_64_msvc.sha256sum] = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

and requires lot of manual work to fix the SRC_URI list.

Making the 'name' property unique by appending the version allows
direct copy & paste of reported sha256sum errors to complete the
crates list.

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
---
 lib/bb/fetch2/crate.py | 2 +-
 lib/bb/tests/fetch.py  | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/bb/fetch2/crate.py b/lib/bb/fetch2/crate.py
index 590dc9c12681..a7021e5b367c 100644
--- a/lib/bb/fetch2/crate.py
+++ b/lib/bb/fetch2/crate.py
@@ -72,7 +72,7 @@ class Crate(Wget):
         ud.url = "https://%s/%s/%s/download" % (host, name, version)
         ud.parm['downloadfilename'] = "%s-%s.crate" % (name, version)
         if 'name' not in ud.parm:
-            ud.parm['name'] = name
+            ud.parm['name'] = '%s-%s' % (name, version)
 
         logger.debug2("Fetching %s to %s" % (ud.url, ud.parm['downloadfilename']))
 
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index da6716890070..6ef0836f2be9 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -2380,7 +2380,7 @@ class CrateTest(FetcherTest):
         ud = fetcher.ud[fetcher.urls[0]]
 
         self.assertIn("name", ud.parm)
-        self.assertEqual(ud.parm["name"], "glob")
+        self.assertEqual(ud.parm["name"], "glob-0.2.11")
         self.assertIn("downloadfilename", ud.parm)
         self.assertEqual(ud.parm["downloadfilename"], "glob-0.2.11.crate")
 
@@ -2428,13 +2428,13 @@ class CrateTest(FetcherTest):
         ud = fetcher.ud[fetcher.urls[0]]
 
         self.assertIn("name", ud.parm)
-        self.assertEqual(ud.parm["name"], "glob")
+        self.assertEqual(ud.parm["name"], "glob-0.2.11")
         self.assertIn("downloadfilename", ud.parm)
         self.assertEqual(ud.parm["downloadfilename"], "glob-0.2.11.crate")
 
         ud = fetcher.ud[fetcher.urls[1]]
         self.assertIn("name", ud.parm)
-        self.assertEqual(ud.parm["name"], "time")
+        self.assertEqual(ud.parm["name"], "time-0.1.35")
         self.assertIn("downloadfilename", ud.parm)
         self.assertEqual(ud.parm["downloadfilename"], "time-0.1.35.crate")
 
@@ -2451,7 +2451,7 @@ class CrateTest(FetcherTest):
     def test_crate_incorrect_cksum(self):
         uri = "crate://crates.io/aho-corasick/0.7.20"
         self.d.setVar('SRC_URI', uri)
-        self.d.setVarFlag("SRC_URI", "aho-corasick.sha256sum", hashlib.sha256("Invalid".encode("utf-8")).hexdigest())
+        self.d.setVarFlag("SRC_URI", "aho-corasick-0.7.20.sha256sum", hashlib.sha256("Invalid".encode("utf-8")).hexdigest())
 
         uris = self.d.getVar('SRC_URI').split()
 
-- 
2.39.2



      parent reply	other threads:[~2023-04-05 12:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 10:16 [PATCH] fetch:crate: create versioned 'name' entries Enrico Scholz
2023-04-05 12:03 ` [bitbake-devel] " Frédéric Martinsons
2023-04-05 12:09   ` Enrico Scholz
2023-04-05 12:21     ` Frédéric Martinsons
2023-04-05 12:24       ` Enrico Scholz
2023-04-05 12:50         ` Frédéric Martinsons
     [not found]         ` <17530ADB1695B5D1.3977@lists.openembedded.org>
2023-04-05 16:28           ` Frédéric Martinsons
2023-04-05 16:44             ` Enrico Scholz
2023-04-05 17:05               ` Frédéric Martinsons
2023-04-06  8:45                 ` Richard Purdie
2023-04-06 10:05                   ` Frédéric Martinsons
2023-04-06 10:15                     ` Richard Purdie
2023-04-06 10:20                   ` Enrico Scholz
2023-04-06 12:14                     ` Richard Purdie
2023-04-06 13:00                       ` Frédéric Martinsons
2023-04-06 13:44                         ` Richard Purdie
2023-04-06 13:57                           ` Frédéric Martinsons
2023-04-06 14:01                       ` Enrico Scholz
2023-04-06 14:18                       ` ';sha256sum=' attribute in SRC_URI (was: [bitbake-devel] [PATCH] fetch:crate: create versioned 'name' entries) Enrico Scholz
2023-04-06 14:46                         ` Frédéric Martinsons
2023-04-05 12:21 ` Enrico Scholz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230405122125.3358972-1-enrico.scholz@sigma-chemnitz.de \
    --to=enrico.scholz@sigma-chemnitz.de \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).