Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 380271 - epatch should test/patch each patch rather than test all patches first
Summary: epatch should test/patch each patch rather than test all patches first
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-22 18:36 UTC by Sven Vermeulen (RETIRED)
Modified: 2011-08-23 18:52 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Failure on patchbundle (patchbundle-failure.tar.bz2.out,393.42 KB, text/plain)
2011-08-22 20:07 UTC, Sven Vermeulen (RETIRED)
Details
Patch file 1 (0047-asterisk-allow_asterisk_to_listen_on_its_control_socket-r2.patch,574 bytes, text/plain)
2011-08-22 20:08 UTC, Sven Vermeulen (RETIRED)
Details
Patch file 2 (0052-asterisk-allow_initrc_to_manage_asterisk_log_and_pid_file_attributes-r3.patch,1.90 KB, text/plain)
2011-08-22 20:09 UTC, Sven Vermeulen (RETIRED)
Details
Ebuild that triggers the epatch (selinux-mutt-2.20110726-r2.ebuild,262 bytes, text/plain)
2011-08-23 09:30 UTC, Sven Vermeulen (RETIRED)
Details
Old(er) selinux-policy-2.eclass (selinux-policy-2.eclass,6.57 KB, text/plain)
2011-08-23 09:30 UTC, Sven Vermeulen (RETIRED)
Details
Test ebuild (foo-2.0.ebuild,630 bytes, text/plain)
2011-08-23 14:23 UTC, Sven Vermeulen (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Vermeulen (RETIRED) gentoo-dev 2011-08-22 18:36:56 UTC
From the output of an epatch run, it looks like epatch first does a --dry-run on all patches in a given archive before applying them. If the archive contains incremental patches (like "-a +b" and then "-b +c") epatch dies during the --dry-run.

Perhaps epatch could iterate over the patches in the archive instead, first testing the patch (--dry-run), then applying, then going to the next patch?

Reproducible: Always
Comment 1 SpanKY gentoo-dev 2011-08-22 19:42:35 UTC
please post an actual example.  epatch tests each patch by itself before moving on to the next one.  if it didnt, many patchesets i personally have made would fall over.
Comment 2 Sven Vermeulen (RETIRED) gentoo-dev 2011-08-22 20:07:54 UTC
Created attachment 284247 [details]
Failure on patchbundle

This is the failure reported when applying the patch bundle. The bundle is a compressed archive with all patches in it, ordered by name (starting with a changeset number).

I'll put the two patches that are interfering as other attachments.
Comment 3 Sven Vermeulen (RETIRED) gentoo-dev 2011-08-22 20:08:47 UTC
Created attachment 284249 [details]
Patch file 1

First patch (sets a policy from "connectto" to "connectto listen")
Comment 4 Sven Vermeulen (RETIRED) gentoo-dev 2011-08-22 20:09:28 UTC
Created attachment 284251 [details]
Patch file 2

Second patch (sets policy from "connectto listen" to "connectto listen accept")
Comment 5 Anthony Basile gentoo-dev 2011-08-22 22:51:06 UTC
(In reply to comment #1)
> please post an actual example.  epatch tests each patch by itself before moving
> on to the next one.  if it didnt, many patchesets i personally have made would
> fall over.

Reading the eutils.eclass carefully, lines 377-417, you see that the dry-run is done immediately before the application of each patch.  I even wrote a little test case example which I put at

http://git.overlays.gentoo.org/gitweb/?p=dev/blueness.git;a=tree;f=tests-only/patchorder;h=206404c70df95e2a27f13d600663ab34579ae65a;hb=af7c7816670c7eb933fc8bcc08b5522587797af2

I'll try to figure out what's going on in this case, but I don't think its a problem in epatch.
Comment 6 SpanKY gentoo-dev 2011-08-23 00:55:21 UTC
Sven: please post the actual ebuild too
Comment 7 Sven Vermeulen (RETIRED) gentoo-dev 2011-08-23 09:30:14 UTC
Created attachment 284325 [details]
Ebuild that triggers the epatch

This is the ebuild, but you're not going to see much there. I'll also attach the eclass that triggers it (the actual eclass in gentoo-x86 has been updated yesterday to use a different patching method, allowing better debugging and such)
Comment 8 Sven Vermeulen (RETIRED) gentoo-dev 2011-08-23 09:30:53 UTC
Created attachment 284327 [details]
Old(er) selinux-policy-2.eclass

Eclass that uses the "epatch patchbundle.tar.bz2" behavior.
Comment 9 Sven Vermeulen (RETIRED) gentoo-dev 2011-08-23 14:23:52 UTC
Created attachment 284367 [details]
Test ebuild

This is a test ebuild that triggers the same problem. Doesn't use eclass and uses hardcoded tarballs that I won't touch (specific tarball for this bugreport) so that ongoing development doesn't skew further analysis.

The ebuild doesn't match good QA, please excuse me for that :p
Comment 10 SpanKY gentoo-dev 2011-08-23 14:41:08 UTC
i think you're simply mistaken.  epatch has never supported operating directly on a tarball of patches.  if you unpack the tarball, epatch will work on that unpacked dir, but that's it.

from your first log file:

PIPE_COMMAND:  bzip2 -dc .../distdir/patchbundle-selinux-base-policy-2.20110726-r3.tar.bz2 > .../16763.patch
PATCH COMMAND:  patch -p0 -g0 -E --no-backup-if-mismatch < '.../16763.patch'

notice that there is no `tar` usage there.  the tar format basically concats files together into a single file with a little metadata ... and patch is pretty good at skipping that metadata and finding the actual patch.

i dont think we need to support patch tarballs directly right now as our current system was worked fine: unpack the tarball, then run `epatch` on the dir.
Comment 11 Sven Vermeulen (RETIRED) gentoo-dev 2011-08-23 18:52:43 UTC
Sometimes I'm just lucky hitting stuff that isn't supposed to work... ;-)

No problem, we're using the epatch (against dir) since a few weeks anyhow.