From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ejbtNSNtfGHrwgAAgWs5BA (envelope-from ) for ; Fri, 29 Oct 2021 23:52:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SKzfMCNtfGFLHQAAbx9fmQ (envelope-from ) for ; Fri, 29 Oct 2021 21:52:35 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8D9492D71E for ; Fri, 29 Oct 2021 23:52:35 +0200 (CEST) Received: from localhost ([::1]:56708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgZne-0001mD-Od for larch@yhetil.org; Fri, 29 Oct 2021 17:52:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgZYe-0004Rv-Fh for guix-patches@gnu.org; Fri, 29 Oct 2021 17:37:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgZYd-0004S6-05 for guix-patches@gnu.org; Fri, 29 Oct 2021 17:37:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mgZYc-0006Gg-Te for guix-patches@gnu.org; Fri, 29 Oct 2021 17:37:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51493] [PATCH 5/5] import: print: Handle patches that are origins. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 Oct 2021 21:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51493 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51493@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 51493-submit@debbugs.gnu.org id=B51493.163554336723992 (code B ref 51493); Fri, 29 Oct 2021 21:37:02 +0000 Received: (at 51493) by debbugs.gnu.org; 29 Oct 2021 21:36:07 +0000 Received: from localhost ([127.0.0.1]:56158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgZXi-0006Eo-OG for submit@debbugs.gnu.org; Fri, 29 Oct 2021 17:36:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mgZXX-0006D1-NJ for 51493@debbugs.gnu.org; Fri, 29 Oct 2021 17:35:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:58464) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgZXS-0002M0-Fh; Fri, 29 Oct 2021 17:35:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=xsG1veVdeP2XPSH7aHhnL8Ri2+GH+W/RqpnnaWbOQGQ=; b=OfyDuEj+mlmm/XBujCHk yvrKLYzRYtsSQPisS18L3ixnVCvFLXemZFCXePTI1szVToukWCooPvuHpZ1Z5/6xTkVRFGL7xdxeU jeiIUqLokRDoyXuqkTQoTlkRRFQsHZhEucwQ9mBwc/MkMO5/T0Y6JbiBVRd9q50OXmktE2B6VUwNJ j1S6YGYrpMGtmQWFRukrYAEB6uzOpQTx7FKIwe3a/BMzH4rb4V1/sM4LU2CovK+QXcHyWBEwD39nJ WvwtB1H9dhZRpI63YFJQGQw9Oe9/xCWaiDCt9yPQ5QBDUhreLjxGHtj9i3E7eiRsZSNRnG+ahnA49 haYx1nqVgWjXsg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55462 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgZXS-0002gP-3Q; Fri, 29 Oct 2021 17:35:50 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 29 Oct 2021 23:35:39 +0200 Message-Id: <20211029213539.30291-5-ludo@gnu.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211029213539.30291-1-ludo@gnu.org> References: <20211029213539.30291-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635544355; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=xsG1veVdeP2XPSH7aHhnL8Ri2+GH+W/RqpnnaWbOQGQ=; b=cQvNAD4wT6rZsvdIojaGWx3ur9Y5z6Bd2RuyQFTDUmnh39jiPvE0tH4UzcF+aEeBXMd40l Do/gJR1Y9Emb54VHCa3EpBacVQpFWWqYIXtRhVZ5VQN5HOtDNKwyXFVGiXRDsFBT0cKLc9 PzJG/v3825NrL4liIbs/6bQc3ix5uXA6/YuJ2fr0EwEZo838qkP3ptZeIMc5Q/eeW9sw6i Wfsw21xKWR+keD3H0m4Ve75CRP3RyEzEfcXwCZrWnmc2jnki46BjQn8xq0/xugWRyhwZ/G vm2oGu4bE8cTblLNZJm7gCXSf1vOLwNngdoB+RVm3BHY2z2nF36ZP49swk2SHw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635544355; a=rsa-sha256; cv=none; b=FluidZRqT54ZfLq1B+4Ov4hxHMQFpQn7PYZDmZcMmBAUVSVpm+rjBwybS8IEg0s4Wvxw13 LxErIG2Ag4DL4cz1PYehvWC+KD5GHReAbl2eHuqwB9v20uLZRy/HNBsM+x02I13ZkY1JO6 8EX/tu2FA0eXSiLwUpQJS5SaO5XkzDbI8J4MV3z7+zDQ1MyMj/UDMvx84NYuU0OLLKMplF yjLfxo6frS4v8k+dKh5gL/zmTe2KkUfw5bwO6vO4Bk/fL3/8cuUOAsRwoyPccBzPD7J6QS WB7RLz9/auX9JEH5d3rZPKbfP+qXWORwj5Mld0kSMtkerKv58C/pGa+bFFUHNA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=OfyDuEj+; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 2.08 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=OfyDuEj+; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 8D9492D71E X-Spam-Score: 2.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: xtFc6jP0kMI3 * guix/import/print.scm (package->code)[source->code]: Handle patches that are origins. * tests/print.scm (pkg-with-origin-input): Add 'patches' field. (pkg-with-origin-patch, pkg-with-origin-patch-source): New variables. ("package with origin patch"): New test. --- guix/import/print.scm | 13 +++++++++++-- tests/print.scm | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/guix/import/print.scm b/guix/import/print.scm index 4e65d18bc3..e04a6647b4 100644 --- a/guix/import/print.scm +++ b/guix/import/print.scm @@ -112,8 +112,17 @@ (define (source->code source version) ;; FIXME: in order to be able to throw away the directory prefix, ;; we just assume that the patch files can be found with ;; "search-patches". - ,@(if (null? patches) '() - `((patches (search-patches ,@(map basename patches)))))))) + ,@(cond ((null? patches) + '()) + ((every string? patches) + `((patches (search-patches ,@(map basename patches))))) + (else + `((patches (list ,@(map (match-lambda + ((? string? file) + `(search-patch ,file)) + ((? origin? origin) + (source->code origin #f))) + patches))))))))) (define (package-lists->code lsts) (list 'quasiquote diff --git a/tests/print.scm b/tests/print.scm index 7f4c8ccdd1..ff0db469ab 100644 --- a/tests/print.scm +++ b/tests/print.scm @@ -22,6 +22,7 @@ (define-module (test-print) #:use-module (guix download) #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) + #:use-module ((gnu packages) #:select (search-patches)) #:use-module (srfi srfi-64)) (define-syntax-rule (define-with-source object source expr) @@ -79,7 +80,9 @@ (define-with-source pkg-with-origin-input pkg-with-origin-input-source version ".tar.gz"))) (sha256 (base32 - "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah")))) + "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah")) + (patches (search-patches "guile-linux-syscalls.patch" + "guile-relocatable.patch")))) (build-system (@ (guix build-system gnu) gnu-build-system)) (inputs `(("o" ,(origin @@ -93,6 +96,30 @@ (define-with-source pkg-with-origin-input pkg-with-origin-input-source (description "This is a dummy package.") (license license:gpl3+))) +(define-with-source pkg-with-origin-patch pkg-with-origin-patch-source + (package + (name "test") + (version "1.2.3") + (source (origin + (method url-fetch) + (uri (string-append "file:///tmp/test-" + version ".tar.gz")) + (sha256 + (base32 + "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah")) + (patches + (list (origin + (method url-fetch) + (uri "http://example.org/x.patch") + (sha256 + (base32 + "0000000000000000000000000000000000000000000000000000"))))))) + (build-system (@ (guix build-system gnu) gnu-build-system)) + (home-page "http://gnu.org") + (synopsis "Dummy") + (description "This is a dummy package.") + (license license:gpl3+))) + (test-equal "simple package" `(define-public test ,pkg-source) (package->code pkg)) @@ -105,4 +132,8 @@ (define-with-source pkg-with-origin-input pkg-with-origin-input-source `(define-public test ,pkg-with-origin-input-source) (package->code pkg-with-origin-input)) +(test-equal "package with origin patch" + `(define-public test ,pkg-with-origin-patch-source) + (package->code pkg-with-origin-patch)) + (test-end "print") -- 2.33.0