From patchwork Thu Aug 11 23:11:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Patterson X-Patchwork-Id: 41567 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A304927BBEA; Fri, 12 Aug 2022 00:12:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id E00B027BBE9 for ; Fri, 12 Aug 2022 00:12:11 +0100 (BST) Received: from localhost ([::1]:46152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oMHLX-0001Uq-2Z for patchwork@mira.cbaines.net; Thu, 11 Aug 2022 19:12:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMHLO-0001Ui-Ph for guix-patches@gnu.org; Thu, 11 Aug 2022 19:12:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37203) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMHLO-0001dO-GD for guix-patches@gnu.org; Thu, 11 Aug 2022 19:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oMHLO-000513-9b for guix-patches@gnu.org; Thu, 11 Aug 2022 19:12:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57146] [PATCH] gnu: polkit: Fix cross-compiling Resent-From: Andrew Patterson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Aug 2022 23:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57146 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57146@debbugs.gnu.org Cc: Andrew Patterson X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166025947819224 (code B ref -1); Thu, 11 Aug 2022 23:12:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Aug 2022 23:11:18 +0000 Received: from localhost ([127.0.0.1]:55185 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMHKf-0004zz-SQ for submit@debbugs.gnu.org; Thu, 11 Aug 2022 19:11:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:33438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oMHKa-0004zn-BJ for submit@debbugs.gnu.org; Thu, 11 Aug 2022 19:11:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oMHKa-0001Rl-64 for guix-patches@gnu.org; Thu, 11 Aug 2022 19:11:12 -0400 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]:42900) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oMHKY-0001VK-4I for guix-patches@gnu.org; Thu, 11 Aug 2022 19:11:11 -0400 Received: by mail-qk1-x72a.google.com with SMTP id c28so5557347qko.9 for ; Thu, 11 Aug 2022 16:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=Mg/VNZebDe8wUtZYYWS1kC4jRRW/2UGVfhgBe75ZNTw=; b=PDy55MvZwwfcOdkvj+NWyi8d9UHi8YuYIhpWHxGqFSqFgLHrwl1ExHKRolsecnytIJ eIYqLtFxUM+TS1Ar4NIdNIenVg2dk0ETrTEQ+BGhsROsSXYOZVSB0WW/noIvdn++d/G/ /c+ECwC9VHL+J83ahwqxML4ElTsWPyAgQI3NrfVxVTpFq0NZnlwkeXMhcAAnQj89nenS LUZRrafVWy/OEUtwVKRGSZvCzcaMq9jEXWvWMxL4LBx82aS1yQMzbzAfbFErWhhMk/d8 3A1UPKOin5q28R/asFibkhw7Ab4/tUfeEgkU/3VGFKsPqmtf3qUVOsdoT+m1VJ7AuvR5 r2lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=Mg/VNZebDe8wUtZYYWS1kC4jRRW/2UGVfhgBe75ZNTw=; b=plC+jsipl5Sk9ysFe6KSL4Q1zGlG6i1r4NK2ihpoDH8YS7KvawsjIwGyedwkLrcdgE 94NFhN/XDkudkbmpdy1K+ZfIlkAJ1f1QvsIx/qRoDIDjjPuPjX1EuAiMLiw+NTDXELVY 9Db24rtNk72UK9FEZYIMlvip4xJqaSQZiT1DTRjrbZzkgsNOgRb0sIaUPnUH61Ha91gg h44ZYes9DBlbmsoD6VeNLvmPLyaemGsQeW/h2LNQic15X+of8h6w8XiLcILkHhHsJeRL ylMSm1qPBDLb+1LmKyWLWiEZEccGZbixE1DWjeLgcJjbnrF3Vlwgrh/a1sJ5cx2q1NTM 7Lgw== X-Gm-Message-State: ACgBeo39bYmQBQkXJnYhMttNHMe6WbZIbwsLXrAly+ZXu2aakWmPrc+v JN5isTEJvldCVNBVwcyOQQylv3jIDuw= X-Google-Smtp-Source: AA6agR5zEosUMNqFCBFFP+G2O1RTa0PJZ5FhJJgcbcVCgyz2BGEUVuT5a7KuRQ9C85yAgb6QATmCQw== X-Received: by 2002:a05:620a:43a1:b0:6b9:287d:3440 with SMTP id a33-20020a05620a43a100b006b9287d3440mr1025240qkp.53.1660259468442; Thu, 11 Aug 2022 16:11:08 -0700 (PDT) Received: from kalantha.lan ([204.111.132.134]) by smtp.gmail.com with ESMTPSA id bm34-20020a05620a19a200b006bac157ec19sm391529qkb.123.2022.08.11.16.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Aug 2022 16:11:07 -0700 (PDT) From: Andrew Patterson Date: Thu, 11 Aug 2022 19:11:00 -0400 Message-Id: <20220811231100.22090-1-andrewpatt7@gmail.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::72a; envelope-from=andrewpatt7@gmail.com; helo=mail-qk1-x72a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches The polkit package used to refer to docbook-xsl via inputs rather native inputs, which obviously doesn't work when cross-compiling. --- gnu/packages/polkit.scm | 165 ++++++++++++++++++++-------------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm index a75608cd43..dd0cf42e5d 100644 --- a/gnu/packages/polkit.scm +++ b/gnu/packages/polkit.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2018 Ricardo Wurmus ;;; Copyright © 2021 Morgan Smith ;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2022 Andrew Patterson ;;; ;;; This file is part of GNU Guix. ;;; @@ -27,6 +28,7 @@ (define-module (gnu packages polkit) #:use-module ((guix licenses) #:select (lgpl2.0+)) + #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix memoization) @@ -55,92 +57,91 @@ (define-public polkit-mozjs (name "polkit") (version "0.120") (source (origin - (method url-fetch) - (uri (string-append - "https://www.freedesktop.org/software/polkit/releases/" - name "-" version ".tar.gz")) - (sha256 - (base32 - "00zfg9b9ivkcj2jcf5b92cpvvyljz8cmfwj86lkvy5rihnd5jypf")) - (patches (search-patches "polkit-configure-elogind.patch" - "polkit-CVE-2021-4034.patch")) - (modules '((guix build utils))) - (snippet - '(begin - (use-modules (guix build utils)) - ;; Disable broken test. - (substitute* "test/Makefile.in" - (("SUBDIRS = mocklibc . polkit polkitbackend") - "SUBDIRS = mocklibc . polkit")) - ;; Disable a test that requires Python, D-Bus and a few - ;; libraries and fails with "ERROR: timed out waiting for bus - ;; process to terminate". - (substitute* "test/polkitbackend/Makefile.am" - (("TEST_PROGS \\+= polkitbackendjsauthoritytest-wrapper.py") - "")) - ;; Guix System's polkit - ;; service stores actions under /etc/polkit-1/actions. - (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c" - (("PACKAGE_DATA_DIR \"/polkit-1/actions\"") - "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\"")) - ;; Set the setuid helper's real location. - (substitute* "src/polkitagent/polkitagentsession.c" - (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"") - "\"/run/setuid-programs/polkit-agent-helper-1\"")))))) + (method url-fetch) + (uri (string-append + "https://www.freedesktop.org/software/polkit/releases/" + name "-" version ".tar.gz")) + (sha256 + (base32 + "00zfg9b9ivkcj2jcf5b92cpvvyljz8cmfwj86lkvy5rihnd5jypf")) + (patches (search-patches "polkit-configure-elogind.patch" + "polkit-CVE-2021-4034.patch")) + (modules '((guix build utils))) + (snippet '(begin + (use-modules (guix build utils)) + ;; Disable broken test. + (substitute* "test/Makefile.in" + (("SUBDIRS = mocklibc . polkit polkitbackend") + "SUBDIRS = mocklibc . polkit")) + ;; Disable a test that requires Python, D-Bus and a few + ;; libraries and fails with "ERROR: timed out waiting for bus + ;; process to terminate". + (substitute* "test/polkitbackend/Makefile.am" + (("TEST_PROGS \\+= polkitbackendjsauthoritytest-wrapper.py") + "")) + ;; Guix System's polkit + ;; service stores actions under /etc/polkit-1/actions. + (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c" + (("PACKAGE_DATA_DIR \"/polkit-1/actions\"") + "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\"")) + ;; Set the setuid helper's real location. + (substitute* "src/polkitagent/polkitagentsession.c" + (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"") + "\"/run/setuid-programs/polkit-agent-helper-1\"")))))) (build-system gnu-build-system) - (inputs - (list expat linux-pam elogind mozjs nspr)) - (propagated-inputs - (list glib)) ; required by polkit-gobject-1.pc - (native-inputs - (list pkg-config - `(,glib "bin") ;for glib-mkenums - intltool - gobject-introspection - libxslt ;for man page generation - docbook-xsl)) ;for man page generation + (inputs (list expat linux-pam elogind mozjs nspr)) + (propagated-inputs (list glib)) ;required by polkit-gobject-1.pc + (native-inputs (list pkg-config + `(,glib "bin") ;for glib-mkenums + intltool + gobject-introspection + libxslt ;for man page generation + docbook-xsl)) ;for man page generation (arguments - `(#:configure-flags '("--sysconfdir=/etc" - "--enable-man-pages" - ;; Prevent ‘configure: error: cannot check for - ;; file existence when cross compiling’. - ,@(if (%current-target-system) - '("--with-os-type=unknown") - '())) - #:phases - (modify-phases %standard-phases - (add-after - 'unpack 'fix-introspection-install-dir - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) - (substitute* (find-files "." "Makefile.in") - (("@INTROSPECTION_GIRDIR@") - (string-append out "/share/gir-1.0/")) - (("@INTROSPECTION_TYPELIBDIR@") - (string-append out "/lib/girepository-1.0/")))))) - (add-after 'unpack 'fix-manpage-generation - (lambda* (#:key inputs #:allow-other-keys) - (let ((xsldoc (string-append (assoc-ref inputs "docbook-xsl") - "/xml/xsl/docbook-xsl-" - ,(package-version docbook-xsl)))) - (substitute* '("docs/man/Makefile.am" "docs/man/Makefile.in") - (("http://docbook.sourceforge.net/release/xsl/current") - xsldoc))))) - (replace - 'install - (lambda* (#:key outputs (make-flags '()) #:allow-other-keys) - ;; Override sysconfdir during "make install", to avoid attempting - ;; to install in /etc, and to instead install the skeletons in the - ;; output directory. - (let ((out (assoc-ref outputs "out"))) - (apply invoke "make" "install" - (string-append "sysconfdir=" out "/etc") - (string-append "polkit_actiondir=" - out "/share/polkit-1/actions") - make-flags))))))) + (list #:configure-flags `(list "--sysconfdir=/etc" "--enable-man-pages" + ;; Prevent ‘configure: error: cannot check for + ;; file existence when cross compiling’. + ,@(if (%current-target-system) + '("--with-os-type=unknown") + '())) + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'fix-introspection-install-dir + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (substitute* (find-files "." "Makefile.in") + (("@INTROSPECTION_GIRDIR@") + (string-append out "/share/gir-1.0/")) + (("@INTROSPECTION_TYPELIBDIR@") + (string-append out "/lib/girepository-1.0/")))))) + (add-after 'unpack 'fix-manpage-generation + (lambda* (#:key native-inputs #:allow-other-keys) + (let ((xsldoc (string-append (assoc-ref + native-inputs + "docbook-xsl") + "/xml/xsl/docbook-xsl-" + #$(package-version docbook-xsl)))) + (substitute* '("docs/man/Makefile.am" + "docs/man/Makefile.in") + (("http://docbook.sourceforge.net/release/xsl/current") + xsldoc))))) + (replace 'install + (lambda* (#:key outputs + (make-flags '()) #:allow-other-keys) + ;; Override sysconfdir during "make install", to avoid attempting + ;; to install in /etc, and to instead install the skeletons in the + ;; output directory. + (let ((out (assoc-ref outputs "out"))) + (apply invoke + "make" + "install" + (string-append "sysconfdir=" out "/etc") + (string-append "polkit_actiondir=" out + "/share/polkit-1/actions") + make-flags))))))) (home-page "https://www.freedesktop.org/wiki/Software/polkit/") (synopsis "Authorization API for privilege management") - (description "Polkit is an application-level toolkit for defining and + (description + "Polkit is an application-level toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes. It is a framework for centralizing the decision making process with respect to granting access to privileged operations