From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QHsCC8/vAGJxEwAAgWs5BA (envelope-from ) for ; Mon, 07 Feb 2022 11:09:19 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yCKpB8/vAGKXwQAAauVa8A (envelope-from ) for ; Mon, 07 Feb 2022 11:09:19 +0100 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 D65EB43826 for ; Mon, 7 Feb 2022 11:09:18 +0100 (CET) Received: from localhost ([::1]:54766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nH0xR-0005Et-LJ for larch@yhetil.org; Mon, 07 Feb 2022 05:09:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nGzzM-0005kM-Mr for guix-patches@gnu.org; Mon, 07 Feb 2022 04:07:14 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47016) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nGzzC-0004F3-OP for guix-patches@gnu.org; Mon, 07 Feb 2022 04:07:11 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nGzzC-0002s0-6z; Mon, 07 Feb 2022 04:07:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53818] [PATCH v2 1/7] upstream: Sort list of updaters. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: maximedevos@telenet.be, guix-patches@gnu.org Resent-Date: Mon, 07 Feb 2022 09:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53818 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53818@debbugs.gnu.org Cc: Maxime Devos X-Debbugs-Original-Xcc: Maxime Devos Received: via spool by 53818-submit@debbugs.gnu.org id=B53818.164422481311010 (code B ref 53818); Mon, 07 Feb 2022 09:07:02 +0000 Received: (at 53818) by debbugs.gnu.org; 7 Feb 2022 09:06:53 +0000 Received: from localhost ([127.0.0.1]:40912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGzz2-0002rW-Mt for submit@debbugs.gnu.org; Mon, 07 Feb 2022 04:06:52 -0500 Received: from h178-251-242-94.cust.a3fiber.se ([178.251.242.94]:55260 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nGzz0-0002rJ-Rr for 53818@debbugs.gnu.org; Mon, 07 Feb 2022 04:06:51 -0500 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yoctocell.xyz; s=mail; t=1644224805; bh=uePA9eU3rVfA9D2Eoe6XklIGhmYCp8Bpq3h/n9/hOOk=; h=From:To:Subject:In-Reply-To:References:Date; b=h11PtFCOM1zR5RujP590b6iLRN3VYdW82tVW0+Rf292w7HAmP8JaqRTHd7qnZujZ0 eoI9l2cPHzLC6nLYUINzabVlQNYBB/KmR0NXpN7hyxMbusW5pCfQfW3JH+GgffBOl8 HQXySucp4zwinh1igfTyxDXVpxgfTnD4LIlhB+Ho= In-Reply-To: References: Message-Id: Date: Mon, 07 Feb 2022 10:06:45 +0100 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1644228558; 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=uePA9eU3rVfA9D2Eoe6XklIGhmYCp8Bpq3h/n9/hOOk=; b=m47yyZwOtBzwtO/Yd7XNgYt5se7I9uiH/5MBRo4cL0l0Gpdzt2RlMj4XNW27BfB5p4H6YC qNS7RAMRxZ3nTM0QM5wptYhoiPxTP1LZlC3rXZVBhKLg1CugzDRn62bzEfgJi1zfNyMPRS 38Pklo1LM6HmzqWiE479tRMH3gIDK8y30fs3Ls/PoyutYpo0fhvSIWtM728paRJK92sj75 ccGhTWz2/kCEgiXQfWJ0Bv1PMz0onEkNnxzDBDUQN3S3U7wZCAOxaj6XK2oLJHzSA8GJzK 7C0HuuHRPjsBvTekVpU/vt13H6Pz//N6vyTycwZtpCIr0vZQxb0JKXRDRFdX8g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1644228558; a=rsa-sha256; cv=none; b=ANV7JtwKGvWQXFGvyg1gksKCHCApjxLy2R14n1ASX+F3RapbIC9MOXH2atwm9DbGhYQc6B nx7ZX60p/H6NWiFx0rFeOFn5A7RBlLE+O/xalZ/8C33v1AVoVmWyGVVNBrdRkMYHckP336 e+BoNYsIaojiYNDyy26677S6xPuk9bZbiyv00Jlg5j93gPI4lD0jEE5VHwC8YzRtX5YT0m x1193FbRi6egDfLp+qXCdrGoYIIfF7bi5C9p9vqDsXzaMA/nCbFKOyrT2Q5qYZBJTZD6pM ysr4/TuVPAEzyt9ZbrM337m1tKxDGaTOyGJXdsGwf5Vi6sule0Zal5AZSOkgOg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=h11PtFCO; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); 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" X-Migadu-Spam-Score: -1.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=h11PtFCO; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); 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" X-Migadu-Queue-Id: D65EB43826 X-Spam-Score: -1.03 X-Migadu-Scanner: scn1.migadu.com X-TUID: RpnJ+1Pod4IF The order determines which updater gets used first when running =E2=80=98gu= ix refresh=E2=80=99 on a package. We want the most generic updaters to be last since they usua= lly don=E2=80=99t provide as much or accurate information as language-specific = updaters. * guix/upstream.scm (sort-updaters): New procedure. (%updaters): Use it. --- guix/upstream.scm | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/guix/upstream.scm b/guix/upstream.scm index 6666803a92..d5faf9d3ee 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -250,14 +250,31 @@ (define (importer-modules) %load-path) #:warn warn-about-load-error))) =20 +(define (sort-updaters updaters) + "Sort UPDATERS by putting the more generic ones last." + (define (genericity updater) + (cond + ((equal? 'repology (upstream-updater-name updater)) + 2) + ((string-prefix? "generic-" + (symbol->string (upstream-updater-name updater))) + 1)=20=20=20=20=20 + (else 0))) + + (define (less a b) + (<=3D (genericity a) (genericity b))) + + (stable-sort updaters less)) + (define %updaters ;; The list of publically-known updaters. - (delay (fold-module-public-variables (lambda (obj result) - (if (upstream-updater? obj) - (cons obj result) - result)) - '() - (importer-modules)))) + (delay (sort-updaters + (fold-module-public-variables (lambda (obj result) + (if (upstream-updater? obj) + (cons obj result) + result)) + '() + (importer-modules))))) =20 ;; Tests need to mock this variable so mark it as "non-declarative". (set! %updaters %updaters) --=20 2.34.1