mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [ptxdist] [PATCH 2/2] doc: dev manual: how to recover from patch merge conflicts with git
Date: Wed, 16 Jun 2021 17:56:31 +0200	[thread overview]
Message-ID: <20210616155631.12180-2-rhi@pengutronix.de> (raw)
In-Reply-To: <20210616155631.12180-1-rhi@pengutronix.de>

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
If someone could write a similar section for the quilt workflow, that
would be great, as I don't know too much about quilt :-)

 doc/dev_patching.rst | 72 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)

diff --git a/doc/dev_patching.rst b/doc/dev_patching.rst
index e3690dfe1b48..a17983aa826a 100644
--- a/doc/dev_patching.rst
+++ b/doc/dev_patching.rst
@@ -159,6 +159,78 @@ that are autogenerated in autotools-based buildsystems.
 Refer to the section :ref:`configure_rebuild` on how PTXdist can
 handle this special task.
 
+Recovering from merge conflicts
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+When updating packages, it can happen that older patches no longer apply.
+In this case, the *extract* stage will throw errors like this::
+
+   -----------------------------
+   target: ima-evm-utils.extract
+   -----------------------------
+
+   extract: pkg_src=/ptx/src/ima-evm-utils-1.3.2.tar.gz
+   extract: pkg_extract_dir=DistroKit/platform-v7a/build-target/ima-evm-utils-1.3.2
+   patchin: git: initializing repository
+   patchin: git: done
+
+   pkg_patch_dir:     'ptxdist/patches/ima-evm-utils-1.3.2'
+   pkg_patch_series:  'ptxdist/patches/ima-evm-utils-1.3.2/series'
+
+   patchin: git: apply 'ptxdist/patches/ima-evm-utils-1.3.2/series'
+   tagging -> base
+   0001-INSTALL-remove-file-at-it-s-autogenerated-by-autotoo.patch
+   0002-Makefile.am-rename-INCLUDES-AM_CPPFLAGS.patch
+   error: patch failed: src/Makefile.am:1
+   error: src/Makefile.am: patch does not apply
+   make: *** […/ptxdist/rules/post/ptxd_make_world_extract.make:41: …/DistroKit/platform-v7a/state/ima-evm-utils.extract] Error 4
+
+In the example above, the first patch was applied cleanly, but the second one
+was not because src/Makefile.am contained different lines than expected.
+If this happens, you have to clean up the merge conflict,
+and apply the remaining patches manually.
+
+First, change into the package's build directory, and abort the current patch::
+
+   …/distrokit/master (master) $  cd platform-v7a/build-target/ima-evm-utils-1.3.2/
+
+   …/build-target/ima-evm-utils-1.3.2 (master|AM/REBASE) $  git log --oneline --graph
+   * 6687ab46087c (HEAD -> master) INSTALL: remove file, as it's autogenerated by autotools
+   * 01a52624237f (tag: ima-evm-utils-1.3.2, tag: base) initial commit
+
+   …/build-target/ima-evm-utils-1.3.2 (master|AM/REBASE) $  git am --abort
+
+   …/build-target/ima-evm-utils-1.3.2 (master) $
+
+(Notice how the Git integration in the shell prompt still shows ``AM/REBASE``
+before the cleanup, signaling the ongoing conflict resolution.)
+
+The remaining patches are still available in the ``./patches`` directory
+relative to your current location.
+Try to apply each of them in turn using ``git am``.
+If a patch fails to apply, Git will not change any files, but will still
+remember the patch's author and commit message, and prompt you to resolve
+the conflicts::
+
+   …/build-target/ima-evm-utils-1.3.2 (master) $  git am patches/0005-evmctl-add-fallback-definitions-for-XATTR_NAME_IMA.patch
+
+   Applying: evmctl: add fallback definitions for XATTR_NAME_IMA
+   Patch failed at 0005 evmctl: add fallback definitions for XATTR_NAME_IMA
+   hint: Use 'git am --show-current-patch=diff' to see the failed patch
+   When you have resolved this problem, run "git am --continue".
+   If you prefer to skip this patch, run "git am --skip" instead.
+   To restore the original branch and stop patching, run "git am --abort".
+
+* If you find that the patch is no longer necessary (e.g. because it was
+  already merged upstream in the new package version), skip it with
+  ``git am --skip``.
+* Otherwise, apply the same patch again manually via ``patch --merge -p1 <
+  patches/filename.patch``, and resolve any resulting conflicts using your
+  favourite editor.
+* Finally, ``git am --continue`` commits your conflict resolution with the
+  patch's original author and log message.
+
+After porting all patches, update the package's patch queue with ``git ptx-patches``.
 
 Adding More Patches to a Package
 ================================
-- 
2.29.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

  reply	other threads:[~2021-06-16 15:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 15:56 [ptxdist] [PATCH 1/2] doc: dev manual: propagate two subsections to sections Roland Hieber
2021-06-16 15:56 ` Roland Hieber [this message]
2021-06-29  5:09   ` [ptxdist] [APPLIED] doc: dev manual: how to recover from patch merge conflicts with git Michael Olbrich
2021-06-29  5:09 ` [ptxdist] [APPLIED] doc: dev manual: propagate two subsections to sections Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210616155631.12180-2-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox