make vdr more patch friendly

Message ID 200507012237.23423.zzam@gmx.de
State New
Headers

Commit Message

Matthias Schwarzott July 1, 2005, 8:37 p.m. UTC
  Hi!

While including vdr into gentoo I found a lot of patches colliding at the same 
places in vdr.
The places where this occurs mostly are:
* config.h, members of cSetup
* config.c, things in global space like new methods of cSetup
* config.c, init of member variables of cSetup
* config.c, store of member variables of cSetup
* config.c, parse/read of member-variables of cSetup
* i18n.c, definition of new i18ns

The solution I propse is:

In each of these places add a context for diff (perhaps like this):

/*
 * Place for patches to insert functions/members to cSetup - Begin
 */
/*
 * Place for patches to insert functions/members to cSetup - End
 */

Attached is a patch to add these contexts at the places mentioned above.


Now, if a patch wants to add some new members to cSetup these should be 
inserted between these two (three lines long) comments. The patch must also 
reproduce the context from above.

Example: If patch a wants to add a variable a_active to cSetup this should 
result in that patch:

  /*
   * Place for patches to insert functions/members to cSetup - Begin
   */
+ // added by patch a
+ int a_active;
+ /*
+  * Place for patches to insert functions/members to cSetup - End
+  */
+ /*
+  * Place for patches to insert functions/members to cSetup - Begin
+  */
  /*
   * Place for patches to insert functions/members to cSetup - End
   */

This will reproduce the context and the next patch can also be applied without 
problems.

That has the following advantages:
1. The patch will be independent of other patches adding variables at the same 
place, as long as they also uses that technique.
2. The patch will nevertheless be garantueed to hit the right place, as the 
occurence of this context is unique.

Greetings
  Matthias
  

Comments

Matthias Schwarzott July 7, 2005, 7:46 p.m. UTC | #1
Hi!

Is there nobody interested in having external patches playing more nice 
together. How are all the other people building vdr with some patches solve 
this issue?
Or are all happy with patching the conflicting parts by hand?

Matthias
  
Grégoire Favre July 7, 2005, 8:01 p.m. UTC | #2
On Thu, Jul 07, 2005 at 09:46:08PM +0200, Matthias Schwarzott wrote:

Hello,

> Is there nobody interested in having external patches playing more nice 
> together. How are all the other people building vdr with some patches solve 
> this issue?

He, I really like your last patch idea !!!

> Or are all happy with patching the conflicting parts by hand?

Not specially, even if the bigpatch on vdrportal.de is quite perfect for
me :-)
  

Patch

diff -ru vdr-1.3.27-vanilla/config.c vdr-1.3.27-prepared/config.c
--- vdr-1.3.27-vanilla/config.c	2005-07-01 12:51:34.000000000 +0200
+++ vdr-1.3.27-prepared/config.c	2005-07-01 21:52:24.000000000 +0200
@@ -15,6 +15,17 @@ 
 #include "plugin.h"
 #include "recording.h"
 
+
+
+/*
+ * Place for Plugins to add code in global space - Begin
+ */
+/*
+ * Place for Plugins to add code in global space - End
+ */
+
+
+
 // IMPORTANT NOTE: in the 'sscanf()' calls there is a blank after the '%d'
 // format characters in order to allow any number of blanks after a numeric
 // value!
@@ -302,6 +313,18 @@ 
   CurrentChannel = -1;
   CurrentVolume = MAXVOLUME;
   CurrentDolby = 0;
+
+
+
+/*
+ * Place for Plugins to initialize variables - Begin
+ */
+/*
+ * Place for Plugins to initialize variables - End
+ */
+
+
+
 }
 
 cSetup& cSetup::operator= (const cSetup &s)
@@ -460,6 +483,18 @@ 
   else if (!strcasecmp(Name, "CurrentChannel"))      CurrentChannel     = atoi(Value);
   else if (!strcasecmp(Name, "CurrentVolume"))       CurrentVolume      = atoi(Value);
   else if (!strcasecmp(Name, "CurrentDolby"))        CurrentDolby       = atoi(Value);
+
+
+
+/*
+ * Place for Plugins to parse parameters into variables - Begin
+ */
+/*
+ * Place for Plugins to parse parameters into variables - End
+ */
+
+
+
   else
      return false;
   return true;
@@ -525,6 +560,17 @@ 
   Store("CurrentVolume",      CurrentVolume);
   Store("CurrentDolby",       CurrentDolby);
 
+
+
+/*
+ * Place for Plugins to store variables - Begin
+ */
+/*
+ * Place for Plugins to store variables - End
+ */
+
+
+
   Sort();
 
   if (cConfig<cSetupLine>::Save()) {
diff -ru vdr-1.3.27-vanilla/config.h vdr-1.3.27-prepared/config.h
--- vdr-1.3.27-vanilla/config.h	2005-07-01 12:51:34.000000000 +0200
+++ vdr-1.3.27-prepared/config.h	2005-07-01 21:51:54.000000000 +0200
@@ -256,6 +256,18 @@ 
   int CurrentChannel;
   int CurrentVolume;
   int CurrentDolby;
+
+
+
+/*
+ * Place for patches to insert functions/members to cSetup - Begin
+ */
+/*
+ * Place for patches to insert functions/members to cSetup - End
+ */
+
+
+
   int __EndData__;
   cSetup(void);
   cSetup& operator= (const cSetup &s);
diff -ru vdr-1.3.27-vanilla/i18n.c vdr-1.3.27-prepared/i18n.c
--- vdr-1.3.27-vanilla/i18n.c	2005-07-01 12:51:24.000000000 +0200
+++ vdr-1.3.27-prepared/i18n.c	2005-07-01 21:53:06.000000000 +0200
@@ -5388,6 +5388,18 @@ 
     "",// TODO
     "",// TODO
   },
+
+
+
+/*
+ * Place for Plugins to add i18n - Begin
+ */
+/*
+ * Place for Plugins to add i18n - End
+ */
+
+
+
   { NULL }
   };