From 5f636d2b5c4e3a239094cc49d8a41919cd763f5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alin=20N=C4=83stac?= Date: Sun, 18 Feb 2007 07:53:58 +0000 Subject: [PATCH] Move the code that preserve *.data files to pkg_preinst (#167285). Package-Manager: portage-2.1.1-r2 --- mail-filter/dspam/ChangeLog | 5 +- mail-filter/dspam/Manifest | 24 ++++----- mail-filter/dspam/dspam-3.6.8-r2.ebuild | 70 ++++++++++--------------- 3 files changed, 43 insertions(+), 56 deletions(-) diff --git a/mail-filter/dspam/ChangeLog b/mail-filter/dspam/ChangeLog index af8688ef88c2..a572ef4d1853 100644 --- a/mail-filter/dspam/ChangeLog +++ b/mail-filter/dspam/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for mail-filter/dspam # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.80 2007/01/08 15:48:44 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/ChangeLog,v 1.81 2007/02/18 07:53:58 mrness Exp $ + + 18 Feb 2007; Alin Năstac dspam-3.6.8-r2.ebuild: + Move the code that preserve *.data files to pkg_preinst (#167285). *dspam-3.6.8-r2 (08 Jan 2007) diff --git a/mail-filter/dspam/Manifest b/mail-filter/dspam/Manifest index 0465ddf93911..973f53e98aaa 100644 --- a/mail-filter/dspam/Manifest +++ b/mail-filter/dspam/Manifest @@ -24,14 +24,14 @@ SHA256 75e04139e564ad55011ee77b8245dc5cdefbb6d56ca451feab5861ab907d614e files/lo DIST dspam-3.6.8-patches-20061219.tar.gz 5370 RMD160 0347a618b63b9fe662838f888f84b705bd24c72a SHA1 a998c131ef763efb32c6f538188de987ec544dc9 SHA256 cdd43862d939e089052bf0fde9e85f7a6b056a441d2d54ff4f3b8bb016f0de4c DIST dspam-3.6.8.tar.gz 743275 RMD160 93a70db14070cb61bd2ef1b0ca55a18be1dbfd7b SHA1 e8c413882eadf1e02837e4a2ffcfc98b801eded1 SHA256 88c7b41fb81e90ba8a260885a1d14bce39f2ef4a06cc2c6b8bfa0b99ba1aec34 DIST dspam_sa_trainer.tar.gz 1230 RMD160 c3d0fca7169d23ecf9d44c850ee255b42d97d818 SHA1 71a002f26a888bdfe47759cf1f780cd6478dacac SHA256 8fb6b1ebe592acf00a028737ef8e174544af166768b987d29048b2319bc5a215 -EBUILD dspam-3.6.8-r2.ebuild 17407 RMD160 3bde1b195dc6978e2db00ea2eefc994c22cc9db7 SHA1 f83841798b19f57a9be07276aa4a67aac500f385 SHA256 857f5b0f9d9ba8efbaabb869d6285b4a7a773949d46c8735a45e7e250fd53a41 -MD5 7de50affaf468d64f2e60353363aa315 dspam-3.6.8-r2.ebuild 17407 -RMD160 3bde1b195dc6978e2db00ea2eefc994c22cc9db7 dspam-3.6.8-r2.ebuild 17407 -SHA256 857f5b0f9d9ba8efbaabb869d6285b4a7a773949d46c8735a45e7e250fd53a41 dspam-3.6.8-r2.ebuild 17407 -MISC ChangeLog 14381 RMD160 812f2529bc6af35fbdff85f803c166ea840461a9 SHA1 1e9e3ca1df1a3c8275e19b3a9eca538ec1a1b892 SHA256 ed9c4ebd4ecd96dd9da652efe9d154d113f4a9a6cf15826d5171d103a9c355c5 -MD5 70bfe14cec4721080619d069f5d193b3 ChangeLog 14381 -RMD160 812f2529bc6af35fbdff85f803c166ea840461a9 ChangeLog 14381 -SHA256 ed9c4ebd4ecd96dd9da652efe9d154d113f4a9a6cf15826d5171d103a9c355c5 ChangeLog 14381 +EBUILD dspam-3.6.8-r2.ebuild 16607 RMD160 f62dd76a5901438c6468b67e45d5ff1ee8d55c75 SHA1 58aa028497110b7590e6b9a875731e95c44b25a3 SHA256 db131189e9da7b4238bda4a854377c085d7f8b343115fbe8bf3da58942f63155 +MD5 7107defefe900399ac7e7b5a86d4108d dspam-3.6.8-r2.ebuild 16607 +RMD160 f62dd76a5901438c6468b67e45d5ff1ee8d55c75 dspam-3.6.8-r2.ebuild 16607 +SHA256 db131189e9da7b4238bda4a854377c085d7f8b343115fbe8bf3da58942f63155 dspam-3.6.8-r2.ebuild 16607 +MISC ChangeLog 14522 RMD160 f8f7d69a9be3b326f2bd555d8727f1c57024d093 SHA1 754c3a82d73ad47cea8f06f7836f664eb77b062a SHA256 9bc8668039bc3a6fbd821b1b1a33c0c893f77f2ef22ad7291e1a4eacaee15178 +MD5 ad83ec64887728f92a350b91c8039fdb ChangeLog 14522 +RMD160 f8f7d69a9be3b326f2bd555d8727f1c57024d093 ChangeLog 14522 +SHA256 9bc8668039bc3a6fbd821b1b1a33c0c893f77f2ef22ad7291e1a4eacaee15178 ChangeLog 14522 MISC metadata.xml 397 RMD160 1d897be7c5d2f12f25490fa6ece53d7dacbe1427 SHA1 5d77bb1cd119d2ff52d65d9256dff9dca7ebcf6f SHA256 19348733b588bec627f76b297a101b21bc9ae7021a2f55fe12240b1dfa176a77 MD5 91827a3d521f4dd3c43a9a062a052e7c metadata.xml 397 RMD160 1d897be7c5d2f12f25490fa6ece53d7dacbe1427 metadata.xml 397 @@ -40,9 +40,9 @@ MD5 0e04eb21f6f99782a7962960107e50b7 files/digest-dspam-3.6.8-r2 759 RMD160 80f03239eb5c96f1d0539aca513209073d9725c7 files/digest-dspam-3.6.8-r2 759 SHA256 21bd59876972d22bbc5301b0ce7606b1e24c521ddf5b7c91304b005f1d577a5e files/digest-dspam-3.6.8-r2 759 -----BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.5 (GNU/Linux) +Version: GnuPG v2.0.2 (GNU/Linux) -iD8DBQFFomfrJnxX6mF440QRAllaAJ9cnsyECDeiF+FQ7MnzptMMW4qYTACg03vq -LfmNEn5RGzmzyZG8HVJu8kU= -=TGMA +iD8DBQFF2AYiJnxX6mF440QRAm/zAJ4oLeiFfQcK1cH84UIPnUNrmS9CbwCeNeVa +drW01iju4CNRvZbisAZ9xjI= +=eMdP -----END PGP SIGNATURE----- diff --git a/mail-filter/dspam/dspam-3.6.8-r2.ebuild b/mail-filter/dspam/dspam-3.6.8-r2.ebuild index 6395138d542f..aafbb17d3905 100644 --- a/mail-filter/dspam/dspam-3.6.8-r2.ebuild +++ b/mail-filter/dspam/dspam-3.6.8-r2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.6.8-r2.ebuild,v 1.1 2007/01/08 15:48:44 mrness Exp $ +# $Header: /var/cvsroot/gentoo-x86/mail-filter/dspam/dspam-3.6.8-r2.ebuild,v 1.2 2007/02/18 07:53:57 mrness Exp $ WANT_AUTOCONF="latest" WANT_AUTOMAKE="latest" @@ -195,20 +195,12 @@ src_install () { newins src/tools.sqlite_drv/purge-3.sql sqlite3_purge.sql fi if use mysql; then - # Use existing configuration if possible - if [[ -f "${ROOT}${CONFDIR}/mysql.data" ]]; then - DSPAM_DB_DATA=( $(sed "s:^[\t ]*$:###:gI" "${ROOT}${CONFDIR}/mysql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock" - DSPAM_DB_DATA[1]="" - DSPAM_DB_DATA[2]="dspam" - DSPAM_DB_DATA[3]="${PASSWORD}" - DSPAM_DB_DATA[4]="dspam" - DSPAM_DB_DATA[5]="true" - fi + DSPAM_DB_DATA[0]="/var/run/mysqld/mysqld.sock" + DSPAM_DB_DATA[1]="" + DSPAM_DB_DATA[2]="dspam" + DSPAM_DB_DATA[3]="${PASSWORD}" + DSPAM_DB_DATA[4]="dspam" + DSPAM_DB_DATA[5]="true" # Modify configuration and create mysql.data file sed -e "s:^#*\(MySQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ @@ -219,7 +211,7 @@ src_install () { -e "s:^#*\(MySQLCompress[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[5]}:gI" \ -i "${D}"/${CONFDIR}/dspam.conf for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${D}/${CONFDIR}/mysql.data + echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> "${D}"/${CONFDIR}/mysql.data done insinto ${CONFDIR} @@ -237,19 +229,11 @@ src_install () { fowners root:dspam ${CONFDIR}/mysql.data fi if use postgres ; then - # Use existing configuration if possible - if [ -f ${ROOT}${CONFDIR}/pgsql.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${CONFDIR}/pgsql.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - DSPAM_DB_DATA[0]="127.0.0.1" - DSPAM_DB_DATA[1]="5432" - DSPAM_DB_DATA[2]="dspam" - DSPAM_DB_DATA[3]="${PASSWORD}" - DSPAM_DB_DATA[4]="dspam" - fi + DSPAM_DB_DATA[0]="127.0.0.1" + DSPAM_DB_DATA[1]="5432" + DSPAM_DB_DATA[2]="dspam" + DSPAM_DB_DATA[3]="${PASSWORD}" + DSPAM_DB_DATA[4]="dspam" # Modify configuration and create pgsql.data file sed -e "s:^#*\(PgSQLServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ @@ -258,9 +242,9 @@ src_install () { -e "s:^#*\(PgSQLPass[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[3]}:gI" \ -e "s:^#*\(PgSQLDb[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[4]}:gI" \ -e "s:^#*\(PgSQLConnectionCache[\t ]*.\):\1:gI" \ - -i ${D}/${CONFDIR}/dspam.conf + -i "${D}"/${CONFDIR}/dspam.conf for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> ${D}/${CONFDIR}/pgsql.data + echo "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" >> "${D}"/${CONFDIR}/pgsql.data done insinto ${CONFDIR} @@ -274,18 +258,10 @@ src_install () { fowners root:dspam ${CONFDIR}/pgsql.data fi if use oracle ; then - # Use existing configuration if possible - if [ -f ${ROOT}${CONFDIR}/oracle.data ]; then - DSPAM_DB_DATA=( $(cat "${ROOT}${CONFDIR}/oracle.data") ) - for DB_DATA_INDEX in $(seq 0 $((${#DSPAM_DB_DATA[@]} - 1))); do - [[ "${DSPAM_DB_DATA[$DB_DATA_INDEX]}" = "###" ]] && DSPAM_DB_DATA[$DB_DATA_INDEX]="" - done - else - DSPAM_DB_DATA[0]="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" - DSPAM_DB_DATA[1]="dspam" - DSPAM_DB_DATA[2]="${PASSWORD}" - DSPAM_DB_DATA[3]="dspam" - fi + DSPAM_DB_DATA[0]="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SID=PROD)))" + DSPAM_DB_DATA[1]="dspam" + DSPAM_DB_DATA[2]="${PASSWORD}" + DSPAM_DB_DATA[3]="dspam" # Modify configuration and create oracle.data file sed -e "s:^#*\(OraServer[\t ]\{1,\}\).*:\1${DSPAM_DB_DATA[0]}:gI" \ @@ -346,6 +322,14 @@ src_install () { doman man/dspam* } +pkg_preinst() { + # Preserve *.data files + local installed_datafiles="${ROOT}"/${CONFDIR}/*.data + if [[ "${installed_datafiles}" != *"*.data" ]]; then + cp "${ROOT}"/${CONFDIR}/*.data "${D}"/${CONFDIR} + fi +} + pkg_postinst() { # need enewgroup/enewuser in this function for binary install. create_dspam_usergroup -- 2.26.2