1: # -*- perl -*-
2#**************************************************************
3#
4#  Licensed to the Apache Software Foundation (ASF) under one
5#  or more contributor license agreements.  See the NOTICE file
6#  distributed with this work for additional information
7#  regarding copyright ownership.  The ASF licenses this file
8#  to you under the Apache License, Version 2.0 (the
9#  "License"); you may not use this file except in compliance
10#  with the License.  You may obtain a copy of the License at
11#
12#    http://www.apache.org/licenses/LICENSE-2.0
13#
14#  Unless required by applicable law or agreed to in writing,
15#  software distributed under the License is distributed on an
16#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17#  KIND, either express or implied.  See the License for the
18#  specific language governing permissions and limitations
19#  under the License.
20#
21#**************************************************************
22
23# generates of the component schema list an ldap schema in slapd format
24
25eval 'exec perl -wS $0 ${1+"$@"}'
26	if 0;
27
28#creating the output file
29open(OUTFILE, ">$ARGV[0]") or die "can't open >$ARGV[0]";
30
31#open the makefile
32open(INFILE, "makefile.mk") or die "can't open makefile.mk";
33
34$inxcs=0;
35
36#search all schemas in the makefile except userprofile and format them as e.g org.openoffice.Inet
37while(<INFILE>) {
38	tr/\r\n//d;
39
40	if (/^\s*XCSFILES/) {
41		$inxcs++;
42	}
43	next unless $inxcs;
44
45	if ($inxcs) {
46
47		$inxcs=0 unless /\\$/;
48
49		next if (/^\s*XCSFILES/);
50		next if (/UserProfile/);
51
52		s/^\s+//;
53		s/\s*\\$//;
54		s/\.xcs.*$//;
55		s#\$/#.#g;
56
57		push(@comp_names, $_);
58	}
59}
60close(INFILE);
61
62# generate the schema in slapd format
63
64foreach (@comp_names) {
65
66	s#org.openoffice.#oo-#g;
67	s#\.#-#g;
68
69	$myLdapName=lc $_;
70
71	print OUTFILE "attribute $myLdapName-attr $myLdapName-attr-oid cis single\n";
72	print OUTFILE "objectclass $myLdapName-class\n";
73	print OUTFILE "\toid\n";
74	print OUTFILE "\t\t$myLdapName-class-oid\n";
75	print OUTFILE "\tsuperior top\n";
76	print OUTFILE "\tallows\n";
77	print OUTFILE "\t$myLdapName-attr\n";
78}
79
80close(OUTFILE);
81
82exit 0;
83