]> git.pld-linux.org Git - packages/VMware-server.git/blob - VMware-server-parse-locations.pl
- drop obsolete and outdated manual inclusion of rpm macros
[packages/VMware-server.git] / VMware-server-parse-locations.pl
1 #!/usr/bin/perl -w
2 # $Id$
3 #
4 # process vmware locations database
5 # filter the database and keep only single answers not the complete log
6 #
7 # purpose: cleanup locations db for making it into default rpm config
8
9 use strict;
10
11 my (%files, %dirs, %answer, %config);
12 while (<>) {
13         chomp;
14         next if /^$/ or /^#/;
15         my ($cmd, $args) = split(/ /, $_, 2);
16         my ($key, $value) = split(/ /, $args, 2);
17         $files{$key} = $value,next if $cmd eq 'file';
18         $config{$key} = 1,next if $cmd eq 'config';
19         $dirs{$args} = 1,next if $cmd eq 'directory';
20         $answer{$key} = $value,next if $cmd eq 'answer';
21         delete $answer{$key},next if $cmd eq 'remove_answer';
22         delete $files{$key},next if $cmd eq 'remove_file';
23         warn "unknown config stub: [$cmd]\n";
24 }
25
26 foreach my $key (sort keys %answer) {
27         my $value = $answer{$key};
28         printf("answer %s %s\n", $key, $value);
29 }
30
31 while (my($key, $value) = each %dirs) {
32         printf("directory %s\n", $key);
33 }
34
35 while (my($key, $value) = each %files) {
36         if ($value) {
37                 printf("file %s %s\n", $key, $value);
38         } else {
39                 printf("file %s\n", $key);
40         }
41         if (exists $config{$key}) {
42                 printf("config %s\n", $key);
43                 delete $config{$key};
44         }
45 }
46
47 while (my($key, $value) = each %config) {
48         printf("config %s\n", $key);
49 }
This page took 0.025834 seconds and 3 git commands to generate.