Hello community, here is the log from the commit of package urlwatch for openSUSE:Factory checked in at 2018-04-01 17:27:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/urlwatch (Old) and /work/SRC/openSUSE:Factory/.urlwatch.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "urlwatch" Sun Apr 1 17:27:47 2018 rev:8 rq:592807 version:2.9 Changes: -------- --- /work/SRC/openSUSE:Factory/urlwatch/urlwatch.changes 2018-02-02 22:21:49.299165623 +0100 +++ /work/SRC/openSUSE:Factory/.urlwatch.new/urlwatch.changes 2018-04-01 17:27:50.488663884 +0200 @@ -1,0 +2,9 @@ +Mon Mar 26 06:48:01 UTC 2018 - kbabioch@suse.com + +- Update to 2.9: + * Pushover: Device and sound attribute + * XDG: Move cache file to XDG_CACHE_DIR + * E-Mail: Add support for --smtp-login and document GMail SMTP usage + * Unconditionally migrate urlwatch 1.x cache dirs + +------------------------------------------------------------------- Old: ---- urlwatch-2.8.tar.gz New: ---- urlwatch-2.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ urlwatch.spec ++++++ --- /var/tmp/diff_new_pack.Ttcqa8/_old 2018-04-01 17:27:51.156639708 +0200 +++ /var/tmp/diff_new_pack.Ttcqa8/_new 2018-04-01 17:27:51.160639563 +0200 @@ -17,7 +17,7 @@ Name: urlwatch -Version: 2.8 +Version: 2.9 Release: 0 Summary: A tool for monitoring webpages for updates License: BSD-3-Clause ++++++ urlwatch-2.8.tar.gz -> urlwatch-2.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/.travis.yml new/urlwatch-2.9/.travis.yml --- old/urlwatch-2.8/.travis.yml 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/.travis.yml 2018-03-24 13:18:25.000000000 +0100 @@ -3,7 +3,6 @@ - "3.4" - "3.5" - "3.6" - - "nightly" install: - pip install pyyaml minidb requests keyring pycodestyle appdirs script: nosetests -v diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/ChangeLog new/urlwatch-2.9/ChangeLog --- old/urlwatch-2.8/ChangeLog 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/ChangeLog 2018-03-24 13:18:25.000000000 +0100 @@ -219,3 +219,10 @@ * SMTP: Fix handling of missing user field (by e-dschungel) * Manpage: Fix documentation of XDG environment variables (by Jelle van der Waa) * Unit tests: Fix imports for out-of-source-tree tests (by Maxime Werlen) + +2018-03-24 Thomas Perl <m@thp.io> + * Pushover: Device and sound attribute (by Tobias Haupenthal) + * XDG: Move cache file to XDG_CACHE_DIR (by Maxime Werlen) + * E-Mail: Add support for --smtp-login and document GMail SMTP usage + * Cleanups: Fix out-of-date debug message, use https (by Jakub Wilk) + * Migration: Unconditionally migrate urlwatch 1.x cache dirs (Fixes #206) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/README.md new/urlwatch-2.9/README.md --- old/urlwatch-2.8/README.md 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/README.md 2018-03-24 13:18:25.000000000 +0100 @@ -102,7 +102,7 @@ filters, here 3 filters are used: html2text, line-grep and whitespace removal to get just a certain info field from a webpage: ```yaml -url: http://thp.io/2008/urlwatch/ +url: https://thp.io/2008/urlwatch/ filter: html2text,grep:Current.*version,strip ``` For most cases, this means that you can specify a filter chain in @@ -111,7 +111,7 @@ If you want to extract only the body tag you can use this filer: ```yaml -url: http://thp.io/2008/urlwatch/ +url: https://thp.io/2008/urlwatch/ filter: element-by-tag:body ``` @@ -146,9 +146,38 @@ enabled: true ``` + +E-MAIL VIA GMAIL SMTP +--------------------- + +You need to configure your GMail account to allow for "less secure" (password-based) +apps to login: + +1. Go to https://myaccount.google.com/ +2. Click on "Sign-in & security" +3. Scroll all the way down to "Allow less secure apps" and enable it + +Now, start the configuration editor: `urlwatch --edit-config` + +These are the keys you need to configure (see #158): + +- `report/email/enabled`: `true` +- `report/email/from`: `your.username@gmail.com` (edit accordingly) +- `report/email/method`: `smtp` +- `report/email/smtp/host`: `smtp.gmail.com` +- `report/email/smtp/keyring`: `true` +- `report/email/smtp/port`: `587` +- `report/email/smtp/starttls`: `true` +- `report/email/to`: The e-mail address you want to send reports to + +Now, for setting the password, it's not stored in the config file, but in your +keychain. To store the password, run: `urlwatch --smtp-login` and enter your +password. + + CONTACT ------- -Website: http://thp.io/2008/urlwatch/ +Website: https://thp.io/2008/urlwatch/ E-Mail: m@thp.io diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/__init__.py new/urlwatch-2.9/lib/urlwatch/__init__.py --- old/urlwatch-2.8/lib/urlwatch/__init__.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/__init__.py 2018-03-24 13:18:25.000000000 +0100 @@ -11,6 +11,6 @@ __copyright__ = 'Copyright 2008-2018 Thomas Perl' __author__ = 'Thomas Perl <m@thp.io>' __license__ = 'BSD' -__url__ = 'http://thp.io/2008/urlwatch/' -__version__ = '2.8' -__user_agent__ = '%s/%s (+http://thp.io/2008/urlwatch/info.html)' % (pkgname, __version__) +__url__ = 'https://thp.io/2008/urlwatch/' +__version__ = '2.9' +__user_agent__ = '%s/%s (+https://thp.io/2008/urlwatch/info.html)' % (pkgname, __version__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/command.py new/urlwatch-2.9/lib/urlwatch/command.py --- old/urlwatch-2.8/lib/urlwatch/command.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/command.py 2018-03-24 13:18:25.000000000 +0100 @@ -39,6 +39,7 @@ from .jobs import JobBase from .reporters import ReporterBase from .util import atomic_rename +from .mailer import set_password, have_password logger = logging.getLogger(__name__) @@ -159,9 +160,53 @@ if self.urlwatch_config.edit_config: sys.exit(self.urlwatcher.config_storage.edit()) - def run(self): + def check_smtp_login(self): + if self.urlwatch_config.smtp_login: + config = self.urlwatcher.config_storage.config['report']['email'] + smtp_config = config['smtp'] + + success = True + + if not config['enabled']: + print('Please enable e-mail reporting in the config first.') + success = False + + if config['method'] != 'smtp': + print('Please set the method to SMTP for the e-mail reporter.') + success = False + + if not smtp_config['keyring']: + print('Keyring authentication must be enabled for SMTP.') + success = False + + smtp_hostname = smtp_config['host'] + if not smtp_hostname: + print('Please configure the SMTP hostname in the config first.') + success = False + + smtp_username = smtp_config.get('user', config['from']) + if not smtp_username: + print('Please configure the SMTP username in the config first.') + success = False + + if not success: + sys.exit(1) + + if have_password(smtp_hostname, smtp_username): + message = 'Password for %s / %s already set, update? [y/N] ' % (smtp_username, smtp_hostname) + if input(message).lower() != 'y': + print('Password unchanged.') + sys.exit(0) + + if success: + set_password(smtp_hostname, smtp_username) + # TODO: Actually verify that the login to the server works + + sys.exit(0) + def run(self): self.check_edit_config() + self.check_smtp_login() self.handle_actions() self.urlwatcher.run_jobs() self.urlwatcher.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/config.py new/urlwatch-2.9/lib/urlwatch/config.py --- old/urlwatch-2.8/lib/urlwatch/config.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/config.py 2018-03-24 13:18:25.000000000 +0100 @@ -87,6 +87,9 @@ group.add_argument('--cache', metavar='FILE', help='use FILE as cache database', default=self.cache) + group = parser.add_argument_group('Authentication') + group.add_argument('--smtp-login', action='store_true', help='Enter password for SMTP (store in keyring)') + group = parser.add_argument_group('job list management') group.add_argument('--list', action='store_true', help='list jobs') group.add_argument('--add', metavar='JOB', help='add job (key1=value1,key2=value2,...)') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/mailer.py new/urlwatch-2.9/lib/urlwatch/mailer.py --- old/urlwatch-2.8/lib/urlwatch/mailer.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/mailer.py 2018-03-24 13:18:25.000000000 +0100 @@ -110,6 +110,10 @@ logger.error('Sendmail failed with {result}'.format(result=result)) +def have_password(smtp_server, from_email): + return keyring.get_password(smtp_server, from_email) is not None + + def set_password(smtp_server, from_email): ''' Set the keyring password for the mail connection. Interactive.''' if keyring is None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/main.py new/urlwatch-2.9/lib/urlwatch/main.py --- old/urlwatch-2.8/lib/urlwatch/main.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/main.py 2018-03-24 13:18:25.000000000 +0100 @@ -45,7 +45,7 @@ logger.info('Using %s as URLs file', self.urlwatch_config.urls) logger.info('Using %s for hooks', self.urlwatch_config.hooks) - logger.info('Using %s as cache directory', self.urlwatch_config.cache) + logger.info('Using %s as cache database', self.urlwatch_config.cache) self.config_storage = config_storage self.cache_storage = cache_storage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/migration.py new/urlwatch-2.9/lib/urlwatch/migration.py --- old/urlwatch-2.8/lib/urlwatch/migration.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/migration.py 2018-03-24 13:18:25.000000000 +0100 @@ -71,7 +71,7 @@ cache = urlwatch_config.cache cache_dir = os.path.join(urlwatch_config.urlwatch_dir, 'cache') - if not os.path.isfile(cache) and os.path.isdir(cache_dir): + if os.path.isdir(cache_dir): print(""" Migrating cache: {cache_dir} -> {cache_db} """.format(cache_dir=cache_dir, cache_db=cache)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/reporters.py new/urlwatch-2.9/lib/urlwatch/reporters.py --- old/urlwatch-2.8/lib/urlwatch/reporters.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/reporters.py 2018-03-24 13:18:25.000000000 +0100 @@ -351,8 +351,6 @@ else: logger.error('Invalid entry for method {method}'.format(method=self.config['method'])) - # TODO set_password(options.email_smtp, options.email_from) - if self.config['html']: body_html = '\n'.join(self.convert(HtmlReporter).submit()) @@ -402,7 +400,9 @@ return app.get_user(self.config['user']) def web_service_submit(self, service, title, body): - msg = service.create_message(title=title, message=body, html=True, sound='spacealarm') + sound = self.config['sound'] + device = self.config['device'] + msg = service.create_message(title=title, message=body, html=True, sound=sound, device=device) msg.send() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/lib/urlwatch/storage.py new/urlwatch-2.9/lib/urlwatch/storage.py --- old/urlwatch-2.8/lib/urlwatch/storage.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/lib/urlwatch/storage.py 2018-03-24 13:18:25.000000000 +0100 @@ -92,6 +92,8 @@ 'pushover': { 'enabled': False, 'app': '', + 'device': '', + 'sound': 'spacealarm', 'user': '', }, 'pushbullet': { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/setup.py new/urlwatch-2.9/setup.py --- old/urlwatch-2.8/setup.py 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/setup.py 2018-03-24 13:18:25.000000000 +0100 @@ -25,4 +25,5 @@ ]), ] +del m['copyright'] setup(**m) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/share/man/man1/urlwatch.1 new/urlwatch-2.9/share/man/man1/urlwatch.1 --- old/urlwatch-2.8/share/man/man1/urlwatch.1 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/share/man/man1/urlwatch.1 2018-03-24 13:18:25.000000000 +0100 @@ -77,9 +77,9 @@ .B $XDG_CONFIG_HOME/urlwatch/hooks.py A Python module that can implement new job types, filters and reporters .TP -.B $XDG_CONFIG_HOME/urlwatch/cache.db +.B $XDG_CACHE_HOME/urlwatch/cache.db A SQLite 3 database that contains the state history of jobs (for diffing) .SH AUTHOR Thomas Perl <thp.io/about> .SH WEBSITE -http://thp.io/2008/urlwatch/ +https://thp.io/2008/urlwatch/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/test/data/urlwatch.yaml new/urlwatch-2.9/test/data/urlwatch.yaml --- old/urlwatch-2.8/test/data/urlwatch.yaml 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/test/data/urlwatch.yaml 2018-03-24 13:18:25.000000000 +0100 @@ -21,7 +21,9 @@ diff: unified pushover: app: '' + device: '' enabled: false + sound: 'spacealarm' user: '' stdout: color: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/urlwatch-2.8/urlwatch new/urlwatch-2.9/urlwatch --- old/urlwatch-2.8/urlwatch 2018-01-28 20:48:05.000000000 +0100 +++ new/urlwatch-2.9/urlwatch 2018-03-24 13:18:25.000000000 +0100 @@ -40,6 +40,7 @@ pkgname = 'urlwatch' urlwatch_dir = os.path.expanduser(os.path.join('~', '.' + pkgname)) +urlwatch_cache_dir = AppDirs(pkgname).user_cache_dir if not os.path.exists(urlwatch_dir): urlwatch_dir = AppDirs(pkgname).user_config_dir @@ -86,8 +87,12 @@ if __name__ == '__main__': config_file = os.path.join(urlwatch_dir, CONFIG_FILE) urls_file = os.path.join(urlwatch_dir, URLS_FILE) - cache_file = os.path.join(urlwatch_dir, CACHE_FILE) hooks_file = os.path.join(urlwatch_dir, HOOKS_FILE) + new_cache_file = os.path.join(urlwatch_cache_dir, CACHE_FILE) + old_cache_file = os.path.join(urlwatch_dir, CACHE_FILE) + cache_file = new_cache_file + if os.path.exists(old_cache_file) and not os.path.exists(new_cache_file): + cache_file = old_cache_file command_config = CommandConfig(pkgname, urlwatch_dir, bindir, prefix, config_file, urls_file, hooks_file, cache_file, False)