From 04c9eb4bdfd7ce5a02bfc29a06566703ba4a583939c6c6fcbdbaf23862e4e194 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Mon, 28 Sep 2009 14:00:48 +0000 Subject: [PATCH 1/4] - Added schema2ldif tool to openldap2-client subpackage (bnc#541819) OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=18 --- openldap2-client.changes | 6 ++++ openldap2-client.spec | 7 ++-- openldap2.changes | 6 ++++ openldap2.spec | 3 ++ schema2ldif.pl | 74 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 schema2ldif.pl diff --git a/openldap2-client.changes b/openldap2-client.changes index 956fda4..0d808bc 100644 --- a/openldap2-client.changes +++ b/openldap2-client.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 28 13:59:18 UTC 2009 - rhafer@novell.com + +- Added schema2ldif tool to openldap2-client subpackage + (bnc#541819) + ------------------------------------------------------------------- Wed Sep 23 15:35:13 UTC 2009 - rhafer@novell.com diff --git a/openldap2-client.spec b/openldap2-client.spec index 7d65c23..aa8b893 100644 --- a/openldap2-client.spec +++ b/openldap2-client.spec @@ -1,5 +1,5 @@ # -# spec file for package openldap2-client (Version 2.4.17) +# spec file for package openldap2 (Version 2.4.17) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -18,7 +18,7 @@ # norootforbuild -Name: openldap2-client +Name: openldap2-client BuildRequires: cyrus-sasl-devel db-devel libopenssl-devel openslp-devel tcpd-devel %if %sles_version == 9 BuildRequires: -db-devel -libopenssl-devel -pwdutils libdb-4_5-devel openssl-devel @@ -50,6 +50,7 @@ Source2: addonschema.tar.gz Source3: DB_CONFIG Source4: sasl-slapd.conf Source5: README.update +Source6: schema2ldif.pl Source100: openldap-2.3.37.tar.bz2 Patch: openldap2.dif Patch2: slapd_conf.dif @@ -287,6 +288,7 @@ install -m 755 -d $RPM_BUILD_ROOT/var/lib/ldap chmod a+x $RPM_BUILD_ROOT/%{_libdir}/liblber.so* chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap_r.so* chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap.so* +install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/usr/sbin/schema2ldif %if "%{name}" == "openldap2" mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates install -m 644 sysconfig.openldap $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openldap @@ -367,6 +369,7 @@ cat > openldap2-client.filelist < openldap2-client.filelist < +# +# The generated LDIF is printed to stdout. +# + +use strict; +use File::Basename; +use Text::Wrap; + +my $infile = $ARGV[0] || print_usage(); + +sub print_usage +{ + print STDERR "usage: schema2ldif.pl \n"; + exit(1); +} + +open( SCHEMA, "< $infile"); + +my $schemaline = ""; +$Text::Wrap::columns=78; +$Text::Wrap::separator="\n "; + +my $cn = basename($infile, ".schema"); +print STDOUT "dn: cn=$cn,cn=schema,cn=config\n"; +print STDOUT "objectClass: olcSchemaConfig\n"; +print STDOUT "cn: $cn\n"; +while ( ) +{ + my $line = $_; + if ( $line =~ /^\s+(.+)$/ ) + { + $schemaline .= " $1"; + next; + } + elsif ( $schemaline ne "" ) + { + print STDOUT wrap(""," ", $schemaline); + print STDOUT "\n"; + $schemaline = ""; + } + if ( $line =~ /^#/ ) + { + print STDOUT $line; + } + elsif ( $line =~ /^\s*$/ ) + { + print STDOUT "#\n"; + } + elsif ( $line =~ /^(objectclass|attributetype|objectidentifier)\s+(.+)$/i ) + { + if ( lc($1) eq "objectidentifier" ) + { + $schemaline .= "olcObjectIdentifier: "; + } + elsif ( lc($1) eq "objectclass" ) + { + $schemaline .= "olcObjectClasses: "; + } + elsif ( lc($1) eq "attributetype" ) + { + $schemaline .= "olcAttributeTypes: "; + } + $schemaline .= $2; + } +} + From 66d5d81e65b87245e193a970c038b759d0c31ad97bfc57a7a1999a940beffeb5 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Mon, 28 Sep 2009 16:16:36 +0000 Subject: [PATCH 2/4] Converted schema2ldif to awk instead of perl, to reduce runtime dependencies. OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=19 --- openldap2-client.spec | 2 +- openldap2.spec | 2 +- schema2ldif | 52 ++++++++++++++++++++++++++++++ schema2ldif.pl | 74 ------------------------------------------- 4 files changed, 54 insertions(+), 76 deletions(-) create mode 100644 schema2ldif delete mode 100644 schema2ldif.pl diff --git a/openldap2-client.spec b/openldap2-client.spec index aa8b893..faf49d8 100644 --- a/openldap2-client.spec +++ b/openldap2-client.spec @@ -50,7 +50,7 @@ Source2: addonschema.tar.gz Source3: DB_CONFIG Source4: sasl-slapd.conf Source5: README.update -Source6: schema2ldif.pl +Source6: schema2ldif Source100: openldap-2.3.37.tar.bz2 Patch: openldap2.dif Patch2: slapd_conf.dif diff --git a/openldap2.spec b/openldap2.spec index 67396a5..41fb40a 100644 --- a/openldap2.spec +++ b/openldap2.spec @@ -50,7 +50,7 @@ Source2: addonschema.tar.gz Source3: DB_CONFIG Source4: sasl-slapd.conf Source5: README.update -Source6: schema2ldif.pl +Source6: schema2ldif Source100: openldap-2.3.37.tar.bz2 Patch: openldap2.dif Patch2: slapd_conf.dif diff --git a/schema2ldif b/schema2ldif new file mode 100644 index 0000000..4ba0afd --- /dev/null +++ b/schema2ldif @@ -0,0 +1,52 @@ +#!/bin/bash +# +# This is a simple tool to convert OpenLDAP Schema files to +# LDIF suitable for usage with OpenLDAP's dynamic configuration +# backend (cn=config) +# +# usage: +# schema2ldif +# +# The generated LDIF is printed to stdout. +# + +if [ -z "$1" ]; then + echo 'usage: schema2ldif ' + exit; +fi + +cn=`basename $1 .schema` + +echo "dn: cn=$cn,cn=schema,cn=config"; +echo "objectclass: olcSchemaConfig"; +echo "cn: $cn"; + +/usr/bin/awk ' +BEGIN { + buffer = ""; + width=78 ; +} +function wrap(data) +{ + if (length(data) > 0) { + do { + print substr(data,0,width); + data = " " substr(data, width+1); + } + while (length(data) > 1 ) + }; +} +/^[\t ]*$/ {wrap(buffer); buffer=""; print "#"; next; } +/^#.*$/ { wrap(buffer); buffer=""; print $0; next } +/^[\t ]+/ { gsub("^[\t ]+",""); buffer = buffer " " $0; next; } +{ + wrap(buffer); + $1 = tolower($1) ; + gsub("^objectclass$","olcObjectclasses:",$1) + gsub("^attributetype$","olcAttributeTypes:",$1) + gsub("^objectidentifier$","olcObjectIdentifier:",$1) + buffer = $0; +} +END { wrap(buffer); print "" } +' "$@" + diff --git a/schema2ldif.pl b/schema2ldif.pl deleted file mode 100644 index c1c2126..0000000 --- a/schema2ldif.pl +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/perl -w -# -# This is a simple tool to convert OpenLDAP Schema files to -# LDIF suitable for usage with OpenLDAP's dynamic configuration -# backend (cn=config) -# -# usage: -# schema2ldif.pl -# -# The generated LDIF is printed to stdout. -# - -use strict; -use File::Basename; -use Text::Wrap; - -my $infile = $ARGV[0] || print_usage(); - -sub print_usage -{ - print STDERR "usage: schema2ldif.pl \n"; - exit(1); -} - -open( SCHEMA, "< $infile"); - -my $schemaline = ""; -$Text::Wrap::columns=78; -$Text::Wrap::separator="\n "; - -my $cn = basename($infile, ".schema"); -print STDOUT "dn: cn=$cn,cn=schema,cn=config\n"; -print STDOUT "objectClass: olcSchemaConfig\n"; -print STDOUT "cn: $cn\n"; -while ( ) -{ - my $line = $_; - if ( $line =~ /^\s+(.+)$/ ) - { - $schemaline .= " $1"; - next; - } - elsif ( $schemaline ne "" ) - { - print STDOUT wrap(""," ", $schemaline); - print STDOUT "\n"; - $schemaline = ""; - } - if ( $line =~ /^#/ ) - { - print STDOUT $line; - } - elsif ( $line =~ /^\s*$/ ) - { - print STDOUT "#\n"; - } - elsif ( $line =~ /^(objectclass|attributetype|objectidentifier)\s+(.+)$/i ) - { - if ( lc($1) eq "objectidentifier" ) - { - $schemaline .= "olcObjectIdentifier: "; - } - elsif ( lc($1) eq "objectclass" ) - { - $schemaline .= "olcObjectClasses: "; - } - elsif ( lc($1) eq "attributetype" ) - { - $schemaline .= "olcAttributeTypes: "; - } - $schemaline .= $2; - } -} - From 86c70f27303a48b59aba6bbf62f2ef849a73107e5a333aaf7c0a48babd43afe3 Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Fri, 2 Oct 2009 22:27:24 +0000 Subject: [PATCH 3/4] checked in OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=20 --- openldap2-client.changes | 6 ----- openldap2-client.spec | 7 ++---- openldap2.changes | 6 ----- openldap2.spec | 3 --- schema2ldif | 52 ---------------------------------------- 5 files changed, 2 insertions(+), 72 deletions(-) delete mode 100644 schema2ldif diff --git a/openldap2-client.changes b/openldap2-client.changes index 0d808bc..956fda4 100644 --- a/openldap2-client.changes +++ b/openldap2-client.changes @@ -1,9 +1,3 @@ -------------------------------------------------------------------- -Mon Sep 28 13:59:18 UTC 2009 - rhafer@novell.com - -- Added schema2ldif tool to openldap2-client subpackage - (bnc#541819) - ------------------------------------------------------------------- Wed Sep 23 15:35:13 UTC 2009 - rhafer@novell.com diff --git a/openldap2-client.spec b/openldap2-client.spec index faf49d8..7d65c23 100644 --- a/openldap2-client.spec +++ b/openldap2-client.spec @@ -1,5 +1,5 @@ # -# spec file for package openldap2 (Version 2.4.17) +# spec file for package openldap2-client (Version 2.4.17) # # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -18,7 +18,7 @@ # norootforbuild -Name: openldap2-client +Name: openldap2-client BuildRequires: cyrus-sasl-devel db-devel libopenssl-devel openslp-devel tcpd-devel %if %sles_version == 9 BuildRequires: -db-devel -libopenssl-devel -pwdutils libdb-4_5-devel openssl-devel @@ -50,7 +50,6 @@ Source2: addonschema.tar.gz Source3: DB_CONFIG Source4: sasl-slapd.conf Source5: README.update -Source6: schema2ldif Source100: openldap-2.3.37.tar.bz2 Patch: openldap2.dif Patch2: slapd_conf.dif @@ -288,7 +287,6 @@ install -m 755 -d $RPM_BUILD_ROOT/var/lib/ldap chmod a+x $RPM_BUILD_ROOT/%{_libdir}/liblber.so* chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap_r.so* chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap.so* -install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/usr/sbin/schema2ldif %if "%{name}" == "openldap2" mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates install -m 644 sysconfig.openldap $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openldap @@ -369,7 +367,6 @@ cat > openldap2-client.filelist < openldap2-client.filelist < -# -# The generated LDIF is printed to stdout. -# - -if [ -z "$1" ]; then - echo 'usage: schema2ldif ' - exit; -fi - -cn=`basename $1 .schema` - -echo "dn: cn=$cn,cn=schema,cn=config"; -echo "objectclass: olcSchemaConfig"; -echo "cn: $cn"; - -/usr/bin/awk ' -BEGIN { - buffer = ""; - width=78 ; -} -function wrap(data) -{ - if (length(data) > 0) { - do { - print substr(data,0,width); - data = " " substr(data, width+1); - } - while (length(data) > 1 ) - }; -} -/^[\t ]*$/ {wrap(buffer); buffer=""; print "#"; next; } -/^#.*$/ { wrap(buffer); buffer=""; print $0; next } -/^[\t ]+/ { gsub("^[\t ]+",""); buffer = buffer " " $0; next; } -{ - wrap(buffer); - $1 = tolower($1) ; - gsub("^objectclass$","olcObjectclasses:",$1) - gsub("^attributetype$","olcAttributeTypes:",$1) - gsub("^objectidentifier$","olcObjectIdentifier:",$1) - buffer = $0; -} -END { wrap(buffer); print "" } -' "$@" - From 3226bd34bcd20f5fd26d191fc591e6709240b8d0a7d9c214f8671905df90e8a7 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Fri, 2 Oct 2009 22:27:25 +0000 Subject: [PATCH 4/4] Updating link to change in openSUSE:Factory/openldap2 revision 54.0 OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=6dd46c1d13c58be42d434881cd495f5c --- openldap2-client.changes | 6 +++++ openldap2-client.spec | 5 +++- openldap2.changes | 6 +++++ openldap2.spec | 5 +++- schema2ldif | 52 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 schema2ldif diff --git a/openldap2-client.changes b/openldap2-client.changes index 956fda4..0d808bc 100644 --- a/openldap2-client.changes +++ b/openldap2-client.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 28 13:59:18 UTC 2009 - rhafer@novell.com + +- Added schema2ldif tool to openldap2-client subpackage + (bnc#541819) + ------------------------------------------------------------------- Wed Sep 23 15:35:13 UTC 2009 - rhafer@novell.com diff --git a/openldap2-client.spec b/openldap2-client.spec index 7d65c23..3a684f3 100644 --- a/openldap2-client.spec +++ b/openldap2-client.spec @@ -27,7 +27,7 @@ BuildRequires: -db-devel -libopenssl-devel -pwdutils libdb-4_5-devel openssl-de BuildRequires: -db-devel -libopenssl-devel -pwdutils libdb-4_5-devel openssl-devel %endif Version: 2.4.17 -Release: 3 +Release: 4 Url: http://www.openldap.org License: BSD 3-clause (or similar) ; openldap 2.8 %if "%{name}" == "openldap2" @@ -50,6 +50,7 @@ Source2: addonschema.tar.gz Source3: DB_CONFIG Source4: sasl-slapd.conf Source5: README.update +Source6: schema2ldif Source100: openldap-2.3.37.tar.bz2 Patch: openldap2.dif Patch2: slapd_conf.dif @@ -287,6 +288,7 @@ install -m 755 -d $RPM_BUILD_ROOT/var/lib/ldap chmod a+x $RPM_BUILD_ROOT/%{_libdir}/liblber.so* chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap_r.so* chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap.so* +install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/usr/sbin/schema2ldif %if "%{name}" == "openldap2" mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates install -m 644 sysconfig.openldap $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openldap @@ -367,6 +369,7 @@ cat > openldap2-client.filelist < openldap2-client.filelist < +# +# The generated LDIF is printed to stdout. +# + +if [ -z "$1" ]; then + echo 'usage: schema2ldif ' + exit; +fi + +cn=`basename $1 .schema` + +echo "dn: cn=$cn,cn=schema,cn=config"; +echo "objectclass: olcSchemaConfig"; +echo "cn: $cn"; + +/usr/bin/awk ' +BEGIN { + buffer = ""; + width=78 ; +} +function wrap(data) +{ + if (length(data) > 0) { + do { + print substr(data,0,width); + data = " " substr(data, width+1); + } + while (length(data) > 1 ) + }; +} +/^[\t ]*$/ {wrap(buffer); buffer=""; print "#"; next; } +/^#.*$/ { wrap(buffer); buffer=""; print $0; next } +/^[\t ]+/ { gsub("^[\t ]+",""); buffer = buffer " " $0; next; } +{ + wrap(buffer); + $1 = tolower($1) ; + gsub("^objectclass$","olcObjectclasses:",$1) + gsub("^attributetype$","olcAttributeTypes:",$1) + gsub("^objectidentifier$","olcObjectIdentifier:",$1) + buffer = $0; +} +END { wrap(buffer); print "" } +' "$@" +