Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 6fb0ad7

Browse files
authored
Merge pull request #311 from pohly/firmware-update
groupcheck, fwupd, fwupdate
2 parents 63f5fe5 + 50b52c4 commit 6fb0ad7

32 files changed

Lines changed: 1156 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 28430ac46d7b319795885dbc554926747b75d04c Mon Sep 17 00:00:00 2001
2+
From: Patrick Ohly <patrick.ohly@intel.com>
3+
Date: Fri, 21 Jul 2017 17:15:51 +0200
4+
Subject: [PATCH] disable service and backend
5+
6+
This is a minimal patch which disables building the service and
7+
backend. This makes it possible to use the normal libpolkit-gobject
8+
together with a service replacement like groupcheck.
9+
10+
Upstream-Status: Inappropriate [Solved independently by upstream in a later commit]
11+
12+
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
13+
---
14+
configure.ac | 6 ------
15+
src/Makefile.am | 3 ++-
16+
2 files changed, 2 insertions(+), 7 deletions(-)
17+
18+
diff --git a/configure.ac b/configure.ac
19+
index 21590b2..5774876 100644
20+
--- a/configure.ac
21+
+++ b/configure.ac
22+
@@ -134,12 +134,6 @@ AC_ARG_WITH(mozjs, AS_HELP_STRING([--with-mozjs=@<:@mozjs185/mozjs-17.0|auto@:>@
23+
with_mozjs=auto)
24+
AS_IF([test x${with_mozjs} != xauto], [
25+
PKG_CHECK_MODULES(LIBJS, ${with_mozjs})
26+
-], [
27+
- PKG_CHECK_MODULES(LIBJS, [mozjs185], have_mozjs185=yes, have_mozjs185=no)
28+
- AS_IF([test x${have_mozjs185} = xno], [
29+
- PKG_CHECK_MODULES(LIBJS, [mozjs-17.0], have_mozjs17=yes,
30+
- [AC_MSG_ERROR([Could not find mozjs185 or mozjs-17.0; see http://ftp.mozilla.org/pub/mozilla.org/js/])])
31+
- ])
32+
])
33+
AC_SUBST(LIBJS_CFLAGS)
34+
AC_SUBST(LIBJS_LIBS)
35+
diff --git a/src/Makefile.am b/src/Makefile.am
36+
index 09fc7b3..be7cd72 100644
37+
--- a/src/Makefile.am
38+
+++ b/src/Makefile.am
39+
@@ -1,5 +1,6 @@
40+
41+
-SUBDIRS = polkit polkitbackend polkitagent programs
42+
+SUBDIRS = polkit
43+
+# polkitbackend polkitagent programs
44+
45+
if BUILD_EXAMPLES
46+
SUBDIRS += examples
47+
--
48+
2.11.0
49+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0"?>
2+
<its:rules xmlns:its="http://www.w3.org/2005/11/its"
3+
version="2.0">
4+
<its:translateRule selector="//*" translate="no"/>
5+
<its:translateRule selector="//action/description |
6+
//action/message"
7+
translate="yes"/>
8+
</its:rules>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0"?>
2+
<locatingRules>
3+
<locatingRule name="polkit policy" pattern="*.policy">
4+
<documentRule localName="policyconfig" target="polkit.its"/>
5+
</locatingRule>
6+
</locatingRules>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FILESEXTRAPATHS_prepend_df-refkit-groupcheck := "${THISDIR}/files:"
2+
3+
# Replace polkit backend engine with groupcheck.
4+
# This is done by splitting out the client library
5+
# and causing it to pull in groupcheck.
6+
PACKAGES_prepend_df-refkit-groupcheck = "${PN}-lib "
7+
FILES_${PN}-lib = " \
8+
${libdir}/libpolkit-gobject*.so.* \
9+
"
10+
RDEPENDS_${PN}-lib = "groupcheck"
11+
12+
# In addition, we disable building the server and backend,
13+
# because that pulls in the heavy mozjs + dependencies.
14+
SRC_URI_append_df-refkit-groupcheck = " file://0001-disable-service-and-backend.patch"
15+
DEPENDS_remove_df-refkit-groupcheck = "mozjs"
16+
EXTRA_OECONF_append_df-refkit-groupcheck = " --disable-test"
17+
SYSTEMD_SERVICE_${PN}_df-refkit-groupcheck = ""
18+
do_install_append_df-refkit-groupcheck () {
19+
rm -rf ${D}${systemd_system_unitdir}
20+
rm -rf ${D}${libdir}/systemd
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# groupcheck only looks at auxiliary groups.
2+
# In order to grant root processes access to
3+
# actions that are reserved for administrators,
4+
# "root" must be in the "adm" group.
5+
6+
do_install_append_df-refkit-groupcheck () {
7+
if grep -q '^adm:.*:$' ${D}${datadir}/base-passwd/group.master; then
8+
sed -i -e 's/^\(adm:.*:\)$/\1root/' ${D}${datadir}/base-passwd/group.master
9+
elif grep -q '^adm:.*:\(.*\)$' ${D}${datadir}/base-passwd/group.master; then
10+
sed -i -e 's/^\(adm:.*:\)\(.*\)$/\1root,\2/' ${D}${datadir}/base-passwd/group.master
11+
else
12+
bbfatal "adding root to adm group impossible"
13+
fi
14+
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Use this class in recipes which depend on other recipes
2+
# or classes that might not be available. The class will then
3+
# will skip the current recipe with a suitable explanation.
4+
#
5+
# The expressions that define whether a component is available must
6+
# expand to something that Python considers as False (empty string,
7+
# None, etc.) or one of the values accepted by oe.types.boolean()
8+
# (0/1/True/False/Yes/No).
9+
#
10+
# Example:
11+
#
12+
# DEPENDS = "foobar"
13+
#
14+
# inherit check-available
15+
# CHECK_AVAILABLE[foobar] = "${HAVE_FOOBAR}"
16+
#
17+
# inherit ${@ check_available_class(d, 'meson', ${HAVE_MESON}) }
18+
19+
def check_available(available):
20+
if isinstance(available, bool):
21+
return available
22+
elif isinstance(available, str) and available != '':
23+
return oe.types.boolean(available)
24+
else:
25+
return bool(available)
26+
27+
def check_available_add_missing(d, component):
28+
missing = d.getVar('_check_available_missing')
29+
if missing is None:
30+
missing = []
31+
missing.append(component)
32+
d.setVar('_check_available_missing', missing)
33+
34+
def check_available_class(d, classname, available):
35+
if check_available(available):
36+
return classname
37+
else:
38+
check_available_add_missing(d, classname + '.bbclass')
39+
return ''
40+
41+
python () {
42+
missing = d.getVar('_check_available_missing')
43+
if missing is None:
44+
missing = []
45+
for component in (d.getVarFlags('CHECK_AVAILABLE') or []):
46+
available = d.getVarFlag('CHECK_AVAILABLE', component)
47+
try:
48+
if not check_available(available):
49+
missing.append(component)
50+
except ValueError as ex:
51+
# This typically is a user error, like setting an invalid value.
52+
# Without additional information about the exact component which
53+
# fails, the error would be hard to find as "bitbake -e" also just
54+
# throws the error.
55+
import sys
56+
tb = sys.exc_info()[2]
57+
raise ValueError('evaluating CHECK_AVAILABLE[%s] = %s = %s failed: %s' %
58+
(component,
59+
d.getVarFlag('CHECK_AVAILABLE', component, False),
60+
available,
61+
ex)).with_traceback(tb)
62+
63+
if missing:
64+
raise bb.parse.SkipRecipe('some required components are unavailable: ' + ', '.join(missing))
65+
}

meta-refkit-core/classes/refkit-image.bbclass

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,9 @@ IMAGE_FEATURES += " \
8888
REFKIT_IMAGE_EXTRA_FEATURES ?= ""
8989

9090
# Inheriting swupd-image.bbclass only works when meta-swupd is in
91-
# bblayers.conf, which may or may not be the case. If not available,
92-
# any image recipe using swupd gets skipped. This has to be done in
93-
# two different functions, raising bb.parse.SkipPackage already while
94-
# parsing fails (bitbake datastore not ready yet).
95-
python () {
96-
if 'swupd' in d.getVar('IMAGE_FEATURES').split() and not d.getVar('LAYERVERSION_meta-swupd'):
97-
raise bb.parse.SkipPackage('meta-swupd is not available, must be added to bblayers.conf')
98-
}
99-
def refkit_swupd_image_class(d):
100-
if 'swupd' in d.getVar('IMAGE_FEATURES').split() and d.getVar('LAYERVERSION_meta-swupd'):
101-
return 'refkit-swupd-image'
102-
else:
103-
return ''
104-
# Here we optionally inherit refkit-swupd-image.bbclass, which configures and activates swupd.
105-
inherit ${@refkit_swupd_image_class(d)}
91+
# bblayers.conf, which may or may not be the case.
92+
inherit check-available
93+
inherit ${@ check_available_class(d, 'swupd-image', ${HAVE_META_SWUPD}) if 'swupd' in d.getVar('IMAGE_FEATURES').split() else '' }
10694

10795
# Optionally inherit OSTree system update support.
10896
inherit ${@oe.utils.all_distro_features(d, 'ostree', 'ostree-image')}

meta-refkit-core/conf/distro/include/refkit-config.inc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ REFKIT_DEFAULT_DISTRO_FEATURES += "ostree"
6464
# This is needed for OSTree and flatpack.
6565
REFKIT_DEFAULT_DISTRO_FEATURES += "usrmerge"
6666

67+
# Replaces polkit with groupcheck. In contrast to polkit,
68+
# groupcheck has very minimal dependencies.
69+
REFKIT_DEFAULT_DISTRO_FEATURES += "refkit-groupcheck"
70+
6771
# Remove currently unsupported distro features from global defaults
6872
REFKIT_DEFAULT_DISTRO_FEATURES_REMOVE += "x11 3g"
6973

@@ -76,6 +80,7 @@ DISTRO_FEATURES_OVERRIDES += " \
7680
refkit-computervision \
7781
refkit-gateway \
7882
refkit-industrial \
83+
refkit-groupcheck \
7984
"
8085

8186
#########################################################################

meta-refkit-core/conf/layer.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ HAVE_ATOP ??= "${HAVE_META_OE}"
5656
HAVE_CRYPTSETUP ??= "${HAVE_META_OE}"
5757
HAVE_CRYPTSETUP ??= "${HAVE_META_OE}"
5858
HAVE_CAN_UTILS ??= "${HAVE_META_OE}"
59+
HAVE_EFIBOOTMGR ??= "${HAVE_META_OE}"
5960
HAVE_VIM ??= "${HAVE_META_OE}"
6061
HAVE_HTOP ??= "${HAVE_META_OE}"
62+
HAVE_MESON ??= "${HAVE_META_OE}"
6163
HAVE_META_SECURITY = "${@ bb.utils.contains('BBFILE_COLLECTIONS', 'security', 'True', 'False', d) }"
6264
HAVE_KEYUTILS ??= "${HAVE_META_SECURITY}"
6365
HAVE_META_NETWORKING = "${@ bb.utils.contains('BBFILE_COLLECTIONS', 'networking-layer', 'True', 'False', d) }"
@@ -69,3 +71,5 @@ HAVE_NODEJS ??= "${HAVE_META_IOT_WEB}"
6971
HAVE_META_FLATPAK = "${@ bb.utils.contains('BBFILE_COLLECTIONS', 'flatpak-layer', 'True', 'False', d) }"
7072
HAVE_FLATPAK ??= "${HAVE_META_FLATPAK}"
7173
HAVE_OSTREE ??= "${HAVE_META_FLATPAK}"
74+
75+
HAVE_META_SWUPD = "${@ bb.utils.contains('BBFILE_COLLECTIONS', 'meta-swupd', 'True', 'False', d) }"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From f724e53c404fc036809a2359a9c3332e562c4b40 Mon Sep 17 00:00:00 2001
2+
From: Patrick Ohly <patrick.ohly@intel.com>
3+
Date: Thu, 13 Jul 2017 17:44:35 +0200
4+
Subject: [PATCH 1/2] meson: avoid unnecessary gdk dependency
5+
6+
gdk is only needed by the asb_plugin_font, which only gets built when
7+
both appstream-build and fonts are enabled. Therefore checking for the
8+
dependency should also be limited to that case, otherwise gdk has to
9+
be provided during compilation also in cases where it is not used at
10+
all.
11+
12+
Upstream-Status: Backport [https://github.com/hughsie/appstream-glib/pull/182]
13+
14+
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
15+
---
16+
meson.build | 2 +-
17+
1 file changed, 1 insertion(+), 1 deletion(-)
18+
19+
diff --git a/meson.build b/meson.build
20+
index b0912cc..c88bbdc 100644
21+
--- a/meson.build
22+
+++ b/meson.build
23+
@@ -55,7 +55,6 @@ gmodule = dependency('gmodule-2.0', version : glib_ver)
24+
giounix = dependency('gio-unix-2.0', version : glib_ver)
25+
libarchive = dependency('libarchive')
26+
soup = dependency('libsoup-2.4', version : '>= 2.51.92')
27+
-gdk = dependency('gdk-3.0')
28+
json_glib = dependency('json-glib-1.0')
29+
gdkpixbuf = dependency('gdk-pixbuf-2.0', version : '>= 2.31.5')
30+
libgcab = dependency('libgcab-1.0', required : false)
31+
@@ -78,6 +77,7 @@ if get_option('enable-builder')
32+
conf.set('HAVE_ALPM', 1)
33+
endif
34+
if get_option('enable-fonts')
35+
+ gdk = dependency('gdk-3.0')
36+
conf.set('HAVE_FONTS', 1)
37+
freetype = dependency('freetype2', version : '>= 9.10.0')
38+
fontconfig = dependency('fontconfig')
39+
--
40+
2.11.0
41+

0 commit comments

Comments
 (0)