patch2pom conversion script v1
Subsystems (3)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
I put together a (perl) script that takes a "diff -Nru" style diff on input and converts it to pom-ng style directory structure like:
pom-ng/foobar/linux-2.6/net/ipv4/netfilter/ipt_foobar.c pom-ng/foobar/linux-2.6/net/ipv4/netfilter/Kconfig.ladd pom-ng/foobar/linux-2.6/net/ipv4/netfilter/Makefile.ladd pom-ng/foobar/linux-2.6/include/linux/netfilter_ipv4/ip_foo.h.ladd pom-ng/foobar/linux-2.6/include/linux/netfilter_ipv4/ip_foo.h.ladd_2
...
pom-ng/foobar/linux-2.6.patch
The main purpose of the script is to take away some of the everyday mechanical work done when implementing & updating pom-ng modules.
Features in version 1:
- support extraction of diffs creating new files
- support Kconfig diff conversion to .ladd format if the patch adds
only whole new config options
- support Makefile diff conversion to .ladd format when only new lines
are added
- support *.c and *.h diff conversion for cases where only new code is
added and only when it's added below comments that look like
/* yadda yadda add foobar here */
- unconverted diff chunks are put in the patch file, i.e.
linux-2.6.patch or iptables.patch.
I've tested it on a few netfilter modules and it was able to reproduce identical directory structures and file contents.
The script is available here:
http://xkr47.outerspace.dyndns.org/netfilter/patch2pom/patch2pom-1.tar.gz
I'll gladly receive ideas, bug reports and whatever you have to say regarding this script :) For example, do you think the suggested "diff
- -Nru" format is ok?
- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFCXGPMxyF48ZTvn+4RArdcAKC0P3bPyqL8Q46tdIUqkTkCrs8DHQCeKM5b Zo6OpwHq7+dlOpuFdaOfB60=
=6Bax
-----END PGP SIGNATURE-----
Hi, Jonas,
From: Jonas Berlin <[email protected]>
Date: Wed, 13 Apr 2005 00:11:58 +0000
Quoted 10 lines
I put together a (perl) script that takes a "diff -Nru" style diff on input and converts it to pom-ng style directory structure like:
pom-ng/foobar/linux-2.6/net/ipv4/netfilter/ipt_foobar.cpom-ng/foobar/linux-2.6/net/ipv4/netfilter/Kconfig.ladd pom-ng/foobar/linux-2.6/net/ipv4/netfilter/Makefile.ladd pom-ng/foobar/linux-2.6/include/linux/netfilter_ipv4/ip_foo.h.ladd pom-ng/foobar/linux-2.6/include/linux/netfilter_ipv4/ip_foo.h.ladd_2
...
pom-ng/foobar/linux-2.6.patch
It's very useful but doesn't work against patches generated by git. It's possible that date doesn't follow file name.
Please consider applying attached patch.
Regards,
-----------------------------------------------------------------
Yasuyuki Kozakai @ USAGI Project <[email protected]>
PatchFile.pm +4 -4
@@ -34,12 +34,12 @@ sub _parse_fileline { my $line = $_[0]; - unless($line =~ /^...\s([^\t]+)\t(.*)/) { + unless($line =~ /^...\s([^\t\s]+)[\t\s]*([^\t\s]*)/) { print STDERR "\033[36;1;40mInvalid file line:\n$line\033[m\n"; exit(10); } - return { file => $1, date => $2 }; + return { file => $1, comments => $2 }; } sub _finish_chunk {
@@ -68,8 +68,8 @@ sub format { my $this = shift; my $str = $this->{diffline}; - $str .= "--- ".$this->{old}->{file}."\t".$this->{old}->{date}."\n"; - $str .= "+++ ".$this->{new}->{file}."\t".$this->{new}->{date}."\n"; + $str .= "--- ".$this->{old}->{file}."\t".$this->{old}->{comments}."\n"; + $str .= "+++ ".$this->{new}->{file}."\t".$this->{new}->{comments}."\n"; foreach my $chunk (@{$this->{chunks}}) { $str .= $chunk->format(); }
patch2pom +5 -9
@@ -79,7 +79,7 @@ $pombase =~ s!/+$!!; sub create_file { - my ($file, $date, @content) = @_; + my ($file, @content) = @_; $file = $pombase.'/'.$file;
@@ -91,10 +91,6 @@ open NEWFILE, '>', $file; print NEWFILE @content; close NEWFILE; - - my $time = str2time($date); - - utime($time, $time, $file); } my $patch_file_opened = 0;
@@ -159,7 +155,7 @@ my @content = @{$file->{chunks}->[0]->{minichunks}->[0]}; chomp $content[$#content] if($file->{chunks}->[0]->{nonewline}); - create_file($filename, $file->{new}->{date}, @content); + create_file($filename, @content); } elsif($filename =~ m!/Kconfig$!) {
@@ -219,7 +215,7 @@ delete $lines[$#lines]; } - create_file($ladd_filename, $file->{new}->{date}, @lines); + create_file($ladd_filename, @lines); } } }
@@ -250,7 +246,7 @@ my $ladd_filename = ladd_filename($filename); - create_file($ladd_filename, $file->{new}->{date}, $context, @{$chunk->{minichunks}->[$i+1]}); + create_file($ladd_filename, $context, @{$chunk->{minichunks}->[$i+1]}); } }
@@ -295,7 +291,7 @@ my $ladd_filename = ladd_filename($filename); - create_file($ladd_filename, $file->{new}->{date}, $context, @{$chunk->{minichunks}->[$i+1]}); + create_file($ladd_filename, $context, @{$chunk->{minichunks}->[$i+1]}); } } }
A message that is not in the archive (sent off-list or not yet received): [email protected]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoting Yasuyuki KOZAKAI on 2005-06-20 12:13 UTC:
Quoted 1 line
Hi, Jonas,
Hello :)
Quoted 2 lines
It's very useful but doesn't work against patches generated by git. It's possible that date doesn't follow file name.
Could you please send some example or give an url to one? I don't know git and would like to look at what it looks like to be able to understand the patch better..
Quoted 1 line
Please consider applying attached patch.
I will, thank you very much =)
- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
iD8DBQFCtyQJxyF48ZTvn+4RAi1QAKC3uJqD6hMyWRax22NsWKbXtOOD8ACgzA1W F4VxqVXSmh1Xa5K7QTMq97s=
=qQmk
-----END PGP SIGNATURE-----
Hi, Jonas,
For example, this is generated by "cg-diff" after applying REJECT patch for linux 2.6 in pom-ng to git tree.
Regards,
-----------------------------------------------------------------
Yasuyuki Kozakai @ USAGI Project <[email protected]>
From: Jonas Berlin <[email protected]>
Date: Mon, 20 Jun 2005 20:16:13 +0000
Quoted 24 lines
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoting Yasuyuki KOZAKAI on 2005-06-20 12:13 UTC:
Quoted 1 line
Hi, Jonas,
Hello :)
Quoted 2 lines
It's very useful but doesn't work against patches generated by git. It's possible that date doesn't follow file name.
Could you please send some example or give an url to one? I don't know git and would like to look at what it looks like to be able to understand the patch better..
Quoted 1 line
Please consider applying attached patch.
I will, thank you very much =)
- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Quoted 4 lines
iD8DBQFCtyQJxyF48ZTvn+4RAi1QAKC3uJqD6hMyWRax22NsWKbXtOOD8ACgzA1W F4VxqVXSmh1Xa5K7QTMq97s=
=qQmk
-----END PGP SIGNATURE-----
include/linux/netfilter_ipv6/ip6t_REJECT.h (mode:100644) renamed from dev/null (tree:25b8fc041b4dce6c404ff01b462bc6b58fa7d372) +18 -0
@@ -0,0 +1,18 @@ +#ifndef _IP6T_REJECT_H +#define _IP6T_REJECT_H + +enum ip6t_reject_with { + IP6T_ICMP6_NO_ROUTE, + IP6T_ICMP6_ADM_PROHIBITED, + IP6T_ICMP6_NOT_NEIGHBOUR, + IP6T_ICMP6_ADDR_UNREACH, + IP6T_ICMP6_PORT_UNREACH, + IP6T_ICMP6_ECHOREPLY, + IP6T_TCP_RESET +}; + +struct ip6t_reject_info { + enum ip6t_reject_with with; /* reject type */ +}; + +#endif /*_IP6T_REJECT_H*/
net/ipv6/ipv6_syms.c (mode:100644) +1 -0
@@ -38,3 +38,4 @@ #endif EXPORT_SYMBOL(rt6_lookup); EXPORT_SYMBOL(ipv6_push_nfrag_opts); +EXPORT_SYMBOL(ip6_dst_lookup);
net/ipv6/netfilter/Kconfig (mode:100644) +11 -0
@@ -238,5 +238,16 @@ If you want to compile it as a module, say M here and read <file:Documentation/modules.txt>. If unsure, say `N'. +config IP6_NF_TARGET_REJECT + tristate 'REJECT target support' + depends on IP6_NF_FILTER + help + The REJECT target allows a filtering rule to specify that an ICMPv6 + error should be issued in response to an incoming packet, rather + than silently being dropped. + + If you want to compile it as a module, say M here and read + Documentation/modules.txt. If unsure, say `N'. + endmenu
net/ipv6/netfilter/Makefile (mode:100644) +1 -0
@@ -24,3 +24,4 @@ obj-$(CONFIG_IP6_NF_TARGET_LOG) += ip6t_LOG.o obj-$(CONFIG_IP6_NF_RAW) += ip6table_raw.o obj-$(CONFIG_IP6_NF_MATCH_HL) += ip6t_hl.o +obj-$(CONFIG_IP6_NF_TARGET_REJECT) += ip6t_REJECT.o
net/ipv6/netfilter/ip6t_REJECT.c (mode:100644) renamed from dev/null (tree:25b8fc041b4dce6c404ff01b462bc6b58fa7d372) +305 -0
305 lines not on this page · raw message