From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id WENXIaLKCGWhUgAA9RJhRA:P1 (envelope-from ) for ; Tue, 19 Sep 2023 00:09:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id WENXIaLKCGWhUgAA9RJhRA (envelope-from ) for ; Tue, 19 Sep 2023 00:09:38 +0200 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 4EB2A446BF for ; Tue, 19 Sep 2023 00:09:38 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=planete-kraus.eu header.s=albinoniA header.b=Ipgg92c8; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=planete-kraus.eu ARC-Seal: i=1; s=key1; d=yhetil.org; t=1695074978; a=rsa-sha256; cv=none; b=NVOyaiotxV9N9fC3LRbK9+2AaXdg5jAmdnmUAE8G5CtcS6g9ZB9CQEvBtxUq1GtdF04kcE ticesM+reRXb02PzdHLp0bLNDyFBIqNSikaWm+dVHo5hODbqiu9RtFhbmdlnQcpapaFa+7 pXn9VKwb6WXiThR/HR/Aoi6dxh63gZTjKf5NvRoZsa6bJbnf4dhFH0tstcucIvCZzxiRTB ZrSlwfumfFDoXBd3q+xWR3/OfcZ+lcCgb4Kuol/lKXfOzuws6aZiC9vLzt2CcM/oIz+S17 K45iX3a30hsLBfk/9SIz38BBvx0DcU12mpYiW98zsL3/GajLguuhs6EQrvUYNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1695074978; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:list-id: list-help:list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=6jwHA9dhZQZhVYaV1RsyTzVKlEa1fcb7yewt2dZfgKI=; b=FD9ZDGk7ZsKPPqc8+AhQE6X7lOzOPNJICR4J5CcBYpmoW0hZgpVyNeH1L3NPKcBhFhET0u vVTwzy6TZdQV5RtMN2Q2JsudOLNOaLwn05XaHjlhc44YOD1z25szY1wFzFOA7TNOPTDbc0 mPWxaqsbitO7rGo4RX+RWYKURl5/+PLDsDu009PklXOquNjH36XKCXQERJQ+jyTJcSuESE CfIoZ0+DKZvOf1lFKsZS8rFYLqm2nScPHWfmUu9f7lbXAIQP/KbbydMjA08jPvMWJqU5sY RmLbv0mr9l4NzsENA58dMEbgCS0YUT6/tjqCcSgtfMihSQp/XoLKvzlvCNyNpQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=planete-kraus.eu header.s=albinoniA header.b=Ipgg92c8; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=reject) header.from=planete-kraus.eu Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiMQR-0008F4-Dn; Mon, 18 Sep 2023 18:09:03 -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 1qiMQQ-0008Et-FG for guix-devel@gnu.org; Mon, 18 Sep 2023 18:09:02 -0400 Received: from planete-kraus.eu ([89.234.140.182]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1qiMQO-0000uU-3M for guix-devel@gnu.org; Mon, 18 Sep 2023 18:09:02 -0400 Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id ae9404e2 for ; Mon, 18 Sep 2023 22:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:from:date:subject:to:mime-version; s=albinoniA; bh=5b 3ITOhSAtgLhApS6kf8HMT2bNM=; b=Ipgg92c8Qw1ngX3OjUm+/na2lKJWyeIra4 6ZXXlmZuWS7McKV42Le0N4Xnma4e0R/3a2/8OX7/0baqZwRo4s7mMp0oY2btFngd 7reepWfGBw8+lhPzFilWCzM0aDj869tMs/lmXze7AeJgXn4MpbwN7eynw6wCzpAW C+w608ZgBbsSQ2vwofOz6HfSh+7G9tjqEgJfbLkhv002RdBvrHJiKEacqltb2PNb bQygB6skMjaX6nF2ZZWuj1iPMZZ3kyly/zXmQbwyQcFDRW9UBOBMh6QZzooWVik8 FCGVmW+wlE0z/JzeFuMc+s1SKmrAgJUv45hjMD2WGR5VH9g9fbEA== Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id da78099e (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for ; Mon, 18 Sep 2023 22:08:53 +0000 (UTC) Message-ID: <4c2f6851dece004152bb1904c8b03c7d5206eeeb.1695074290.git.vivien@planete-kraus.eu> From: Vivien Kraus Date: Sun, 17 Sep 2023 07:42:05 +0200 Subject: [PATCH qa-frontpage] Apply incoming patches onto the correct feature branch To: guix-devel@gnu.org MIME-Version: 1.0 User-Agent: Evolution 3.46.4 Received-SPF: pass client-ip=89.234.140.182; envelope-from=vivien@planete-kraus.eu; helo=planete-kraus.eu X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_24_48=1.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -7.32 X-Spam-Score: -7.32 X-Migadu-Queue-Id: 4EB2A446BF X-Migadu-Scanner: mx2.migadu.com X-TUID: xv4ebUZpzuLo It seems that the only available information of the feature branch is in the patch name. --- Hello guix! Thank you for making the QA tool. It seems to me that feature branches are ignored for patches. The patches seem to always be applied on top of master. I get that idea because the base-for-issue-* tag is always put on HEAD, and all my patches targetting gnome-team recently get applied to master. I understand that the latter could be a problem with me. If patches are indeed applied on top of master, then the question arises, what to do. The available information from patchwork is scarce: the base-commit is not available, and the optional feature branch only appears in the name of the patches of the series. I think it is possible to parse the patch names. This way, we get some useful information: the feature branch, the series revision, and the patch index. The patch index can be used to make sure the patches are in correct order (this can be the case if a server in the path re-orders the emails). What do you think? Best regards, Vivien guix-qa-frontpage/manage-patch-branches.scm | 80 +++++++++++++++++++-- 1 file changed, 76 insertions(+), 4 deletions(-) diff --git a/guix-qa-frontpage/manage-patch-branches.scm b/guix-qa-frontpage/manage-patch-branches.scm index 7f3adb1..0512680 100644 --- a/guix-qa-frontpage/manage-patch-branches.scm +++ b/guix-qa-frontpage/manage-patch-branches.scm @@ -102,6 +102,55 @@ (close-pipe pipe) result)) +(define (parse-patch-name name) + (let ((args + (and + (string-prefix? "[" name) + (let ((stop (string-index name #\]))) + (substring name 1 stop)))) + (as-bug-number + (lambda (arg) + (and (string-prefix? "bug#" arg) + (string->number (substring arg (string-length "bug#")))))) + (as-v2 + (lambda (arg) + (and (string-prefix? "v" arg) + (string->number (substring arg 1))))) + (as-patch-number + (lambda (arg) + (match (string-split arg #\/) + (((= string->number index) (= string->number total)) + (and index total (<= index total) + (cons index total))) + (else #f))))) + (let analyze ((bug-number #f) + (branch "master") + (version 1) + (index 1) + (total 1) + (arguments + (if args + (string-split args #\,) + '()))) + (match arguments + ((or ("") ()) + `((bug-number . ,bug-number) + (branch . ,branch) + (version . ,version) + (index . ,index) + (total . ,total))) + (((= as-bug-number (? number? new-bug-number)) + arguments ...) + (analyze new-bug-number branch version index total arguments)) + (((= as-v2 (? number? new-version)) + arguments ...) + (analyze bug-number branch new-version index total arguments)) + (((= as-patch-number ((? number? new-index) . (? number? new-total))) + arguments ...) + (analyze bug-number branch version new-index new-total arguments)) + ((feature-branch arguments ...) + (analyze bug-number feature-branch version index total arguments)))))) + (define (create-branch-for-issue issue-number patchwork-series) (define (apply-patches) (let ((series-data @@ -116,9 +165,32 @@ (json->scm body))))) (if (assoc-ref series-data "received_all") - (let* ((patch-data - (vector->list - (assoc-ref series-data "patches"))) + (let* ((annotated-patch-data + (map + (lambda (patch) + (let ((name (assoc-ref patch "name"))) + `((patch . ,patch) + (metadata . ,(parse-patch-name name))))) + (vector->list + (assoc-ref series-data "patches")))) + (patch-data + (map + (lambda (annotated) + (assq-ref annotated 'patch)) + (stable-sort + annotated-patch-data + (lambda (a b) + (let ((a-meta (assq-ref a 'metadata)) + (b-meta (assq-ref b 'metadata))) + (< (assq-ref a-meta 'index) + (assq-ref b-meta 'index))))))) + (feature-branch + (match annotated-patch-data + ((p rest ...) + (let ((meta (assq-ref p 'metadata))) + (if meta + (assq-ref meta 'branch) + "master"))))) (branch-name (simple-format #f "issue-~A" issue-number)) (base-tag @@ -127,7 +199,7 @@ (simple-format #t "all patches have been received\n") (system* "git" "tag" "--delete" base-tag) - (invoke "git" "tag" base-tag) + (invoke "git" "tag" base-tag feature-branch) (let ((patch-ids (map base-commit: 96e85c3ff9dbc55bcabeceff6ef45c54151ce7b3 -- 2.41.0