From patchwork Mon Oct 9 12:28:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 54633 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 6ABD927BBE2; Mon, 9 Oct 2023 13:32:00 +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_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS 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 57CAF27BBE9 for ; Mon, 9 Oct 2023 13:31:58 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qppQG-0003Dz-CF; Mon, 09 Oct 2023 08:31:44 -0400 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 1qppQE-0003Db-F4 for guix-patches@gnu.org; Mon, 09 Oct 2023 08:31:42 -0400 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 1qppQE-0004HP-7A for guix-patches@gnu.org; Mon, 09 Oct 2023 08:31:42 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qppQY-0003f9-DC; Mon, 09 Oct 2023 08:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66421] [PATCH] guix: import: Don't import yanked rust crates. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Mon, 09 Oct 2023 12:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66421 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66421@debbugs.gnu.org Cc: Efraim Flashner , Efraim Flashner X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by submit@debbugs.gnu.org id=B.169685468314018 (code B ref -1); Mon, 09 Oct 2023 12:32:02 +0000 Received: (at submit) by debbugs.gnu.org; 9 Oct 2023 12:31:23 +0000 Received: from localhost ([127.0.0.1]:59475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qppPu-0003e1-PA for submit@debbugs.gnu.org; Mon, 09 Oct 2023 08:31:23 -0400 Received: from lists.gnu.org ([2001:470:142::17]:42816) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qppPr-0003dY-Bi for submit@debbugs.gnu.org; Mon, 09 Oct 2023 08:31:21 -0400 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 1qppPA-0002Ke-W7 for guix-patches@gnu.org; Mon, 09 Oct 2023 08:30:40 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qppP7-00047o-JH for guix-patches@gnu.org; Mon, 09 Oct 2023 08:30:35 -0400 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-9b29186e20aso767220266b.2 for ; Mon, 09 Oct 2023 05:30:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696854631; x=1697459431; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=c7MQRouC39swwzSJOLzPZNKeabvVCaYDMDwUiBff6u8=; b=FUHvTc2487S2QGoRHjETYIHJSrb5f49S87UGyUw/3ZAw2tmiKSSQ/QkvHov7vyzKMp kK+A2221NAwwL489F1+NZ5sMgSG1QnOqiEWTpCEGNkkBx6+YxBXzpuOueEeYXXcGMlf2 Mh5haD9KrKI2vtZSDxEmrYH3B+MJSp8UnjpbTVZILOaxsJFqRvOyJKupEAhCniy9p4xp icRay6tor+iH5BNrqyLY37Ytad36ZC6bCwpaUO7LYz0PL7xmySqGOCUhrY4hVF8hMxDW dIZs6Atxge62lGT8bhg3YeAtK0XZHzjgzKco4B2U2mRfT8vEs+Ueqf3Ox7qVJ76i2zQ0 lEEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696854631; x=1697459431; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=c7MQRouC39swwzSJOLzPZNKeabvVCaYDMDwUiBff6u8=; b=Jk/37WpcjE7iFEVsHtrx8N/6IXmZNg/cNkUkQ6iVYtS4gZ4QWOAZX2fxojZj/JnaZd I0BraCEm1Un5+tfynGrZXtEwUqf3QX1a1qZr97GxXN5U0L17KtGdLQfzn5hmrsMk7MDg PfTr290HI3+kQC3u8OyGOFKRJ1Hrr1ITtFHvS3Vx3YkSEWtyFzj9QpgfeebnHmIF/lEA KEQdQIGksy3kMSz5qpgD3ytXgI24tN65sJMm1Va6sUZhAmepqIqGsMWNe+wPGbq4pHFx zxsMVb8PECSa3Jx91vngt7fX0+J799zL6qu/RgJKX7Up3792HdZGYgd60g/00mkeq4hE u45Q== X-Gm-Message-State: AOJu0YyjwFp5nnflORmpjDUh5BNY24bf8/PIaoaNg3CxEhasHeUvnTIG iNV2CexciBbEjFGw68iIIw6gHtcOl6HuRw== X-Google-Smtp-Source: AGHT+IFMBiFL0JG2zzEuERZ9x0mREwECvCDw0/RAi1Kh/Y+gf9GffivQemCA/LO0b3OZVrrpzBEMLA== X-Received: by 2002:a17:906:8b:b0:9a5:846d:d823 with SMTP id 11-20020a170906008b00b009a5846dd823mr15011564ejc.45.1696854630890; Mon, 09 Oct 2023 05:30:30 -0700 (PDT) Received: from localhost ([2a02:ed3:916:6300:c3db:b80e:a694:a54f]) by smtp.gmail.com with ESMTPSA id z11-20020a170906074b00b00988f168811bsm6779198ejb.135.2023.10.09.05.30.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 05:30:30 -0700 (PDT) From: Efraim Flashner Date: Mon, 9 Oct 2023 15:28:01 +0300 Message-ID: <7e6cbc6b1b853dcc951ba85efc5f90a7443ff800.1696854438.git.efraim@flashner.co.il> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=efraim.flashner@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/import/crate.scm (): Add yanked? field. (crate->guix-package)[find-crate-version]: Remove versions which have been yanked. * tests/crate.scm: Adjust tests for new yanked? field. --- Before this patch `guix import core-foundation-sys` would give 0.8.4 (the listed max version), `guix import core-foundation-sys@0.8` would give 0.8.5 (which was yanked but was higher than 0.8.4). Similarly, before `guix import core-foundation-sys@0.7` gave 0.7.2 and after 0.7.0. guix/import/crate.scm | 7 ++++++- tests/crate.scm | 40 +++++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 14 deletions(-) base-commit: 9b77bd0b9b4f3de69390da0ba7db5b9dbc01e554 diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 6e10ebb5d4..a7eafb023e 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2021 Nicolas Goaziou ;;; Copyright © 2022 Hartmut Goebel ;;; Copyright © 2023 Simon Tournier +;;; Copyright © 2023 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -82,6 +83,7 @@ (define-json-mapping make-crate-version crate-version? (match-lambda ('null #f) ((? string? str) str))) + (yanked? crate-version-yanked? "yanked") ;boolean (links crate-version-links)) ;alist ;; Crate dependency. Each dependency (each edge in the graph) is annotated as @@ -256,12 +258,15 @@ (define* (crate->guix-package crate-name #:key version include-dev-deps? (semver->string (last versions))))) ;; find the highest version of a crate that fulfills the semver + ;; and hasn't been yanked (define (find-crate-version crate range) (let* ((semver-range (string->semver-range range)) (versions (sort (filter (lambda (entry) - (semver-range-contains? semver-range (first entry))) + (and + (not (crate-version-yanked? (second entry))) + (semver-range-contains? semver-range (first entry)))) (map (lambda (ver) (list (string->semver (crate-version-number ver)) ver)) diff --git a/tests/crate.scm b/tests/crate.scm index 720fcb212c..5aea5efaf3 100644 --- a/tests/crate.scm +++ b/tests/crate.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016 David Craven ;;; Copyright © 2019, 2020, 2022 Ludovic Courtès ;;; Copyright © 2020 Martin Becze +;;; Copyright © 2023 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -76,21 +77,24 @@ (define test-foo-crate \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/foo/0.8.1/dependencies\" - } + }, + \"yanked\": false }, { \"id\": 234212, \"num\": \"1.0.0\", \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/foo/1.0.0/dependencies\" - } + }, + \"yanked\": false }, { \"id\": 234214, \"num\": \"1.0.3\", \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/foo/1.0.3/dependencies\" - } + }, + \"yanked\": false } ] } @@ -123,14 +127,16 @@ (define test-root-crate \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/root/1.0.0/dependencies\" - } + }, + \"yanked\": false }, { \"id\": 234242, \"num\": \"1.0.4\", \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/root/1.0.4/dependencies\" - } + }, + \"yanked\": false } ] } @@ -178,21 +184,24 @@ (define test-intermediate-a-crate \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/intermediate-a/1.0.40/dependencies\" - } + }, + \"yanked\": false }, { \"id\": 234250, \"num\": \"1.0.42\", \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/intermediate-a/1.0.42/dependencies\" - } + }, + \"yanked\": false }, { \"id\": 234252, \"num\": \"1.1.0-alpha.1\", \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/intermediate-a/1.1.0-alpha.1/dependencies\" - } + }, + \"yanked\": false } ] } @@ -235,7 +244,8 @@ (define test-intermediate-b-crate \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/intermediate-b/1.2.3/dependencies\" - } + }, + \"yanked\": false } ] } @@ -268,14 +278,16 @@ (define test-leaf-alice-crate \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/leaf-alice/0.7.3/dependencies\" - } + }, + \"yanked\": false }, { \"id\": 234272, \"num\": \"0.7.5\", \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/leaf-alice/0.7.5/dependencies\" - } + }, + \"yanked\": false } ] } @@ -302,7 +314,8 @@ (define test-leaf-bob-crate \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/leaf-bob/3.0.1/dependencies\" - } + }, + \"yanked\": false } ] } @@ -597,7 +610,8 @@ (define test-doctool-crate \"license\": \"MIT OR Apache-2.0\", \"links\": { \"dependencies\": \"/api/v1/crates/doctool/2.2.2/dependencies\" - } + }, + \"yanked\": false } ] }