Skip to contentSkip to conversation

fwupd: set vendor_ids_dir

PATCH In review [email protected] 2 participants 7 messages Jul 14, 2025 – Jul 15, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fwupd: set vendor_ids_dir

From: Martin Jansa <[email protected]>

* it's in RSS as fwupd/2.0.12/recipe-sysroot/usr/share/hwdata/usb.ids but meson is searching the paths on host with:

  # look for usb.ids in both of the Debian and Fedora locations,
  # and fall back to the system datadir in case we're building in a venv or prefix
  vendor_ids_dir = get_option('vendor_ids_dir')
  if vendor_ids_dir == ''
    vendor_ids_dir = join_paths(datadir, 'misc')
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = join_paths(datadir, 'hwdata')
    endif
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = '/usr/share/hwdata'
    endif
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = '/usr/share/misc'
    endif
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = '/usr/local/var/homebrew/linked/usb.ids/share/misc'
    endif
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      error('could not auto-detect -Dvendor_ids_dir=')
    endif
  endif
  conf.set_quoted ('FWUPD_DATADIR_VENDOR_IDS', vendor_ids_dir)

it shouldn't be looking at host's paths and and on hosts without usb.ids in one of these locations it fails with:

../sources/fwupd-2.0.12/meson.build:323:4: ERROR: Problem encountered: could not auto-detect -Dvendor_ids_dir=

---
 meta-oe/recipes-bsp/fwupd/fwupd_2.0.12.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-bsp/fwupd/fwupd_2.0.12.bb +2 -0
index e25fbe1f54..eb43c3d865 100644
@@ -37,6 +37,8 @@ GIDOCGEN_MESON_DISABLE_FLAG = 'disabled'
 GIR_MESON_ENABLE_FLAG = 'enabled'
 GIR_MESON_DISABLE_FLAG = 'disabled'
 
+EXTRA_OEMESON = "-Dvendor_ids_dir=${datadir}/hwdata"
+
 PACKAGECONFIG ??= "\
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
     ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
#1 lore raw

Hi,

Quoted 5 lines · On Mon, Jul 14, 2025 at 03:46:57PM +0200, [email protected] wrote:

From: Martin Jansa <[email protected]>

* it's in RSS as fwupd/2.0.12/recipe-sysroot/usr/share/hwdata/usb.ids but meson is searching the paths on host with:

Quoted 7 lines
  # look for usb.ids in both of the Debian and Fedora locations,
  # and fall back to the system datadir in case we're building in a venv or prefix
  vendor_ids_dir = get_option('vendor_ids_dir')
  if vendor_ids_dir == ''
    vendor_ids_dir = join_paths(datadir, 'misc')
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = join_paths(datadir, 'hwdata')

Isn't this the same as ${datadir}/hwdata ?

Cheers,

-Mikko

Quoted 39 lines

endif
if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
vendor_ids_dir = '/usr/share/hwdata'
endif
if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
vendor_ids_dir = '/usr/share/misc'
endif
if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
vendor_ids_dir = '/usr/local/var/homebrew/linked/usb.ids/share/misc'
endif
if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
error('could not auto-detect -Dvendor_ids_dir=')
endif
endif
conf.set_quoted ('FWUPD_DATADIR_VENDOR_IDS', vendor_ids_dir)

it shouldn't be looking at host's paths and and on hosts without usb.ids in one of these locations it fails with:

../sources/fwupd-2.0.12/meson.build:323:4: ERROR: Problem encountered: could not auto-detect -Dvendor_ids_dir=

---
 meta-oe/recipes-bsp/fwupd/fwupd_2.0.12.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-bsp/fwupd/fwupd_2.0.12.bb +2 -0
index e25fbe1f54..eb43c3d865 100644
@@ -37,6 +37,8 @@ GIDOCGEN_MESON_DISABLE_FLAG = 'disabled'
 GIR_MESON_ENABLE_FLAG = 'enabled'
 GIR_MESON_DISABLE_FLAG = 'disabled'
 
+EXTRA_OEMESON = "-Dvendor_ids_dir=${datadir}/hwdata"
+
 PACKAGECONFIG ??= "\
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
     ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)} \
#2 lore raw
Quoted 17 lines · Mikko Rapeli

Hi,

Quoted 5 lines · On Mon, Jul 14, 2025 at 03:46:57PM +0200, [email protected] wrote:

From: Martin Jansa <[email protected]>

* it's in RSS as fwupd/2.0.12/recipe-sysroot/usr/share/hwdata/usb.ids but meson is searching the paths on host with:

Quoted 7 lines
  # look for usb.ids in both of the Debian and Fedora locations,
  # and fall back to the system datadir in case we're building in a venv or prefix
  vendor_ids_dir = get_option('vendor_ids_dir')
  if vendor_ids_dir == ''
    vendor_ids_dir = join_paths(datadir, 'misc')
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = join_paths(datadir, 'hwdata')
Quoted 1 line

Isn't this the same as ${datadir}/hwdata ?

It is the same value, but on my host, I don't have /usr/share/hwdata/usb.ids so meson doesn't detect any existing vendor_ids_dir value and fails.

With this change it accepts passed vendor_ids_dir value without testing it's existence (neither on host nor in RSS).

Cheers,

#3 lore raw

Hi,

Quoted 15 lines · Martin Jansa
Quoted 14 lines · Mikko Rapeli
Quoted 12 lines · On Mon, Jul 14, 2025 at 03:46:57PM +0200, [email protected] wrote:

From: Martin Jansa <[email protected]>

* it's in RSS as fwupd/2.0.12/recipe-sysroot/usr/share/hwdata/usb.ids but meson is searching the paths on host with:

  # look for usb.ids in both of the Debian and Fedora locations,
  # and fall back to the system datadir in case we're building in a venv or prefix
  vendor_ids_dir = get_option('vendor_ids_dir')
  if vendor_ids_dir == ''
    vendor_ids_dir = join_paths(datadir, 'misc')
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = join_paths(datadir, 'hwdata')
Quoted 8 lines
Quoted 1 line

Isn't this the same as ${datadir}/hwdata ?

It is the same value, but on my host, I don't have /usr/share/hwdata/usb.ids so meson doesn't detect any existing vendor_ids_dir value and fails.

With this change it accepts passed vendor_ids_dir value without testing it's existence (neither on host nor in RSS).

Previous version of fwupd update patches did not include "hwdata" as build dependency so recipe sysroot did not have usb.ids file but now it should have. Then meson.bbclass is setting datadir so I'm wondering if there is a bug in meson.bbclass or in these fwupd side scripts that they only check the host paths on not the recipe sysroot ones? Is fwupd not using the correct variables?

Should the fwupd meson config actually check if the file is in join_paths(sys_root, datadir, 'hwdata')?

I'm fine with this change but just wondering if there is something more missing.

Cheers,

-Mikko

#4 lore raw
Quoted 25 lines · Mikko Rapeli

Hi,

Quoted 21 lines · Martin Jansa
Quoted 14 lines · Mikko Rapeli
Quoted 5 lines · On Mon, Jul 14, 2025 at 03:46:57PM +0200, [email protected] wrote:

From: Martin Jansa <[email protected]>

* it's in RSS as fwupd/2.0.12/recipe-sysroot/usr/share/hwdata/usb.ids but meson is searching the paths on host with:

Quoted 7 lines
  # look for usb.ids in both of the Debian and Fedora locations,
  # and fall back to the system datadir in case we're building in a venv or prefix
  vendor_ids_dir = get_option('vendor_ids_dir')
  if vendor_ids_dir == ''
    vendor_ids_dir = join_paths(datadir, 'misc')
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = join_paths(datadir, 'hwdata')
Quoted 1 line

Isn't this the same as ${datadir}/hwdata ?

It is the same value, but on my host, I don't have /usr/share/hwdata/usb.ids so meson doesn't detect any existing vendor_ids_dir value and fails.

Quoted 5 lines
Quoted 2 lines

With this change it accepts passed vendor_ids_dir value without testing it's existence (neither on host nor in RSS).

Previous version of fwupd update patches did not include "hwdata" as build dependency so recipe sysroot did not have usb.ids file

and previous version wasn't failing like this, it started to fail only after the upgrade as
https://github.com/fwupd/fwupd/commit/61a863de8dd429be8c393ec267d63db78de71b76#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4
was introduced in version 2.

The hwdata dependency added in v2 might not be needed, I guess it should be runtime dependency for libfwupdplugin not build time.

Quoted 4 lines

but now it should have. Then meson.bbclass is setting datadir so I'm wondering if there is a bug in meson.bbclass or in these fwupd side scripts that they only check the host paths on not the recipe sysroot ones? Is fwupd not using the correct variables?

Yes it checks the paths on host not in RSS as said in commit message.

Quoted 2 lines

Should the fwupd meson config actually check if the file is in join_paths(sys_root, datadir, 'hwdata')?

Something like this might work, but not sure where you expect sys_root to be defined. I see it added as a property by meson.bbclass, but doing just this causes:
ERROR: Unknown variable "sys_root".

#5 lore raw
Quoted 48 lines · Martin Jansa
Quoted 25 lines · Mikko Rapeli

Hi,

Quoted 21 lines · Martin Jansa
Quoted 14 lines · Mikko Rapeli
Quoted 5 lines · On Mon, Jul 14, 2025 at 03:46:57PM +0200, [email protected] wrote:

From: Martin Jansa <[email protected]>

* it's in RSS as fwupd/2.0.12/recipe-sysroot/usr/share/hwdata/usb.ids but meson is searching the paths on host with:

Quoted 7 lines
  # look for usb.ids in both of the Debian and Fedora locations,
  # and fall back to the system datadir in case we're building in a venv or prefix
  vendor_ids_dir = get_option('vendor_ids_dir')
  if vendor_ids_dir == ''
    vendor_ids_dir = join_paths(datadir, 'misc')
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = join_paths(datadir, 'hwdata')
Quoted 1 line

Isn't this the same as ${datadir}/hwdata ?

It is the same value, but on my host, I don't have /usr/share/hwdata/usb.ids so meson doesn't detect any existing vendor_ids_dir value and fails.

Quoted 5 lines
Quoted 2 lines

With this change it accepts passed vendor_ids_dir value without testing it's existence (neither on host nor in RSS).

Previous version of fwupd update patches did not include "hwdata" as build dependency so recipe sysroot did not have usb.ids file

and previous version wasn't failing like this, it started to fail only after the upgrade as
https://github.com/fwupd/fwupd/commit/61a863de8dd429be8c393ec267d63db78de71b76#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4
was introduced in version 2.

The hwdata dependency added in v2 might not be needed, I guess it should be runtime dependency for libfwupdplugin not build time.

Quoted 4 lines

but now it should have. Then meson.bbclass is setting datadir so I'm wondering if there is a bug in meson.bbclass or in these fwupd side scripts that they only check the host paths on not the recipe sysroot ones? Is fwupd not using the correct variables?

Yes it checks the paths on host not in RSS as said in commit message.

Quoted 7 lines
Quoted 2 lines

Should the fwupd meson config actually check if the file is in join_paths(sys_root, datadir, 'hwdata')?

Something like this might work, but not sure where you expect sys_root to be defined. I see it added as a property by meson.bbclass, but doing just this causes:
ERROR: Unknown variable "sys_root".

And if you change the meson.build like this then you would need to set FWUPD_DATADIR_VENDOR_IDS without the sys_root prefix, because in runtime it will be just ${datadir}/hwdata again.

#6 lore raw

Hi,

Quoted 48 lines · Martin Jansa
Quoted 47 lines · Martin Jansa
Quoted 22 lines · Mikko Rapeli
Quoted 21 lines · Martin Jansa
Quoted 14 lines · Mikko Rapeli
Quoted 5 lines · On Mon, Jul 14, 2025 at 03:46:57PM +0200, [email protected] wrote:

From: Martin Jansa <[email protected]>

* it's in RSS as fwupd/2.0.12/recipe-sysroot/usr/share/hwdata/usb.ids but meson is searching the paths on host with:

Quoted 7 lines
  # look for usb.ids in both of the Debian and Fedora locations,
  # and fall back to the system datadir in case we're building in a venv or prefix
  vendor_ids_dir = get_option('vendor_ids_dir')
  if vendor_ids_dir == ''
    vendor_ids_dir = join_paths(datadir, 'misc')
    if not fs.is_file(join_paths(vendor_ids_dir, 'usb.ids'))
      vendor_ids_dir = join_paths(datadir, 'hwdata')
Quoted 1 line

Isn't this the same as ${datadir}/hwdata ?

It is the same value, but on my host, I don't have /usr/share/hwdata/usb.ids so meson doesn't detect any existing vendor_ids_dir value and fails.

Quoted 5 lines
Quoted 2 lines

With this change it accepts passed vendor_ids_dir value without testing it's existence (neither on host nor in RSS).

Previous version of fwupd update patches did not include "hwdata" as build dependency so recipe sysroot did not have usb.ids file

and previous version wasn't failing like this, it started to fail only after the upgrade as
https://github.com/fwupd/fwupd/commit/61a863de8dd429be8c393ec267d63db78de71b76#diff-30d8f6be6320feeacf686be94f48c70869b52630e01ea625f0f15adc0d57c3e4
was introduced in version 2.

The hwdata dependency added in v2 might not be needed, I guess it should be runtime dependency for libfwupdplugin not build time.

Quoted 4 lines

but now it should have. Then meson.bbclass is setting datadir so I'm wondering if there is a bug in meson.bbclass or in these fwupd side scripts that they only check the host paths on not the recipe sysroot ones? Is fwupd not using the correct variables?

Yes it checks the paths on host not in RSS as said in commit message.

Quoted 2 lines

Should the fwupd meson config actually check if the file is in join_paths(sys_root, datadir, 'hwdata')?

Quoted 8 lines
Quoted 4 lines

Something like this might work, but not sure where you expect sys_root to be defined. I see it added as a property by meson.bbclass, but doing just this causes:
ERROR: Unknown variable "sys_root".

And if you change the meson.build like this then you would need to set FWUPD_DATADIR_VENDOR_IDS without the sys_root prefix, because in runtime it will be just ${datadir}/hwdata again.

Right, so your patch is the way out for now. Thanks for checking this!

Cheers,

-Mikko