Bug#621376: uses libdb4.7

2011-06-02 Thread Ondřej Surý
2011/5/31 Joachim Wiedorn ad_deb...@joonet.de:
 You have two options:

 1. if the databases contains only temporary data, you can just remove
 them and let the squidguard create them from scratch

 I think these is the best way for squidguard.

If you can drop the databases without any significant loss, then just
do it. There's no reason to write code to migrate temporary data to
new format.

O.
-- 
Ondřej Surý ond...@sury.org
http://blog.rfc1925.org/



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#621376: uses libdb4.7

2011-05-31 Thread Ondřej Surý
Package: squidguard
Severity: normal

Hi Joachim,

please Cc: me or use bugnumber-submit...@bugs.debian.org, since I
didn't receive your email.

  removal of libdb4.7-dev has been scheduled on 2011-06-14 (exactly
  after month after perl transition).
 
  If you need help with transition or do you want me to take care of it,
  please don't hesitate to contact me, I'll be happy to help.
 
 I have a question about transition: The old databases used by squidguard
 must be migrated to the new libdb

 version 4.8

Don't use db4.8.  libdb4.8 is also obsolete.

 (I think that libdb 5.1 does not run with squidguard 1.4).

There really no reason why it shouldn't work, unless there are some
checks for DB_VERSION_MAJOR == 4 as I stated in the original report.
The db5.1 is really db4.11, but the upstream probably didn't wanted to
use two digits fro DB_VERSION_MINOR.

 How should I initiate this migration in the updated squidguard
 package?

Well, that depends whether the squidguard uses Berkeley DB environment:
http://download.oracle.com/docs/cd/E17076_02/html/upgrading/upgrade_process.html

And quickly scanning the source code it does.

You have two options:

1. if the databases contains only temporary data, you can just remove
them and let the squidguard create them from scratch

2. run the upgrade script in the postinst, it's not that hard.  You
can find the simple version of the upgrade procedure f.e. in the sks
where I wrote it.

You have to add these lines to debian/rules to note compiled-in version:

BDB_VERSION ?= $(shell LC_ALL=C dpkg-query -l 'libdb[45].[0-9]-dev' | grep ^ii 
| sed -e 's|.*\s\libdb\([45]\.[0-9]\)-dev\s.*|\1|')

the_install_target:
echo $(BDB_VERSION)  debian/package/usr/lib/package/berkeley_db.txt

and then the postinst (you have to adjust paths and users, etc.):

# Read the active Berkeley DB version, fall back to 4.7 if not found
if [ -r /var/lib/package/berkeley_db.active ]; then
OLD_BDB=$(cat /usr/lib/package/berkeley_db.active)
else
if dpkg --compare-versions $2 lt 1.1.1+dpkgv3-1; then
OLD_BDB=4.6
elif dpkg --compare-versions $2 lt 1.1.1+dpkgv3-6.1; then
OLD_BDB=4.7
else
OLD_BDB=4.7
fi
fi

# Read the compiled-in Berkeley DB version
NEW_BDB=$(cat /usr/lib/package/berkeley_db.txt)

if [ $OLD_BDB != $NEW_BDB ]; then

# Upgrade Berkeley DB in place
BACKUP_DIR=/var/backup/package/$(date +%Y%m%d-%H%M%S)
mkdir -p $BACKUP_DIR
chown username:username ${BACKUP_DIR}

for DBHOME in database directories; do

# Don't run if the database directory doesn't exist
[ ! -d ${DBHOME} ]  continue

# Create backup directory
mkdir -p ${BACKUP_DIR}/${DBHOME}
chown username:username ${BACKUP_DIR}/${DBHOME}

# Make sure we own the files
chown username:username -R ${DBHOME}

if [ -x /usr/bin/db${OLD_BDB}_recover ]; then
# Run recover with old tools
su username -c db${OLD_BDB}_recover -h ${DBHOME}
# Backup needed log files
LOG_FILES=$(su username -c db${OLD_BDB}_archive -h ${DBHOME} 
-l)
else
# If we don't have the Berkeley DB tools then backup all log 
files
LOG_FILES=$(cd ${DBHOME}; ls -1 | grep -E ^log\.)
fi

# Backup log files
for log_file in ${LOG_FILES}; do
cp -a ${DBHOME}/$log_file ${BACKUP_DIR}/${DBHOME}/
done

# Backup  upgrade database files
for db in $(cd ${DBHOME}; ls -1 | grep -Ev ^(__|log\.)); do
# Backup database file
su username -c cp ${DBHOME}/${db} ${BACKUP_DIR}/${DBHOME}/
# Upgrade database file
su username -c db${NEW_BDB}_upgrade -h ${DBHOME} 
${DBHOME}/$db;
done

# Set checkpoint and delete old logfiles
su username -c db${NEW_BDB}_checkpoint -h ${DBHOME} -1
su username -c db${NEW_BDB}_archive -h ${DBHOME} -d
done

# Note the active Berkeley DB version
cp -f /usr/lib/package/berkeley_db.txt 
/usr/lib/package/berkeley_db.active

fi

Also don't forget to remove the berkeley_db.active file in the postrm purge 
target:

Something like this:

package.postrm:
if [ $1 = purge ]; then
rm -f /usr/lib/package/berkeley_db.active
rmdir /usr/lib/package || true
fi



-- System Information:
Debian Release: 6.0.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=cs_CZ.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash



-- 
To UNSUBSCRIBE, email to 

Bug#621376: uses libdb4.7

2011-05-31 Thread Joachim Wiedorn
Ondřej Surý ond...@debian.org wrote on 2011-05-31 17:47:

 Don't use db4.8.  libdb4.8 is also obsolete.

I saw the problem, that squidguard generelly don't compile with the
new db5.1. So I have made the package with db4.8. But my new sponsor
now giving me some hints and a patch for using the db5.1 and also
the support forum of squidguard giving me a patch. So I will create 
and test a new package of squidguard using db5.1 in the next days.

  How should I initiate this migration in the updated squidguard
  package?
 
 Well, that depends whether the squidguard uses Berkeley DB environment:
 http://download.oracle.com/docs/cd/E17076_02/html/upgrading/upgrade_process.html
 
 And quickly scanning the source code it does.

Ok, I think I understand.

 You have two options:
 
 1. if the databases contains only temporary data, you can just remove
 them and let the squidguard create them from scratch

I think these is the best way for squidguard.


 You have to add these lines to debian/rules to note compiled-in version:
 
 BDB_VERSION ?= $(shell LC_ALL=C dpkg-query -l 'libdb[45].[0-9]-dev' | grep 
 ^ii | sed -e 's|.*\s\libdb\([45]\.[0-9]\)-dev\s.*|\1|')
 
 the_install_target:
   echo $(BDB_VERSION)  debian/package/usr/lib/package/berkeley_db.txt
:
:

I have seen this by another package and haven't understand the sense. I
will look how I can implement this code for squidguard rules file.

Thanks for all your hints.

---
Have a nice day.

Joachim (Germany)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org