diff options
-rw-r--r-- | net-nntp/sabnzbd/ChangeLog | 11 | ||||
-rw-r--r-- | net-nntp/sabnzbd/files/par2cmdline.patch | 12 | ||||
-rw-r--r-- | net-nntp/sabnzbd/files/sabnzbd.initd | 100 | ||||
-rw-r--r-- | net-nntp/sabnzbd/files/sabnzbd.logrotate | 13 | ||||
-rw-r--r-- | net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild | 119 | ||||
-rw-r--r-- | net-nntp/sabnzbd/sabnzbd-0.7.16.ebuild (renamed from net-nntp/sabnzbd/sabnzbd-0.7.14.ebuild) | 6 |
6 files changed, 77 insertions, 184 deletions
diff --git a/net-nntp/sabnzbd/ChangeLog b/net-nntp/sabnzbd/ChangeLog index 5568fa42da24..0de9d31bcd43 100644 --- a/net-nntp/sabnzbd/ChangeLog +++ b/net-nntp/sabnzbd/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for net-nntp/sabnzbd # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/ChangeLog,v 1.17 2013/09/08 14:32:03 jer Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/ChangeLog,v 1.18 2013/10/08 23:19:35 jsbronder Exp $ + +*sabnzbd-0.7.16 (08 Oct 2013) + + 08 Oct 2013; Justin Bronder <jsbronder@gentoo.org> -sabnzbd-0.7.13-r2.ebuild, + -sabnzbd-0.7.14.ebuild, +sabnzbd-0.7.16.ebuild, +files/par2cmdline.patch, + files/sabnzbd.initd, -files/sabnzbd.logrotate: + Version bump and remove old (#484226). Fix initd script thanks to eponymous + (#483786). Remove logrotate (#483672). Fix issues with stable version of + par2cmdline thanks to dcb (#480302). 08 Sep 2013; Jeroen Roovers <jer@gentoo.org> files/sabnzbd.ini: Fix CRLF by eponymous (bug #484236). diff --git a/net-nntp/sabnzbd/files/par2cmdline.patch b/net-nntp/sabnzbd/files/par2cmdline.patch new file mode 100644 index 000000000000..d5648eb57aea --- /dev/null +++ b/net-nntp/sabnzbd/files/par2cmdline.patch @@ -0,0 +1,12 @@ +--- sabnzbd/newsunpack.py.orig 2013-07-07 13:29:12.000000000 +0200 ++++ sabnzbd/newsunpack.py 2013-08-02 20:16:22.286697000 +0200 +@@ -966,7 +966,7 @@ + + # Append the wildcard for this set + wildcard = '%s*' % os.path.join(os.path.split(parfile)[0], setname) +- if single or len(globber(wildcard, None)) < 2: ++ if len(globber(wildcard, None)) < 2: + # Support bizarre naming conventions + wildcard = os.path.join(os.path.split(parfile)[0], '*') + command.append(wildcard) + diff --git a/net-nntp/sabnzbd/files/sabnzbd.initd b/net-nntp/sabnzbd/files/sabnzbd.initd index 97c6b69c5d00..576c403dff1f 100644 --- a/net-nntp/sabnzbd/files/sabnzbd.initd +++ b/net-nntp/sabnzbd/files/sabnzbd.initd @@ -1,7 +1,6 @@ #!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/files/sabnzbd.initd,v 1.5 2013/06/25 03:48:26 jsbronder Exp $ RUNDIR=/var/run/sabnzbd @@ -9,6 +8,40 @@ depend() { need net } +get_var() { + echo $(sed -n \ + '/\[misc]/,/^'$1'/ s/^'$1' = \([[:alnum:].]\+\)[\r|\n|\r\n]*$/\1/p' \ + ${SABNZBD_CONFIGFILE}) +} + +get_port() { + if [ "$(get_var 'enable_https')" == "1" ]; then + echo $(get_var 'https_port') + else + echo $(get_var 'port') + fi +} + +get_addr() { + local host=$(get_var 'host') + local port=$(get_port) + local protocol + + [ "${host}" == "0.0.0.0" ] && host=localhost + if [ "$(get_var 'enable_https')" == "1" ]; then + protocol="https" + else + protocol="http" + fi + + echo ${protocol}://${host}:${port} +} + +get_pidfile() { + local port=$(get_port) + echo "${RUNDIR}/sabnzbd-${port}.pid" +} + start() { ebegin "Starting SABnzbd" @@ -20,76 +53,49 @@ start() { --user ${SABNZBD_USER} \ --group ${SABNZBD_GROUP} \ --name sabnzbd \ + --background \ --pidfile $(get_pidfile) \ --exec /usr/bin/sabnzbd \ -- \ --config-file ${SABNZBD_CONFIGFILE} \ --logging ${SABNZBD_LOGGING} \ --daemon \ - --pid "${RUNDIR}" + --pid ${RUNDIR} eend $? } -get_var() { - echo $(echo $(grep "^$1" ${SABNZBD_CONFIGFILE} | head -n 1 | sed 's/\r//' | awk '{print $3}')) -} - -get_pidfile () { - # pid file name is hard-coded in sabnzbd, this must match - local ssl=$(get_var 'enable_https') - - if [ -z "${ssl}" ]; then - echo "${RUNDIR}/sabnzbd-8080.pid" - elif [ ${ssl} -eq 0 ]; then - echo "${RUNDIR}/sabnzbd-$(get_var 'port').pid" - else - echo "${RUNDIR}/sabnzbd-$(get_var 'https_port').pid" - fi -} - -get_addr() { - local host=$(get_var 'host') - #local ssl=$(get_var 'enable_https') - #local ssl_port=$(get_var 'https_port') - local port=$(get_var 'port') - - if [ "${host}" == "0.0.0.0" ]; then - host=localhost +start_pre() { + if [ "$RC_CMD" == "restart" ]; then + local pidfile=$(get_pidfile) + while [ -e ${pidfile} ]; do + sleep 1 + done fi - # sabnzbd seems to only respond correctly to non ssl requests - echo ${host}:${port} + return 0 } stop() { local api_key=$(get_var 'api_key') - local rc t - - ebegin "Stopping SABnzbd @ $(get_addr)" + local addr=$(get_addr) + local pidfile=$(get_pidfile) + local rc=1 - /usr/bin/wget -q --delete-after --no-check-certificate \ - "http://$(get_addr)/sabnzbd/api?mode=shutdown&apikey=${api_key}" - rc=$? + ebegin "Stopping SABnzbd @ ${addr}" - if [ ${rc} -eq 0 ]; then - # Wait for sabnzbd to fully shutdown. - for ((t=0; t < 30; t++)); do - sleep 0.5 - [ ! -s $(get_pidfile) ] && break - done - fi - - if [ -s $(get_pidfile) ]; then - # Using wget didn't work, resort to start-stop-daemon + # SABnzbd will return "ok" if shutdown is successful + rc=$(/usr/bin/curl -k -s "${addr}/sabnzbd/api?mode=shutdown&apikey=${api_key}") + if [ "${rc}" == "ok" ]; then + rc=0 + else einfo "Falling back to SIGTERM, this may not work if you restarted via the web interface" start-stop-daemon \ --stop \ - --pidfile $(get_pidfile) \ + --pidfile ${pidfile} \ --retry SIGTERM/1/SIGKILL/5 rc=$? fi eend ${rc} } - diff --git a/net-nntp/sabnzbd/files/sabnzbd.logrotate b/net-nntp/sabnzbd/files/sabnzbd.logrotate deleted file mode 100644 index 3910e33fd649..000000000000 --- a/net-nntp/sabnzbd/files/sabnzbd.logrotate +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/files/sabnzbd.logrotate,v 1.1 2013/02/06 04:59:55 jsbronder Exp $ - -/var/log/sabnzbd/*.log{ - missingok - notifempty - su sabnzbd sabnzbd - sharedscripts - postrotate - /etc/init.d/sabnzbd status && /etc/init.d/sabnzbd restart - endscript -} diff --git a/net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild b/net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild deleted file mode 100644 index 5974d5f05ba3..000000000000 --- a/net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild +++ /dev/null @@ -1,119 +0,0 @@ -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild,v 1.1 2013/06/25 03:48:26 jsbronder Exp $ - -EAPI="4" - -# Require python-2 with sqlite USE flag -PYTHON_DEPEND="2:2.6" -PYTHON_USE_WITH="sqlite" - -inherit eutils python user - -MY_P="${P/sab/SAB}" - -DESCRIPTION="Binary newsgrabber with web-interface" -HOMEPAGE="http://www.sabnzbd.org/" -SRC_URI="mirror://sourceforge/sabnzbdplus/${MY_P}-src.tar.gz" - -# Sabnzbd is GPL-2 but bundles software with the following licenses. -LICENSE="GPL-2 BSD LGPL-2 MIT BSD-1" -SLOT="0" -KEYWORDS="~amd64" -IUSE="+rar +ssl unzip +yenc" - -# Sabnzbd is installed to /usr/share/ as upstream makes it clear they should not -# be in python's sitedir. See: http://wiki.sabnzbd.org/unix-packaging - -# TODO: still bundled but not in protage: -# kronos, rarfile, rsslib, ssmtplib, listquote, json-py, msgfmt -# pynewsleecher -# -# Also note that cherrypy is still bundled. It's near impossible to find -# out where the bundled and heavily patched version came from (pulled from -# cherrypy subversion, patched somewhere, then imported to sabnzbd and patched -# further. Upstream is planning on making this easier with 0.8.0. -# https://github.com/sabnzbd/sabnzbd/issues/47 - -RDEPEND=" - >=app-arch/par2cmdline-0.4 - >=dev-python/cheetah-2.0.1 - dev-python/configobj - dev-python/feedparser - dev-python/gntp - dev-python/pythonutils - net-misc/wget - rar? ( || ( app-arch/unrar app-arch/rar ) ) - ssl? ( dev-python/pyopenssl ) - unzip? ( >=app-arch/unzip-5.5.2 ) - yenc? ( dev-python/yenc ) -" - -S="${WORKDIR}/${MY_P}" - -pkg_setup() { - HOMEDIR="/var/lib/${PN}" - python_set_active_version 2 - python_pkg_setup - - # Create sabnzbd group - enewgroup ${PN} - # Create sabnzbd user, put in sabnzbd group - enewuser "${PN}" -1 -1 "${HOMEDIR}" "${PN}" -} - -src_prepare() { - epatch "${FILESDIR}"/use-system-configobj-and-feedparser.patch - epatch "${FILESDIR}"/growler-support-gntp-1.0.patch - - # remove bundled modules - rm -r sabnzbd/utils/{feedparser,configobj}.py || die - rm -r gntp || die - rm licenses/License-{feedparser,configobj,gntp}.txt || die -} - -src_install() { - local d - - dodir /usr/share/${PN}/sabnzbd - insinto /usr/share/${PN}/ - doins SABnzbd.py - fperms +x /usr/share/${PN}/SABnzbd.py - dobin "${FILESDIR}"/sabnzbd - - for d in cherrypy email icons interfaces locale po sabnzbd tools util; do - insinto /usr/share/${PN}/${d} - doins -r ${d}/* - done - - newinitd "${FILESDIR}/${PN}.initd" "${PN}" - newconfd "${FILESDIR}/${PN}.confd" "${PN}" - - insinto /etc/logrotate.d - newins "${FILESDIR}/"${PN}.logrotate ${PN} - - diropts -o ${PN} -g ${PN} - dodir /etc/${PN} - dodir /var/log/${PN} - - insinto "/etc/${PN}" - insopts -m 0600 -o ${PN} -g ${PN} - doins "${FILESDIR}/${PN}.ini" - - dodoc {ABOUT,CHANGELOG,ISSUES,README}.txt Sample-PostProc.sh licenses/* -} - -pkg_postinst() { - python_mod_optimize /usr/share/${PN} - - einfo "Default directory: ${HOMEDIR}" - einfo "" - einfo "Run: gpasswd -a <user> sabnzbd" - einfo "to add an user to the sabnzbd group so it can edit sabnzbd files" - einfo "" - einfo "By default sabnzbd will listen on 127.0.0.1:8080" -} - -pkg_postrm() { - python_mod_cleanup /usr/share/${PN} -} diff --git a/net-nntp/sabnzbd/sabnzbd-0.7.14.ebuild b/net-nntp/sabnzbd/sabnzbd-0.7.16.ebuild index 4e03ff18dfd9..7700f353f210 100644 --- a/net-nntp/sabnzbd/sabnzbd-0.7.14.ebuild +++ b/net-nntp/sabnzbd/sabnzbd-0.7.16.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/sabnzbd-0.7.14.ebuild,v 1.1 2013/07/11 23:08:10 jsbronder Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/sabnzbd-0.7.16.ebuild,v 1.1 2013/10/08 23:19:35 jsbronder Exp $ EAPI="4" @@ -65,6 +65,7 @@ pkg_setup() { src_prepare() { epatch "${FILESDIR}"/use-system-configobj-and-feedparser.patch epatch "${FILESDIR}"/growler-support-gntp-1.0.patch + epatch "${FILESDIR}"/par2cmdline.patch # remove bundled modules rm -r sabnzbd/utils/{feedparser,configobj}.py || die @@ -89,9 +90,6 @@ src_install() { newinitd "${FILESDIR}/${PN}.initd" "${PN}" newconfd "${FILESDIR}/${PN}.confd" "${PN}" - insinto /etc/logrotate.d - newins "${FILESDIR}/"${PN}.logrotate ${PN} - diropts -o ${PN} -g ${PN} dodir /etc/${PN} dodir /var/log/${PN} |