suggestion: version stamping of patches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



udo_richter@xxxxxx(Udo Richter)  01.06.05 19:48


>Rainer Zocholl wrote:
>> can't patches modify/add a string to a "Versionstring table" too,
>> which VDR logs in syslog and (maybe) displays in the command window?

>Problem is: How to avoid collisions of different patches if they want
>to write to the same 'installed patches' list?

>Only idea I have would be an installed-patches sub folder where every
>patch can place an unique-named file with an ID string. Then you just
>need a clever makefile that merges all these together into one
>include-able file.

>Can make depend a file on every file in a sub folder? eg. does
>something like this work:

>installed-patches.inc: installed-patches/*
>	@cat installed-patches/* > installed-patches.inc


assuming the degree of garbage in teh VDR folder is ninimal,
such a simple script could be used:
(Of course it would be more elegant if "depend" generates an exactfittung
list)

#!/bin/sh

# very frist script
FILE=cvs_revs.h
FILETMP=$FILE.tmp
mv $FILE $FILE.old

rm -f $FILETMP
echo "/* Automatically generated by $0 */" > $FILETMP
echo "static char* CVS_ALL[] = {" >> $FILETMP
grep "^\* \$Id: .*\$$" *.c *.h | sort | awk '{ print "/* Filename",$1" */","\n" "\""$2,$3,$4,$5,$6,$7,$8,$9,$10"\"," }' >> $FILETMP
echo "NULL };" >> $FILETMP

diff  $FILE.old $FILETMP
if [ $? -eq 0 ] ; then
 echo no change
 mv $FILE.old $FILE
 rm $FILETMP
else
 echo change
 mv $FILETMP $FILE
 rm $FILE.old
fi

run in the VDR directory generates the file cvs_revs.h:

static char* CVS_ALL[] = {
/* Filename audio.c: */
"* $Id: audio.c 1.3 2005/02/12 12:40:51 kls Exp $",
/* Filename audio.h: */
"* $Id: audio.h 1.3 2005/02/12 12:20:19 kls Exp $",
/* Filename channels.c: */
"* $Id: channels.c 1.42 2005/05/29 10:32:38 kls Exp $",
... etc..
NULL };

This file may be include into "vdr.h" or "vdr.c"
The "redundant" "/* Filename audio.h: */" is
to give "patch" some fix points for "fuzzy" logic,
as this file might have many changes.
At least i hope it may help...


VDR may run a loop like:

  {
    #include "cvs_revs.h" /* for CVS_ALL */
    int i;
    for(i=0; CVS_ALL[i]!=NULL; i++)
      nvprintf(LOG_DEBUG, "%s\n", CVS_ALL[i]);
    nvprintf(LOG_DEBUG, "Built at: " __DATE__ " " __TIME__ "\n");
  }

writing into syslog when it starts togehter with it's own version number.




There are two ways a patch can indicate it self it was applied:

If a patch is applied it could add it's own "Id$: patch" to
the modified source file.
Or it changes the CVS $Id.
At least that would be fair to do...

The "make" calls the above script and generate 
the new include.


instead of "grep ...*c *.h" a "find" may be more usefull,
as it can go recursive thru the directories.

Too the files date might be included if the "patch" forgat to
change or add an Id.


The code was taken from Sergeis Haller "nvram-wakeup"




Rainer---<=====>                         Vertraulich
             //
           //                              
         <=====>--------------ocholl, Kiel, Germany ------------



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux