[Buildroot] [PATCH 1/1] package/polkit: switch to meson-package

Arnout Vandecappelle arnout at mind.be
Sat Sep 11 15:54:32 UTC 2021



On 30/08/2021 23:50, Fabrice Fontaine wrote:
> Switch to meson-package to fix the following build failure raised since
> bump of gobject-introspection to version 1.68.0 in commit
> abc110e3624aa4e8a9bd8595b3fdc0aec60845e0:
> 
> Could not find GIR file 'Gio-2.0.gir'; check XDG_DATA_DIRS or use --includedir
> error parsing file Polkit-1.0.gir: Failed to parse included gir Gio-2.0
> If the above error message is about missing .so libraries, then setting up GIR_EXTRA_LIBS_PATH in the .mk file should help.
> Typically like this: PKG_MAKE_ENV += GIR_EXTRA_LIBS_PATH="$(@D)/.libs"
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/26bcb21900b403db690d6005dbef0a76ff494d6c
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>

 Applied to master, thanks.

 Regards,
 Arnout

> ---
>  ...02-Improve-meson_post_install-script.patch | 124 ++++++++++++++++++
>  package/polkit/Config.in                      |   2 +-
>  package/polkit/polkit.mk                      |  27 ++--
>  3 files changed, 136 insertions(+), 17 deletions(-)
>  create mode 100644 package/polkit/0002-Improve-meson_post_install-script.patch
> 
> diff --git a/package/polkit/0002-Improve-meson_post_install-script.patch b/package/polkit/0002-Improve-meson_post_install-script.patch
> new file mode 100644
> index 0000000000..932bf88f59
> --- /dev/null
> +++ b/package/polkit/0002-Improve-meson_post_install-script.patch
> @@ -0,0 +1,124 @@
> +From 6c8022392713955c5ae0061e22b50a16a1c2252a Mon Sep 17 00:00:00 2001
> +From: Simon McVittie <smcv at collabora.com>
> +Date: Thu, 15 Jul 2021 12:36:05 +0000
> +Subject: [PATCH] Improve meson_post_install script
> +
> +[Retrieved from:
> +https://gitlab.freedesktop.org/polkit/polkit/-/commit/6c8022392713955c5ae0061e22b50a16a1c2252a]
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
> +---
> + .gitlab-ci.yml        |  3 +--
> + meson_post_install.py | 58 +++++++++++++++++++++++++++++++++++--------
> + 2 files changed, 49 insertions(+), 12 deletions(-)
> +
> +diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> +index 8ac3e9f..6d0abb4 100644
> +--- a/.gitlab-ci.yml
> ++++ b/.gitlab-ci.yml
> +@@ -26,8 +26,6 @@ build_stable:
> +   before_script:
> +     - dnf upgrade -y --nogpgcheck fedora-release fedora-repos*
> +     - dnf update -y && dnf install -y $DEPENDENCIES
> +-    - getent group polkitd >/dev/null || groupadd -r polkitd
> +-    - getent passwd polkitd >/dev/null || useradd -r -g polkitd -d / -s /sbin/nologin -c "User for polkitd" polkitd
> + 
> +   script:
> +     - meson setup 
> +@@ -43,6 +41,7 @@ build_stable:
> +     - meson compile -C builddir
> +     - meson test    -C builddir
> +     - meson install -C builddir
> ++    - DESTDIR=$(pwd)/DESTDIR meson install -C builddir
> +   artifacts:
> +     name: 'test logs'
> +     when: 'always'
> +diff --git a/meson_post_install.py b/meson_post_install.py
> +index 0a0fccf..0ab7469 100644
> +--- a/meson_post_install.py
> ++++ b/meson_post_install.py
> +@@ -1,20 +1,44 @@
> + #!/usr/bin/env python3
> + 
> +-import getpass
> + import os
> + import pwd
> + import sys
> + 
> ++destdir = os.environ.get('DESTDIR')
> + prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
> + 
> +-bindir = os.path.join(prefix, sys.argv[1])
> +-pkgdatadir = os.path.join(prefix, sys.argv[2])
> +-pkglibdir = os.path.join(prefix, sys.argv[3])
> +-pkgsysconfdir = os.path.join(prefix, sys.argv[4])
> ++def destdir_path(p):
> ++    if os.path.isabs(p):
> ++        if destdir is None:
> ++            return p
> ++        else:
> ++            return os.path.join(destdir, os.path.relpath(p, '/'))
> ++    else:
> ++        return os.path.join(prefix, p)
> + 
> +-polkitd_uid = pwd.getpwnam(sys.argv[5]).pw_uid
> ++bindir = destdir_path(sys.argv[1])
> ++pkgdatadir = destdir_path(sys.argv[2])
> ++pkglibdir = destdir_path(sys.argv[3])
> ++pkgsysconfdir = destdir_path(sys.argv[4])
> ++polkitd_user = sys.argv[5]
> + 
> +-os.chmod(os.path.join(bindir, 'pkexec'), 0o4775)
> ++try:
> ++    polkitd_uid = pwd.getpwnam(polkitd_user).pw_uid
> ++except KeyError:
> ++    polkitd_uid = None
> ++
> ++dst = os.path.join(bindir, 'pkexec')
> ++
> ++if os.geteuid() == 0:
> ++    os.chmod(dst, 0o4755)
> ++    os.chown(dst, 0, -1)
> ++else:
> ++    print(
> ++        'Owner and mode of {} need to be setuid root (04755) after '
> ++        'installation'.format(
> ++            dst,
> ++        )
> ++    )
> + 
> + dst_dirs = [
> +     os.path.join(pkgsysconfdir, 'rules.d'),
> +@@ -24,13 +48,27 @@ dst_dirs = [
> + for dst in dst_dirs:
> +     if not os.path.exists(dst):
> +         os.makedirs(dst, mode=0o700)
> +-        if getpass.getuser() == "root":
> ++        if os.geteuid() == 0 and polkitd_uid is not None:
> +             os.chown(dst, polkitd_uid, -1)
> ++        else:
> ++            print(
> ++                'Owner of {} needs to be set to {} after installation'.format(
> ++                    dst, polkitd_user,
> ++                )
> ++            )
> + 
> + # polkit-agent-helper-1 need to be setuid root because it's used to
> + # authenticate not only the invoking user, but possibly also root
> + # and/or other users.
> + dst = os.path.join(pkglibdir, 'polkit-agent-helper-1')
> +-os.chmod(dst, 0o4755)
> +-if getpass.getuser() == "root":
> ++
> ++if os.geteuid() == 0:
> ++    os.chmod(dst, 0o4755)
> +     os.chown(dst, 0, -1)
> ++else:
> ++    print(
> ++        'Owner and mode of {} need to be setuid root (04755) after '
> ++        'installation'.format(
> ++            dst,
> ++        )
> ++    )
> +-- 
> +GitLab
> +
> diff --git a/package/polkit/Config.in b/package/polkit/Config.in
> index 622cbbb90b..a968ee52d7 100644
> --- a/package/polkit/Config.in
> +++ b/package/polkit/Config.in
> @@ -5,7 +5,7 @@ config BR2_PACKAGE_POLKIT
>  	depends on BR2_USE_MMU # libglib2, dbus
>  	depends on BR2_USE_WCHAR # libglib2
>  	depends on !BR2_STATIC_LIBS # duktape
> -	select BR2_PACKAGE_DBUS # runtime
> +	select BR2_PACKAGE_DBUS
>  	select BR2_PACKAGE_DUKTAPE
>  	select BR2_PACKAGE_EXPAT
>  	select BR2_PACKAGE_LIBGLIB2
> diff --git a/package/polkit/polkit.mk b/package/polkit/polkit.mk
> index 3a8c442dbb..7d75d66ffb 100644
> --- a/package/polkit/polkit.mk
> +++ b/package/polkit/polkit.mk
> @@ -9,36 +9,31 @@ POLKIT_SITE = $(call github,aduskett,polkit-duktape,v$(POLKIT_VERSION))
>  POLKIT_LICENSE = GPL-2.0
>  POLKIT_LICENSE_FILES = COPYING
>  POLKIT_CPE_ID_VENDOR = polkit_project
> -POLKIT_AUTORECONF = YES
>  POLKIT_INSTALL_STAGING = YES
>  
>  POLKIT_DEPENDENCIES = \
> -	duktape libglib2 host-intltool expat $(TARGET_NLS_DEPENDENCIES)
> +	dbus duktape libglib2 host-intltool expat $(TARGET_NLS_DEPENDENCIES)
>  
> -POLKIT_CONF_ENV = \
> -	CXXFLAGS="$(TARGET_CXXFLAGS)" \
> -	LIBS=$(TARGET_NLS_LIBS)
> +POLKIT_LDFLAGS = $(TARGET_NLS_LIBS)
>  
>  POLKIT_CONF_OPTS = \
> -	--with-os-type=unknown \
> -	--disable-man-pages \
> -	--disable-examples \
> -	--disable-libelogind \
> -	--disable-libsystemd-login \
> -	--with-duktape
> +	-Dman=false \
> +	-Dexamples=false \
> +	-Dsession_tracking=ConsoleKit \
> +	-Djs_engine=duktape
>  
>  ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
> -POLKIT_CONF_OPTS += --enable-introspection
> +POLKIT_CONF_OPTS += -Dintrospection=true
>  POLKIT_DEPENDENCIES += gobject-introspection
>  else
> -POLKIT_CONF_OPTS += --disable-introspection
> +POLKIT_CONF_OPTS += -Dintrospection=false
>  endif
>  
>  ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
>  POLKIT_DEPENDENCIES += linux-pam
> -POLKIT_CONF_OPTS += --with-authfw=pam
> +POLKIT_CONF_OPTS += -Dauthfw=pam
>  else
> -POLKIT_CONF_OPTS += --with-authfw=shadow
> +POLKIT_CONF_OPTS += -Dauthfw=shadow
>  endif
>  
>  # polkit.{its,loc} are needed for gvfs and must be installed in $(HOST_DIR)
> @@ -72,4 +67,4 @@ define POLKIT_INSTALL_INIT_SYSV
>  		$(TARGET_DIR)/etc/init.d/S50polkit
>  endef
>  
> -$(eval $(autotools-package))
> +$(eval $(meson-package))
> 


More information about the buildroot mailing list