From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: Re: [ptxdist] [APPLIED] doc: dev manual: how to recover from patch merge conflicts with git
Date: Tue, 29 Jun 2021 07:09:17 +0200 [thread overview]
Message-ID: <20210629050917.2523923-1-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20210616155631.12180-2-rhi@pengutronix.de>
Thanks, applied as 0ab10db1c2d26ae4d94454aedffa6cf5073423f7.
Michael
[sent from post-receive hook]
On Tue, 29 Jun 2021 07:09:17 +0200, Roland Hieber <rhi@pengutronix.de> wrote:
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> Message-Id: <20210616155631.12180-2-rhi@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> 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
> ================================
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
next prev parent reply other threads:[~2021-06-29 5:10 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 ` [ptxdist] [PATCH 2/2] doc: dev manual: how to recover from patch merge conflicts with git Roland Hieber
2021-06-29 5:09 ` Michael Olbrich [this message]
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=20210629050917.2523923-1-m.olbrich@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=ptxdist@pengutronix.de \
--cc=rhi@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