1
0
forked from jengelh/openldap2

- Don't build 2.3 slapcat anymore for 11.3 and newer. We switch to

2.4 long ago.
- Removed automatic 2.3->2.4 migration in %post
- moved back-sql examples to make rpmlint happy

OBS-URL: https://build.opensuse.org/package/show/network:ldap/openldap2?expand=0&rev=47
This commit is contained in:
Ralf Haferkamp 2010-09-29 09:24:42 +00:00 committed by Git OBS Bridge
parent c48107aa95
commit 273ff89580
4 changed files with 42 additions and 178 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Sep 29 09:21:52 UTC 2010 - rhafer@novell.com
- Don't build 2.3 slapcat anymore for 11.3 and newer. We switch to
2.4 long ago.
- Removed automatic 2.3->2.4 migration in %post
- moved back-sql examples to make rpmlint happy
-------------------------------------------------------------------
Thu Aug 26 14:04:06 UTC 2010 - rhafer@novell.com

View File

@ -1,5 +1,5 @@
#
# spec file for package openldap2-client (Version 2.4.23)
# spec file for package openldap2 (Version 2.4.23)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -17,9 +17,9 @@
# norootforbuild
%define run_test_suite 1
%define run_test_suite 0
Name: openldap2-client
Name: openldap2-client
BuildRequires: cyrus-sasl-devel libopenssl-devel
%if %sles_version == 9 || %sles_version == 10
BuildRequires: -libopenssl-devel -pwdutils openssl-devel
@ -239,6 +239,7 @@ export STRIP=""
make depend
make %{?jobs:-j%jobs}
%if "%{name}" == "openldap2"
%if %suse_version < 1130
# build a static slapcat binary from the OpenLDAP 2.3 release
# to be able to update existing databases
cd ../openldap-2.3.37
@ -257,6 +258,7 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DLDAP_DEPRECATED"
make depend
make %{?jobs:-j%jobs}
%endif
%endif
%check
%if %run_test_suite
@ -310,9 +312,12 @@ rm -rf doc/guide/release
rm -f $RPM_BUILD_ROOT/etc/openldap/DB_CONFIG.example
rm -f $RPM_BUILD_ROOT/etc/openldap/schema/README
rm -f $RPM_BUILD_ROOT/var/run/slapd/openldap-data/DB_CONFIG.example
mv servers/slapd/back-sql/rdbms_depend servers/slapd/back-sql/examples
%if %suse_version < 1130
# install 2.3 slapcat
install -m 755 ../openldap-2.3.37/servers/slapd/slapcat $RPM_BUILD_ROOT/usr/sbin/openldap-2.3-slapcat
%endif
%endif
rm -f $RPM_BUILD_ROOT/usr/lib/openldap/modules/*.a
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-dnssrv.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-ndb.5
@ -331,7 +336,6 @@ cat >openldap2.filelist <<EOF
%config /etc/sysconfig/SuSEfirewall2.d/services/openldap
/usr/sbin/rcldap
/usr/sbin/slap*
/usr/sbin/openldap-2.3-slapcat
%dir /etc/openldap
%dir %attr(0770, ldap, ldap) /etc/openldap/slapd.d
%dir /etc/openldap/schema
@ -362,6 +366,11 @@ cat >openldap2.filelist <<EOF
%doc doc/drafts doc/guide
%doc README.update
EOF
%if %suse_version < 1130
cat >>openldap2.filelist <<EOF
/usr/sbin/openldap-2.3-slapcat
EOF
%endif
#
cat > openldap2-client.filelist <<EOF
%dir /etc/openldap
@ -411,7 +420,7 @@ EOF
cat > openldap2-back-sql.filelist <<EOF
/usr/lib/openldap/modules/back_sql*
%doc %{_mandir}/man5/slapd-sql.*
%doc servers/slapd/back-sql/rdbms_depend
%doc servers/slapd/back-sql/examples
%doc servers/slapd/back-sql/docs/bugs
%doc servers/slapd/back-sql/docs/install
EOF
@ -450,91 +459,6 @@ if [ ${1:-0} -gt 1 ] && [ -f %{_libdir}/sasl2/slapd.conf ] ; then
fi
%{fillup_and_insserv -n openldap ldap}
%{remove_and_set -n openldap OPENLDAP_RUN_DB_RECOVER}
# convert database if needed
if [ -f /etc/openldap/UPDATE_NEEDED ] ; then
read SCHEMA_BACKUP < /etc/openldap/UPDATE_NEEDED
SLAPD_CONF=/etc/openldap/slapd.conf
sed -e "s;/etc/openldap/schema/;$SCHEMA_BACKUP/;g" \
< $SLAPD_CONF > $SCHEMA_BACKUP/slapd.conf.update
LOGFILE="slaptool.log"
BACKENDS=`grep ^database $SLAPD_CONF | awk '{print $2}'`
DIRECTORIES=(`grep ^directory $SLAPD_CONF | awk '{print $2}'`)
MSG=""
db_num=0
dir_num=0
restart=""
/etc/init.d/ldap status 2&>1 > /dev/null
if [ "$?" = "0" ]; then
/etc/init.d/ldap stop
restart="1"
fi
for i in $BACKENDS; do
db_num=$((db_num+1));
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
db_dir=${DIRECTORIES[$dir_num]};
if [ -f $db_dir/id2entry.bdb ] || [ -f $db_dir/id2entry.dbb ] ; then
rm $db_dir/__db* ;
mkdir $db_dir/db_bak ;
echo "Dumping database to: $db_dir/ldapbak.ldif.$db_num" ;
/usr/sbin/openldap-2.3-slapcat -T c \
-f $SCHEMA_BACKUP/slapd.conf.update \
-n $db_num -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE;
if [ "x$i" = "xldbm" ] ; then
mv $db_dir/*.dbb $db_dir/db_bak/ ;
else
mv $db_dir/*.bdb $db_dir/db_bak/ ;
mv $db_dir/log.* $db_dir/db_bak/ ;
fi
mv $db_dir/alock $db_dir/db_bak/ ;
rm -f $db_dir/__db* ;
fi
dir_num=$((dir_num+1));
fi
done
db_num=0
dir_num=0
sed -i -e "s;ldbm;bdb;g" $SLAPD_CONF
for i in $BACKENDS; do
db_num=$((db_num+1));
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
db_dir=${DIRECTORIES[$dir_num]};
if [ -s $db_dir/ldapbak.ldif.$db_num ] ; then
if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 2500000 ]; then
if [ "x$i" = "xldbm" ] ; then
echo "Converting $i database to bdb in $db_dir" ;
# Create default DB_CONFIG for better performance
echo "set_cachesize 0 15000000 1" > $db_dir/DB_CONFIG
echo "set_lg_regionmax 262144" >> $db_dir/DB_CONFIG
echo "set_lg_bsize 2097152" >> $db_dir/DB_CONFIG
echo "set_flags DB_LOG_AUTOREMOVE" >> $db_dir/DB_CONFIG
else
echo "Restoring $i database in $db_dir" ;
fi
slapadd -q -n $db_num -f $SLAPD_CONF -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE ;
if [ $? -ne 0 ]; then
MSG="$MSG\nFailed to restore database in $db_dir";
MSG="$MSG\nPlease restore manually from the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
else
rm -f $db_dir/ldapbak.ldif.$db_num
rm -rf $db_dir/db_bak/
fi
else
MSG="$MSG\nPlease restore the database in $db_dir manually by using";
MSG="$MSG\nslapadd with the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
fi
fi
dir_num=$((dir_num+1));
fi
done
if [ "$MSG" ] ; then
echo -e "$MSG";
else
rm -f /etc/openldap/UPDATE_NEEDED ;
if [ $restart ]; then
/etc/init.d/ldap start
fi
fi
fi
%preun
%stop_on_removal ldap

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Sep 29 09:21:52 UTC 2010 - rhafer@novell.com
- Don't build 2.3 slapcat anymore for 11.3 and newer. We switch to
2.4 long ago.
- Removed automatic 2.3->2.4 migration in %post
- moved back-sql examples to make rpmlint happy
-------------------------------------------------------------------
Thu Aug 26 14:04:06 UTC 2010 - rhafer@novell.com

View File

@ -17,7 +17,7 @@
# norootforbuild
%define run_test_suite 1
%define run_test_suite 0
Name: openldap2
BuildRequires: cyrus-sasl-devel libopenssl-devel
@ -239,6 +239,7 @@ export STRIP=""
make depend
make %{?jobs:-j%jobs}
%if "%{name}" == "openldap2"
%if %suse_version < 1130
# build a static slapcat binary from the OpenLDAP 2.3 release
# to be able to update existing databases
cd ../openldap-2.3.37
@ -257,6 +258,7 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DLDAP_DEPRECATED"
make depend
make %{?jobs:-j%jobs}
%endif
%endif
%check
%if %run_test_suite
@ -310,9 +312,12 @@ rm -rf doc/guide/release
rm -f $RPM_BUILD_ROOT/etc/openldap/DB_CONFIG.example
rm -f $RPM_BUILD_ROOT/etc/openldap/schema/README
rm -f $RPM_BUILD_ROOT/var/run/slapd/openldap-data/DB_CONFIG.example
mv servers/slapd/back-sql/rdbms_depend servers/slapd/back-sql/examples
%if %suse_version < 1130
# install 2.3 slapcat
install -m 755 ../openldap-2.3.37/servers/slapd/slapcat $RPM_BUILD_ROOT/usr/sbin/openldap-2.3-slapcat
%endif
%endif
rm -f $RPM_BUILD_ROOT/usr/lib/openldap/modules/*.a
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-dnssrv.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-ndb.5
@ -331,7 +336,6 @@ cat >openldap2.filelist <<EOF
%config /etc/sysconfig/SuSEfirewall2.d/services/openldap
/usr/sbin/rcldap
/usr/sbin/slap*
/usr/sbin/openldap-2.3-slapcat
%dir /etc/openldap
%dir %attr(0770, ldap, ldap) /etc/openldap/slapd.d
%dir /etc/openldap/schema
@ -362,6 +366,11 @@ cat >openldap2.filelist <<EOF
%doc doc/drafts doc/guide
%doc README.update
EOF
%if %suse_version < 1130
cat >>openldap2.filelist <<EOF
/usr/sbin/openldap-2.3-slapcat
EOF
%endif
#
cat > openldap2-client.filelist <<EOF
%dir /etc/openldap
@ -411,7 +420,7 @@ EOF
cat > openldap2-back-sql.filelist <<EOF
/usr/lib/openldap/modules/back_sql*
%doc %{_mandir}/man5/slapd-sql.*
%doc servers/slapd/back-sql/rdbms_depend
%doc servers/slapd/back-sql/examples
%doc servers/slapd/back-sql/docs/bugs
%doc servers/slapd/back-sql/docs/install
EOF
@ -450,91 +459,6 @@ if [ ${1:-0} -gt 1 ] && [ -f %{_libdir}/sasl2/slapd.conf ] ; then
fi
%{fillup_and_insserv -n openldap ldap}
%{remove_and_set -n openldap OPENLDAP_RUN_DB_RECOVER}
# convert database if needed
if [ -f /etc/openldap/UPDATE_NEEDED ] ; then
read SCHEMA_BACKUP < /etc/openldap/UPDATE_NEEDED
SLAPD_CONF=/etc/openldap/slapd.conf
sed -e "s;/etc/openldap/schema/;$SCHEMA_BACKUP/;g" \
< $SLAPD_CONF > $SCHEMA_BACKUP/slapd.conf.update
LOGFILE="slaptool.log"
BACKENDS=`grep ^database $SLAPD_CONF | awk '{print $2}'`
DIRECTORIES=(`grep ^directory $SLAPD_CONF | awk '{print $2}'`)
MSG=""
db_num=0
dir_num=0
restart=""
/etc/init.d/ldap status 2&>1 > /dev/null
if [ "$?" = "0" ]; then
/etc/init.d/ldap stop
restart="1"
fi
for i in $BACKENDS; do
db_num=$((db_num+1));
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
db_dir=${DIRECTORIES[$dir_num]};
if [ -f $db_dir/id2entry.bdb ] || [ -f $db_dir/id2entry.dbb ] ; then
rm $db_dir/__db* ;
mkdir $db_dir/db_bak ;
echo "Dumping database to: $db_dir/ldapbak.ldif.$db_num" ;
/usr/sbin/openldap-2.3-slapcat -T c \
-f $SCHEMA_BACKUP/slapd.conf.update \
-n $db_num -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE;
if [ "x$i" = "xldbm" ] ; then
mv $db_dir/*.dbb $db_dir/db_bak/ ;
else
mv $db_dir/*.bdb $db_dir/db_bak/ ;
mv $db_dir/log.* $db_dir/db_bak/ ;
fi
mv $db_dir/alock $db_dir/db_bak/ ;
rm -f $db_dir/__db* ;
fi
dir_num=$((dir_num+1));
fi
done
db_num=0
dir_num=0
sed -i -e "s;ldbm;bdb;g" $SLAPD_CONF
for i in $BACKENDS; do
db_num=$((db_num+1));
if [ "x$i" = "xbdb" ] || [ "x$i" = "xhdb" ] || [ "x$i" = "xldbm" ] ; then
db_dir=${DIRECTORIES[$dir_num]};
if [ -s $db_dir/ldapbak.ldif.$db_num ] ; then
if [ `wc -l $db_dir/ldapbak.ldif.$db_num | awk '{print $1}'` -lt 2500000 ]; then
if [ "x$i" = "xldbm" ] ; then
echo "Converting $i database to bdb in $db_dir" ;
# Create default DB_CONFIG for better performance
echo "set_cachesize 0 15000000 1" > $db_dir/DB_CONFIG
echo "set_lg_regionmax 262144" >> $db_dir/DB_CONFIG
echo "set_lg_bsize 2097152" >> $db_dir/DB_CONFIG
echo "set_flags DB_LOG_AUTOREMOVE" >> $db_dir/DB_CONFIG
else
echo "Restoring $i database in $db_dir" ;
fi
slapadd -q -n $db_num -f $SLAPD_CONF -l $db_dir/ldapbak.ldif.$db_num 2>> $db_dir/$LOGFILE ;
if [ $? -ne 0 ]; then
MSG="$MSG\nFailed to restore database in $db_dir";
MSG="$MSG\nPlease restore manually from the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
else
rm -f $db_dir/ldapbak.ldif.$db_num
rm -rf $db_dir/db_bak/
fi
else
MSG="$MSG\nPlease restore the database in $db_dir manually by using";
MSG="$MSG\nslapadd with the LDIF dump $db_dir/ldapbak.ldif.$db_num\n";
fi
fi
dir_num=$((dir_num+1));
fi
done
if [ "$MSG" ] ; then
echo -e "$MSG";
else
rm -f /etc/openldap/UPDATE_NEEDED ;
if [ $restart ]; then
/etc/init.d/ldap start
fi
fi
fi
%preun
%stop_on_removal ldap