From 81a2d5a90b7af5c26d337aae36af9b078909871a Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Thu, 3 Sep 2026 14:53:26 +0200 Subject: [PATCH 1/4] Document exportpatches - How to install (in parallel to importpatches) - That the script makes assumption about your remote's name --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ad4ce21..86614ee 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A command to update Fedora Python dist-git spec & patches from a Git repository Meant to be used with a local clone of [fedora-python/cpython] which includes tags like `vX.Y.Z` (upstream releases) and branches like `fedora-X.Y` (`vX.Y.Z` + commits for individual patches). +The script assumes that your local clone is named `fedora-python`. The summary lines of patch commits must start with `NNNNN: `, where NNNNN is the patch number (registered in the [patch registry]). @@ -25,11 +26,12 @@ conventions.) ## Setup -Add the script to your `$PATH`, for example: +Add the scripts to your `$PATH`, for example: ln -s $PWD/importpatches.py ~/.local/bin/importpatches + ln -s $PWD/exportpatches.py ~/.local/bin/exportpatches -The script needs to know where your local clone of `fedora-python/cpython` is, +The scripts need to know where your local clone of `fedora-python/cpython` is, and uses Git configuration as a default. In your clone of dist-git, run `git config importpatches.upstream .../cpython`. @@ -40,7 +42,7 @@ to avoid the need to set this in all dist-git clones of Pythons. ## Usage -Run `importpatches.py` without arguments in your clone of dist-git. +Run `importpatches.py`/`exportpatches.py` without arguments in your clone of dist-git. If the defaults don't work for you, run with `--help` to see the options. From 43ddf65202174964509a91437c9a9560f8cdfe50 Mon Sep 17 00:00:00 2001 From: Karolina Surma <33810531+befeleme@users.noreply.github.com> Date: Fri, 4 Sep 2026 07:55:43 +0200 Subject: [PATCH 2/4] Apply suggestion from @hroncok MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Miro HronĨok --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 86614ee..ea61078 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A command to update Fedora Python dist-git spec & patches from a Git repository Meant to be used with a local clone of [fedora-python/cpython] which includes tags like `vX.Y.Z` (upstream releases) and branches like `fedora-X.Y` (`vX.Y.Z` + commits for individual patches). -The script assumes that your local clone is named `fedora-python`. +The script assumes that the remote is named `fedora-python`. The summary lines of patch commits must start with `NNNNN: `, where NNNNN is the patch number (registered in the [patch registry]). From 9efab49df2773961a1b217cd5805a378f98a532f Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Fri, 4 Sep 2026 08:03:44 +0200 Subject: [PATCH 3/4] Actually document exportpatches throughout README (to be squashed) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ea61078..90a9c40 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# importpatches.py +# importpatches.py and exportpatches.py -A command to update Fedora Python dist-git spec & patches from a Git repository +Commands to update Fedora Python dist-git spec & patches from/to a Git repository Meant to be used with a local clone of [fedora-python/cpython] which includes tags like `vX.Y.Z` (upstream releases) and branches like `fedora-X.Y` (`vX.Y.Z` + commits for individual patches). -The script assumes that the remote is named `fedora-python`. +The exportpatches script assumes that the remote is named `fedora-python`. The summary lines of patch commits must start with `NNNNN: `, where NNNNN is the patch number (registered in the [patch registry]). @@ -48,7 +48,7 @@ If the defaults don't work for you, run with `--help` to see the options. ## Git hash IDs -The script adds Git hash IDs to the spec file. +The importpatches script adds Git hash IDs to the spec file. These are hashes of the patch content, ignoring tings like context lines and comments. When one of these changes, pay special atttention to the patch diff. From 876f2f2a08c987257bd9cb8d1c120c7449384bf9 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Fri, 4 Sep 2026 08:21:42 +0200 Subject: [PATCH 4/4] Add a section explaining the mechanics of both scripts --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index 90a9c40..1742895 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,32 @@ Run `importpatches.py`/`exportpatches.py` without arguments in your clone of dis If the defaults don't work for you, run with `--help` to see the options. +## What it does + +### importpatches + +importpatches takes commits between a base tag and head tag +in the [fedora-python/cpython] clone and turns them into patch files +plus updated spec comments in the current dist-git checkout. +Each commit is formatted into a *.patch file (named NNNNN-... where possible) +and its Git patch-id is written into the spec comment above +the PatchNNNNN: line, along with the commit message body. +It replaces the whole patches section between the +`(Patches taken from github.com/fedora-python/cpython)` and +`(New patches go here ^^^)` markers, removing old patch files and moving +the new ones into place. + + +### exportpatches + +exportpatches is an inverse of importpatches: it takes patches listed +in the dist-git spec and applies them onto a local clone of [fedora-python/cpython], +producing the fedora-X.Y branch from the upstream vX.Y.Z tag. +Each patch becomes one commit, with the summary line prefixed by its patch +number (NNNNN: ) as required by the patch registry. +It then tags the result and pushes the branch and tag to the fedora remote. + + ## Git hash IDs The importpatches script adds Git hash IDs to the spec file.