[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Whole-Package Extractor Program (extracts a whole package from a patch (
From: |
Danny Milosavljevic |
Subject: |
Whole-Package Extractor Program (extracts a whole package from a patch (that would be adding an entire package) and applies it to a master clone and commits) |
Date: |
Thu, 28 Jul 2016 14:00:26 +0200 |
Hi,
On Thu, 28 Jul 2016 11:36:03 +0000
ng0 <address@hidden> wrote:
>I did not see that they are all related, only the 3 of them I looked at.
Yeah, that was my fault. I should have done a patch series in the first place -
given that these perl package patches touch the same files and so probably
won't apply out-of-order.
> I'm relatively new to scheme, so this should be useful for future
> reference for myself and other newcomers.
The Python script I attached (new version attached again) can only handle the
special case of a patch which patches well-formatted (i.e. newline where it
should be etc) scm files which adds packages and removes nothing.
It uses heuristics and is not the right fix - but half a solution is better
than none.
What it can do is you give it a patch or E-Mail name on the commandline and it
will read it and extract the "+" blocks and just append them to the guix git
master. There are also a few special cases handled like adapting the
define-module form if necessary but it's not really safe in general - i.e. you
have to verify the result manually.
Still beats rewriting all the patches manually :)
For example you give it a patch containing
diff a/foo.scm b/foo.scm
+++ b/foo.scm
@@ 22 number doesn't matter
+(define foo 2)
and it will append
(define foo 2)
to the end of the file "foo.scm" in a fixed directory ~/src/guix-master/guix .
A better solution would be to add something like "guix edit" to guix which
extracts the package and returns an S-Expression to send to the list - not
forgetting eventually required module header changes (imports etc). Otherwise
it will always depend on the order the patches from different people are
applied. That won't scale.
reapply-guix-patch-to-master
Description: Binary data