Commit Graph

58 Commits

Author SHA1 Message Date
Richard Hughes
2d00cda464 Remove PLUGINBUILDDIR and use G_TEST_SRCDIR and G_TEST_BUILDDIR instead
This allows us to override the location we load data files from, which
allows us to do more kinds of installed tests in the future.

Also, move the global data/tests content into the place that it is used
as it was getting impossible to manage.
2021-10-21 18:36:22 +01:00
Richard Hughes
19abf996c7 Allow the daemon to request interactive action from the end user
The "return error and hope the client resubmits the firmware again"
pattern is clunky. There are two plugins doing this now, and about to
be one more.

This adds FwupdRequest which provides a structured way of asking the
user to perform an action, e.g. to replug the device or to press a
special key or button.

This replaces much of the UpdateMessage and UpdateImage API although
it is still used internally. Clients capable of processing the new
DeviceRequest signal should add REQUESTS to their feature flags.

Also, this allows us go back to the old meaning of _NEEDS_BOOTLOADER,
which was "needs rebooting into a bootloader mode" rather than the
slightly weird "user needs to do something and resubmit request".
2021-07-14 17:03:50 +01:00
Richard Hughes
6bc2d155a9 trivial: Remove a build warning by including Json properly 2021-05-17 09:27:54 +01:00
Richard Hughes
5e95cae0c4 trivial: Fix CI by including the version symbols 2021-04-30 16:07:10 +01:00
Richard Hughes
c77b4f03a2 Check the versions of libfwupd and libfwupdplugin at startup
This prevents super-hard-to-debug crashes like we saw in #3197 where the user
was mixing PPAs and official versions.
2021-04-30 15:00:04 +01:00
Richard Hughes
fdd507957a Switch from libproxy to GProxyResolver
GProxyResolver will use libproxy only when required. TIL.
2021-04-28 15:52:45 +01:00
Richard Hughes
f992fb75cd Use libproxy to get the system proxy setting for a given URL 2021-04-26 16:30:13 +01:00
Norbert Kamiński
76e19930a8 fwupd port for BSD distros
Signed-off-by: Norbert Kamiński <norbert.kaminski@3mdeb.com>
2021-03-19 17:05:09 +00:00
Richard Hughes
01a30aa6de Add support for oss-fuzz 2021-02-08 09:17:03 +00:00
Richard Hughes
9b3f7aba82 trivial: Remove unused -Dlink_language support 2021-02-07 16:59:57 +00:00
Richard Hughes
3f7ee4d5a1 libfwupd: Return the progress information using the correct GMainContext
We don't want the (shared) progress notifications going to the thread-default
GMainContext by default as this changes behaviour (ABI?) with older libfwupd
versions.

If the client really does want progress notifications to go to a different
GMainContext they it can call fwupd_client_set_main_context() with the desired
context, e.g. g_main_context_get_thread_default() or g_main_context_new().

This has the intended side effect of returning progress and state notifications
to the main thread, which is typically (but not always) the thread that created
the FwupdClient object.
2021-01-08 16:48:34 +00:00
Richard Hughes
92bfc1b6a8 trivial: Do not hard-depend on newer GLib versions 2021-01-08 09:10:32 +00:00
Richard Hughes
a3c6e8a8bd trivial: Fix -Dcurl=false with latest code 2021-01-08 09:10:29 +00:00
Richard Hughes
2c1f08d874 libfwupd: Do not allow multiple threads to create the GDBusProxy
When using the sync API entrypoints like fwupd_client_get_devices() these call
into fwupd_client_connect() to ensure the proxy is set up. This is not thread
safe and chaos ensues if you call two sync functions from different threads,
like GNOME Software does at startup...

Use a mutex to protect access to this shared resource.

Original test code from Philip Withnall, slightly tweaked by me. Thanks!
2021-01-07 16:39:08 +00:00
Richard Hughes
f1c79a8eae trivial: Fix a warning generated by new versions of meson
This fixes:

    DEPRECATION: Library fwupd was passed to the "libraries" keyword argument of
    a previous call to generate() method instead of first positional argument.
    Adding fwupd to "Requires" field, but this is a deprecated behaviour that
    will change in a future version of Meson.
2021-01-05 17:47:23 +00:00
Richard Hughes
f9fe19f7f6 Make libcurl optional for fuzzing
For fuzzing we want to exclude libcurl support as it depends on other very heavy
libraries like OpenSSL or libtasn which make the fuzzing binary much larger if
linked statically.
2021-01-04 16:22:36 +00:00
Richard Hughes
2e5c1d15bc Do not hardcode building shared libraries
Respect the -Ddefault_library meson define.
2021-01-04 15:26:28 +00:00
Richard Hughes
93867eda8e Allow linking with the CXX linker
This is required by oss-fuzz, for non-obvious reasons!
2020-12-14 20:34:20 +00:00
Richard Hughes
7115d6c6a6 Do not leak global cargs out of libfwupd
This gives us warnings if a specific binary redefines the domain.
2020-12-08 20:53:59 +00:00
Richard Hughes
173d389fa5 Register the SoupSession gtype when required
This allows old gnome-software clients to work with new fwupd versions.
2020-11-19 19:39:37 +00:00
Richard Hughes
3a73c342ba Switch from libsoup to libcurl
The former drags on glib-networking and then gsettings-desktop-schemas, which
add over 5Mb to the minimal IoT and CoreOS composes. Everything already uses
libcurl (even NetworkManager!) and so this is an easy way to reduce image size.
2020-11-19 19:39:37 +00:00
Mario Limonciello
90e80e6752 trivial: allow building as a subproject 2020-11-13 06:17:47 -06:00
Richard Hughes
7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00
Richard Hughes
7c8a830659 libfwupd: Add async versions of the library for GUI tools
Rather than force the GUI to interact with fwupd using threads, provide
async versions so thay can be run without blocking the UI thread.
2020-09-03 15:46:57 +01:00
Richard Hughes
173acd2e07 Add FwupdSecurityAttr to libfwupd
This will be used to store security attributes about platform security.
2020-05-11 17:52:41 +01:00
Mario Limonciello
11a7423d24 trivial: skip some self tests if system isn't set up properly
```
ok 10 /fwupd/client{remotes} # SKIP no valid daemon: Error calling StartServiceByName for org.freedesktop.fwupd: Failed to activate service 'org.freedesktop.fwupd': timed out (service_start_timeout=25000ms)
ok 11 /fwupd/client{devices} # SKIP no valid daemon: Error calling StartServiceByName for org.freedesktop.fwupd: Failed to activate service 'org.freedesktop.fwupd': timed out (service_start_timeout=25000ms)

```
2020-04-10 06:50:51 -05:00
Richard Hughes
a1de20665a Load the signature to get the aliased CDN-safe version of the metadata
Switch to downloading the signature first, which we can then load to get the
suffixed build-specific URL of the actual metadata file. You need to have
libjcat 0.1.1 installed and fwupd built against the new version for this to
work.

Fixes https://github.com/fwupd/fwupd/issues/391
2020-04-03 16:27:04 +01:00
Richard Hughes
3ee52ca4dd trivial: Include the Fwupd GIR in the FwupdPLugin GIR 2019-11-27 12:45:35 +00:00
Mario Limonciello
6b0e66354b Convert libfwupdprivate to a shared library libfwupdplugin 2019-11-27 11:32:43 +00:00
Richard Hughes
dce91204c9 Fix some typos spotted using codespell 2019-04-08 12:47:53 +01:00
Mario Limonciello
2df922c23d Move the core built-in 'fwupd' remote over to the dell-esrt plugin
This metadata is useless to other systems, so if compiling a custom
fwupd without -Dplugin_dell=true it shouldn't be included.
2019-04-02 07:18:29 -05:00
Richard Hughes
e7715fd1f2 trivial: Use newer Meson features 2019-02-28 11:17:35 -06:00
Mario Limonciello
3143bad0f5 fu-tool: Save device state to @LOCALSTATEDIR@/lib/fwupd/state.json on actions
This feature is turned on with the new fwupdtool option `--enable-json-state`

The intended use case is for ChromeOS to be able to save information about
devices on the system when `fwupdtool update` was run to display in the UX at
a later time.
2019-02-28 10:32:45 -06:00
Richard Hughes
6b78d64987 Add fwupd_guid_from_string() to drop dep on uuid
This also allows us to write mixed-endian structures and adds tests. As part of
this commit we've also changed the API of something that's not yet been in any
tarball release, so no pitchforks please.
2019-02-06 14:48:04 +00:00
Richard Hughes
592baedfff Export some of the GUID functionality 2019-02-04 15:19:57 +00:00
Richard Hughes
bcf875ff3b trivial: Don't use AppStream-glib in libfwupd
It's only used in one place, and that's for checking against very old versions
of the running daemon.
2018-10-11 07:54:01 +01:00
Robert Ancell
911e40f1aa Fix Vala bindings:
- Name the bindings the same as the pkgconfig file
 - Update the GIR bindings to include the appropriate header file which updates
   the Vala bindings
2018-03-07 09:21:31 +00:00
Robert Ancell
5c535a53ce Generate Vala bindings 2018-02-26 06:04:27 +00:00
Richard Hughes
b58104895d trivial: Add fwupd_build_history_report_json() for future use 2018-01-11 21:28:22 +00:00
Richard Hughes
d0cff7caec Remove autoconf-isms from the meson configure options
See https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting
2017-11-27 18:07:53 +00:00
Richard Hughes
f497dac356 trivial: Skip some self tests if the running fwupd is too old 2017-10-05 21:18:15 +01:00
Richard Hughes
d727929327 Generate the LD script from the GObject Introspection data
Also, we now verify the version script is correct each time we run the tests;
the consequences of getting the version script wrong are terribly bad.

Note, we can't actually use generated .map file for two reasons:

  1. We don't hard depend on GObject Introspection
  2. The map file is required to build the lib that the GIR is built from

To avoid the circular dep, and to ensure we don't change exported API
accidentaly actually check in a version of the version script to git.
2017-09-28 09:23:52 +01:00
Richard Hughes
80893e29fe trivial: Remove FwupdResult from libfwupd 2017-09-28 09:23:52 +01:00
Richard Hughes
b86ef97b36 trivial: Remove fwupd_remote_build_uri()
This also removes the long-deprecated fwupd_remote_get_uri() and fwupd_remote_get_uri_asc()
2017-09-28 09:23:52 +01:00
Richard Hughes
94110f5983 Remove some deprecated #define names and bump the soname
Also, bump soname as we're going to clean up a lot of things now.

Many thanks to Mario Limonciello for all the Debian-specific changes.
2017-09-28 09:23:52 +01:00
Richard Hughes
b4fd0dfd7d Move deprecated symbols to a new header
This does two things:

 * Allows new users of the library to see only the supported symbols
 * Allows us to ensure we're not using deprecated API internally

I can also use this in gnome-software in CI to make sure we're not using
deprecated API too. I don't think we're ready for a soname bump so we have to
hang on to the deprecated code for now.
2017-09-08 13:31:01 +01:00
Richard Hughes
c6afb51e32 Add a FirmwareBaseURI parameter to the remote configs
This allows somebody to mirror the CDN without resigning the metadata files.

Fixes: https://github.com/hughsie/fwupd/issues/186
2017-08-23 14:22:12 +01:00
Richard Hughes
2d95a71a0c Support embedded devices with local firmware metadata
In this mode, both the metadata and firmware is stored on the local filesystem
and distributed using a distribution system like OSTree.

Fixes https://github.com/hughsie/fwupd/issues/162
2017-07-28 17:41:24 +01:00
Patrick Ohly
eb03b0f33d meson: introspection optional
Calling g-ir-scanner when cross-compiling with bitbake/OpenEmbedded
fails because it calls the wrong ld (the one from the host). More work
will be needed in meson.bbclass and/or gobject-introspection.bbclass
to make it work.

In the meantime, having an option to turn of introspection is useful
perhaps also in other cases where the extra work is not needed. For
example, fwupd works fine also when it is off.

The name of the new meson option matches the --disable-introspection
that is used by some autotools-based projects.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2017-07-26 13:29:21 +01:00
Richard Hughes
7ee053df51 trivial: Actually generate complete GObjectIntrospection data 2017-06-21 15:32:08 +01:00