diff options
author | Alexander Verbovetsky <alik@ejik.org> | 2020-09-19 00:54:17 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-09-19 00:54:17 +0700 |
commit | a436d194f572e8ec475c4e2c6d1f2ff9d4179c4f (patch) | |
tree | 31a5446cf5620add550baf59d2d99d602be8885e | |
parent | 3b97d8ee65fbbb4163f3b5ebd93ee832b0f82396 (diff) | |
download | slackbuilds-a436d194f572e8ec475c4e2c6d1f2ff9d4179c4f.tar.gz |
network/rss2email: Added (rss to email gateway).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | network/rss2email/4b36e28.patch | 239 | ||||
-rw-r--r-- | network/rss2email/README | 8 | ||||
-rw-r--r-- | network/rss2email/rss2email.SlackBuild | 94 | ||||
-rw-r--r-- | network/rss2email/rss2email.info | 10 | ||||
-rw-r--r-- | network/rss2email/slack-desc | 19 |
5 files changed, 370 insertions, 0 deletions
diff --git a/network/rss2email/4b36e28.patch b/network/rss2email/4b36e28.patch new file mode 100644 index 0000000000..5b6a050c7e --- /dev/null +++ b/network/rss2email/4b36e28.patch @@ -0,0 +1,239 @@ +diff -Naur orig/CHANGELOG new/CHANGELOG +--- orig/CHANGELOG 2020-08-31 18:03:24.000000000 +0300 ++++ new/CHANGELOG 2020-09-05 16:09:45.000000000 +0300 +@@ -1,4 +1,7 @@ + UNRELEASED ++ * Improve log messages ++ * Remove documentation of `smtp-ssl-protocol` as this option was dropped in 2016 ++ * Stop forging SMTP and sendmail envelope sender (#134) + + v3.12.2 (2020-08-31) + * Fix bug `AttributeError: 'NoneType' object has no attribute 'close'` (#126) +diff -Naur orig/r2e.1 new/r2e.1 +--- orig/r2e.1 2020-08-31 18:03:24.000000000 +0300 ++++ new/r2e.1 2020-09-05 16:09:45.000000000 +0300 +@@ -253,8 +253,6 @@ + SMTP server + .IP smtp-ssl + Connect to the SMTP server using SSL +-.IP smtp-ssl-protocol +-TLS/SSL version to use on STARTTLS when not using 'smtp-ssl'. + .RE + .SS IMAP configuration + .IP imap-auth +diff -Naur orig/rss2email/__init__.py new/rss2email/__init__.py +--- orig/rss2email/__init__.py 2020-08-31 18:03:24.000000000 +0300 ++++ new/rss2email/__init__.py 2020-09-05 16:09:45.000000000 +0300 +@@ -26,7 +26,7 @@ + import sys as _sys + + +-__version__ = '3.12.2' ++__version__ = '3.12.1' + __url__ = 'https://github.com/rss2email/rss2email' + __author__ = 'The rss2email maintainers' + __email__ = 'rss2email@tremily.us' +diff -Naur orig/rss2email/config.py new/rss2email/config.py +--- orig/rss2email/config.py 2020-08-31 18:03:24.000000000 +0300 ++++ new/rss2email/config.py 2020-09-05 16:09:45.000000000 +0300 +@@ -83,11 +83,11 @@ + # Transfer-Encoding. For local mailing it is safe and + # convenient to use 8bit. + ('use-8bit', str(False)), +- # True: Only use the 'from' address. ++ # True: Only use the 'from' address. Overrides the use-publisher-email setting. + # False: Use the email address specified by the feed, when possible. + ('force-from', str(False)), +- # True: Use the publisher's email if you can't find the author's. +- # False: Just use the 'from' email instead. ++ # True: Use author's email if found, or use publisher's email if found, or use the 'from' setting. ++ # False: Use author's email if found, or use the 'from' setting. + ('use-publisher-email', str(False)), + # If empty, only use the feed email address rather than + # friendly name plus email address. Available attributes may +@@ -132,7 +132,7 @@ + # because the old entries will not be recorded under their new + # link-based ids. + ('trust-link', str(False)), +- # If 'trust-guid' or 'trust-link' is True, this settings allows to receive ++ # If 'trust-guid' or 'trust-link' is True, this setting allows to receive + # a new email message in reply to the previous one when the post changes. + ('reply-changes', str(False)), + # To most correctly encode emails with international +diff -Naur orig/rss2email/email.py new/rss2email/email.py +--- orig/rss2email/email.py 2020-08-31 18:03:24.000000000 +0300 ++++ new/rss2email/email.py 2020-09-05 16:09:45.000000000 +0300 +@@ -151,7 +151,7 @@ + message[key] = _Header(value, encoding) + return message + +-def smtp_send(sender, recipient, message, config=None, section='DEFAULT'): ++def smtp_send(recipient, message, config=None, section='DEFAULT'): + if config is None: + config = _config.CONFIG + server = config.get(section, 'smtp-server') +@@ -190,7 +190,7 @@ + except Exception as e: + raise _error.SMTPAuthenticationError( + server=server, username=username) +- smtp.send_message(message, sender, recipient.split(',')) ++ smtp.send_message(message, config.get(section, 'from'), recipient.split(',')) + smtp.quit() + + def imap_send(message, config=None, section='DEFAULT'): +@@ -345,12 +345,12 @@ + else: + return bytesio.getvalue() + +-def sendmail_send(sender, recipient, message, config=None, section='DEFAULT'): ++def sendmail_send(recipient, message, config=None, section='DEFAULT'): + if config is None: + config = _config.CONFIG + message_bytes = _flatten(message) + sendmail = config.get(section, 'sendmail') +- sender_name,sender_addr = _parseaddr(sender) ++ sender_name,sender_addr = _parseaddr(config.get(section, 'from')) + _LOG.debug( + 'sending message to {} via {}'.format(recipient, sendmail)) + try: +@@ -366,11 +366,11 @@ + except Exception as e: + raise _error.SendmailError() from e + +-def send(sender, recipient, message, config=None, section='DEFAULT'): ++def send(recipient, message, config=None, section='DEFAULT'): + protocol = config.get(section, 'email-protocol') + if protocol == 'smtp': + smtp_send( +- sender=sender, recipient=recipient, message=message, ++ recipient=recipient, message=message, + config=config, section=section) + elif protocol == 'imap': + imap_send(message=message, config=config, section=section) +@@ -378,5 +378,5 @@ + maildir_send(message=message, config=config, section=section) + else: + sendmail_send( +- sender=sender, recipient=recipient, message=message, ++ recipient=recipient, message=message, + config=config, section=section) +diff -Naur orig/rss2email/error.py new/rss2email/error.py +--- orig/rss2email/error.py 2020-08-31 18:03:24.000000000 +0300 ++++ new/rss2email/error.py 2020-09-05 16:09:45.000000000 +0300 +@@ -42,15 +42,14 @@ + + + class TimeoutError (RSS2EmailError): +- def __init__(self, time_limited_function, message=None): +- if message is None: +- if time_limited_function.error is not None: +- message = ( +- 'error while running time limited function: {}'.format( +- time_limited_function.error[1])) +- else: +- message = '{} second timeout exceeded'.format( +- time_limited_function.timeout) ++ def __init__(self, time_limited_function): ++ if time_limited_function.error is not None: ++ message = ( ++ 'error while running time limited function in {}: {}'.format( ++ time_limited_function.name, time_limited_function.error[1])) ++ else: ++ message = '{} second timeout exceeded in {}'.format( ++ time_limited_function.timeout, time_limited_function.name) + super(TimeoutError, self).__init__(message=message) + self.time_limited_function = time_limited_function + +@@ -148,8 +147,9 @@ + class InvalidFeedConfig (FeedError): + def __init__(self, setting, feed, message=None, **kwargs): + if not message: +- message = "invalid feed configuration {}".format( +- {setting: getattr(feed, setting)}) ++ message = ( ++ "invalid feed configuration '{setting}' in {feed}".format( ++ setting=getattr(feed, setting), feed=feed)) + super(InvalidFeedConfig, self).__init__( + feed=feed, message=message, **kwargs) + self.setting = setting +diff -Naur orig/rss2email/feed.py new/rss2email/feed.py +--- orig/rss2email/feed.py 2020-08-31 18:03:24.000000000 +0300 ++++ new/rss2email/feed.py 2020-09-05 16:09:45.000000000 +0300 +@@ -373,7 +373,7 @@ + kwargs = {} + if proxy: + kwargs['handlers'] = [_urllib_request.ProxyHandler({'http':proxy})] +- f = _util.TimeLimitedFunction(timeout, _feedparser.parse) ++ f = _util.TimeLimitedFunction('feed {}'.format(self.name), timeout, _feedparser.parse) + return f(self.url, self.etag, modified=self.modified, **kwargs) + + def _process(self, parsed): +@@ -773,9 +773,9 @@ + if entry.get('summary_detail', None): + contents.append(entry.summary_detail) + if self.html_mail: +- types = ['text/html', 'text/plain'] ++ types = ['application/xhtml+xml', 'text/html', 'text/plain'] + else: +- types = ['text/plain', 'text/html'] ++ types = ['text/plain', 'text/html', 'application/xhtml+xml'] + for content_type in types: + for content in contents: + if content['type'] == content_type: +@@ -871,7 +871,7 @@ + section = self.section + if section not in self.config: + section = 'DEFAULT' +- _email.send(sender=sender, recipient=self.to, message=message, ++ _email.send(recipient=self.to, message=message, + config=self.config, section=section) + + def run(self, send=True): +diff -Naur orig/rss2email/feeds.py new/rss2email/feeds.py +--- orig/rss2email/feeds.py 2020-08-31 18:03:24.000000000 +0300 ++++ new/rss2email/feeds.py 2020-09-05 16:09:45.000000000 +0300 +@@ -239,11 +239,10 @@ + def load(self, require=False): + _LOG.debug('load feed configuration from {}'.format(self.configfiles)) + if self.configfiles: +- self.read_configfiles = self.config.read(self.configfiles) ++ read_configfiles = self.config.read(self.configfiles) + else: +- self.read_configfiles = [] +- _LOG.debug('loaded configuration from {}'.format( +- self.read_configfiles)) ++ read_configfiles = [] ++ _LOG.debug('loaded configuration from {}'.format(read_configfiles)) + self._load_feeds(require=require) + + def _load_feeds(self, require): +diff -Naur orig/rss2email/util.py new/rss2email/util.py +--- orig/rss2email/util.py 2020-08-31 18:03:24.000000000 +0300 ++++ new/rss2email/util.py 2020-09-05 16:09:45.000000000 +0300 +@@ -35,19 +35,20 @@ + >>> def sleeping_return(sleep, x): + ... time.sleep(sleep) + ... return x +- >>> TimeLimitedFunction(0.5, sleeping_return)(0.1, 'x') ++ >>> TimeLimitedFunction('sleeping', 0.5, sleeping_return)(0.1, 'x') + 'x' +- >>> TimeLimitedFunction(0.5, sleeping_return)(10, 'y') ++ >>> TimeLimitedFunction('sleeping', 0.5, sleeping_return)(10, 'y') + Traceback (most recent call last): + ... +- rss2email.error.TimeoutError: 0.5 second timeout exceeded +- >>> TimeLimitedFunction(0.5, time.sleep)('x') ++ rss2email.error.TimeoutError: 0.5 second timeout exceeded in sleeping ++ >>> TimeLimitedFunction('sleep', 0.5, time.sleep)('x') + Traceback (most recent call last): + ... +- rss2email.error.TimeoutError: error while running time limited function: a float is required ++ rss2email.error.TimeoutError: error while running time limited function in sleep: a float is required + """ +- def __init__(self, timeout, target, **kwargs): ++ def __init__(self, name, timeout, target, **kwargs): + super(TimeLimitedFunction, self).__init__(target=target, daemon=True, **kwargs) ++ self.name = name + self.timeout = timeout + self.result = None + self.error = None diff --git a/network/rss2email/README b/network/rss2email/README new file mode 100644 index 0000000000..cdc9dd0f20 --- /dev/null +++ b/network/rss2email/README @@ -0,0 +1,8 @@ +A python script that converts RSS/Atom newsfeeds to email. + +It is the successor to the rss2email by Aaron Swartz, available on SBo +as r2e. + +rss2email requires feedparser to be built with python3 support. + +rss2email will conflict with r2e. diff --git a/network/rss2email/rss2email.SlackBuild b/network/rss2email/rss2email.SlackBuild new file mode 100644 index 0000000000..f6e181b909 --- /dev/null +++ b/network/rss2email/rss2email.SlackBuild @@ -0,0 +1,94 @@ +#!/bin/sh + +# Slackware build script for rss2email + +# Copyright 2020, Alexander Verbovetsky, Moscow, Russia +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 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=rss2email +VERSION=${VERSION:-3.12.2} # Don't forget to remove the patch below!!! +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION + +# For ver. 3.12.2 only +patch -p1 < $CWD/4b36e28.patch + +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +python3 setup.py install --root=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/man/man1 +gzip -c9 r2e.1 > $PKG/usr/man/man1/r2e.1.gz + +install -m 0644 -T -D completion/r2e.zsh $PKG/usr/share/zsh/site-functions/_r2e + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AUTHORS CHANGELOG HACKING.md README.rst $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/rss2email/rss2email.info b/network/rss2email/rss2email.info new file mode 100644 index 0000000000..1b46bee487 --- /dev/null +++ b/network/rss2email/rss2email.info @@ -0,0 +1,10 @@ +PRGNAM="rss2email" +VERSION="3.12.2" +HOMEPAGE="https://github.com/rss2email/rss2email" +DOWNLOAD="https://github.com/rss2email/rss2email/archive/v3.12.2/rss2email-3.12.2.tar.gz" +MD5SUM="9975f0c0f637daaa025d09ae54c33a8c" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="python3 feedparser html2text" +MAINTAINER="Alexander Verbovetsky" +EMAIL="alik@ejik.org" diff --git a/network/rss2email/slack-desc b/network/rss2email/slack-desc new file mode 100644 index 0000000000..9c4d4fb883 --- /dev/null +++ b/network/rss2email/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +rss2email: rss2email (rss to email gateway) +rss2email: +rss2email: A python script that converts RSS/Atom newsfeeds to email. +rss2email: +rss2email: +rss2email: +rss2email: Homepage: https://github.com/rss2email/rss2email +rss2email: +rss2email: +rss2email: +rss2email: |