author | kergoth <kergoth> | 2003-01-16 04:38:48 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-01-16 04:38:48 (UTC) |
commit | 7ffd4623880396f07e34faf195f8c131218cf682 (patch) (unidiff) | |
tree | 78aaf4470ef3ff18a871c0487dafe59d62f34ff3 | |
parent | 73927fe1c095507ce7fdd310917521fcd305b7e5 (diff) | |
download | opie-7ffd4623880396f07e34faf195f8c131218cf682.zip opie-7ffd4623880396f07e34faf195f8c131218cf682.tar.gz opie-7ffd4623880396f07e34faf195f8c131218cf682.tar.bz2 |
General cleanup for generated configs. 1) Sort included config.in's, 2) capitalize first letter of generated menu sections.
-rwxr-xr-x | scripts/makecfg.pl | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/scripts/makecfg.pl b/scripts/makecfg.pl index d7dc41e..de9d71a 100755 --- a/scripts/makecfg.pl +++ b/scripts/makecfg.pl | |||
@@ -13,8 +13,7 @@ close(FILE); | |||
13 | my ($dirname,$dir,$file,@files,$filename,$tagname,$name,$caps,$pre,$post,$sources,@dupecheck,$basedir); | 13 | my ($dirname,$dir,$file,@files,$filename,$tagname,$name,$caps,$pre,$post,$sources,@dupecheck,$basedir); |
14 | my @founddirs; | ||
14 | $file = shift || die; | 15 | $file = shift || die; |
15 | $basedir = shift; | 16 | $basedir = shift; |
16 | push(@files, $file); | ||
17 | 17 | ||
18 | foreach(@files){ | 18 | my $cfg=$file; |
19 | my $cfg=$_; | ||
20 | ($dirname=$cfg)=~s,(.*)/(.*),$1,; | 19 | ($dirname=$cfg)=~s,(.*)/(.*),$1,; |
@@ -40,2 +39,7 @@ if(-e "$dirname/config.in.in"){ | |||
40 | } else { | 39 | } else { |
40 | my ($firstletter, $rest); | ||
41 | $firstletter = substr($tagname, 0, 1); | ||
42 | $rest = substr($tagname, 1); | ||
43 | $firstletter =~ tr/a-z/A-Z/; | ||
44 | $tagname = $firstletter . $rest; | ||
41 | $pre = "menu \"$tagname\"\n"; | 45 | $pre = "menu \"$tagname\"\n"; |
@@ -49,2 +53,18 @@ print $pre; | |||
49 | File::Find::find({wanted => \&wanted}, $dirname); | 53 | File::Find::find({wanted => \&wanted}, $dirname); |
54 | @::founddirs=sort(@::founddirs); | ||
55 | foreach (@::founddirs) { | ||
56 | if(grep(/^$_\/config.in$/, @dupecheck)){ | ||
57 | next; | ||
58 | } | ||
59 | my $nslashes = $_ =~ tr!/!!; | ||
60 | my $dirnslashes = $dirname =~ tr!/!!; | ||
61 | $dirnslashes++; | ||
62 | if($dirnslashes != $nslashes){next;} | ||
63 | my $reldir; | ||
64 | if (defined($basedir)) { | ||
65 | ($reldir=$_)=~s,^$basedir/,,; | ||
66 | } | ||
67 | print " source " . $reldir . "/config.in\n"; | ||
68 | push(@dupecheck, $_ . "/config.in"); | ||
69 | } | ||
50 | print $post; | 70 | print $post; |
@@ -52,3 +72,2 @@ select(STDOUT); | |||
52 | close(CFG); | 72 | close(CFG); |
53 | } | ||
54 | exit; | 73 | exit; |
@@ -62,17 +81,3 @@ sub wanted { | |||
62 | if( /config.in$/s ) { | 81 | if( /config.in$/s ) { |
63 | if(grep(/^$File::Find::dir\/config.in$/, @dupecheck)){ | 82 | push(@::founddirs,$File::Find::dir); |
64 | return; | ||
65 | } | ||
66 | my $nslashes = $File::Find::dir =~ tr!/!!; | ||
67 | my $dirnslashes = $dirname =~ tr!/!!; | ||
68 | $dirnslashes++; | ||
69 | # print STDERR "dirnslashes is $dirnslashes\n"; | ||
70 | # print STDERR "nslashes is $nslashes\n"; | ||
71 | if($dirnslashes != $nslashes){return;} | ||
72 | my $reldir; | ||
73 | if (defined($basedir)) { | ||
74 | ($reldir=$File::Find::dir)=~s,^$basedir/,,; | ||
75 | } | ||
76 | print " source " . $reldir . "/config.in\n"; | ||
77 | push(@dupecheck, $File::Find::dir . "/config.in"); | ||
78 | } | 83 | } |