:: Re: [DNG] samba-libs package in Deb…
Top Pagina
Delete this message
Reply to this message
Auteur: Enrico Weigelt, metux IT consult
Datum:  
Aan: dng
Onderwerp: Re: [DNG] samba-libs package in Debian now depends on libsystemd0

patch attached ...

mit freundlichen Grüßen
--
Enrico Weigelt,
metux IT consulting
+49-151-27565287
>From 39558e4585802d3ac6aec7eaf857f03434218be5 Mon Sep 17 00:00:00 2001
From: "Enrico Weigelt, metux IT consult" <enrico.weigelt@???>
Date: Thu, 30 Jun 2016 19:01:53 +0200
Subject: [PATCH] drop systemd dependencies

---
 ctdb/packaging/RPM/ctdb.spec.in         | 14 --------------
 docs-xml/smbdotconf/logging/logging.xml |  1 -
 lib/util/become_daemon.c                | 22 ----------------------
 lib/util/debug.c                        | 21 +--------------------
 lib/util/samba_util.h                   |  2 --
 lib/util/wscript                        |  8 --------
 lib/util/wscript_build                  |  4 ++--
 lib/util/wscript_configure              | 23 -----------------------
 packaging/NetworkManager/README         |  3 ---
 9 files changed, 3 insertions(+), 95 deletions(-)


diff --git a/ctdb/packaging/RPM/ctdb.spec.in b/ctdb/packaging/RPM/ctdb.spec.in
index b7c881e..2d451df 100644
--- a/ctdb/packaging/RPM/ctdb.spec.in
+++ b/ctdb/packaging/RPM/ctdb.spec.in
@@ -1,4 +1,3 @@
-%define with_systemd %{?_with_systemd: 1} %{?!_with_systemd: 0}
%define initdir %{_sysconfdir}/init.d
Name: ctdb
Summary: Clustered TDB
@@ -60,10 +59,6 @@ Requires: libtevent >= %{libtevent_version}
BuildRequires: pcp-libs-devel
%endif

-%if %{with_systemd}
-BuildRequires: systemd-units
-%endif
-
%description
ctdb is the clustered database used by samba

@@ -116,13 +111,8 @@ DESTDIR=$RPM_BUILD_ROOT ./buildtools/bin/waf install

install -m644 config/ctdb.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ctdb

-%if %{with_systemd}
-mkdir -p $RPM_BUILD_ROOT%{_unitdir}
-install -m 755 config/ctdb.service $RPM_BUILD_ROOT%{_unitdir}
-%else
mkdir -p $RPM_BUILD_ROOT%{initdir}
install -m755 config/ctdb.init $RPM_BUILD_ROOT%{initdir}/ctdb
-%endif

# This is a hack. All documents should be installed in /usr/share/doc.
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/ctdb/events.d/README
@@ -152,11 +142,7 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/ctdb/gcore_trace.sh
%config(noreplace) %{_sysconfdir}/ctdb/debug_locks.sh

-%if %{with_systemd}
-%{_unitdir}/ctdb.service
-%else
%attr(755,root,root) %{initdir}/ctdb
-%endif

%attr(755,root,root) %{_sysconfdir}/ctdb/notify.d

diff --git a/docs-xml/smbdotconf/logging/logging.xml b/docs-xml/smbdotconf/logging/logging.xml
index 8524884..3744976 100644
--- a/docs-xml/smbdotconf/logging/logging.xml
+++ b/docs-xml/smbdotconf/logging/logging.xml
@@ -28,7 +28,6 @@
   <itemizedlist>
     <listitem><para><parameter moreinfo="none">syslog</parameter></para></listitem>
     <listitem><para><parameter moreinfo="none">file</parameter></para></listitem>
-    <listitem><para><parameter moreinfo="none">systemd</parameter></para></listitem>
     <listitem><para><parameter moreinfo="none">lttng</parameter></para></listitem>
     <listitem><para><parameter moreinfo="none">gpfs</parameter></para></listitem>
   </itemizedlist>
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 9979fad..5fcd0ad 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -24,9 +24,6 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "system/locale.h"
-#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
-#include <systemd/sd-daemon.h>
-#endif
 #include "lib/util/close_low_fd.h"


 /*******************************************************************
@@ -69,9 +66,6 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout
     if (do_fork) {
         newpid = fork();
         if (newpid) {
-#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
-            sd_notifyf(0, "READY=0\nSTATUS=Starting process...\nMAINPID=%lu", (unsigned long) newpid);
-#endif /* HAVE_LIBSYSTEMD_DAEMON */
             _exit(0);
         }
     }
@@ -98,16 +92,6 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout


 _PUBLIC_ void exit_daemon(const char *msg, int error)
 {
-#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
-    if (msg == NULL) {
-        msg = strerror(error);
-    }
-
-    sd_notifyf(0, "STATUS=daemon failed to start: %s\n"
-                  "ERRNO=%i",
-                  msg,
-                  error);
-#endif
     DEBUG(0, ("STATUS=daemon failed to start: %s, error code %d\n", msg, error));
     exit(1);
 }
@@ -117,9 +101,6 @@ _PUBLIC_ void daemon_ready(const char *name)
     if (name == NULL) {
         name = "Samba";
     }
-#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
-    sd_notifyf(0, "READY=1\nSTATUS=%s: ready to serve connections...", name);
-#endif
     DEBUG(0, ("STATUS=daemon '%s' finished starting up and ready to serve "
           "connections\n", name));
 }
@@ -129,8 +110,5 @@ _PUBLIC_ void daemon_status(const char *name, const char *msg)
     if (name == NULL) {
         name = "Samba";
     }
-#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
-    sd_notifyf(0, "\nSTATUS=%s: %s", name, msg);
-#endif
     DEBUG(0, ("STATUS=daemon '%s' : %s", name, msg));
 }
diff --git a/lib/util/debug.c b/lib/util/debug.c
index ed89944..07369d8 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -102,7 +102,7 @@ static struct {
     .fd = 2 /* stderr by default */
 };


-#if defined(WITH_SYSLOG) || defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD)
+#if defined(WITH_SYSLOG)
 static int debug_level_to_priority(int level)
 {
     /*
@@ -183,18 +183,6 @@ static void debug_syslog_log(int msg_level,
 }
 #endif /* WITH_SYSLOG */


-#if defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD)
-#include <systemd/sd-journal.h>
-static void debug_systemd_log(int msg_level,
-                  const char *msg, const char *msg_no_nl)
-{
-    sd_journal_send("MESSAGE=%s", msg_no_nl,
-            "PRIORITY=%d", debug_level_to_priority(msg_level),
-            "LEVEL=%d", msg_level,
-            NULL);
-}
-#endif
-
 #ifdef HAVE_LTTNG_TRACEF
 #include <lttng/tracef.h>
 static void debug_lttng_log(int msg_level,
@@ -255,13 +243,6 @@ static struct debug_backend {
     },
 #endif


-#if defined(HAVE_LIBSYSTEMD_JOURNAL) || defined(HAVE_LIBSYSTEMD)
-    {
-        .name = "systemd",
-        .log = debug_systemd_log,
-    },
-#endif
-
 #ifdef HAVE_LTTNG_TRACEF
     {
         .name = "lttng",
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index c339161..f817718 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -554,13 +554,11 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout


/**
Exit daemon and print error message to the log at level 0
- Optionally report failure to systemd if systemd integration is enabled
**/
_PUBLIC_ void exit_daemon(const char *msg, int error);

/**
Report that the daemon is ready to serve connections to the log at level 0
- Optionally report status to systemd if systemd integration is enabled
**/
_PUBLIC_ void daemon_ready(const char *daemon);

diff --git a/lib/util/wscript b/lib/util/wscript
index 953becf..fa35301 100644
--- a/lib/util/wscript
+++ b/lib/util/wscript
@@ -2,14 +2,6 @@ def set_options(opt):
     ''' This is a bit strange, but disable is the flag, not enable. '''
     opt.add_option('--disable-fault-handling', action='store_true', dest='disable_fault_handling', help=('disable the fault handlers'), default=False)


-    opt.add_option('--with-systemd',
-                   help=("Enable systemd integration"),
-                   action='store_true', dest='enable_systemd')
-
-    opt.add_option('--without-systemd',
-                   help=("Disable systemd integration"),
-                   action='store_false', dest='enable_systemd')
-
     opt.add_option('--with-lttng',
                    help=("Enable lttng integration"),
                    action='store_true', dest='enable_lttng')
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 6d2ab4a..bf5411a 100755
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -44,7 +44,7 @@ if bld.CONFIG_SET('HAVE_GPFS'):
 bld.SAMBA_LIBRARY('samba-debug',
                   source='debug.c',
                   deps='replace time-basic close-low-fd talloc socket-blocking' + samba_debug_add_deps,
-                  public_deps='systemd systemd-journal lttng-ust',
+                  public_deps='lttng-ust',
                   local_include=False,
                   includes=samba_debug_add_inc,
                   private_library=True)
@@ -122,7 +122,7 @@ else:
                     server_id.c dprintf.c bitmap.c pidfile.c
                     tevent_debug.c memcache.c''',
                   deps='samba-util-core DYNCONFIG close-low-fd tini tiniparser genrand',
-                  public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid systemd systemd-daemon',
+                  public_deps='talloc tevent execinfo pthread LIBCRYPTO charset util_setid',
                   public_headers='debug.h attr.h byteorder.h data_blob.h memory.h safe_string.h time.h talloc_stack.h xfile.h string_wrappers.h idtree.h idtree_random.h blocking.h signal.h substitute.h fault.h genrand.h',
                   header_path= [ ('dlinklist.h samba_util.h', '.'), ('*', 'util') ],
                   local_include=False,
diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure
index a1e5801..b63c605 100644
--- a/lib/util/wscript_configure
+++ b/lib/util/wscript_configure
@@ -98,29 +98,6 @@ conf.CHECK_CODE('struct statvfs buf; buf.f_flags = 0',
                 local_include=False,
                 execute=False)


-#
-# systemd removed the libsystemd-daemon and libsystemd-journal libraries. In newer
-# versions it is only libsystemd. As waf pkg-config handling does not provide
-# targets which could be used as a dependency based on the package name we need
-# to look for them on our own. This enabled one of the library targets based on
-# which version we detect.
-#
-conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
-conf.SET_TARGET_TYPE('systemd-journal', 'EMPTY')
-conf.SET_TARGET_TYPE('systemd', 'EMPTY')
-
-if Options.options.enable_systemd != False:
-    conf.CHECK_CFG(package='libsystemd-daemon', args='--cflags --libs',
-                   msg='Checking for libsystemd-daemon')
-    if not conf.CHECK_LIB('systemd-daemon', shlib=True):
-        conf.CHECK_LIB('systemd', shlib=True)
-
-if Options.options.enable_systemd != False:
-    conf.CHECK_CFG(package='libsystemd-journal', args='--cflags --libs',
-                   msg='Checking for libsystemd-journal')
-    if not conf.CHECK_LIB('systemd-journal', shlib=True):
-        conf.CHECK_LIB('systemd', shlib=True)
-
 if Options.options.enable_lttng != False:
     conf.CHECK_CFG(package='lttng-ust', args='--cflags --libs',
                    msg='Checking for lttng-ust', uselib_store="LTTNG-UST")
diff --git a/packaging/NetworkManager/README b/packaging/NetworkManager/README
index 0db8be6..b0a6149 100644
--- a/packaging/NetworkManager/README
+++ b/packaging/NetworkManager/README
@@ -1,6 +1,3 @@
 This directory includes files for the dispatcher of NetworkManager. The files
 need to be copied to /etc/NetworkManager/dispatcher.d/ and will be automatically
 called if a network interface goes up or down.
-
-30-winbind-systemd: This will set winbind into offline mode if you have winbind
-                    offline logon turned on.
-- 
2.6.4.442.g545299f