Sophie

Sophie

distrib > Mageia > 1 > i586 > media > core-updates-src > by-pkgid > 2d27fe3dff73e21c1aac97aebe0dff40 > files > 37

rpm-4.8.1-10.5.mga1.src.rpm

From 3f8e8a4963eb0adfa38e42f71dca0c25beafa592 Mon Sep 17 00:00:00 2001
From: unknown author <cooker@mandrivalinux.org>
Date: Mon, 5 Jan 2009 13:29:57 +0000
Subject: [PATCH 03/36] syslog

---
 configure.ac |    6 ++++++
 lib/psm.c    |   21 +++++++++++++++++++++
 system.h     |    4 ++++
 3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8c2ef50..4ccaa15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -232,6 +232,12 @@ AC_SUBST(WITH_LZMA_LIB)
 #=================
 
 dnl
+dnl Checking syslog
+dnl
+
+AC_CHECK_HEADERS(syslog.h)
+
+dnl
 dnl Check for features
 dnl
 
diff --git a/system.h b/system.h
index dc053ee..9fd16b4 100644
--- a/system.h
+++ b/system.h
@@ -9,6 +9,10 @@
 #include "config.h"
 #endif
 
+#if HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
 #include <sys/types.h>
 
 #include <sys/stat.h>
-- 
1.6.4.4


--- a/macros.in
+++ b/macros.in	2011-03-02 10:31:31.226079490 +0100
@@ -1203,6 +1203,8 @@
 %__urlhelper_proxyopts   %{?_httpproxy:--proxy %{_httpproxy}%{?_httpport::%{_httpport}}}%{!?_httpproxy:%{nil}}
 %_urlhelper             %{__urlhelpercmd} %{?__urlhelper_localopts} %{?__urlhelper_proxyopts} %{__urlhelperopts}
 
+# Syslog support when installing/removing rpms
+%_use_syslog  1
 
 # \endverbatim
 #*/


--- a/lib/psm.c
+++ b/lib/psm.c	2011-03-02 16:24:14.614091989 +0100
@@ -1580,6 +1580,14 @@
 				NULL, NULL);
 	(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
 
+#if HAVE_SYSLOG_H
+       {
+               if (rpmExpandNumeric("%{_use_syslog}")) {
+                       syslog(LOG_NOTICE, "[RPM] %s installed\n", rpmteNEVRA(psm->te));
+               }
+       }
+#endif				
+
 	if (rc == RPMRC_OK)
 	    rpmteSetDBInstance(psm->te, headerGetInstance(h));
 	headerFree(h);
@@ -1591,6 +1599,15 @@
 	rc = rpmdbRemove(rpmtsGetRdb(ts), rpmtsGetTid(ts),
 				rpmteDBInstance(psm->te), NULL, NULL);
 	(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBREMOVE), 0);
+
+#if HAVE_SYSLOG_H
+        {
+               if (rpmExpandNumeric("%{_use_syslog}")) {
+                       syslog(LOG_NOTICE, "[RPM] %s removed\n", rpmteNEVRA(psm->te));
+               }
+       }
+#endif
+
 	if (rc == RPMRC_OK)
 	    rpmteSetDBInstance(psm->te, 0);
 	break;