forked from pool/fwupd
Accepting request 726463 from Base:System
OBS-URL: https://build.opensuse.org/request/show/726463 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/fwupd?expand=0&rev=21
This commit is contained in:
commit
cc189d4840
281
fwupd-bsc1143905-hash-the-source-files.patch
Normal file
281
fwupd-bsc1143905-hash-the-source-files.patch
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
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
|
||||||
|
|
@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 26 06:48:00 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
|
||||||
|
|
||||||
|
- Add fwupd-bsc1143905-hash-the-source-files.patch to hash the
|
||||||
|
source files instead of libfwupdprivate.a to avoid the checksum
|
||||||
|
change due to the random naming LTO profile sections
|
||||||
|
(bsc#1143905)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jul 24 08:12:17 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
|
Wed Jul 24 08:12:17 UTC 2019 - Gary Ching-Pang Lin <glin@suse.com>
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ URL: https://fwupd.org/
|
|||||||
Source: https://github.com/hughsie/%{name}/archive/%{version}.tar.gz
|
Source: https://github.com/hughsie/%{name}/archive/%{version}.tar.gz
|
||||||
# PATCH-FIX-OPENSUSE fwupd-bsc1130056-shim-path.patch bsc#1130056
|
# PATCH-FIX-OPENSUSE fwupd-bsc1130056-shim-path.patch bsc#1130056
|
||||||
Patch1: fwupd-bsc1130056-change-shim-path.patch
|
Patch1: fwupd-bsc1130056-change-shim-path.patch
|
||||||
|
# PATCH-FIX-UPSTRAEM fwupd-bsc1143905-hash-the-source-files.patch bsc#1143905
|
||||||
|
Patch2: fwupd-bsc1143905-hash-the-source-files.patch
|
||||||
BuildRequires: dejavu-fonts
|
BuildRequires: dejavu-fonts
|
||||||
BuildRequires: docbook-utils-minimal
|
BuildRequires: docbook-utils-minimal
|
||||||
BuildRequires: gcab
|
BuildRequires: gcab
|
||||||
@ -143,6 +145,7 @@ the local machine.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
for file in $(grep -l %{_bindir}/env . -r); do
|
for file in $(grep -l %{_bindir}/env . -r); do
|
||||||
sed -i "s|%{_bindir}/env python3|%{_bindir}/python3|" $file
|
sed -i "s|%{_bindir}/env python3|%{_bindir}/python3|" $file
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user