* Colin Walters <walters@xxxxxxxxxx> [2004-04-22 01:35]: > On Wed, 2004-04-21 at 18:57, Thomas Bleher wrote: > > http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages > > I see you're using Arch to maintain the policy, very cool. I really > wish we could do that here. Editing patches in Emacs' diff-mode and > committing to CVS just isn't quite the same... Yeah, arch is just So Cool! I really hope it gets adopted more widely. Right now I have some patches and cleanups in my local trees; I haven't sent them yet because preparing patches, splitting and cleaning them requires extra work. With arch this process would be much easier. So I hope someone soon makes an official arch archive where merge request can be sent to. That would really rock :-) For the time being I will maintain my arch repository. I have attached the small script I use to replay changes from CVS into arch. I didn't use cscvs because I wanted to use taglines (really useful with all the file moving). Syncing the other way round (arch->cvs) is not done yet, but shouldn't be too difficult; only the taglines need to be filtered out. Thomas -- http://www.cip.ifi.lmu.de/~bleher/selinux/ - my SELinux pages GPG-Fingerprint: BC4F BB16 30D6 F253 E3EA D09E C562 2BAE B2F4 ABE7 Write a wise saying, and your name will live forever. -- Anonymous
#!/bin/bash # (C) 2004 Thomas Bleher <ThomasBleher@xxxxxx> under the GNU GPL v2 # clean up a patch between a cvs tree and an arch tree with taglines # just pipe your patch through this... # # this small script can be used to synchronize an arch-archive with a # cvs repository. assuming the codebase is identical except taglines # Usage: diff -urN arch/ cvs/ | cleanup-patch | patch -d arch/ -p1 # the above line merges all changes from cvs into arch # first filter out all control files filterdiff -x '*/CVS/*' -x '*/.arch-i*' -x '*/{arch}/*' -x '*/,,*' -x '*/++log*' | filterdiff | \ perl -0 -w -ne '# slurp the whole patch in and mangle it for my $file (split(/(?=\n--- )/)) { # split into files for (split(/\n(?=@@ )/m, $file)) { # split into chunks (starting with @@) if (not /^@/) { # the header, just pass it through $data = $_; } else { # the cvs version doesnt have arch-tags; filter them from the diff if (s/\n-\n-(# arch-tag: [-a-z0-9]+)(.*)/$2\n \n $1/s # arch-tag with preceding blank line || s/\n-(# arch-tag: [-a-z0-9]+)(.*)/$2\n+\n $1/s) { # single line arch-tag s/^(@@ -\d+,\d+ \+\d+,)(\d+)( @@\n)/$1.($2 + 2).$3/me; # adjust line count in patch } s/^@@.*?@@(\n[ \\].*)+$//g; # delete hunks that are now empty if (not /^$/) { $data .= "\n".$_; } } } print $data unless ($data =~ /^\n---.*\n\+\+\+.*$/); } ' | \ filterdiff | interdiff -U 3 /dev/null /proc/self/fd/0 | filterdiff # some final cleanup
Attachment:
signature.asc
Description: Digital signature