Skip to content

Commit

Permalink
issue 6430 - Fix review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
progier389 committed Dec 4, 2024
1 parent 172c87f commit 875f395
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 46 deletions.
4 changes: 1 addition & 3 deletions ldap/servers/slapd/back-ldbm/db-bdb/bdb_bdbreader_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include "bdb_layer.h"
#include <robdb.h>

#define DEBUG 1

/*
* This file contains the stub that transform usual bdb API (limited to the function 389-ds needs to export a db and a changelog
* to bdb_ro callbacks
Expand Down Expand Up @@ -248,7 +246,7 @@ int db_close(DB *db, u_int32_t flags)

int dbc_close(DBC *dbc)
{
bdbreader_bdb_close(dbc->impl);
bdbreader_cur_close(dbc->impl);
dbc->impl = NULL;
slapi_ch_free((void **)&dbc);
return DB_SUCCESS;
Expand Down
3 changes: 0 additions & 3 deletions ldap/servers/slapd/back-ldbm/dbimpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ const char *dblayer_op2str(dbi_op_t op)
return str[idx];
}

<<<<<<< HEAD
/* Get the li_directory directory from the database instance name -
* Caller should free the returned value
*/
Expand Down Expand Up @@ -440,8 +439,6 @@ get_li_directory(const char *fname)
}

/* Open db env, db and db file privately (for dbscan) */
=======
/* Open db env, db and db file privately (used by dbscan) */
int dblayer_private_open(const char *plgname, const char *dbfilename, int rw, Slapi_Backend **be, dbi_env_t **env, dbi_db_t **db)
{
struct ldbminfo *li;
Expand Down
6 changes: 5 additions & 1 deletion lib/librobdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ See test/test.c (Using a 389ds entries database as example, It shows how to dump
# Running tests

dnf install -y dist/RPMS/*/*.rpm

make test

or

make localtest


# LICENSE

Same as lib part for rpm: GPLv2 or alternatively LGPL (See COPYING and COPYING.RPM for full details)
7 changes: 5 additions & 2 deletions lib/librobdb/robdb.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Version: 1.1
Release: %{autorelease -n %{?dist}}
Summary: Provide basic functions to search and read Berkeley Database records

License: GPL-2.0-or-later
License: GPL-2.0-or-later OR LGPL-2.1-or-later
URL: https://github.com/389ds/389-ds-base/lib/librobdb
Source0: %{name}-%{version}.tar.bz2
Source0: %{name}-%{version}.tar.bz2

BuildRequires: gcc
# Requires:
Expand Down Expand Up @@ -46,6 +46,9 @@ some basic functions to search and read Berkeley Database records

%{?ldconfig_scriptlets}

%check
make localtest


%files libs
%license COPYING COPYING.RPM
Expand Down
74 changes: 37 additions & 37 deletions rpm/389-ds-base.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,11 @@ if ! make DESTDIR="$RPM_BUILD_ROOT" check; then cat ./test-suite.log && false; f

%post
if [ -n "$DEBUGPOSTTRANS" ] ; then
output=$DEBUGPOSTTRANS
output2=${DEBUGPOSTTRANS}.upgrade
output=$DEBUGPOSTTRANS
output2=${DEBUGPOSTTRANS}.upgrade
else
output=/dev/null
output2=/dev/null
output=/dev/null
output2=/dev/null
fi

# reload to pick up any changes to systemd files
Expand All @@ -606,11 +606,11 @@ HOMEDIR="/usr/share/dirsrv"

getent group $GROUPNAME >/dev/null || groupadd -f -g $ALLOCATED_GID -r $GROUPNAME
if ! getent passwd $USERNAME >/dev/null ; then
if ! getent passwd $ALLOCATED_UID >/dev/null ; then
useradd -r -u $ALLOCATED_UID -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
else
useradd -r -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
fi
if ! getent passwd $ALLOCATED_UID >/dev/null ; then
useradd -r -u $ALLOCATED_UID -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
else
useradd -r -g $GROUPNAME -d $HOMEDIR -s /sbin/nologin -c "user for 389-ds-base" $USERNAME
fi
fi

# Reload our sysctl before we restart (if we can)
Expand All @@ -620,46 +620,46 @@ sysctl --system &> $output; true
instbase="%{_sysconfdir}/%{pkgname}"
ninst=0
for dir in $instbase/slapd-* ; do
echo dir = $dir >> $output 2>&1 || :
if [ ! -d "$dir" ] ; then continue ; fi
case "$dir" in *.removed) continue ;; esac
basename=`basename $dir`
inst="%{pkgname}@`echo $basename | sed -e 's/slapd-//g'`"
echo found instance $inst - getting status >> $output 2>&1 || :
if /bin/systemctl -q is-active $inst ; then
echo instance $inst is running >> $output 2>&1 || :
instances="$instances $inst"
else
echo instance $inst is not running >> $output 2>&1 || :
fi
ninst=`expr $ninst + 1`
echo dir = $dir >> $output 2>&1 || :
if [ ! -d "$dir" ] ; then continue ; fi
case "$dir" in *.removed) continue ;; esac
basename=`basename $dir`
inst="%{pkgname}@`echo $basename | sed -e 's/slapd-//g'`"
echo found instance $inst - getting status >> $output 2>&1 || :
if /bin/systemctl -q is-active $inst ; then
echo instance $inst is running >> $output 2>&1 || :
instances="$instances $inst"
else
echo instance $inst is not running >> $output 2>&1 || :
fi
ninst=`expr $ninst + 1`
done
if [ $ninst -eq 0 ] ; then
echo no instances to upgrade >> $output 2>&1 || :
exit 0 # have no instances to upgrade - just skip the rest
echo no instances to upgrade >> $output 2>&1 || :
exit 0 # have no instances to upgrade - just skip the rest
else
# restart running instances
echo shutting down all instances . . . >> $output 2>&1 || :
for inst in $instances ; do
echo stopping instance $inst >> $output 2>&1 || :
/bin/systemctl stop $inst >> $output 2>&1 || :
done
for inst in $instances ; do
echo starting instance $inst >> $output 2>&1 || :
/bin/systemctl start $inst >> $output 2>&1 || :
done
# restart running instances
echo shutting down all instances . . . >> $output 2>&1 || :
for inst in $instances ; do
echo stopping instance $inst >> $output 2>&1 || :
/bin/systemctl stop $inst >> $output 2>&1 || :
done
for inst in $instances ; do
echo starting instance $inst >> $output 2>&1 || :
/bin/systemctl start $inst >> $output 2>&1 || :
done
fi


%preun
if [ $1 -eq 0 ]; then # Final removal
# remove instance specific service files/links
rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || :
# remove instance specific service files/links
rm -rf %{_sysconfdir}/systemd/system/%{groupname}.wants/* > /dev/null 2>&1 || :
fi

%postun
if [ $1 = 0 ]; then # Final removal
rm -rf /var/run/%{pkgname}
rm -rf /var/run/%{pkgname}
fi

%post snmp
Expand Down

0 comments on commit 875f395

Please sign in to comment.