~ubuntu-branches/ubuntu/gutsy/directory-administrator/gutsy

« back to all changes in this revision

Viewing changes to schema/ol-schema-migrate.pl

  • Committer: Bazaar Package Importer
  • Author(s): Guido Trotter
  • Date: 2006-03-28 08:21:51 UTC
  • mfrom: (1.1.1 upstream) (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20060328082151-y8h12be370r2exz1
Tags: 1.7.1-1
* The "On Train" release
* New upstream version
  - Doesn't violate object class rules anymore (closes: #195825)
* Forward port two debian patches which are still applicable
* Stop applying patches which seem not useful anymore
* Remove old "install" file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl -w
 
2
#
 
3
# Convert OpenLDAP schema files into RHDS format with pretty printing
 
4
#
 
5
# Mike Jackson <mj@sci.fi> 14 June 2005
 
6
#
 
7
# GPL license
 
8
#
 
9
 
 
10
use strict;
 
11
 
 
12
my @lines = <>;
 
13
my @at;
 
14
my @oc;
 
15
my $at  = 0;
 
16
my $oc  = 0;
 
17
my $at_string;
 
18
my $oc_string;
 
19
 
 
20
 
 
21
for (@lines) {
 
22
 
 
23
  next if (/^\s*\#/); # skip comments
 
24
 
 
25
  if ($at) {
 
26
    s/\n//;
 
27
    s/ +/ /;
 
28
    s/\t/ /;
 
29
    $at_string .= $_;
 
30
 
 
31
    if ( /\)$/ ) {
 
32
      push @at, $at_string;
 
33
      $at = 0;
 
34
      $at_string = "";
 
35
    }
 
36
  }
 
37
 
 
38
  if ($oc) {
 
39
    s/ +/ /;
 
40
    s/\t/ /;
 
41
    $oc_string .= $_;
 
42
 
 
43
    if ( /^\n/ ) {
 
44
      $oc_string =~ s/\n//;
 
45
      push @oc, $oc_string;
 
46
      $oc = 0;
 
47
      $oc_string = "";
 
48
    }
 
49
    $oc_string =~ s/\n//;
 
50
  }
 
51
 
 
52
  if ( /attribute[t|T]ype/ ) {
 
53
    $at  = 1;
 
54
    s/\n//;
 
55
    s/attribute[t|T]ype/attributeTypes:/;
 
56
    $at_string .= $_;
 
57
  }
 
58
 
 
59
  if ( /object[c|C]lass/ ) {
 
60
    $oc  = 1;
 
61
    s/\n//;
 
62
    s/object[c|C]lass/objectClasses:/;
 
63
    $oc_string .= $_;
 
64
  }
 
65
}
 
66
 
 
67
&seperator;
 
68
print "dn: cn=schema\n";
 
69
&seperator;
 
70
 
 
71
 
 
72
for (@at) {
 
73
 
 
74
  s/attributeTypes: \(/attributeTypes: \(\n /;
 
75
 
 
76
  s/NAME/\n  NAME/;
 
77
  s/EQUALITY/\n  EQUALITY/;
 
78
  s/SUBSTRING/\n  SUBSTRING/;
 
79
  s/DESC/\n  DESC/;
 
80
  s/SYNTAX/\n  SYNTAX/;
 
81
  s/SUP/\n  SUP/;
 
82
  s/SUBSTR/\n  SUBSTR/;
 
83
  s/SINGLE-VALUE/\n  SINGLE-VALUE/;
 
84
 
 
85
  s/\)$/\n  )/;
 
86
  s/ \n/\n/g;
 
87
 
 
88
  print "$_\n";
 
89
  &seperator;
 
90
}
 
91
 
 
92
for (@oc) {
 
93
 
 
94
  s/objectClasses: \(/objectClasses: \(\n /;
 
95
 
 
96
  s/NAME/\n  NAME/;
 
97
  s/SUP/\n  SUP/;
 
98
  s/AUXILIARY/\n  AUXILIARY/;
 
99
  s/STRUCTURAL/\n  STRUCTURAL/;
 
100
  s/DESC/\n  DESC/;
 
101
  s/MUST/\n  MUST/;
 
102
  s/MAY/\n  MAY/;
 
103
 
 
104
  s/\)$/\n  )/;
 
105
  s/ \n/\n/g;
 
106
 
 
107
  print "$_\n";
 
108
  &seperator;
 
109
}
 
110
 
 
111
 
 
112
## subs
 
113
sub seperator {
 
114
  print "#\n";
 
115
  print "#********************************************************************\n";
 
116
  print "#\n";
 
117
}