[Openvas-commits] r3383 - in trunk/openvas-manager: . packaging/debian src

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 15 14:20:06 CEST 2009


Author: mwiegand
Date: 2009-05-15 14:20:06 +0200 (Fri, 15 May 2009)
New Revision: 3383

Added:
   trunk/openvas-manager/packaging/debian/compat
   trunk/openvas-manager/packaging/debian/openvas-manager.dirs
   trunk/openvas-manager/packaging/debian/openvas-manager.install
Modified:
   trunk/openvas-manager/CMakeLists.txt
   trunk/openvas-manager/ChangeLog
   trunk/openvas-manager/packaging/debian/control
   trunk/openvas-manager/packaging/debian/rules
   trunk/openvas-manager/src/CMakeLists.txt
   trunk/openvas-manager/src/logf.h
   trunk/openvas-manager/src/openvasmd.c
Log:
Initial set of changes to make Debian packaging work.

* packaging/debian/compat: New. Sets debhelper compatibility level to
5.

* packaging/debian/control: Set dependencies for package.

* packaging/debian/openvas-manager.dirs: New. Request creation of
var/lib/openvas/mgr.

* packaging/debian/openvas-manager.install: New. Request installation of
the created binary.

* packaging/debian/rules: Adjusted calls to cmake and make to make the
package build as expected.

* src/logf.h: Changed to honour OPENVAS_LOG_DIR because PREFIX might be
in a different hierarchy than the appropriate place for the log file.

* src/CMakeLists.txt: Define OPENVAS_LOG_DIR when compiling. Temporarily
disabled directory creation since it broke Debian packaging; the mkdir
should use DESTDIR, not CMAKE_INSTALL_PREFIX directly. Changed install
to honour LIBDIR and BINDIR.

* CMakeLists.txt: Make it possible to set different prefixes for
individual directories; this is expected by Debian.

* src/openvasmd.c: (cleanup) Better NULL guard for fclose since it
seemed to somehow trigger a segfault in the packaged Debian binary when
compiled on Lenny.


Modified: trunk/openvas-manager/CMakeLists.txt
===================================================================
--- trunk/openvas-manager/CMakeLists.txt	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/CMakeLists.txt	2009-05-15 12:20:06 UTC (rev 3383)
@@ -65,15 +65,50 @@
 
 ## Variables
 
-set (OPENVAS_LIB_INSTALL_DIR    "${CMAKE_INSTALL_PREFIX}/lib/")
-set (OPENVAS_HEADER_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/")
-set (OPENVAS_SERVER_CERTIFICATE "${CMAKE_INSTALL_PREFIX}/var/lib/openvas/CA/servercert.pem")
-set (OPENVAS_SERVER_KEY         "${CMAKE_INSTALL_PREFIX}/var/lib/openvas/private/CA/serverkey.pem")
-set (OPENVAS_CA_CERTIFICATE     "${CMAKE_INSTALL_PREFIX}/var/lib/openvas/CA/cacert.pem")
-
 set (CMAKE_BUILD                Debug)
 set (CMAKE_VERBOSE_MAKEFILE     ON)
 
+if (NOT SYSCONFDIR)
+  set (SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc")
+endif (NOT SYSCONFDIR)
+
+if (NOT EXEC_PREFIX)
+  set (EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}")
+endif (NOT EXEC_PREFIX)
+
+if (NOT BINDIR)
+  set (BINDIR "${EXEC_PREFIX}/bin")
+endif (NOT BINDIR)
+
+if (NOT SBINDIR)
+  set (SBINDIR "${EXEC_PREFIX}/sbin")
+endif (NOT SBINDIR)
+
+if (NOT LIBDIR)
+  set (LIBDIR "${EXEC_PREFIX}/lib")
+endif (NOT LIBDIR)
+
+if (NOT LOCALSTATEDIR)
+  set (LOCALSTATEDIR "${CMAKE_INSTALL_PREFIX}/var")
+endif (NOT LOCALSTATEDIR)
+
+if (NOT INCLUDEDIR)
+  set (INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include")
+endif (NOT INCLUDEDIR)
+
+#if (NOT SYSCONFDIR)
+#  set (SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc")
+#endif (NOT SYSCONFDIR)
+
+set (OPENVAS_STATE_DIR "${LOCALSTATEDIR}/lib/openvas")
+set (OPENVAS_LOG_DIR   "${LOCALSTATEDIR}/log/openvas")
+
+set (OPENVAS_LIB_INSTALL_DIR    "${LIBDIR}")
+set (OPENVAS_HEADER_INSTALL_DIR "${INCLUDEDIR}")
+set (OPENVAS_SERVER_CERTIFICATE "${OPENVAS_STATE_DIR}/CA/servercert.pem")
+set (OPENVAS_SERVER_KEY         "${OPENVAS_STATE_DIR}/private/CA/serverkey.pem")
+set (OPENVAS_CA_CERTIFICATE     "${OPENVAS_STATE_DIR}/CA/cacert.pem")
+
 message ("-- Install prefix: ${CMAKE_INSTALL_PREFIX}")
 
 ## Version
@@ -84,8 +119,8 @@
 
 ## Program
 
-set (CMAKE_C_FLAGS_DEBUG        "${CMAKE_C_FLAGS_DEBUG} -Wall")
-set (CMAKE_C_FLAGS              "${CMAKE_C_FLAGS} -Wall")
+set (CMAKE_C_FLAGS_DEBUG        "${CMAKE_C_FLAGS_DEBUG} -Wall -O2")
+set (CMAKE_C_FLAGS              "${CMAKE_C_FLAGS} -Wall -O2")
 
 add_subdirectory (src)
 

Modified: trunk/openvas-manager/ChangeLog
===================================================================
--- trunk/openvas-manager/ChangeLog	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/ChangeLog	2009-05-15 12:20:06 UTC (rev 3383)
@@ -1,3 +1,36 @@
+2009-05-15  Michael Wiegand <michael.wiegand at intevation.de>
+
+	Initial set of changes to make Debian packaging work.
+
+	* packaging/debian/compat: New. Sets debhelper compatibility level to
+	5.
+
+	* packaging/debian/control: Set dependencies for package.
+
+	* packaging/debian/openvas-manager.dirs: New. Request creation of
+	var/lib/openvas/mgr.
+
+	* packaging/debian/openvas-manager.install: New. Request installation of
+	the created binary.
+
+	* packaging/debian/rules: Adjusted calls to cmake and make to make the
+	package build as expected.
+
+	* src/logf.h: Changed to honour OPENVAS_LOG_DIR because PREFIX might be
+	in a different hierarchy than the appropriate place for the log file.
+
+	* src/CMakeLists.txt: Define OPENVAS_LOG_DIR when compiling. Temporarily
+	disabled directory creation since it broke Debian packaging; the mkdir
+	should use DESTDIR, not CMAKE_INSTALL_PREFIX directly. Changed install
+	to honour LIBDIR and BINDIR.
+
+	* CMakeLists.txt: Make it possible to set different prefixes for
+	individual directories; this is expected by Debian.
+
+	* src/openvasmd.c: (cleanup) Better NULL guard for fclose since it
+	seemed to somehow trigger a segfault in the packaged Debian binary when
+	compiled on Lenny.
+
 2009-05-15  Matthew Mundell <mmundell at intevation.de>
 
 	* src/tests/new_task_empty_rc, src/tests/new_task_medium_rc: Remove old

Added: trunk/openvas-manager/packaging/debian/compat
===================================================================
--- trunk/openvas-manager/packaging/debian/compat	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/packaging/debian/compat	2009-05-15 12:20:06 UTC (rev 3383)
@@ -0,0 +1 @@
+5

Modified: trunk/openvas-manager/packaging/debian/control
===================================================================
--- trunk/openvas-manager/packaging/debian/control	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/packaging/debian/control	2009-05-15 12:20:06 UTC (rev 3383)
@@ -2,7 +2,7 @@
 Section: admin
 Priority: optional
 Maintainer: Debian OpenVAS Maintainers <openvas-distro-deb at wald.intevation.org>
-Build-Depends: debhelper (>= 5)
+Build-Depends: debhelper (>= 5), dpatch, libglib2.0-dev, cmake, libsqlite3-dev, doxygen, libossp-uuid-dev, libgnutls-dev, libopenvas2-dev
 Standards-Version: 3.8.0
 
 Package: openvas-manager

Added: trunk/openvas-manager/packaging/debian/openvas-manager.dirs
===================================================================
--- trunk/openvas-manager/packaging/debian/openvas-manager.dirs	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/packaging/debian/openvas-manager.dirs	2009-05-15 12:20:06 UTC (rev 3383)
@@ -0,0 +1 @@
+var/lib/openvas/mgr

Added: trunk/openvas-manager/packaging/debian/openvas-manager.install
===================================================================
--- trunk/openvas-manager/packaging/debian/openvas-manager.install	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/packaging/debian/openvas-manager.install	2009-05-15 12:20:06 UTC (rev 3383)
@@ -0,0 +1 @@
+usr/bin

Modified: trunk/openvas-manager/packaging/debian/rules
===================================================================
--- trunk/openvas-manager/packaging/debian/rules	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/packaging/debian/rules	2009-05-15 12:20:06 UTC (rev 3383)
@@ -15,7 +15,7 @@
 	dh_testdir
 
 	# Add here commands to configure the package.
-	cmake -DCMAKE_INSTALL_PREFIX=/usr .
+	cmake -DCMAKE_INSTALL_PREFIX=/usr -DSYSCONFDIR=/etc -DLOCALSTATEDIR=/var .
 
 	touch $@
 
@@ -36,7 +36,6 @@
 	rm -f build-stamp config.stamp
 
 	# Add here commands to clean up after the build process.
-	$(MAKE) clean
 
 	dh_clean
 
@@ -47,7 +46,7 @@
 	dh_installdirs
 
 	# Add here commands to install the package into debian/tmp
-	$(MAKE) install
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
 
 # Build architecture-independent files here.
 binary-indep: build install

Modified: trunk/openvas-manager/src/CMakeLists.txt
===================================================================
--- trunk/openvas-manager/src/CMakeLists.txt	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/src/CMakeLists.txt	2009-05-15 12:20:06 UTC (rev 3383)
@@ -103,6 +103,10 @@
   add_definitions (-DCACERT=\\\"${OPENVAS_CA_CERTIFICATE}\\\")
 endif (OPENVAS_CA_CERTIFICATE)
 
+if (OPENVAS_LOG_DIR)
+  add_definitions (-DOPENVAS_LOG_DIR=\\\"${OPENVAS_LOG_DIR}\\\")
+endif (OPENVAS_LOG_DIR)
+
 if (OPENVAS_LIB_INSTALL_DIR)
   set (TEMP "-L${OPENVAS_LIB_INSTALL_DIR}")
 else (OPENVAS_LIB_INSTALL_DIR)
@@ -126,11 +130,11 @@
 ## Install
 
 install (TARGETS openvasmd
-         RUNTIME DESTINATION bin
-         LIBRARY DESTINATION lib
-         ARCHIVE DESTINATION lib/static)
+         RUNTIME DESTINATION ${BINDIR}
+         LIBRARY DESTINATION ${LIBDIR}
+         ARCHIVE DESTINATION ${LIBDIR}/static)
 
-install (CODE "FILE (MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/var/lib/openvas/mgr/\")")
+#install (CODE "FILE (MAKE_DIRECTORY \"${CMAKE_INSTALL_PREFIX}/var/lib/openvas/mgr/\")")
 
 ## Tests
 

Modified: trunk/openvas-manager/src/logf.h
===================================================================
--- trunk/openvas-manager/src/logf.h	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/src/logf.h	2009-05-15 12:20:06 UTC (rev 3383)
@@ -45,16 +45,9 @@
 #define LOG 1
 
 /**
- * @brief Installation prefix.
- */
-#ifndef PREFIX
-#define PREFIX ""
-#endif
-
-/**
  * @brief Name of log file.
  */
-#define LOG_FILE PREFIX "/var/log/openvas/openvasmd.log"
+#define LOG_FILE OPENVAS_LOG_DIR "/openvasmd.log"
 
 #if LOG
 extern FILE* log_stream;

Modified: trunk/openvas-manager/src/openvasmd.c
===================================================================
--- trunk/openvas-manager/src/openvasmd.c	2009-05-15 11:57:31 UTC (rev 3382)
+++ trunk/openvas-manager/src/openvasmd.c	2009-05-15 12:20:06 UTC (rev 3383)
@@ -543,7 +543,10 @@
   cleanup_manage ();
   if (manager_socket > -1) close (manager_socket);
 #if LOG
-  if (log_stream && fclose (log_stream)) perror ("Failed to close log stream");
+  if (log_stream != NULL)
+    {
+      if (fclose (log_stream)) perror ("Failed to close log stream");
+    }
 #endif
   ovas_server_context_free (server_context);
 }



More information about the Openvas-commits mailing list