Accepting request 642025 from home:mcepl

Clean up SPEC file, make the package building again.

OBS-URL: https://build.opensuse.org/request/show/642025
OBS-URL: https://build.opensuse.org/package/show/Education/dictd?expand=0&rev=4
This commit is contained in:
Marguerite Su 2018-10-16 05:12:41 +00:00 committed by Git OBS Bridge
parent 61738d82f1
commit 3f55ce16c6
6 changed files with 10386 additions and 193 deletions

View File

@ -0,0 +1,86 @@
diff -purN dictd-1.12.1/dictd.c dictd-1.12.1_new/dictd.c
--- dictd-1.12.1/dictd.c 2011-01-09 17:53:27.000000000 +0100
+++ dictd-1.12.1_new/dictd.c 2014-02-25 16:12:49.752301674 +0100
@@ -329,6 +329,7 @@ static void xsigprocmask (int how, const
}
}
+/*
static void block_signals (void)
{
sigset_t set;
@@ -350,6 +351,7 @@ static void unblock_signals (void)
xsigprocmask (SIG_UNBLOCK, &set, NULL);
}
+*/
static void handler( int sig )
{
@@ -1264,21 +1266,22 @@ static void release_root_privileges( voi
* -- Bob Hilliard
*/
{
+ int unused __attribute__((unused));
if (geteuid() == 0) {
struct passwd *pwd;
if ((pwd = getpwnam("dictd"))) {
- setgid(pwd->pw_gid);
+ unused = setgid(pwd->pw_gid);
initgroups("dictd",pwd->pw_gid);
- setuid(pwd->pw_uid);
+ unused = setuid(pwd->pw_uid);
} else if ((pwd = getpwnam("nobody"))) {
- setgid(pwd->pw_gid);
+ unused = setgid(pwd->pw_gid);
initgroups("nobody",pwd->pw_gid);
- setuid(pwd->pw_uid);
+ unused = setuid(pwd->pw_uid);
} else {
- setgid(GID_NOGROUP);
+ unused = setgid(GID_NOGROUP);
initgroups("nobody", GID_NOGROUP);
- setuid(UID_NOBODY);
+ unused = setuid(UID_NOBODY);
}
}
}
@@ -1464,6 +1467,7 @@ static void pid_file_write ()
static void reopen_012 (void)
{
int fd = open ("/dev/null", O_RDWR);
+ int unused __attribute__((unused));
if (fd == -1)
err_fatal_errno (__func__, ":E: can't open /dev/null");
@@ -1471,9 +1475,9 @@ static void reopen_012 (void)
close (1);
close (2);
- dup (fd);
- dup (fd);
- dup (fd);
+ unused = dup (fd);
+ unused = dup (fd);
+ unused = dup (fd);
}
int main (int argc, char **argv, char **envp)
@@ -1489,6 +1493,7 @@ int main (int argc, char **argv, char **
int i;
int errno_accept = 0;
+ int unused __attribute__((unused));
const char * default_strategy_arg = "???";
@@ -1696,7 +1701,7 @@ int main (int argc, char **argv, char **
if (detach){
/* become a daemon */
- daemon (0, 1);
+ unused = daemon (0, 1);
reopen_012 ();
/* after fork from daemon(3) */

10216
dictd-1.9.15-ipv6.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Oct 15 09:51:29 CEST 2018 - mcepl@suse.com
- Clean up SPEC file.
-------------------------------------------------------------------
Fri Oct 12 23:56:35 UTC 2012 - mailaender@opensuse.org

View File

@ -1,154 +0,0 @@
#! /bin/sh
# Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany.
#
# Author: Uwe Drechsel <feedback@suse.de>
#
# /etc/init.d/dictd
#
# and symbolic its link
#
# /usr/sbin/rcdictd
#
### BEGIN INIT INFO
# Provides: dictd
# Required-Start: $remote_fs $syslog
# Should-Start: $network
# Required-Stop: $remote_fs $syslog
# Should-Stop: $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start dictd server to provide dictionaries
# Short-Description: Electronic Online Dictionaries
### END INIT INFO
DICTD_BIN=/usr/sbin/dictd
test -x $DICTD_BIN || { echo "$DICTD_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed
# rc_failed <num> set local and overall rc status to <num><num>
# rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status
. /etc/rc.status
# First reset status of this service
rc_reset
# Return values acc. to LSB for all commands but status:
# 0 - success
# 1 - generic or unspecified error
# 2 - invalid or excess argument(s)
# 3 - unimplemented feature (e.g. "reload")
# 4 - insufficient privilege
# 5 - program is not installed
# 6 - program is not configured
# 7 - program is not running
#
# Note that starting an already running service, stopping
# or restarting a not-running service as well as the restart
# with force-reload (in case signalling is not supported) are
# considered a success.
case "$1" in
start)
echo -n "Starting dictd "
## Start daemon with startproc(8). If this fails
## the echo return value is set appropriate.
# NOTE: startproc return 0, even if service is
# already running to match LSB spec.
startproc $DICTD_BIN -L /var/log/dictd
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down dictd "
## Stop daemon with killproc(8) and if this fails
## set echo the echo return value.
killproc -TERM $DICTD_BIN
# Remember status and be verbose
rc_status -v
;;
try-restart)
## Stop the service and if this succeeds (i.e. the
## service was running before), start it again.
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
$0 status >/dev/null && $0 restart
# Remember status and be quiet
rc_status
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
## Signal the daemon to reload its config. Most daemons
## do this on signal 1 (SIGHUP).
## If it does not support it, restart.
echo -n "Reload service dictd "
## if it supports it:
killproc -HUP $DICTD_BIN
#touch /var/run/dictd.pid
rc_status -v
## Otherwise:
#$0 stop && $0 start
#rc_status
;;
reload)
## Like force-reload, but if daemon does not support
## signalling, do nothing (!)
# If it supports signalling:
echo -n "Reload service dictd "
killproc -HUP $DICTD_BIN
#touch /var/run/dictd.pid
rc_status -v
## Otherwise if it does not support reload:
#rc_failed 3
#rc_status -v
;;
status)
echo -n "Checking for dictd: "
## Check status with checkproc(8), if process is running
## checkproc will return with exit status 0.
# Status has a slightly different for the status command:
# 0 - service running
# 1 - service dead, but /var/run/ pid file exists
# 2 - service dead, but /var/lock/ lock file exists
# 3 - service not running
# NOTE: checkproc returns LSB compliant status values.
checkproc $DICTD_BIN
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload,
## give out the argument which is required for a reload.
test /etc/dictd/dictd.conf -nt /var/run/dictd.pid && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit

10
dictd.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Dictd Dictionary Server Daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/sbin/dictd --listen-to 127.0.0.1
[Install]
WantedBy=multi-user.target

View File

@ -1,26 +1,49 @@
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# spec file for package dictd
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: dictd
Version: 1.12.1
Release: 1
License: GPL-2.0+
Summary: Electronic Online Dictionaries
Url: http://www.dict.org
Release: 0
Summary: DICT protocol (RFC 2229) server and command-line client
License: GPL-1.0-or-later AND Zlib AND MIT
Group: Productivity/Office/Dictionary
Source0: %{name}-%{version}.tar.gz
Source2: dictd.init
Source3: colorit.conf
BuildRequires: libmaa-devel
BuildRequires: zlib-devel
URL: https://sourceforge.net/projects/dict/
Source0: http://downloads.sourceforge.net/dict/%{name}-%{version}.tar.gz
Source1: colorit.conf
Source2: dictd.service
Patch0: dictd-1.12.1-unused-return.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=198359
# https://sourceforge.net/p/dict/feature-requests/4/
# Patch1: dictd-1.9.15-ipv6.patch
BuildRequires: bison
BuildRequires: flex
BuildRequires: gawk
BuildRequires: gcc
BuildRequires: libdbi-devel
BuildRequires: libmaa-devel
BuildRequires: libtool
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: systemd
BuildRequires: zlib-devel
# libtool-ltdl-devel byacc
%if 0%{?suse_version}
Requires(pre): %insserv_prereq %fillup_prereq
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%endif
%description
@ -30,54 +53,61 @@ set up your own dictionary. To look up, for example, the word 'grunt',
just type "dict grunt" at a command line. See the man pages of dict and
dictd for details.
%package devel
Summary: Development files for dictd
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%description devel
Development files for dictd (header files).
%prep
%setup -q
%setup
%autopatch -p1
%build
%configure
export LDFLAGS="%{?__global_ldflags}" CPPFLAGS="$RPM_OPT_FLAGS -fPIC"
%configure --enable-dictorg --disable-plugin
make %{?_smp_mflags}
%install
%make_install
install -D -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/dictd
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/colorit.conf
ln -sf /etc/init.d/dictd %{buildroot}%{_sbindir}/rcdictd
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/colorit.conf
cat <<EOF > $RPM_BUILD_ROOT/%{_sysconfdir}/dictd.conf
global {
#syslog
#syslog_facility daemon
}
# Add database definitions here...
# We stop the search here
database_exit
# Add hidden database definitions here...
EOF
install -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/dictd.service
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcdictd
%pre
%service_add_pre dictd.service
%post
%fillup_and_insserv dictd
%service_add_post dictd.service
touch %{_localstatedir}/log/dictd
chown nobody:nogroup %{_localstatedir}/log/dictd
chmod 644 %{_localstatedir}/log/dictd
%preun
%stop_on_removal dictd
%service_del_preun dictd.service
%postun
%restart_on_update dictd
%insserv_cleanup
rm -rf %{_localstatedir}/log/dictd
%service_del_postun dictd.service
%files
%defattr(-,root,root)
%doc ANNOUNCE COPYING ChangeLog NEWS README TODO example*
%license COPYING
%doc ANNOUNCE ChangeLog NEWS README TODO example*
%doc doc/dicf.ms doc/rfc.ms doc/rfc2229.txt doc/security.doc
%{_bindir}/*
%{_sbindir}/*
%{_mandir}/man1/*
%{_mandir}/man8/*
%attr(0644,root,root) %{_unitdir}/dictd.service
%config(noreplace) %{_sysconfdir}/colorit.conf
%config %{_sysconfdir}/init.d/dictd
%config(noreplace) %{_sysconfdir}/dictd.conf
%files devel
%defattr(-,root,root)
%{_includedir}/dict*
%changelog
%changelog