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 /scripts | |
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 | |||
@@ -11,12 +11,11 @@ while(<FILE>){$packages.=$_;} | |||
11 | close(FILE); | 11 | close(FILE); |
12 | 12 | ||
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,; |
21 | ($filename=$cfg)=~s,(.*/)(.*),$2,; | 20 | ($filename=$cfg)=~s,(.*/)(.*),$2,; |
22 | ($tagname=$dirname)=~s,.*/,,; | 21 | ($tagname=$dirname)=~s,.*/,,; |
@@ -38,6 +37,11 @@ if(-e "$dirname/config.in.in"){ | |||
38 | $pre = $contents; | 37 | $pre = $contents; |
39 | } | 38 | } |
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"; |
42 | $post = "endmenu\n"; | 46 | $post = "endmenu\n"; |
43 | } | 47 | } |
@@ -47,10 +51,25 @@ select(CFG); | |||
47 | print $pre; | 51 | print $pre; |
48 | @dupecheck=(); | 52 | @dupecheck=(); |
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; |
51 | select(STDOUT); | 71 | select(STDOUT); |
52 | close(CFG); | 72 | close(CFG); |
53 | } | ||
54 | exit; | 73 | exit; |
55 | 74 | ||
56 | use vars qw/*name *dir *prune/; | 75 | use vars qw/*name *dir *prune/; |
@@ -60,20 +79,6 @@ use vars qw/*name *dir *prune/; | |||
60 | 79 | ||
61 | sub wanted { | 80 | 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 | } |
79 | } | 84 | } |