From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id ML7YFfCIK2ccXwAAe85BDQ:P1 (envelope-from ) for ; Wed, 06 Nov 2024 15:19:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id ML7YFfCIK2ccXwAAe85BDQ (envelope-from ) for ; Wed, 06 Nov 2024 16:19:12 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=FMjGE2Gt; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=BRL795my; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730906351; a=rsa-sha256; cv=none; b=ndSRryUXAU/YL3o9oJmpX2cokFSH2O1XoZWHPPafziXg5odcz1C02o4rVyREAQ8BkQnSXF P8fIOEdcv7IK0cVstbYIxZE//FdmRFHO5DlW1TsmSMbbxtqv2O2cswBaykMZP34Rg+N69H yjGvjt+1t0kVvG5vqUioQEmgGOSJdDe3I0cQ27CauT3VAddafSzkuTH+r/RoIRTMyxFdWP exIhVRjUbLQCZN3RDBRd4pFWCwVlplytqgnhc1sL9pApTCPYMa4vazqN4o5tC0Qg++CFU8 S99VgtYB2etr4Ya2DSzktm0yG5b0/X5+0XIJ8QeI4lDZ7IVvaqkizCScPs7tQw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=FMjGE2Gt; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=BRL795my; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730906351; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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=SQ7kXClpaNYrkL8CFPZOppNfTjaJZFZ09cfMz8rEf2g=; b=e5yusttFMwpnzqNPYnNQTwLj+/1s01oozXFHfft3ziplUZPyR+EGCQBBmUldTJMPYCwo/D bDUgbF+1j9VUzqSL7y8ekvS/faDnnJ8xoGR7buDvY4vYKqGwBWe4T3DfzXq2CZHXbaBVNJ hdOKd6X/2nVN620JK3Xty4S8H0QPVkx257SkESSJKfwHhODmLya8yWSmg/K78ktd9Wj9mR B6TazBda9Ddqj5IVCSaww2QWtBDOEtvOZ1l9E2ceRJ7u30l408U/j0t+zLJ76Ljz4z/CwI fb7I83gpJuqGK38cBVN7rrQDO43eqvQP7c4fc7z4yRIC0olrpGlLfyMj0xSKqw== 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 D13897D4B3 for ; Wed, 06 Nov 2024 16:19:10 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8hoH-0002cA-BC; Wed, 06 Nov 2024 10:19:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8hoG-0002c1-0m for guix-patches@gnu.org; Wed, 06 Nov 2024 10:19:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8hoF-0005Vo-Ng for guix-patches@gnu.org; Wed, 06 Nov 2024 10:19:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=SQ7kXClpaNYrkL8CFPZOppNfTjaJZFZ09cfMz8rEf2g=; b=FMjGE2Gt+ubZWC/m/C+zS2JV0+Eq3DjyFLk71DdzxL5KLc4ESeJHXdOIMGtEgM53+SYAkbqLJXkfFcgwKcbERDpx5Gp6KAopf+VP4c9zxQ37Wi2u4QPANQMQ9y0kQZjvDfg538nBJ08ejPtZvqGPgMz1xYg3XOZONROOHiemtFDPSuvrQ0doE0wLLK6KtovNUlFPVJmN0Y2gfvfXAd9kMH5V55TgMzpkdoSLNY4h3ijZN8rsRb8Pv3MOA7JDK354i82YetLAf/38AF4hyAbwKPJpDeycC+UioJ3e/4VIutDZMyt8eopSzrzOxoz4RaO12E19lIe7yOnh9ObpA+SMRQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t8hoE-0005It-Hh for guix-patches@gnu.org; Wed, 06 Nov 2024 10:19:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#73833] [PATCH v2 1/5] guix: import: utils: Add function git->origin. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 06 Nov 2024 15:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73833 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Nicolas Graves Cc: 73833@debbugs.gnu.org Received: via spool by 73833-submit@debbugs.gnu.org id=B73833.173090632520364 (code B ref 73833); Wed, 06 Nov 2024 15:19:02 +0000 Received: (at 73833) by debbugs.gnu.org; 6 Nov 2024 15:18:45 +0000 Received: from localhost ([127.0.0.1]:45068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8hnw-0005IN-LL for submit@debbugs.gnu.org; Wed, 06 Nov 2024 10:18:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38396) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t8hnu-0005I8-1o for 73833@debbugs.gnu.org; Wed, 06 Nov 2024 10:18:43 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8hlg-0005KS-Rl; Wed, 06 Nov 2024 10:16:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=SQ7kXClpaNYrkL8CFPZOppNfTjaJZFZ09cfMz8rEf2g=; b=BRL795mydgzFuNDQR4xk 1DubaNZdNgpadTVdw23syCmlZ5v8SYgnux4rRLgnoHmzmTJB3HP2MDmuL+7989O4yhhies5UfsHeS 59thDmPJV6GVFWJCjI+bwD9g8LdmdkwGRd5Z3nPyEq3cT2QwyDGnKGFeoeoNCo3i1K2EZFLIap9Lc werhdvQW5wHuH0VFoT3BX2xBk7uGpuKldgQVHSrm2Xki3TsPpkdnBNGJx6WBKM/Jvhqn+t+fqEIk4 dyDOApWiv1yGuenm5BjDDTvgjF9UAeS99yu2I0LFqBuA+xQwSH/KXZPNwJD8CIstMjyGgRD7TqQye 7WxotWTxvL8c2Q==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <20241017223308.27941-2-ngraves@ngraves.fr> (Nicolas Graves's message of "Fri, 18 Oct 2024 00:25:57 +0200") References: <20241017223308.27941-1-ngraves@ngraves.fr> <20241017223308.27941-2-ngraves@ngraves.fr> Date: Wed, 06 Nov 2024 16:16:18 +0100 Message-ID: <87zfmcwfy5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.59 X-Spam-Score: -3.59 X-Migadu-Queue-Id: D13897D4B3 X-Migadu-Scanner: mx10.migadu.com X-TUID: KqYbVNbkZIyp Hi, Nice patch series! Nicolas Graves skribis: > * guix/import/utils.scm: (git->origin): Add function. > > * guix/import/elpa.scm > (download-git-repository): Remove function download-git-repository. > (git-repository->origin): Remove function git-repository->origin. > (ref): Add function ref. > (melpa-recipe->origin): Use functions git->origin and ref. > > * guix/import/go.scm > (git-checkout-hash): Remove function git-checkout-hash. > (transform-version): Add function transform-version. > (vcs->origin): Use functions git->origin and transform-version. Add > optional argument transform-version. > > * tests/import/go.scm > (go-module->guix-package): Adapt test case to changes in guix/import/go.s= cm. > > * guix/import/minetest.scm > (download-git-repository): Remove function download-git-repository. > (make-minetest-sexp): Use function git->origin. > > * tests/minetest.scm > (make-package-sexp): Use function git->origin. > (example-package): Adapt test-case to git->origin. > > * guix/import/composer.scm > (make-php-sexp): Use function git->origin. > > Change-Id: Ied05a63bdd60fbafe26fbbb4e115ff6f0bb9db3c [=E2=80=A6] > +(define (ref recipe) > + "Create REF from MELPA RECIPE." More like: "Return a value suitable for the 'update-cached-checkout' #:ref argument corresponding to RECIPE, a MELPA recipe alist." > +;; This is done because the version field of the package, which the gene= rated > +;; quoted expression refers to, has been stripped of any 'v' prefixed. > +(define (transform-version version) Please add a docstring. > - ;; Use a custom cache to avoid cluttering the default one under > - ;; ~/.cache/guix, but choose one under /tmp so that it's persistent ac= ross > - ;; subsequent "guix import" invocations. > - (mkdir-p cache) > - (chmod cache #o700) > - (let-values (((checkout commit _) > - (parameterize ((%repository-cache-directory cache)) > - (update-cached-checkout url Looks like this bit and its rationale in (guix import go) gets lost here: =E2=80=98git->origin=E2=80=99 unconditionally uses ~/.cache, which me= ans that =E2=80=98guix import go -r =E2=80=A6=E2=80=99 would fill that directory. Could we restore that behavior, probably as an option to =E2=80=98git->orig= in=E2=80=99? > +control system is being used. Optionally use the function TRANSFORM-VERS= ION > +which takes version as an input." Two spaces after end-of-sentence period please. :-) =E2=80=9CCall TRANSFORM-VERSION with VERSION as an argument to compute the downstream version number.=E2=80=9D You can have #:key (transform-version identity) and call it unconditionally (that is, it would always be a procedure, never #f). > +(define* (git->origin repo-url ref #:key (ref->commit #f)) > + "Returns a generated `origin' block of a package depending on the git = source > +control system, and the directory in the store where the package has been > +downloaded, in case further processing is necessary. REPO-URL or REF ca= n be > +null. REF->COMMIT can be a function or #t, in which case the commit matc= hing > +ref is used. If REF->COMMIT is not used, the value inside REF is used." s/function/procedure/ > + (let* ((version (and (pair? ref) (cdr ref))) > + (directory commit > + (if version > + (with-store store > + (latest-repository-commit store repo-url > + #:ref (if version re= f '()))) > + (values #f #f))) > + (vcommit (match ref->commit > + (#t commit) > + (#f version) > + ((? procedure?) (ref->commit version)) > + (_ #f)))) Weird semantics for =E2=80=98ref->commit=E2=80=99. Could it not always be = a procedure? Also, s/vcommit/commit-string/ or something. See the coding style regarding identifiers (info "(guix) Formatting Code"). Likewise, could you remove uses of car/cdr in this patch set, at least for new code (info "(guix) Data Types and Pattern Matching")? Ludo=E2=80=99.