From 109b2f018af8e4c87e4c793c7c03dfab919fc450 Mon Sep 17 00:00:00 2001 From: Alexander Verbovetsky Date: Wed, 28 Sep 2016 09:05:21 +0700 Subject: network/r2e: Updated for version 2.71 + new maintainer. Signed-off-by: Willy Sudiarto Raharjo --- network/r2e/README | 17 +++-- network/r2e/README.Slackware | 14 ++++ network/r2e/config.py.patch | 12 ---- network/r2e/doinst.sh | 17 +++-- network/r2e/fix-email-header-injection.patch | 33 ++++++++++ network/r2e/r2e.SlackBuild | 95 ++++++++++++---------------- network/r2e/r2e.info | 12 ++-- network/r2e/remove-newlines.patch | 20 ++++++ network/r2e/rss2email.certver.patch | 11 ++++ network/r2e/slack-desc | 6 +- network/r2e/wrapper.r2e | 4 +- 11 files changed, 147 insertions(+), 94 deletions(-) create mode 100644 network/r2e/README.Slackware delete mode 100644 network/r2e/config.py.patch create mode 100644 network/r2e/fix-email-header-injection.patch create mode 100644 network/r2e/remove-newlines.patch create mode 100644 network/r2e/rss2email.certver.patch diff --git a/network/r2e/README b/network/r2e/README index 6ec2f3e747..601627766a 100644 --- a/network/r2e/README +++ b/network/r2e/README @@ -2,15 +2,14 @@ rss2email is a free tool for delivering news from RSS feeds to your email program. This allows you to view RSS feeds in an interface you are already familiar with and to apply filters to incoming feeds. -After installing this package, edit /etc/r2e/config.py to taste, then do -the following: +NOTE: +rss2email has no option for disabling HTTPS certificate verification, +because Python requires this. - mkdir ~/.rss2email - r2e new you@yourdomain.com - r2e add http://yourfeed.yourdomain.com - r2e run --no-send +But it is possible to monkeypatch the ssl module to disable +verification globally for all feeds. -You will probably want to create a cron job to periodically -execute "r2e run". +If you want the verification to be disabled pass CERTVER=no to the +script: CERTVER=no ./rss2email.SlackBuild -See http://rss2email.infogami.com for additional information. +See README.Slackware for post-installation configuration. diff --git a/network/r2e/README.Slackware b/network/r2e/README.Slackware new file mode 100644 index 0000000000..2d0503a968 --- /dev/null +++ b/network/r2e/README.Slackware @@ -0,0 +1,14 @@ +After installing this package please do the following: + + mkdir ~/.rss2email + r2e new you@yourdomain.com + r2e add http://yourfeed.yourdomain.com + r2e run --no-send + +To customize rss2email copy /usr/doc/config.py.example to ~/.rss2email +and edit it to taste. + +You will probably want to create a cron job to periodically execute +"r2e run". + +See http://www.allthingsrss.com/rss2email/ for additional information. diff --git a/network/r2e/config.py.patch b/network/r2e/config.py.patch deleted file mode 100644 index da0905832d..0000000000 --- a/network/r2e/config.py.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -Nur r2e-2.6.6.orig/rss2email.py r2e-2.6.6/rss2email.py ---- r2e-2.6.6.orig/rss2email.py 2009-01-05 13:15:15.000000000 -0600 -+++ r2e-2.6.6/rss2email.py 2009-03-27 20:35:32.561832322 -0500 -@@ -200,7 +200,7 @@ - print >>warn, ('Fatal error: sendmail exited with code %s' % status) - sys.exit(1) - except: -- print '''Error attempting to send email via sendmail. Possibly you need to configure your config.py to use a SMTP server? Please refer to the rss2email documentation or website (http://rss2email.infogami.com) for complete documentation of config.py. The options below may suffice for configuring email: -+ print '''Error attempting to send email via sendmail. Possibly you need to configure your /etc/r2e/config.py to use a SMTP server? Please refer to the rss2email documentation or website (http://rss2email.infogami.com) for complete documentation of /etc/r2e/config.py. The options below may suffice for configuring email: - # 1: Use SMTP_SERVER to send mail. - # 0: Call /usr/sbin/sendmail to send mail. - SMTP_SEND = 0 diff --git a/network/r2e/doinst.sh b/network/r2e/doinst.sh index c9bb64c3d8..b8ba97c4b3 100644 --- a/network/r2e/doinst.sh +++ b/network/r2e/doinst.sh @@ -1,9 +1,12 @@ -config() { - NEW="$1" - OLD="$(dirname $NEW)/$(basename $NEW .new)" - [ ! -r $OLD ] && mv $NEW $OLD - rm -f $NEW -} +if [ -d /etc/r2e ]; then + cat << EOF > /etc/r2e/README.config +Starting version 2.71 to customize r2e please edit config.py in your +user directory ~/.rss2email -config etc/r2e/config.py.new +File /etc/r2e/config.py is not used anymore. The directory /etc/r2e +can safely be removed. +See /usr/doc/config.py.example for a full list of available +configuration variables. +EOF +fi diff --git a/network/r2e/fix-email-header-injection.patch b/network/r2e/fix-email-header-injection.patch new file mode 100644 index 0000000000..8407d5d0ee --- /dev/null +++ b/network/r2e/fix-email-header-injection.patch @@ -0,0 +1,33 @@ +From: Etienne Millon +Date: Fri, 25 May 2012 18:04:08 +0200 +Subject: Fix email header injection + +Bug: http://bugs.python.org/issue5871 +Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526064 +--- + rss2email.py | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/rss2email.py b/rss2email.py +index 69998db..a6c3cbe 100755 +--- a/rss2email.py ++++ b/rss2email.py +@@ -111,9 +111,16 @@ PROXY="" + CHARSET_LIST='US-ASCII', 'ISO-8859-1', 'UTF-8', 'BIG5', 'ISO-2022-JP' + + from email.MIMEText import MIMEText +-from email.Header import Header ++from email.Header import Header as _Header + from email.Utils import parseaddr, formataddr +- ++ ++class Header(_Header): ++ # Work-around for ++ def append(self, s=None, *args, **kwargs): ++ if s is not None: ++ s = s.replace('\n', ' ').replace('\r', ' ') ++ _Header.append(self, s, *args, **kwargs) ++ + # Note: You can also override the send function. + + def send(sender, recipient, subject, body, contenttype, extraheaders=None, smtpserver=None): diff --git a/network/r2e/r2e.SlackBuild b/network/r2e/r2e.SlackBuild index be493c8848..4811e8e369 100644 --- a/network/r2e/r2e.SlackBuild +++ b/network/r2e/r2e.SlackBuild @@ -1,51 +1,38 @@ #!/bin/sh # Slackware build script for r2e + # Written by Tom Canich # Released under the BSD +# Modified by Robby Workman # Copyright (c) 2009, Tom Canich, State College, Pennsylvania, USA +# Copyright 2016, Alexander Verbovetsky, Moscow, Russia # All rights reserved. # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials -# provided with the distribution. -# * Neither the name of Tom Canich nor the names of other -# contributors may be used to endorse or promote products -# derived from this software without specific prior written -# permission. +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: # -# THIS SOFTWARE IS PROVIDED BY Tom Canich ''AS IS'' AND ANY -# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tom Canich BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Modified by Robby Workman +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=r2e -VERSION=2.66 +PRGNAMLONG=rss2email +VERSION=${VERSION:-2.71} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} -if [ -z "$ARCH" ]; then - case "$( uname -m )" in - i?86) ARCH=i486 ;; - arm*) ARCH=arm ;; - *) ARCH=$( uname -m ) ;; - esac -fi +ARCH=noarch CWD=$(pwd) TMP=${TMP:-/tmp/SBo} @@ -57,35 +44,31 @@ set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP -rm -rf $PRGNAM-$VERSION -tar xvf $CWD/rss2email-$VERSION.tar.gz -cd rss2email-$VERSION +rm -rf $PRGNAMLONG-$VERSION +tar xvf $CWD/$PRGNAMLONG-$VERSION.tar.gz +chmod -R a=r,a+X,u+w $PRGNAMLONG-$VERSION +cd $PRGNAMLONG-$VERSION +chown -R root:root . -# Patch rss2email.py so that our config.py location is shown -patch -p1 < $CWD/config.py.patch +patch -p1 < $CWD/remove-newlines.patch +patch -p1 < $CWD/fix-email-header-injection.patch +sed --in-place \ + -e 's/http:\/\/rss2email.infogami.com/http:\/\/www.allthingsrss.com\/rss2email\//g' \ + -e 's/__version__ = "2.70"/__version__ = "2.71"/' \ + rss2email.py +[ "${CERTVER:-yes}" = "no" ] && patch < $CWD/rss2email.certver.patch -mkdir -p $PKG/usr/lib/$PRGNAM -install -m 0755 -o root -g root feedparser.py $PKG/usr/lib/$PRGNAM -install -m 0755 -o root -g root html2text.py $PKG/usr/lib/$PRGNAM -install -m 0755 -o root -g root rss2email.py $PKG/usr/lib/$PRGNAM +mkdir -p $PKG/usr/share/$PRGNAM +install -m 0644 -o root -g root feedparser.py $PKG/usr/share/$PRGNAM +install -m 0644 -o root -g root html2text.py $PKG/usr/share/$PRGNAM +install -m 0644 -o root -g root rss2email.py $PKG/usr/share/$PRGNAM mkdir -p $PKG/usr/bin install -m 0755 -o root -g root $CWD/wrapper.r2e $PKG/usr/bin/r2e -mkdir -p $PKG/etc/r2e -cat << EOF > $PKG/etc/r2e/config.py.new -# This directory and file location is SlackBuilds.org-specific. -# In other words, this is a deviation from upstream. -# Official r2e looks in its current working directory for config.py, -# which is actually /usr/lib/r2e in this package. As such, this -# config.py file is symlinked to that location as well. -# -EOF -cat config.py >> $PKG/etc/r2e/config.py.new -( cd $PKG/usr/lib/$PRGNAM ; ln -s ../../../etc/r2e/config.py config.py ) - mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README +cp -a CHANGELOG config.py.example readme.html $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/README.Slackware > $PKG/usr/doc/$PRGNAM-$VERSION/README.Slackware cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/network/r2e/r2e.info b/network/r2e/r2e.info index aa5fb24252..13c53aeefa 100644 --- a/network/r2e/r2e.info +++ b/network/r2e/r2e.info @@ -1,10 +1,10 @@ PRGNAM="r2e" -VERSION="2.66" -HOMEPAGE="http://rss2email.infogami.com" -DOWNLOAD="http://www.allthingsrss.com/rss2email/rss2email-2.66.tar.gz" -MD5SUM="84a7aa98b52952e37dd239fefb01e9d9" +VERSION="2.71" +HOMEPAGE="http://www.allthingsrss.com/rss2email/" +DOWNLOAD="http://www.allthingsrss.com/rss2email/rss2email-2.71.tar.gz" +MD5SUM="7d7dbac5aa181b07261516213a312f39" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" -MAINTAINER="Tom Canich" -EMAIL="tcanich@canich.net" +MAINTAINER="Alexander Verbovetsky" +EMAIL="alik@ejik.org" diff --git a/network/r2e/remove-newlines.patch b/network/r2e/remove-newlines.patch new file mode 100644 index 0000000000..7ae7751633 --- /dev/null +++ b/network/r2e/remove-newlines.patch @@ -0,0 +1,20 @@ +From: David Watson +Date: Mon, 18 Apr 2011 10:41:04 +0200 +Subject: remove-newlines + +--- + html2text.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/html2text.py b/html2text.py +index 0ed4cec..1cd5194 100755 +--- a/html2text.py ++++ b/html2text.py +@@ -305,6 +305,7 @@ class _html2text(HTMLParser.HTMLParser): + if has_key(attrs, 'src'): + attrs['href'] = attrs['src'] + alt = attrs.get('alt', '') ++ alt = re.sub('\n', ' ', alt) + i = self.previousIndex(attrs) + if i is not None: + attrs = self.a[i] diff --git a/network/r2e/rss2email.certver.patch b/network/r2e/rss2email.certver.patch new file mode 100644 index 0000000000..b56ce4bcd7 --- /dev/null +++ b/network/r2e/rss2email.certver.patch @@ -0,0 +1,11 @@ +--- rss2email.py.orig 2016-09-28 01:57:12.929900342 +0200 ++++ rss2email.py 2016-09-28 01:57:36.316685746 +0200 +@@ -25,6 +25,8 @@ + + import urllib2 + urllib2.install_opener(urllib2.build_opener()) ++import ssl ++ssl._create_default_https_context = ssl._create_unverified_context + + ### Vaguely Customizable Options ### + diff --git a/network/r2e/slack-desc b/network/r2e/slack-desc index eb27c9b00c..9d66917f32 100644 --- a/network/r2e/slack-desc +++ b/network/r2e/slack-desc @@ -12,8 +12,8 @@ r2e: rss2email is a free tool for delivering news from RSS feeds to your r2e: email program. This allows you to view RSS feeds in an interface you r2e: are already familiar with and to apply filters to incoming feeds. r2e: -r2e: See /usr/doc/r2e-@VERSION@/README for post-installation configuration. -r2e: -r2e: Homepage: http://rss2email.infogami.com +r2e: See /usr/doc/r2e-@VERSION@/README.Slackware for post-installation +r2e: configuration. r2e: +r2e: Homepage: http://www.allthingsrss.com/rss2email/ r2e: diff --git a/network/r2e/wrapper.r2e b/network/r2e/wrapper.r2e index 3c57b2e069..5dca09f80f 100644 --- a/network/r2e/wrapper.r2e +++ b/network/r2e/wrapper.r2e @@ -1,2 +1,4 @@ #!/bin/sh -python /usr/lib/r2e/rss2email.py $HOME/.rss2email/feeds.dat $* +mkdir -p ~/.rss2email +cd ~/.rss2email +exec python /usr/share/r2e/rss2email.py feeds.dat $* -- cgit v1.2.3