Accepting request 147894 from home:jengelh:branches:Base:System

- Use simpler HXmap_get in at-parse-suse-sysconfig.patch
  (bnc#780259)

OBS-URL: https://build.opensuse.org/request/show/147894
OBS-URL: https://build.opensuse.org/package/show/Base:System/at?expand=0&rev=52
This commit is contained in:
Ralf Lang
2013-01-10 12:17:02 +00:00
committed by Git OBS Bridge
parent 1db49b09b5
commit c33e9aa431
3 changed files with 73 additions and 55 deletions

View File

@@ -1,54 +1,86 @@
--- atd.c.orig
+++ atd.c
@@ -104,8 +104,15 @@ static pam_handle_t *pamh = NULL;
From: Christian Boltz <suse-beta@cboltz.de>
Last updated by: Jan Engelhardt <jengelh@inai.de>
http://bugzilla.novell.com/780259
---
Makefile.in | 4 ++--
atd.c | 21 +++++++++++++++++++++
configure.in | 44 +++++++++++++++++++++++++++-----------------
3 files changed, 50 insertions(+), 19 deletions(-)
Index: at-3.1.8/Makefile.in
===================================================================
--- at-3.1.8.orig/Makefile.in
+++ at-3.1.8/Makefile.in
@@ -31,7 +31,7 @@ SELINUXLIB = @SELINUXLIB@
PAMLIB = @PAMLIB@
CC = @CC@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ @HX_CFLAGS@
LDFLAGS = @LDFLAGS@
LFILE = $(ATJOB_DIR)/.SEQ
DEFS = @DEFS@ -DVERSION=\"$(VERSION)\" \
@@ -39,7 +39,7 @@ DEFS = @DEFS@ -DVERSION=\"$(VERSION)\"
-DDAEMON_USERNAME=\"$(DAEMON_USERNAME)\" \
-DDAEMON_GROUPNAME=\"$(DAEMON_GROUPNAME)\" \
-DLFILE=\"$(LFILE)\" -Wall
-LIBS = @LIBS@
+LIBS = @LIBS@ @HX_LIBS@
LIBOBJS = @LIBOBJS@
INSTALL = @INSTALL@
Index: at-3.1.8/atd.c
===================================================================
--- at-3.1.8.orig/atd.c
+++ at-3.1.8/atd.c
@@ -104,6 +104,10 @@ static pam_handle_t *pamh = NULL;
}
#endif
+#include <libHX/defs.h>
+#include <libHX/map.h>
+#include <libHX/option.h>
+
+
/* Local headers */
+#define streq(a, b) (strcmp((a), (b)) == 0)
+
#include "privs.h"
#include "daemon.h"
@@ -996,6 +1003,30 @@ main(int argc, char *argv[])
@@ -934,6 +938,7 @@ main(int argc, char *argv[])
* for execution and yet another one, optionally, for sending mail.
* Files which already have run are removed during the next invocation.
*/
+ struct HXmap *sc_map;
int c;
time_t next_invocation;
struct sigaction act;
@@ -996,6 +1001,22 @@ main(int argc, char *argv[])
}
}
+ struct HXmap *sysconfigmap;
+ const struct HXmap_node *node;
+ struct HXmap_trav *trav;
+ sc_map = HX_shconfig_map("/etc/sysconfig/atd");
+ if (sc_map != NULL) {
+ char *v;
+
+ sysconfigmap = HX_shconfig_map("/etc/sysconfig/atd");
+
+ if(sysconfigmap != NULL)
+ {
+ trav = HXmap_travinit(sysconfigmap, HXMAP_NOFLAGS);
+ while ((node = HXmap_traverse(trav)) != NULL) {
+ if(streq(node->skey, "ATD_BATCH_INTERVAL") && strlen(node->sdata) != 0) {
+ batch_interval = atoi(node->sdata);
+ syslog(LOG_INFO, "sysconfig requested batch_interval to be set to %d\n", batch_interval);
+ }
+ if(streq(node->skey, "ATD_LOADAVG") && strlen(node->sdata) != 0) {
+ load_avg = atof(node->sdata);
+ syslog(LOG_INFO, "sysconfig requested load_avg to be set to %lf\n", load_avg);
+ }
+ }
+
+ HXmap_travfree(trav);
+ HXmap_free(sysconfigmap);
+ v = HXmap_get(sc_map, "ATD_BATCH_INTERVAL");
+ if (v != NULL && strlen(v) > 0) {
+ batch_interval = strtol(v, NULL, 0);
+ syslog(LOG_INFO, "sysconfig requested batch_interval to be set to %d\n", batch_interval);
+ }
+ v = HXmap_get(sc_map, "ATD_LOADAVG");
+ if (v != NULL && strlen(v) > 0) {
+ load_avg = strtod(v, NULL);
+ syslog(LOG_INFO, "sysconfig requested load_avg to be set to %f\n", load_avg);
+ }
+ }
+
namep = argv[0];
if (chdir(ATJOB_DIR) != 0)
perr("Cannot change to " ATJOB_DIR);
--- configure.in.orig
+++ configure.in
Index: at-3.1.8/configure.in
===================================================================
--- at-3.1.8.orig/configure.in
+++ at-3.1.8/configure.in
@@ -1,9 +1,10 @@
dnl Process this file with autoconf to produce a configure script.
@@ -138,23 +170,3 @@
-AC_OUTPUT(Makefile atrun atd.8 atrun.8 at.1 batch)
+AC_CONFIG_FILES([Makefile atrun atd.8 atrun.8 at.1 batch])
+AC_OUTPUT
--- Makefile.in.orig
+++ Makefile.in
@@ -31,7 +31,7 @@ SELINUXLIB = @SELINUXLIB@
PAMLIB = @PAMLIB@
CC = @CC@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ @HX_CFLAGS@
LDFLAGS = @LDFLAGS@
LFILE = $(ATJOB_DIR)/.SEQ
DEFS = @DEFS@ -DVERSION=\"$(VERSION)\" \
@@ -39,7 +39,7 @@ DEFS = @DEFS@ -DVERSION=\"$(VERSION)\"
-DDAEMON_USERNAME=\"$(DAEMON_USERNAME)\" \
-DDAEMON_GROUPNAME=\"$(DAEMON_GROUPNAME)\" \
-DLFILE=\"$(LFILE)\" -Wall
-LIBS = @LIBS@
+LIBS = @LIBS@ @HX_LIBS@
LIBOBJS = @LIBOBJS@
INSTALL = @INSTALL@

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sun Jan 6 20:43:45 UTC 2013 - jengelh@inai.de
- Use simpler HXmap_get in at-parse-suse-sysconfig.patch
(bnc#780259)
-------------------------------------------------------------------
Wed Nov 28 21:46:58 UTC 2012 - crrodriguez@opensuse.org

View File

@@ -1,7 +1,7 @@
#
# spec file for package at
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: at
BuildRequires: autoconf
BuildRequires: autoconf >= 2.69
BuildRequires: automake
BuildRequires: bison
BuildRequires: flex
@@ -100,7 +100,7 @@ This program allows you to run jobs at specified times.
%patch17 -p1
%patch18
%patch19
%patch20
%patch20 -p1
%build
rm -fv y.tab.c y.tab.h lex.yy.c lex.yy.o y.tab.o
autoreconf -fiv