Re: [bitbake-devel] [PATCH v3] fetch2/crate: support configurable registry and index URLs
Ross Burton <[email protected]> Wed, 3 Jun 2026 11:30:49 +0000
| Newsgroups | org.openembedded.lists.bitbake-devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, On 21 May 2026, at 17:30, minsung.cho via lists.openembedded.org <[email protected]> wrote: > + if dl_url: > + ud.url = dl_url.replace('{crate}', name).replace('{version}', version) > else: > ud.url = "https://%s/%s/%s/download" % (host, name, version) Instead of using replace() calls, we can treat the string that looks exactly like a f-string as an f-string, and use format(). eg: ud.url = dl_url.format(version=version, crate=name) > + elif host == 'crates.io' or index_url.startswith('https://index.crates.io/'): > + if not index_url.endswith('/'): > + index_url += '/' > + ud.versionsurl = index_url + index_path > + ud.crate_index_format = 'sparse' It looks like setting index_url to include {index_path} in the crates.io <http://crates.io/> special-casing would mean this entire block can be deleted, as the block above would handle it? > + ud.versionsurl = ud.versionsurl.replace('{crate}', name).replace('{version}', version) Again, use format(). > - if ud.versionsurl.startswith('https://index.crates.io/'): > + if getattr(ud, 'crate_index_format', None) == 'sparse': When is crate_index_format not set? If it’s not been set in the codepaths above, the other variables haven’t been set either. I think this can be a normal attribute lookup. > - bb.process.run('chmod u+rw -R %s' % self.tempdir) > + bb.process.run('chmod -R u+rw %s' % self.tempdir) Separate commit please, as this is unrelated to crate registry fetching. Also, as you’re changing this command please switch it to use a list instead of a string, that is [‘chmod’, ‘-R’, ‘u+rw’, self.tempdir]. Many thanks for writing an actual test case! Thanks, Ross