commit crudini for openSUSE:Factory
Hello community, here is the log from the commit of package crudini for openSUSE:Factory checked in at 2017-08-24 18:56:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/crudini (Old) and /work/SRC/openSUSE:Factory/.crudini.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "crudini" Thu Aug 24 18:56:41 2017 rev:7 rq:518536 version:0.9 Changes: -------- --- /work/SRC/openSUSE:Factory/crudini/crudini.changes 2016-12-10 18:29:05.794528618 +0100 +++ /work/SRC/openSUSE:Factory/.crudini.new/crudini.changes 2017-08-24 18:56:55.327206733 +0200 @@ -1,0 +2,11 @@ +Thu Aug 24 13:22:03 UTC 2017 - tbechtold@suse.com + +- update to 0.9: + * Write errors to stdout are diagnosed correctly and consistently. + * Replacing symlinks now replaces the target rather than the symlink itself. + * The case of parameters is maintained with --get. + * Single token parameters (without equals) are now supported, + which are used in mysql config for example. +- Drop 3c52bd938975f7c5b32d7009f109ccbd2328c16d.patch . Applied upstream. + +------------------------------------------------------------------- Old: ---- 3c52bd938975f7c5b32d7009f109ccbd2328c16d.patch crudini-0.8.tar.gz New: ---- crudini-0.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ crudini.spec ++++++ --- /var/tmp/diff_new_pack.k6Omla/_old 2017-08-24 18:56:56.127094103 +0200 +++ /var/tmp/diff_new_pack.k6Omla/_new 2017-08-24 18:56:56.135092977 +0200 @@ -1,7 +1,7 @@ # # spec file for package crudini # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,15 +17,13 @@ Name: crudini -Version: 0.8 +Version: 0.9 Release: 0 Summary: CRUD for .ini files License: GPL-2.0 Group: System/Base Url: https://github.com/pixelb/crudini/releases Source: %{name}-%{version}.tar.gz -# PATCH-FIX-UPSTREAM 3c52bd938975f7c5b32d7009f109ccbd2328c16d.patch -- https://github.com/pixelb/crudini/commit/3c52bd938975f7c5b32d7009f109ccbd232... -Patch1: 3c52bd938975f7c5b32d7009f109ccbd2328c16d.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Requires: python-iniparse @@ -34,7 +32,6 @@ %prep %setup -q -%patch1 -p1 %build ++++++ crudini-0.8.tar.gz -> crudini-0.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/Makefile new/crudini-0.9/Makefile --- old/crudini-0.8/Makefile 2016-11-23 22:04:49.000000000 +0100 +++ new/crudini-0.9/Makefile 2016-12-13 21:15:02.000000000 +0100 @@ -1,5 +1,5 @@ name = crudini -version = 0.8 +version = 0.9 all: help2man -n "manipulate ini files" -o crudini.1 -N ./crudini-help diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/NEWS new/crudini-0.9/NEWS --- old/crudini-0.8/NEWS 2016-11-23 22:10:30.000000000 +0100 +++ new/crudini-0.9/NEWS 2016-12-13 21:14:15.000000000 +0100 @@ -1,5 +1,23 @@ crudini NEWS -*- outline -*- +* Noteworthy changes in release 0.9 (2016-12-13) + +** Bug fixes + + Write errors to stdout are diagnosed correctly and consistently. + + Replacing symlinks now replaces the target rather than the symlink itself. + +** Changes in behavior + + The case of parameters is maintained with --get. + +** Improvements + + Single token parameters (without equals) are now supported, + which are used in mysql config for example. + + * Noteworthy changes in release 0.8 (2016-11-23) ** Bug fixes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/TODO new/crudini-0.9/TODO --- old/crudini-0.8/TODO 2015-02-06 14:26:13.000000000 +0100 +++ new/crudini-0.9/TODO 2016-12-13 13:27:00.000000000 +0100 @@ -1,5 +1,3 @@ -support variables without = - support --set,--merge of #commented name=value with operation controlled with --with-comment=always diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/crudini new/crudini-0.9/crudini --- old/crudini-0.8/crudini 2016-11-23 22:08:16.000000000 +0100 +++ new/crudini-0.9/crudini 2016-12-13 21:14:56.000000000 +0100 @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- # vim:fileencoding=utf8 # -# Copyright (C) 2013-2015, Pádraig Brady <P@draigBrady.com> +# Copyright © Pádraig Brady <P@draigBrady.com> # # This program is free software; you can redistribute it and/or modify it # under the terms of the GPLv2, the GNU General Public License version 2, as @@ -40,11 +40,29 @@ raise +# TODO: support configurable options for various ini variants. +# For now just support parameters without '=' specified +class CrudiniInputFilter(): + def __init__(self, fp): + self.fp = fp + self.crudini_no_arg = False + + def readline(self): + line = self.fp.readline() + # XXX: This doesn't handle ;inline comments. + # Really should be done within inparse. + if (line and line[0] not in '[ \t#;\n' + and '=' not in line and ':' not in line): + self.crudini_no_arg = True + line = line[:-1] + ' = crudini_no_arg\n' + return line + + # XXX: should be done in iniparse. Used to # add support for ini files without a section -class AddDefaultSection(): +class AddDefaultSection(CrudiniInputFilter): def __init__(self, fp): - self.fp = fp + CrudiniInputFilter.__init__(self, fp) self.first = True def readline(self): @@ -52,7 +70,7 @@ self.first = False return '[%s]' % iniparse.DEFAULTSECT else: - return self.fp.readline() + return CrudiniInputFilter.readline(self) class FileLock(object): @@ -205,6 +223,8 @@ :param section: str (default 'None') """ + if value == 'crudini_no_arg': + value = '' print name or value @@ -215,6 +235,8 @@ print "[%s]" % section def name_value(self, name, value, section=None): + if value == 'crudini_no_arg': + value = '' print name, '=', value.replace('\n', '\n ') @@ -230,6 +252,8 @@ line += ' ' if name: line += '%s' % name + if value == 'crudini_no_arg': + value = '' if value: line += ' = %s' % value.replace('\n', '\\n') print line @@ -263,6 +287,8 @@ if not PrintSh._valid_sh_identifier(name): error('Invalid sh identifier: %s' % name) sys.exit(1) + if value == 'crudini_no_arg': + value = '' sys.stdout.write("%s=%s\n" % (name, pipes.quote(value))) @@ -474,7 +500,7 @@ if o in ('--help',): self.usage(0) elif o in ('--version',): - print 'crudini 0.8' + print 'crudini 0.9' sys.exit(0) elif o in ('--verbose',): self.verbose = True @@ -590,9 +616,12 @@ fp = StringIO(self.data) if add_default: fp = AddDefaultSection(fp) + else: + fp = CrudiniInputFilter(fp) conf = CrudiniConfigParser(preserve_case=preserve_case) conf.readfp(fp) + self.crudini_no_arg = fp.crudini_no_arg return conf except EnvironmentError as e: error(str(e)) @@ -674,7 +703,7 @@ if self.mode == "--del": return if value is None: - value = '' + value = 'crudini_no_arg' if self.crudini_no_arg else '' if self.vlist: value = self.update_list( curr_val, @@ -817,21 +846,25 @@ self.madded_default_section = self.added_default_section try: - self.conf = self.parse_file(self.cfgfile) - except ConfigParser.ParsingError as e: - error('Error parsing %s: %s' % (self.cfgfile, e.message)) - sys.exit(1) + if self.mode == '--get' and self.param is None: + # Maintain case when outputting params. + # Note sections are handled case sensitively + # even if optionxform is not set. + preserve_case = True + else: + preserve_case = False + self.conf = self.parse_file(self.cfgfile, + preserve_case=preserve_case) - # Take the [DEFAULT] header from the input if present - if ( - self.mode == '--merge' and - self.update not in ('param', 'section') and - not self.madded_default_section and - self.mconf.items(iniparse.DEFAULTSECT) - ): - self.added_default_section = self.madded_default_section + # Take the [DEFAULT] header from the input if present + if ( + self.mode == '--merge' and + self.update not in ('param', 'section') and + not self.madded_default_section and + self.mconf.items(iniparse.DEFAULTSECT) + ): + self.added_default_section = self.madded_default_section - try: if self.mode == '--set': self.command_set() elif self.mode == '--merge': @@ -840,45 +873,46 @@ self.command_del() elif self.mode == '--get': self.command_get() - except ConfigParser.NoSectionError as e: - error('Section not found: %s' % e.section) - sys.exit(1) - except ConfigParser.NoOptionError: - error('Parameter not found: %s' % self.param) - sys.exit(1) - if self.mode != '--get': - # XXX: Ideally we should just do conf.write(f) here, - # but to avoid iniparse issues, we massage the data a little here - str_data = str(self.conf.data) - if len(str_data) and str_data[-1] != '\n': - str_data += '\n' - - if ( - ( - self.added_default_section and - not ( - self.section_explicit_default and - self.mode in ('--set', '--merge') + if self.mode != '--get': + # XXX: Ideally we should just do conf.write(f) here, but to + # avoid iniparse issues, we massage the data a little here + str_data = str(self.conf.data) + if len(str_data) and str_data[-1] != '\n': + str_data += '\n' + + if ( + ( + self.added_default_section and + not ( + self.section_explicit_default and + self.mode in ('--set', '--merge') + ) + ) or + ( + self.mode == '--del' and + self.section == iniparse.DEFAULTSECT and + self.param is None ) - ) or - ( - self.mode == '--del' and - self.section == iniparse.DEFAULTSECT and - self.param is None - ) - ): - # See note at add_section() call above detailing - # where this extra \n comes from that we handle - # here for the edge case of new files. - default_sect = '[%s]\n' % iniparse.DEFAULTSECT - if not self.newline_at_start and \ - str_data.startswith(default_sect + '\n'): - str_data = str_data[len(default_sect) + 1:] - else: - str_data = str_data.replace(default_sect, '', 1) + ): + # See note at add_section() call above detailing + # where this extra \n comes from that we handle + # here for the edge case of new files. + default_sect = '[%s]\n' % iniparse.DEFAULTSECT + if not self.newline_at_start and \ + str_data.startswith(default_sect + '\n'): + str_data = str_data[len(default_sect) + 1:] + else: + str_data = str_data.replace(default_sect, '', 1) + + if self.crudini_no_arg: + # This is the main case + str_data = str_data.replace(' = crudini_no_arg', '') + # Handle setting empty values for existing param= format + str_data = str_data.replace('=crudini_no_arg', '=') + # Handle setting empty values for existing colon: format + str_data = str_data.replace(':crudini_no_arg', ':') - try: changed = self.chksum != self._chksum(str_data) if self.output == '-': @@ -887,7 +921,8 @@ if self.inplace: self.file_rewrite(self.output, str_data) else: - self.file_replace(self.output, str_data) + self.file_replace(os.path.realpath(self.output), + str_data) if self.verbose: def quote_val(val): @@ -899,7 +934,22 @@ self.value]))) sys.stderr.write('%s: %s\n' % (('unchanged', 'changed')[changed], what)) - except EnvironmentError as e: + + # Finish writing now to consistently handle errors here + # (and while excepthook is set) + sys.stdout.flush() + except ConfigParser.ParsingError as e: + error('Error parsing %s: %s' % (self.cfgfile, e.message)) + sys.exit(1) + except ConfigParser.NoSectionError as e: + error('Section not found: %s' % e.section) + sys.exit(1) + except ConfigParser.NoOptionError: + error('Parameter not found: %s' % self.param) + sys.exit(1) + except EnvironmentError as e: + # Handle EPIPE as python doesn't catch SIGPIPE + if e.errno != errno.EPIPE: error(str(e)) sys.exit(1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/crudini.1 new/crudini-0.9/crudini.1 --- old/crudini-0.8/crudini.1 2016-11-23 22:16:35.000000000 +0100 +++ new/crudini-0.9/crudini.1 2016-12-13 21:15:26.000000000 +0100 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.2. -.TH CRUDINI "1" "November 2016" "crudini 0.8" "User Commands" +.TH CRUDINI "1" "December 2016" "crudini 0.9" "User Commands" .SH NAME crudini \- manipulate ini files .SH SYNOPSIS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/noequals.ini new/crudini-0.9/noequals.ini --- old/crudini-0.8/noequals.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/crudini-0.9/noequals.ini 2016-12-13 14:21:50.000000000 +0100 @@ -0,0 +1,19 @@ +# Differences from mysql.conf +# #comments can't be at middle of line +# single/double quotes are not stripped +# leading spaces on line are not ignored + +!include directives treated as parameters + +[noequals] +param1 +param2= +param3 = +colon1: +colon2 : +space param +never #comment +not ;comment +multiline=val + spaceval + tabval diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/setup.py new/crudini-0.9/setup.py --- old/crudini-0.8/setup.py 2016-11-23 22:04:44.000000000 +0100 +++ new/crudini-0.9/setup.py 2016-12-13 21:14:47.000000000 +0100 @@ -9,7 +9,7 @@ setup( name="crudini", - version="0.8", + version="0.9", author="Pádraig Brady", author_email="P@draigBrady.com", description=("A utility for manipulating ini files"), @@ -24,6 +24,6 @@ "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Programming Language :: Python :: 2", ], - install_requires=['iniparse'], + install_requires=['iniparse>=0.3.2'], scripts=["crudini"] ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/tests/example.lines new/crudini-0.9/tests/example.lines --- old/crudini-0.8/tests/example.lines 2014-09-05 17:46:40.000000000 +0200 +++ new/crudini-0.9/tests/example.lines 2016-12-10 16:52:57.000000000 +0100 @@ -17,7 +17,7 @@ [ section1 ] empty [ section1 ] python_interpolate = %(dup1)s/blah [ section1 ] interpolate2 = ${dup1}/blah -[ section1 ] caps = not significant +[ section1 ] Caps = not significant [ section1 ] combine = sections [ empty section ] [ non-sh-compat ] space name = val diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/tests/section1.ini new/crudini-0.9/tests/section1.ini --- old/crudini-0.8/tests/section1.ini 2013-01-19 18:00:45.000000000 +0100 +++ new/crudini-0.9/tests/section1.ini 2016-12-10 16:51:43.000000000 +0100 @@ -19,5 +19,5 @@ empty = python_interpolate = %(dup1)s/blah interpolate2 = ${dup1}/blah -caps = not significant +Caps = not significant combine = sections diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/tests/section1.lines new/crudini-0.9/tests/section1.lines --- old/crudini-0.8/tests/section1.lines 2013-05-15 19:19:55.000000000 +0200 +++ new/crudini-0.9/tests/section1.lines 2016-12-10 16:52:30.000000000 +0100 @@ -16,5 +16,5 @@ [ section1 ] empty [ section1 ] python_interpolate = %(dup1)s/blah [ section1 ] interpolate2 = ${dup1}/blah -[ section1 ] caps = not significant +[ section1 ] Caps = not significant [ section1 ] combine = sections diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/tests/section1.sh new/crudini-0.9/tests/section1.sh --- old/crudini-0.8/tests/section1.sh 2013-01-19 18:01:04.000000000 +0100 +++ new/crudini-0.9/tests/section1.sh 2016-12-10 16:52:03.000000000 +0100 @@ -18,5 +18,5 @@ empty='' python_interpolate='%(dup1)s/blah' interpolate2='${dup1}/blah' -caps='not significant' +Caps='not significant' combine=sections diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/tests/test.sh new/crudini-0.9/tests/test.sh --- old/crudini-0.8/tests/test.sh 2016-11-23 21:58:58.000000000 +0100 +++ new/crudini-0.9/tests/test.sh 2016-12-13 14:21:22.000000000 +0100 @@ -1,7 +1,7 @@ #!/bin/bash trap "exit 130" INT -cleanup() { rm -f test.ini good.ini example.ini; exit; } +cleanup() { rm -f err noequals*.ini test.ini ltest.ini good.ini example.ini; exit; } trap cleanup EXIT export PATH=..:$PATH @@ -472,3 +472,30 @@ crudini --set file.conf '' option 2 || fail diff -u good.conf file.conf && ok || fail rm file.conf good.conf + +# ensure errors diagnosed correctly +crudini --get example.ini 2>err | : +! test -s err && ok || fail #EPIPE ignored +if test -e /dev/full; then +crudini --get example.ini 2>err >/dev/full +grep -q 'No space left' err && ok || fail +fi + +# ensure symlinks handled correctly in file replace mode +printf '%s\n' '[section]' 'param = value' > test.ini +ln -s test.ini ltest.ini +crudini --set ltest.ini section param newvalue || fail +test "$(crudini --get test.ini section param)" = 'newvalue' && ok || fail +crudini --output=ltest.ini --set ltest.ini section param newvalue2 || fail +test "$(crudini --get test.ini section param)" = 'newvalue2' && ok || fail + +# Test single token parameters (without equals) +cp ../noequals.ini . +crudini --get noequals.ini >/dev/null && ok || fail +cp noequals.ini noequals_new.ini +printf '%s\n' 'new' 'new_equals = ' >> noequals_new.ini +for param in param{1..3} colon{1..2} new; do + crudini --set noequals.ini noequals $param || fail +done +crudini --set noequals.ini noequals new_equals '' || fail +diff -u noequals.ini noequals_new.ini && ok || fail diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/crudini-0.8/tox.ini new/crudini-0.9/tox.ini --- old/crudini-0.8/tox.ini 2014-11-28 15:14:35.000000000 +0100 +++ new/crudini-0.9/tox.ini 2016-11-26 12:16:39.000000000 +0100 @@ -2,8 +2,8 @@ envlist = py26,py27,pep8 [testenv] -deps=iniparse -commands=/bin/bash -c 'cd tests && ./test.sh' +deps = iniparse>=0.3.2 +commands = /bin/bash -c 'cd tests && ./test.sh' [testenv:pep8] deps = flake8
participants (1)
-
root@hilbert.suse.de