xref: /AOO41X/main/officecfg/util/component-ldif.gen (revision 2123d7570813d7d92dade2ba70822a073d984013)
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 ldif 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 ldif format
63foreach (@comp_names) {
64
65    s#org.openoffice.#oo-#g;
66    s#\.#-#g;
67
68    $myLdapName=lc $_;
69
70    print OUTFILE "dn: cn=schema\n";
71    print OUTFILE "attributetypes: ($myLdapName-attr-oid NAME '$myLdapName-attr' DESC '$myLdapName attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE_VALUE )\n\n";
72
73    print OUTFILE "dn: cn=schema\n";
74    print OUTFILE "objectclasses: ($myLdapName-class-oid NAME '$myLdapName-class' DESC '$myLdapName objclass' SUP 'top' MAY ($myLdapName-attr \$ ))\n\n";
75}
76
77close(OUTFILE);
78
79exit 0;
80