DevHeads.net

when DEP-3 compliant patches in Fedora?

Hi

I am building software for misc distributions for over 11 years. And so
far Fedora packages are the worst of those I played with (mostly
OpenEmbedded and Debian).

Why? Because patches are mess. Let's take random one:

@@ -108,7 +108,7 @@
M = int(max(r, g, b))
m = int(min(r, g, b))
val = (2 * M + r + g + b) / 5
- p[:] = (val + r) / 2, (val + g) / 2, (val + b) / 2
+ #p[:] = (val + r) / 2, (val + g) / 2, (val + b) / 2
if alpha[y][x] >= 250:
alpha[y][x] = 255 - (M - m) * 3 / 4
del pixels

Who knows what it does and why? For some reason it has a name '64bitfix'
but why it is needed? Did upstream ever saw it? No idea.

In Debian (or in OpenEmbedded) it is solved by implementing DEP-3 [1]
which is set of requirements about extra metadata in patches such as:

- Description or Subject (required)
- Origin (required except if Author is present)
- Bug-<Vendor> or Bug (optional)
- Forwarded (optional)
- Author or From (optional)
- Reviewed-by or Acked-by (optional)
- Last-Update (optional)
- Applied-Upstream (optional)

1. <a href="http://dep.debian.net/deps/dep3/" title="http://dep.debian.net/deps/dep3/">http://dep.debian.net/deps/dep3/</a>

Examples:

* posix/bug-regex17.c: Add testcases.
* posix/regcomp.c (re_compile_fastmap_iter): Rewrite COMPLEX_BRACKET
handling.

Origin: upstream, <a href="http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdb56bac" title="http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdb56bac">http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdb56bac</a>
Bug: <a href="http://sourceware.org/bugzilla/show_bug.cgi?id=9697" title="http://sourceware.org/bugzilla/show_bug.cgi?id=9697">http://sourceware.org/bugzilla/show_bug.cgi?id=9697</a>
Bug-Debian: <a href="http://bugs.debian.org/510219" title="http://bugs.debian.org/510219">http://bugs.debian.org/510219</a>

A patch created by the Debian maintainer John Doe, which got forwarded and rejected:

Description: Use FHS compliant paths by default
Upstream is not interested in switching to those paths.
.
But we will continue using them in Debian nevertheless to comply with
our policy.
Forwarded: <a href="http://lists.example.com/oct-2006/1234.html" title="http://lists.example.com/oct-2006/1234.html">http://lists.example.com/oct-2006/1234.html</a>
Author: John Doe <johndoe- ... at users dot alioth.debian.org>
Last-Update: 2006-12-21

A vendor specific patch not meant for upstream submitted on the BTS by a Debian developer:

Description: Workaround for broken symbol resolving on mips/mipsel
The correct fix will be done in etch and it will require toolchain
fixes.
Forwarded: not-needed
Origin: vendor, <a href="http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=80;bug=265678" title="http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=80;bug=265678">http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=80;bug=265678</a>
Bug-Debian: <a href="http://bugs.debian.org/265678" title="http://bugs.debian.org/265678">http://bugs.debian.org/265678</a>
Author: Thiemo Seufer < ... at debian dot org>

A patch submitted and applied upstream:

Description: Fix widget frobnication speeds
Frobnicating widgets too quickly tended to cause explosions.
Forwarded: <a href="http://lists.example.com/2010/03/1234.html" title="http://lists.example.com/2010/03/1234.html">http://lists.example.com/2010/03/1234.html</a>
Author: John Doe <johndoe- ... at users dot alioth.debian.org>
Applied-Upstream: 1.2, <a href="http://bzr.example.com/frobnicator/trunk/revision/123" title="http://bzr.example.com/frobnicator/trunk/revision/123">http://bzr.example.com/frobnicator/trunk/revision/123</a>
Last-Update: 2010-03-29

Are there any plans on adding/enforcing such requirements at least for new
patches?

Maintainers are not the only persons who work on their packages. Sometimes some
random developers go though random packages for several reasons (fixing ftbfs on
secondary architectures, mass rebuilds etc). There is also "bus factor" which
can wipe maintainer from existence or people just orphan own packages.

Why we have to check patch after patch for their reason or upstream status?

Comments

Re: when DEP-3 compliant patches in Fedora?

By Florian Weimer at 08/28/2015 - 07:44

On 08/28/2015 02:11 PM, Marcin Juszkiewicz wrote:
In reality, here's what the Debian version of this patch looks like:

<http://sources.debian.net/src/monsterz/0.7.1-8/debian/patches/010_64-bit-alignment-issues-with-python2.5.diff/>

I'm not sure if it's all that more helpful, to be honest. It does not
follow DEP-3, sure, but neither do many other Debian packages. Even
some critical server packages still do not have any broken-out patches
at all.

(In general, if there is no upstream to contribute such fixes to, it's
probably best not to ship such software at all.)

Re: when DEP-3 compliant patches in Fedora?

By Marcin Juszkiewicz at 08/28/2015 - 08:10

W dniu 28.08.2015 o 14:44, Florian Weimer pisze:

I would say that it is a bit better. Now I at least know that it is
related to Python 2.5 (which we no longer ship) and some 64bit alignment
issues due to it ;D

But yes, with dead upstream it is not so funny.

Re: when DEP-3 compliant patches in Fedora?

By Kevin Kofler at 08/29/2015 - 20:47

Marcin Juszkiewicz wrote:
It means the problem first showed up with 2.5, but chances are all later 2.x
(and maybe also 3.x) are affected too.

Kevin Kofler

Re: when DEP-3 compliant patches in Fedora?

By King InuYasha at 08/28/2015 - 07:51

​If patches are exported from Mercurial or Git, y​ou'd have all the
information you'd want. However, most people I know aren't working from the
hg/git repository when making packages. That said, I would seriously hope
there would be comments in the spec indicating why the patch is needed. I
know that when I have to make patches to packages, I will put comments
right above the patch source line with information about the patch.

Re: when DEP-3 compliant patches in Fedora?

By Marcin Juszkiewicz at 08/28/2015 - 08:03

W dniu 28.08.2015 o 14:51, Neal Gompa pisze:

Fully agree. Only info about upstream status is missing.

Often there is not even such information ;(

Re: when DEP-3 compliant patches in Fedora?

By Kevin Kofler at 08/28/2015 - 07:40

Marcin Juszkiewicz wrote:
I am opposed to any such scheme, because it means we could no longer produce
our patches with diff without hand-editing them.

Such information, if needed, belongs into specfile comments.

Kevin Kofler

Re: when DEP-3 compliant patches in Fedora?

By Marcin Juszkiewicz at 08/28/2015 - 09:12

W dniu 28.08.2015 o 14:40, Kevin Kofler pisze:
Ever heard of "quilt"? It even has handling of sane spec files built-in.

My common way of tweaking Fedora patches is this:

cd ~/rpmbuild/fedora-packager/PACKAGENAME/
git up
quilt setup -v *spec
cd SOURCENAME-VERSION
quilt push -a

And then I have upstream source with Fedora patches applied. 'quilt
push/pop' allows me to apply/revert patches, 'quilt refresh' refreshes
patch (amount of context lines etc can be configured, description is
kept, diffstat can be added).

Try it one day?

Re: when DEP-3 compliant patches in Fedora?

By Kevin Kofler at 08/29/2015 - 20:44

Marcin Juszkiewicz wrote:
Sorry, but I'm opposed to requiring a specific tool to generate patches.
Patches are made in many ways in the real world: plain diff, svn diff, git
diff, … Requiring a tool that forces a specific workflow on us just because
a normal diff is not good enough for you is a no go.

Kevin Kofler

Re: when DEP-3 compliant patches in Fedora?

By Florian Weimer at 08/30/2015 - 09:04

On 08/30/2015 03:44 AM, Kevin Kofler wrote:
You for got sed. (Look ma, no conflicts!)

And that alone is sufficient reason for me to wish for a switch to
completely declarative patching. (I know it wont happen.)

Re: when DEP-3 compliant patches in Fedora?

By Michael Catanzaro at 08/28/2015 - 08:47

On Fri, 2015-08-28 at 14:40 +0200, Kevin Kofler wrote:
Let's do that then. openSUSE already has established required comments
for patches in specfiles: <a href="https://en.opensuse.org/openSUSE:Packaging_Pa" title="https://en.opensuse.org/openSUSE:Packaging_Pa">https://en.opensuse.org/openSUSE:Packaging_Pa</a>
tches_guidelines#Patch_markup_.28also_called_.22Tagging_patches.22.29

It works well in practice. It's not hard to write, and it more helpful
than the Fedora tradition of just adding a link to the upstream bug.
Maintainers in openSUSE understand that it is required.

Re: when DEP-3 compliant patches in Fedora?

By Kevin Kofler at 08/29/2015 - 20:41

Michael Catanzaro wrote:
To be honest, I don't see why we need to REQUIRE patch descriptions to begin
with. And especially not more verbose ones than what we have now. A link to
the upstream bug can be enough if the upstream bug contains the needed
information (what the problem is, and what upstream release the fix will be
included in). KDE bug reports usually contain this information, and also the
author of the patch (which shouldn't be a required information though, it's
enough to know that it comes from upstream) and a link to the upstream
commit.

Kevin Kofler

Re: when DEP-3 compliant patches in Fedora?

By =?iso-8859-1?q?... at 08/28/2015 - 07:32

Marcin Juszkiewicz < ... at redhat dot com> wrote:
Have you read the existent policy on this?
<a href="http://fedoraproject.org/wiki/Packaging:Guidelines#Patch_Guidelines" title="http://fedoraproject.org/wiki/Packaging:Guidelines#Patch_Guidelines">http://fedoraproject.org/wiki/Packaging:Guidelines#Patch_Guidelines</a>

Björn Persson

Re: when DEP-3 compliant patches in Fedora?

By Marcin Juszkiewicz at 08/28/2015 - 08:01

W dniu 28.08.2015 o 14:32, Björn Persson pisze:

Yes, I have read it. But lot of maintainers did not.

Example specfile:

Source1: %{name}.score
Patch0: %{name}-0.7.1-userpmopts.patch
Patch1: %{name}-0.7.1-64bitfix.patch
Patch2: %{name}-0.7.1-blit-crash.patch

Re: when DEP-3 compliant patches in Fedora?

By =?iso-8859-1?q?... at 08/28/2015 - 14:58

Marcin Juszkiewicz wrote:
OK, so you're aware that the examples you point out don't comply with
the policy. What is your proposal then? More policy? More manual
reviews? Some kind of automated policy enforcement? Or do you expect
that a different data format will result in better observance?

Björn Persson

Re: when DEP-3 compliant patches in Fedora?

By =?UTF-8?Q?Mat=C... at 08/28/2015 - 11:02

On 2015-08-28, 13:01 GMT, Marcin Juszkiewicz wrote:
Well, perhaps instead of non-sensical (meaning, it cannot get to
any meaningful resolution) discussion on devel, I would think
that filing a bug could lead to something?

Matěj

Re: when DEP-3 compliant patches in Fedora?

By Marcin Juszkiewicz at 08/28/2015 - 12:09

W dniu 28.08.2015 o 18:02, Matěj Cepl pisze:
You mean mass bug reporting for each package where spec file lacks
information about patches?

Prefer to spend that time on fixing those packages where aarch64 or
other secondary architecture is not handled.

Re: when DEP-3 compliant patches in Fedora?

By =?UTF-8?Q?Mat=C... at 08/29/2015 - 17:42

On 2015-08-28, 17:09 GMT, Marcin Juszkiewicz wrote:
No, just for the package where you are bothered by the lack of
information. What I meant is that in the end all those tens of
thousands of patches needs to be described one at the time. And
by chatting about it on devel@ won't fix the description for one
of them.

Matěj