On Fri, Nov 20, 2015 at 08:52:41PM +0100, Sumit Bose wrote:
On Fri, Nov 20, 2015 at 06:58:56PM +0100, Jakub Hrozek wrote:
> The attached patch tries to detect if the build platform has the rules.d
> polkit directory and only installs the file from contrib if so. As an
> additional improvement we might add a config option that specifies the
> directory directly, but I don't think it's needed at the moment.
>
> I ran a local mock build of epel-6 and fedora and those passed. Now the
> patch is in CI to check Debian.
>
> Sorry again for the careless review of the first patch.
> From 060b224356acf387eafa6f7daeca87ce71fabaa5 Mon Sep 17 00:00:00 2001
> From: Jakub Hrozek <jhrozek(a)redhat.com>
> Date: Fri, 20 Nov 2015 18:54:13 +0100
> Subject: [PATCH] BUILD: Install polkit rules file only on platforms that
> support it
>
> ---
> Makefile.am | 2 ++
> configure.ac | 8 ++++++++
> contrib/ci/deps.sh | 1 +
> contrib/sssd.spec.in | 1 +
> 4 files changed, 12 insertions(+)
>
> diff --git a/Makefile.am b/Makefile.am
> index
212440c9b174de10ca4b8481af350f06b090cc34..d6ca1cf1b79859cf4de6788ecdc306b614630a42 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -151,10 +151,12 @@ endif
> if HAVE_NSS
> sssdlibexec_PROGRAMS += p11_child
> if SSSD_USER
> +if HAVE_POLKIT_RULES_D
> polkit_rulesdir = $(datadir)/polkit-1/rules.d
> dist_polkit_rules_DATA = contrib/sssd-pcsc.rules
> endif
> endif
> +endif
>
> if BUILD_PAC_RESPONDER
> sssdlibexec_PROGRAMS += sssd_pac
> diff --git a/configure.ac b/configure.ac
> index
f7254c096659e7d8e395b4d0b0c71b5aa28d38f1..f68aef59b4ab48cc5e8fcac06925706f744cf4be 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -424,6 +424,14 @@ SSS_ENABLE_INTGCHECK_REQS
>
> AM_CONDITIONAL([HAVE_DEVSHM], [test -d /dev/shm])
>
> +# Check if we're building on a platform with new polkit scheme
> +AC_PATH_PROG([PKCHECK],[pkcheck])
> +if test ! -x "$PKCHECK"; then
> + AC_MSG_WARN([pkcheck not found, will not install polkit rules])
If you try to build SSSD on a system where pkcheck is not installed
configure will fail with
checking for pkcheck... no
configure: WARNING: pkcheck not found, will not install polkit rules
checking that generated files are newer than configure... done
configure: error: conditional "HAVE_POLKIT_RULES_D" was never defined.
Usually this means the macro was only invoked conditionally.
Makefile:6946: recipe for target 'config.status' failed
make: *** [config.status] Error 1
Yes, conditional must be called in a branch that is always executed.
That's a bug in the patch, but I'll resend after we decide on best
solution.
Why is the check for pkcheck needed at all? Wouldn't it be sufficient to
just look for the rules.d directory?
But don't you need to make sure the package that provides the rules.d
directory is installed in the buildroot of whatever system you're
building for? Otherwise you wouldn't detect the directory even if the OS
normally has it (tested on Fedora rawhide build that didn't pull in
polkit)