packages: mpd_sima/mpd_sima.service (NEW), mpd_sima/mpd_sima.spec (NEW), mp...

wiget wiget at pld-linux.org
Fri Feb 3 14:47:16 CET 2012


Author: wiget                        Date: Fri Feb  3 13:47:16 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- initial

---- Files affected:
packages/mpd_sima:
   mpd_sima.service (NONE -> 1.1)  (NEW), mpd_sima.spec (NONE -> 1.1)  (NEW), vardir.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/mpd_sima/mpd_sima.service
diff -u /dev/null packages/mpd_sima/mpd_sima.service:1.1
--- /dev/null	Fri Feb  3 14:47:16 2012
+++ packages/mpd_sima/mpd_sima.service	Fri Feb  3 14:47:11 2012
@@ -0,0 +1,10 @@
+[Unit]
+Description=MPD_sima
+After=mpd.service network.target
+
+[Service]
+User=mpd_sima
+ExecStart=/usr/bin/mpd-sima --config=/etc/mpd-sima.cfg --var_dir=/var/lib/mpd_sima
+
+[Install]
+WantedBy=multi-user.target

================================================================
Index: packages/mpd_sima/mpd_sima.spec
diff -u /dev/null packages/mpd_sima/mpd_sima.spec:1.1
--- /dev/null	Fri Feb  3 14:47:16 2012
+++ packages/mpd_sima/mpd_sima.spec	Fri Feb  3 14:47:11 2012
@@ -0,0 +1,103 @@
+# $Revision$, $Date$
+Summary:	Automagically add titles to mpd playlist
+Name:		mpd_sima
+Version:	0.8.0
+Release:	1
+License:	GPL v3+
+Group:		Applications
+Source0:	http://codingteam.net/project/sima/download/file/%{name}_%{version}.tgz
+# Source0-md5:	5c6e5790ce87c034ef4c437c214bad1d
+Source1:	%{name}.service
+Patch0:		vardir.patch
+URL:		http://codingteam.net/project/sima
+BuildRequires:	rpm-pythonprov
+BuildRequires:	sed >= 4.0
+Requires:	python-mpd
+Requires:	systemd-units >= 37-0.10
+Provides:	group(mpd_sima)
+Provides:	user(mpd_sima)
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+MPD Sima is a python daemon meant to feed MPD playlist with artist
+similar to your currently playing track, provided that this artist is
+found in MPD library.
+
+This python code allows you to never run out of music when your
+playlist queue is getting short.
+
+%prep
+%setup -q -n %{name}_%{version}
+%patch0 -p1
+for f in src/mpd_sima src/simadb_cli; do
+	sed -i -e 's=#!/usr/bin/env python=#!/usr/bin/python=' $f
+done
+for f in data/wrappers/mpd-sima data/wrappers/simadb_cli; do
+	sed -i -e 's=#!/usr/bin/env sh=#!/bin/sh=' $f
+done
+
+%build
+%{__make} PREFIX=%{_prefix}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_sharedstatedir}/%{name},%{_sysconfdir},%{systemdunitdir}}
+
+%{__make} install \
+	PREFIX=%{_prefix} \
+	DESTDIR=$RPM_BUILD_ROOT
+
+install doc/examples/mpd_sima.cfg $RPM_BUILD_ROOT%{_sysconfdir}/mpd-sima.cfg
+install %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
+%py_comp $RPM_BUILD_ROOT%{_datadir}/mpd-sima
+%py_ocomp $RPM_BUILD_ROOT%{_datadir}/mpd-sima
+%{__rm} $RPM_BUILD_ROOT%{_datadir}/mpd-sima/{lib,utils}/*.py
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%pre
+%groupadd -g 275 mpd_sima
+%useradd -u 275 -r -d /home/services/mpd_sima -s /bin/false -c "MPD_sima user" -g mpd_sima mpd_sima
+
+%post
+%systemd_post %{name}.service
+
+%preun
+%systemd_preun %{name}.service
+
+%postun
+if [ "$1" = "0" ]; then
+	%userremove mpd_sima
+	%groupremove mpd_sima
+fi
+%systemd_reload
+
+%files
+%defattr(644,root,root,755)
+%doc doc/AUTHORS doc/Changelog doc/copyright_holders doc/examples doc/FAQ doc/README.* doc/THANKS doc/sima_db.dia
+%attr(600,mpd_sima,mpd_sima) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/mpd-sima.cfg
+%attr(755,root,root) %{_bindir}/mpd-sima
+%attr(755,root,root) %{_bindir}/simadb_cli
+%dir %{_datadir}/mpd-sima
+%attr(755,root,root) %{_datadir}/mpd-sima/mpd_sima
+%attr(755,root,root) %{_datadir}/mpd-sima/simadb_cli
+%dir %{_datadir}/mpd-sima/lib
+%{_datadir}/mpd-sima/lib/*.py[co]
+%dir %{_datadir}/mpd-sima/utils
+%{_datadir}/mpd-sima/utils/*.py[co]
+%{_mandir}/man1/mpd-sima.1*
+%{_mandir}/man1/mpd-sima.cfg.1*
+%{_mandir}/man1/simadb_cli.1*
+%{systemdunitdir}/%{name}.service
+%attr(770,mpd_sima,mpd_sima) %{_sharedstatedir}/mpd_sima
+
+%define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1  2012/02/03 13:47:11  wiget
+- initial
+

================================================================
Index: packages/mpd_sima/vardir.patch
diff -u /dev/null packages/mpd_sima/vardir.patch:1.1
--- /dev/null	Fri Feb  3 14:47:16 2012
+++ packages/mpd_sima/vardir.patch	Fri Feb  3 14:47:11 2012
@@ -0,0 +1,25 @@
+--- mpd_sima_0.8.0/src/utils/startopt.py.wiget	2012-02-03 14:09:03.722512780 +0100
++++ mpd_sima_0.8.0/src/utils/startopt.py	2012-02-03 14:10:09.119982354 +0100
+@@ -52,6 +52,13 @@ def is_file_exist(option, opt_str, value
+         raise OptionValueError('no access to "%s"' % value)
+     setattr(parser.values, option.dest, value)
+ 
++def is_directory_rwable(option, opt_str, value, parser):
++    value = normalize_path(value)
++    # Check either file is write-able or not
++    if not access(value, W_OK):
++        raise OptionValueError('no write access to "%s"' % value)
++    setattr(parser.values, option.dest, value)
++
+ def obsolete_option(option, opt_str, value, parser):
+     raise parser.error('"%s" now obsolete' % option)#}}}
+ 
+@@ -129,7 +136,7 @@ OPTS = list([
+         'type': 'string',
+         'dest': 'var_dir',
+         'action': 'callback',
+-        'callback': is_file_rwable,
++        'callback': is_directory_rwable,
+         'help': 'Directory to store var content (ie. database)'},
+     {
+         'sw': ['--new-version'],
================================================================


More information about the pld-cvs-commit mailing list