Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
fwupd.16495
fwupd-bsc1143905-hash-the-source-files.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fwupd-bsc1143905-hash-the-source-files.patch of Package fwupd.16495
From 14354a72483c5bc88928015a9154ad2055cefabd Mon Sep 17 00:00:00 2001 From: Richard Hughes <richard@hughsie.com> Date: Sun, 25 Aug 2019 08:31:07 +0100 Subject: [PATCH 1/2] Split up source files in the build script (cherry picked from commit 22d482c244ea8ab6b0e2a417ecc08f2d1949b65f) --- src/meson.build | 120 +++++++++++++++--------------------------------- 1 file changed, 36 insertions(+), 84 deletions(-) diff --git a/src/meson.build b/src/meson.build index 92283179..a9f51fe2 100644 --- a/src/meson.build +++ b/src/meson.build @@ -7,7 +7,26 @@ endif keyring_deps = [] keyring_src = [] test_deps = [] -init_src = [] +libfwupdprivate_src = [ + 'fu-archive.c', + 'fu-chunk.c', + 'fu-common.c', + 'fu-common-cab.c', + 'fu-common-guid.c', + 'fu-common-version.c', + 'fu-device.c', + 'fu-device-locker.c', + 'fu-hwids.c', + 'fu-history.c', + 'fu-io-channel.c', + 'fu-plugin.c', + 'fu-progressbar.c', + 'fu-quirks.c', + 'fu-smbios.c', + 'fu-test.c', + 'fu-udev-device.c', + 'fu-usb-device.c', +] if get_option('gpg') keyring_src += 'fu-keyring-gpg.c' @@ -24,30 +43,13 @@ if get_option('pkcs7') endif if get_option('systemd') - init_src += 'fu-systemd.c' + libfwupdprivate_src += 'fu-systemd.c' endif libfwupdprivate = static_library( 'fwupdprivate', sources : [ - init_src, - 'fu-archive.c', - 'fu-common.c', - 'fu-common-guid.c', - 'fu-common-version.c', - 'fu-chunk.c', - 'fu-device.c', - 'fu-device-locker.c', - 'fu-hwids.c', - 'fu-history.c', - 'fu-io-channel.c', - 'fu-plugin.c', - 'fu-progressbar.c', - 'fu-quirks.c', - 'fu-smbios.c', - 'fu-test.c', - 'fu-udev-device.c', - 'fu-usb-device.c', + libfwupdprivate_src, ], include_directories : [ include_directories('..'), @@ -57,11 +59,12 @@ libfwupdprivate = static_library( giounix, gudev, gusb, - soup, - sqlite, libarchive, + libgcab, libjsonglib, libxmlb, + soup, + sqlite, valgrind, ], link_with : [ @@ -185,34 +188,17 @@ fwupdtool = executable( sources : [ 'fu-tool.c', keyring_src, - init_src, - 'fu-archive.c', - 'fu-chunk.c', - 'fu-common.c', - 'fu-common-cab.c', - 'fu-common-guid.c', - 'fu-common-version.c', + libfwupdprivate_src, 'fu-config.c', - 'fu-keyring.c', - 'fu-keyring-result.c', - 'fu-engine.c', - 'fu-hwids.c', 'fu-debug.c', - 'fu-device.c', 'fu-device-list.c', - 'fu-device-locker.c', + 'fu-engine.c', 'fu-idle.c', 'fu-install-task.c', - 'fu-io-channel.c', 'fu-keyring.c', + 'fu-keyring-result.c', 'fu-keyring-utils.c', - 'fu-history.c', - 'fu-plugin.c', 'fu-plugin-list.c', - 'fu-quirks.c', - 'fu-smbios.c', - 'fu-udev-device.c', - 'fu-usb-device.c', 'fu-util-common.c', ], include_directories : [ @@ -269,35 +255,18 @@ executable( fu_hash, sources : [ keyring_src, - init_src, - 'fu-archive.c', - 'fu-chunk.c', - 'fu-common.c', - 'fu-common-cab.c', - 'fu-common-guid.c', - 'fu-common-version.c', + libfwupdprivate_src, 'fu-config.c', - 'fu-keyring.c', - 'fu-keyring-result.c', - 'fu-engine.c', - 'fu-main.c', - 'fu-hwids.c', 'fu-debug.c', - 'fu-device.c', 'fu-device-list.c', - 'fu-device-locker.c', + 'fu-engine.c', 'fu-idle.c', - 'fu-io-channel.c', 'fu-install-task.c', 'fu-keyring.c', + 'fu-keyring-result.c', 'fu-keyring-utils.c', - 'fu-history.c', - 'fu-plugin.c', + 'fu-main.c', 'fu-plugin-list.c', - 'fu-quirks.c', - 'fu-smbios.c', - 'fu-udev-device.c', - 'fu-usb-device.c', ], include_directories : [ include_directories('..'), @@ -343,36 +312,19 @@ if get_option('tests') fu_hash, sources : [ keyring_src, - init_src, - 'fu-self-test.c', - 'fu-archive.c', - 'fu-chunk.c', - 'fu-common.c', - 'fu-common-cab.c', - 'fu-common-guid.c', - 'fu-common-version.c', + libfwupdprivate_src, 'fu-config.c', - 'fu-engine.c', - 'fu-keyring.c', - 'fu-keyring-utils.c', - 'fu-hwids.c', - 'fu-device.c', 'fu-device-list.c', - 'fu-device-locker.c', - 'fu-history.c', + 'fu-engine.c', 'fu-idle.c', 'fu-install-task.c', - 'fu-io-channel.c', 'fu-keyring.c', 'fu-keyring-result.c', - 'fu-plugin.c', + 'fu-keyring-utils.c', 'fu-plugin-list.c', - 'fu-progressbar.c', - 'fu-quirks.c', + 'fu-self-test.c', 'fu-smbios.c', 'fu-test.c', - 'fu-udev-device.c', - 'fu-usb-device.c', ], include_directories : [ include_directories('..'), -- 2.22.0 From 4e7dc8140865223bc23685b94c2ba10fb3f2e152 Mon Sep 17 00:00:00 2001 From: Richard Hughes <richard@hughsie.com> Date: Sun, 25 Aug 2019 09:50:28 +0100 Subject: [PATCH 2/2] Hash the source files when generating the daemon hash The unstripped static library changes between builds with profiling metadata when compiling with LTO. Fixes https://github.com/fwupd/fwupd/issues/1298 (cherry picked from commit 5611fd0581b1c28de97321daefae798a78f475b8) --- src/fu-hash.py | 17 +++++++++-------- src/meson.build | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/fu-hash.py b/src/fu-hash.py index 13b20fc6..639ca37a 100644 --- a/src/fu-hash.py +++ b/src/fu-hash.py @@ -16,17 +16,18 @@ def usage(return_code): out = sys.stdout else: out = sys.stderr - out.write("usage: fu-hash.py <DAEMON> <HEADER>") + out.write("usage: fu-hash.py <HEADER> <SRC1> <SRC2>...") sys.exit(return_code) if __name__ == '__main__': if {'-?', '--help', '--usage'}.intersection(set(sys.argv)): usage(0) - if len(sys.argv) != 3: + if len(sys.argv) < 3: usage(1) - with open(sys.argv[1], 'rb') as f: - buf = f.read() - csum = hashlib.sha256(buf).hexdigest() - with open(sys.argv[2], 'w') as f2: - f2.write('#pragma once\n') - f2.write('#define FU_BUILD_HASH "%s"\n' % csum) + m = hashlib.sha256() + for argv in sys.argv[2:]: + with open(argv, 'rb') as f: + m.update(f.read()) + with open(sys.argv[1], 'w') as f2: + f2.write('#pragma once\n') + f2.write('#define FU_BUILD_HASH "%s"\n' % m.hexdigest()) diff --git a/src/meson.build b/src/meson.build index a9f51fe2..31513aea 100644 --- a/src/meson.build +++ b/src/meson.build @@ -174,11 +174,11 @@ resources_src = gnome.compile_resources( fu_hash = custom_target( 'fu-hash.h', - input : libfwupdprivate, + input : libfwupdprivate_src, output : 'fu-hash.h', command : [python3.path(), join_paths(meson.current_source_dir(), 'fu-hash.py'), - '@INPUT@', '@OUTPUT@'] + '@OUTPUT@', '@INPUT@'] ) fwupdtool = executable( -- 2.22.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor