Hello community, here is the log from the commit of package spec-cleaner for openSUSE:Factory checked in at 2018-12-13 19:50:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/spec-cleaner (Old) and /work/SRC/openSUSE:Factory/.spec-cleaner.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "spec-cleaner" Thu Dec 13 19:50:16 2018 rev:56 rq:657809 version:1.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/spec-cleaner/spec-cleaner.changes 2018-08-20 16:22:00.149041432 +0200 +++ /work/SRC/openSUSE:Factory/.spec-cleaner.new.28833/spec-cleaner.changes 2018-12-13 19:50:18.896555974 +0100 @@ -1,0 +2,8 @@ +Thu Dec 13 11:34:07 UTC 2018 - Tomáš Chvátal <tchva...@suse.com> + +- Version update to 1.1.2 bsc#1099674: + * Fixed qmake macro recommendation + * More licenses recognised + * Do not curlify sysuser_create + +------------------------------------------------------------------- Old: ---- spec-cleaner-1.1.1.tar.gz New: ---- spec-cleaner-1.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ spec-cleaner.spec ++++++ --- /var/tmp/diff_new_pack.h8ih5G/_old 2018-12-13 19:50:20.424554003 +0100 +++ /var/tmp/diff_new_pack.h8ih5G/_new 2018-12-13 19:50:20.512553890 +0100 @@ -13,12 +13,12 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: spec-cleaner -Version: 1.1.1 +Version: 1.1.2 Release: 0 Summary: .spec file cleaner License: BSD-3-Clause ++++++ spec-cleaner-1.1.1.tar.gz -> spec-cleaner-1.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/.travis.yml new/spec-cleaner-spec-cleaner-1.1.2/.travis.yml --- old/spec-cleaner-spec-cleaner-1.1.1/.travis.yml 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/.travis.yml 2018-12-13 12:30:17.000000000 +0100 @@ -1,4 +1,5 @@ sudo: required +dist: xenial addons: apt: packages: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/README.md new/spec-cleaner-spec-cleaner-1.1.2/README.md --- old/spec-cleaner-spec-cleaner-1.1.1/README.md 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/README.md 2018-12-13 12:30:17.000000000 +0100 @@ -127,6 +127,7 @@ CNRI-Python-GPL-Compatible | CNRI Python Open Source GPL Compatible License Agreement CNRI-Python | CNRI Python License Condor-1.1 | Condor Public License v1.1 +copyleft-next-0.3.1 | copyleft-next 0.3.1 CPAL-1.0 | Common Public Attribution License 1.0 CPL-1.0 | Common Public License 1.0 CPOL-1.02 | Code Project Open License 1.02 @@ -262,8 +263,12 @@ OCCT-PL | Open CASCADE Technology Public License OCLC-2.0 | OCLC Research Public License 2.0 ODbL-1.0 | ODC Open Database License v1.0 +ODC-By-1.0 | Open Data Commons Attribution License v1.0 OFL-1.0 | SIL Open Font License 1.0 OFL-1.1 | SIL Open Font License 1.1 +OGL-UK-1.0 | Open Government Licence v1.0 +OGL-UK-2.0 | Open Government Licence v2.0 +OGL-UK-3.0 | Open Government Licence v3.0 OGTSL | Open Group Test Suite License OLDAP-1.1 | Open LDAP Public License v1.1 OLDAP-1.2 | Open LDAP Public License v1.2 @@ -311,6 +316,7 @@ SAX-PD | Sax Public Domain Notice Saxpath | Saxpath License SCEA | SCEA Shared Source License +Sendmail-8.23 | Sendmail License 8.23 Sendmail | Sendmail License SGI-B-1.0 | SGI Free Software License B v1.0 SGI-B-1.1 | SGI Free Software License B v1.1 @@ -333,6 +339,8 @@ TMate | TMate Open Source License TORQUE-1.1 | TORQUE v2.5+ Software License v1.1 TOSL | Trusster Open Source License +TU-Berlin-1.0 | Technische Universitaet Berlin License 1.0 +TU-Berlin-2.0 | Technische Universitaet Berlin License 2.0 Unicode-DFS-2015 | Unicode License Agreement - Data Files and Software (2015) Unicode-DFS-2016 | Unicode License Agreement - Data Files and Software (2016) Unicode-TOU | Unicode Terms of Use @@ -389,7 +397,11 @@ Linux-syscall-note Nokia-Qt-exception-1.1 OCCT-exception-1.0 +OCaml-LGPL-linking-exception OpenJDK-assembly-exception-1.0 +PS-or-PDF-font-exception-20170817 +Qt-GPL-exception-1.0 +Qt-LGPL-exception-1.1 Qwt-exception-1.0 WxWindows-exception-3.1 eCos-exception-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/data/excludes-bracketing.txt new/spec-cleaner-spec-cleaner-1.1.2/data/excludes-bracketing.txt --- old/spec-cleaner-spec-cleaner-1.1.1/data/excludes-bracketing.txt 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/data/excludes-bracketing.txt 2018-12-13 12:30:17.000000000 +0100 @@ -139,6 +139,7 @@ suse_update_desktop_file systemd_preun systemd_requires +sysusers_create sysusers_requires sysusers_generate_pre tmpfiles_create diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/data/licenses_changes.txt new/spec-cleaner-spec-cleaner-1.1.2/data/licenses_changes.txt --- old/spec-cleaner-spec-cleaner-1.1.1/data/licenses_changes.txt 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/data/licenses_changes.txt 2018-12-13 12:30:17.000000000 +0100 @@ -678,6 +678,8 @@ OCCT-PL+ OCCT-PL+ OCLC-2.0 OCLC-2.0 OCLC-2.0+ OCLC-2.0+ +ODC-By-1.0 ODC-By-1.0 +ODC-By-1.0+ ODC-By-1.0+ ODbL-1.0 ODbL-1.0 ODbL-1.0+ ODbL-1.0+ OFL-1.0 OFL-1.0 @@ -688,6 +690,12 @@ OFL-1.1 SIL Open Font License OFL-1.1 SIL Open Font License 1.1 OFL-1.1+ OFL-1.1+ +OGL-UK-1.0 OGL-UK-1.0 +OGL-UK-1.0+ OGL-UK-1.0+ +OGL-UK-2.0 OGL-UK-2.0 +OGL-UK-2.0+ OGL-UK-2.0+ +OGL-UK-3.0 OGL-UK-3.0 +OGL-UK-3.0+ OGL-UK-3.0+ OGTSL OGTSL OGTSL+ OGTSL+ OLDAP-1.1 OLDAP-1.1 @@ -1062,6 +1070,8 @@ Sendmail SUSE-Sendmail Sendmail Sendmail Sendmail+ Sendmail+ +Sendmail-8.23 Sendmail-8.23 +Sendmail-8.23+ Sendmail-8.23+ SimPL-2.0 SimPL-2.0 SimPL-2.0+ SimPL-2.0+ Sleepycat Sleepycat @@ -1085,6 +1095,10 @@ TORQUE-1.1+ TORQUE-1.1+ TOSL TOSL TOSL+ TOSL+ +TU-Berlin-1.0 TU-Berlin-1.0 +TU-Berlin-1.0+ TU-Berlin-1.0+ +TU-Berlin-2.0 TU-Berlin-2.0 +TU-Berlin-2.0+ TU-Berlin-2.0+ UPL-1.0 UPL-1.0 UPL-1.0+ UPL-1.0+ Unicode http://www.unicode.org/copyright.html @@ -1164,6 +1178,8 @@ bzip2-1.0.5+ bzip2-1.0.5+ bzip2-1.0.6 bzip2-1.0.6 bzip2-1.0.6+ bzip2-1.0.6+ +copyleft-next-0.3.1 copyleft-next-0.3.1 +copyleft-next-0.3.1+ copyleft-next-0.3.1+ curl curl curl+ curl+ diffmark diffmark diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/data/licenses_exceptions.txt new/spec-cleaner-spec-cleaner-1.1.2/data/licenses_exceptions.txt --- old/spec-cleaner-spec-cleaner-1.1.1/data/licenses_exceptions.txt 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/data/licenses_exceptions.txt 2018-12-13 12:30:17.000000000 +0100 @@ -17,7 +17,11 @@ Linux-syscall-note Nokia-Qt-exception-1.1 OCCT-exception-1.0 +OCaml-LGPL-linking-exception OpenJDK-assembly-exception-1.0 +PS-or-PDF-font-exception-20170817 +Qt-GPL-exception-1.0 +Qt-LGPL-exception-1.1 Qwt-exception-1.0 WxWindows-exception-3.1 eCos-exception-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/setup.py new/spec-cleaner-spec-cleaner-1.1.2/setup.py --- old/spec-cleaner-spec-cleaner-1.1.1/setup.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/setup.py 2018-12-13 12:30:17.000000000 +0100 @@ -10,19 +10,14 @@ setup( name='spec_cleaner', description='RPM .spec files cleaner', - long_description=('Command-line tool for cleaning various formatting ' - 'errors in RPM .spec files'), + long_description=('Command-line tool for cleaning various formatting ' 'errors in RPM .spec files'), url='https://github.com/openSUSE/spec-cleaner', download_url='https://github.com/openSUSE/spec-cleaner', - version=__version__, - author='Tomáš Chvátal', author_email='tchva...@suse.cz', - maintainer='Tomáš Chvátal', maintainer_email='tchva...@suse.cz', - license='License :: OSI Approved :: BSD License', classifiers=[ # complete classifier list: @@ -39,17 +34,9 @@ ], platforms=['Linux'], keywords=['SUSE', 'RPM', '.spec', 'cleaner'], - setup_requires=['pytest-runner'], tests_require=['pytest', 'pytest-cov'], - packages=['spec_cleaner'], - - data_files=[ - ('lib/obs/service/', glob('obs/*')), - ('share/spec-cleaner', glob('data/*')), - ], - - entry_points={ - 'console_scripts': ['spec-cleaner = spec_cleaner:main']}, + data_files=[('lib/obs/service/', glob('obs/*')), ('share/spec-cleaner', glob('data/*'))], + entry_points={'console_scripts': ['spec-cleaner = spec_cleaner:main']}, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/__init__.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/__init__.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/__init__.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/__init__.py 2018-12-13 12:30:17.000000000 +0100 @@ -13,7 +13,7 @@ from .rpmexception import RpmException, RpmWrongArgs -__version__ = '1.1.1' +__version__ = '1.1.2' def process_args(argv): @@ -22,47 +22,54 @@ :param argv: passed arguments """ - parser = argparse.ArgumentParser(prog='spec-cleaner', - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - description='Cleans the given spec file according to style guide and returns the result.') + parser = argparse.ArgumentParser( + prog='spec-cleaner', + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + description='Cleans the given spec file according to style guide and returns the result.', + ) # Make the -d, -i, and -o exclusive as we can do only one of those output_group = parser.add_mutually_exclusive_group() - parser.add_argument('specfile', metavar='SPEC', type=str, - help='spec file to beautify') - parser.add_argument('-c', '--cmake', action='store_true', - help='convert dependencies to their cmake() counterparts, requires bit more of cleanup in spec afterwards.') - output_group.add_argument('-d', '--diff', action='store_true', - help='run the diff program to show differences between new and original specfile.') - parser.add_argument('--diff-prog', default='vimdiff', - help='specify the diff binary to call with diff option.') - parser.add_argument('-f', '--force', action='store_true', - help='overwrite the output file if already exist.') - output_group.add_argument('-i', '--inline', action='store_true', - help='inline the changes directly to the parsed file.') - parser.add_argument('-m', '--minimal', action='store_true', - help='run in minimal mode that does not do anything intrusive (ie. just sets the Copyright)') - parser.add_argument('--no-curlification', action='store_true', - help='do not convert variables bracketing (%%{macro}) and keep it as it was on the input') - parser.add_argument('--no-copyright', action='store_true', - help='do not include official SUSE copyright hear and just keep what is present') - parser.add_argument('--libexecdir', action='store_true', - help='convert /usr/lib to %%{_libexecdir}') - parser.add_argument('--copyright-year', metavar='YYYY', type=int, default=datetime.now().year, - help='year to insert into the copyright header when re-generating it') - output_group.add_argument('-o', '--output', default='', - help='specify the output file for the cleaned spec content.') - parser.add_argument('-p', '--pkgconfig', action='store_true', - help='convert dependencies to their pkgconfig() counterparts, requires bit more of cleanup in spec afterwards.') - parser.add_argument('--perl', action='store_true', - help='convert dependencies to their perl() counterparts, highly expansive use carefully') - parser.add_argument('-t', '--tex', action='store_true', - help='convert dependencies to their tex() counterparts, requires verification of the output afterwards.') - parser.add_argument('-v', '--version', action='version', version=__version__, - help='show package version and exit') - parser.add_argument('-k', '--keep-space', action='store_true', - help='keep empty lines in preamble intact.') + parser.add_argument('specfile', metavar='SPEC', type=str, help='spec file to beautify') + parser.add_argument( + '-c', + '--cmake', + action='store_true', + help='convert dependencies to their cmake() counterparts, requires bit more of cleanup in spec afterwards.', + ) + output_group.add_argument('-d', '--diff', action='store_true', help='run the diff program to show differences between new and original specfile.') + parser.add_argument('--diff-prog', default='vimdiff', help='specify the diff binary to call with diff option.') + parser.add_argument('-f', '--force', action='store_true', help='overwrite the output file if already exist.') + output_group.add_argument('-i', '--inline', action='store_true', help='inline the changes directly to the parsed file.') + parser.add_argument( + '-m', '--minimal', action='store_true', help='run in minimal mode that does not do anything intrusive (ie. just sets the Copyright)' + ) + parser.add_argument( + '--no-curlification', action='store_true', help='do not convert variables bracketing (%%{macro}) and keep it as it was on the input' + ) + parser.add_argument('--no-copyright', action='store_true', help='do not include official SUSE copyright hear and just keep what is present') + parser.add_argument('--libexecdir', action='store_true', help='convert /usr/lib to %%{_libexecdir}') + parser.add_argument( + '--copyright-year', + metavar='YYYY', + type=int, + default=datetime.now().year, + help='year to insert into the copyright header when re-generating it', + ) + output_group.add_argument('-o', '--output', default='', help='specify the output file for the cleaned spec content.') + parser.add_argument( + '-p', + '--pkgconfig', + action='store_true', + help='convert dependencies to their pkgconfig() counterparts, requires bit more of cleanup in spec afterwards.', + ) + parser.add_argument('--perl', action='store_true', help='convert dependencies to their perl() counterparts, highly expansive use carefully') + parser.add_argument( + '-t', '--tex', action='store_true', help='convert dependencies to their tex() counterparts, requires verification of the output afterwards.' + ) + parser.add_argument('-v', '--version', action='version', version=__version__, help='show package version and exit') + parser.add_argument('-k', '--keep-space', action='store_true', help='keep empty lines in preamble intact.') # print help if there is no argument if len(argv) < 1: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/dependency_parser.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/dependency_parser.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/dependency_parser.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/dependency_parser.py 2018-12-13 12:30:17.000000000 +0100 @@ -4,28 +4,14 @@ from .rpmexception import NoMatchException from .rpmrequirestoken import RpmRequiresToken -chunk_types = ( - 'text', 'space', 'macro', 'operator', 'version' -) +chunk_types = ('text', 'space', 'macro', 'operator', 'version') state_types = ('start', 'name', 'operator', 'version') re_brackets = {} -re_brackets['('] = re.compile( - r'(' + - r'\(' + r'|' + r'\)' + r'|' + - r'\\(' + r'|' + r'\\)' + r'|' + - r'[^\()]+' + - r')' -) - -re_brackets['{'] = re.compile( - r'(' + - r'\{' + r'|' + r'\}' + r'|' + - r'\\{' + r'|' + r'\\}' + r'|' + - r'[^\{}]+' + - r')' -) +re_brackets['('] = re.compile(r'(' + r'\(' + r'|' + r'\)' + r'|' + r'\\(' + r'|' + r'\\)' + r'|' + r'[^\()]+' + r')') + +re_brackets['{'] = re.compile(r'(' + r'\{' + r'|' + r'\}' + r'|' + r'\\{' + r'|' + r'\\}' + r'|' + r'[^\{}]+' + r')') re_name = re.compile(r'[-A-Za-z0-9_~(){}@:;.+/*\[\]]+') re_version = re.compile(r'[-A-Za-z0-9_~():.+]+') @@ -48,8 +34,7 @@ try: bite, string = consume_chars(regex, string) except NoMatchException: - raise Exception('unexpected parser error when looking for end of ' - 'macro') + raise Exception('unexpected parser error when looking for end of macro') if bite == opening: opened += 1 @@ -58,8 +43,7 @@ macro += bite if opened: - raise Exception('Unexpectedly met end of string when looking for end ' - 'of macro') + raise Exception('Unexpectedly met end of string when looking for end of macro') return macro, string @@ -81,15 +65,13 @@ return '}' elif bracket == '(': return ')' - raise Exception('Undefined bracket matching - add defintion of "%s" to ' - 'matching_bracket()' % bracket) + raise Exception('Undefined bracket matching - add defintion of "%s" to ' 'matching_bracket()' % bracket) def read_macro(string): opening = string[1] closing = matching_bracket(opening) - return find_end_of_bracketed_macro( - string, re_brackets[opening], opening, closing) + return find_end_of_bracketed_macro(string, re_brackets[opening], opening, closing) def read_next_chunk(string): @@ -163,7 +145,12 @@ rest: '%s' token: '%s' parsed: '%s'""", - self.next, self.next_type, self.string, self.token, self.parsed) + self.next, + self.next_type, + self.string, + self.token, + self.parsed, + ) self.state_change() def flat_out(self): @@ -173,9 +160,7 @@ return result def flush(self): - self.parsed.append( - (self.token_name, self.token_operator, self.token_version) - ) + self.parsed.append((self.token_name, self.token_operator, self.token_version)) # cleanup state self.token = [] self.token_name = '' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmbuild.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmbuild.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmbuild.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmbuild.py 2018-12-13 12:30:17.000000000 +0100 @@ -31,8 +31,8 @@ msg = '# FIXME: you should use %%cmake macros' elif self.reg.re_meson.match(line): msg = '# FIXME: you should use %%meson macros' - elif self.reg.re_qmake_qt5.match(line): - msg = '# FIXME: you should use %qmake_qt5 macro' + elif self.reg.re_qmake5.match(line): + msg = '# FIXME: you should use %qmake5 macro' else: return diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmcleaner.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmcleaner.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmcleaner.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmcleaner.py 2018-12-13 12:30:17.000000000 +0100 @@ -13,7 +13,17 @@ from .rpmdescription import RpmDescription from .rpmexception import RpmException from .rpmfiles import RpmFiles -from .rpmhelpers import find_macros_with_arg, load_keywords_whitelist, parse_rpm_showrc, read_cmake_changes, read_group_changes, read_licenses_changes, read_perl_changes, read_pkgconfig_changes, read_tex_changes +from .rpmhelpers import ( + find_macros_with_arg, + load_keywords_whitelist, + parse_rpm_showrc, + read_cmake_changes, + read_group_changes, + read_licenses_changes, + read_perl_changes, + read_pkgconfig_changes, + read_tex_changes, +) from .rpminstall import RpmInstall from .rpmpackage import RpmPackage from .rpmpreamble import RpmPreamble @@ -32,6 +42,7 @@ If the section is required and not found it is created with blank values as fixme for the spec creator. """ + specfile = None fin = None fout = None @@ -81,7 +92,7 @@ (self.reg.re_spec_scriptlets, RpmScriptlets), (self.reg.re_spec_triggers, RpmScriptlets), (self.reg.re_spec_files, RpmFiles), - (self.reg.re_spec_changelog, RpmChangelog) + (self.reg.re_spec_changelog, RpmChangelog), ] # Find all the present licenses @@ -143,22 +154,18 @@ def _detect_preamble_section(self, line): # This is seriously ugly but can't think of cleaner way if not isinstance(self.current_section, (RpmPreamble, RpmPackage)): - if any([re.match(line) for re in [ - self.reg.re_bcond_with, - self.reg.re_debugpkg, - ]]): + if any([re.match(line) for re in [self.reg.re_bcond_with, self.reg.re_debugpkg]]): return True # We can have locally defined variables in phases - if not isinstance(self.current_section, - (RpmInstall, RpmCheck, RpmBuild, RpmPrep)) and \ - (self.reg.re_define.match(line) or self.reg.re_global.match(line)): + if not isinstance(self.current_section, (RpmInstall, RpmCheck, RpmBuild, RpmPrep)) and ( + self.reg.re_define.match(line) or self.reg.re_global.match(line) + ): return True return False def _detect_condition_change(self, line): - if any([re.match(line) for re in [ - self.reg.re_endif, self.reg.re_else, self.reg.re_endcodeblock]]): + if any([re.match(line) for re in [self.reg.re_endif, self.reg.re_else, self.reg.re_endcodeblock]]): return True return False @@ -174,10 +181,10 @@ # if previous non-empty-uncommented line was starting the condition # we end up the condition section in preamble (if applicable) and # proceed to output - if self._detect_condition_change(line) or(type(self.current_section) is Section and (self.reg.re_if.match(line) - or self.reg.re_codeblock.match(line))): - if not hasattr(self.current_section, 'condition') or (hasattr(self.current_section, 'condition') - and not self.current_section.condition): + if self._detect_condition_change(line) or ( + type(self.current_section) is Section and (self.reg.re_if.match(line) or self.reg.re_codeblock.match(line)) + ): + if not hasattr(self.current_section, 'condition') or (hasattr(self.current_section, 'condition') and not self.current_section.condition): # If we have to break out we go ahead with small class # which just print the one evil line return Section @@ -283,7 +290,9 @@ self.fout.flush() if self.options['diff']: - cmd = shlex.split(self.options['diff_prog'] + ' ' + self.options['specfile'].replace(' ', '\\ ') + ' ' + self.fout.name.replace(' ', '\\ ')) + cmd = shlex.split( + self.options['diff_prog'] + ' ' + self.options['specfile'].replace(' ', '\\ ') + ' ' + self.fout.name.replace(' ', '\\ ') + ) try: subprocess.call(cmd, shell=False) except OSError as error: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmcopyright.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmcopyright.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmcopyright.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmcopyright.py 2018-12-13 12:30:17.000000000 +0100 @@ -24,9 +24,13 @@ def _add_pkg_header(self): specname = os.path.splitext(os.path.basename(self.spec))[0] - self.lines.append("""# + self.lines.append( + """# # spec file for package {0} -#""".format(specname)) +#""".format( + specname + ) + ) def _create_default_copyright(self): self.my_copyright = '# Copyright (c) {0} SUSE LINUX GmbH, Nuernberg, Germany.'.format(self.year) @@ -39,7 +43,8 @@ self.lines.append(i) def _add_default_license(self): - self.lines.append("""# + self.lines.append( + """# # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the @@ -50,7 +55,8 @@ # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ -#""") +#""" + ) def _add_buildrules(self): for i in sorted(self.buildrules): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmhelpers.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmhelpers.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmhelpers.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmhelpers.py 2018-12-13 12:30:17.000000000 +0100 @@ -106,12 +106,7 @@ licenses[index] = my_license # create back new string with replaced licenses - s = ' '.join(licenses).replace( - '( ', '(').replace( - ' )', ')').replace( - ' and ', ' AND ').replace( - ' or ', ' OR ').replace( - ' with ', ' WITH ') + s = ' '.join(licenses).replace('( ', '(').replace(' )', ')').replace(' and ', ' AND ').replace(' or ', ' OR ').replace(' with ', ' WITH ') return s diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpminstall.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpminstall.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpminstall.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpminstall.py 2018-12-13 12:30:17.000000000 +0100 @@ -44,7 +44,8 @@ """ Replace all known variations of la file deletion with one unified """ - if (self.reg.re_rm.search(line) and len(self.reg.re_rm_double.split(line)) == 1) or \ - (self.reg.re_find.search(line) and len(self.reg.re_find_double.split(line)) == 2): + if (self.reg.re_rm.search(line) and len(self.reg.re_rm_double.split(line)) == 1) or ( + self.reg.re_find.search(line) and len(self.reg.re_find_double.split(line)) == 2 + ): line = 'find %{buildroot} -type f -name "*.la" -delete -print' return line diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmpackage.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmpackage.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmpackage.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmpackage.py 2018-12-13 12:30:17.000000000 +0100 @@ -18,8 +18,11 @@ return # If the package is lang package we add here comment about the lang # package - if len(self.lines) == 1 and (self.previous_line.startswith('%') and - (self.previous_line.endswith(' lang') or self.previous_line.endswith('-lang'))) and not line.startswith('#'): + if ( + len(self.lines) == 1 + and (self.previous_line.startswith('%') and (self.previous_line.endswith(' lang') or self.previous_line.endswith('-lang'))) + and not line.startswith('#') + ): if not self.minimal: Section.add(self, '# FIXME: consider using %%lang_package macro') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmpreamble.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmpreamble.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmpreamble.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmpreamble.py 2018-12-13 12:30:17.000000000 +0100 @@ -124,11 +124,13 @@ """ Check if we have ppc64 obsolete and delete it """ - if not self.minimal and \ - len(self.paragraph.items['conditions']) == 3 and \ - isinstance(self.paragraph.items['conditions'][0], list) and \ - self.paragraph.items['conditions'][0][0] == '# bug437293' and \ - self.paragraph.items['conditions'][1].endswith('64bit'): + if ( + not self.minimal + and len(self.paragraph.items['conditions']) == 3 + and isinstance(self.paragraph.items['conditions'][0], list) + and self.paragraph.items['conditions'][0][0] == '# bug437293' + and self.paragraph.items['conditions'][1].endswith('64bit') + ): self.paragraph.items['conditions'] = [] def _prune_empty_condition(self): @@ -136,10 +138,10 @@ Remove empty conditions """ # check if we start with if - if len(self.paragraph.items['conditions']) == 2 and \ - ((isinstance(self.paragraph.items['conditions'][0], list) and \ - self.paragraph.items['conditions'][0][-1].startswith('%if')) or \ - self.paragraph.items['conditions'][0].startswith('%if')): + if len(self.paragraph.items['conditions']) == 2 and ( + (isinstance(self.paragraph.items['conditions'][0], list) and self.paragraph.items['conditions'][0][-1].startswith('%if')) + or self.paragraph.items['conditions'][0].startswith('%if') + ): self.paragraph.items['conditions'] = [] PYPI_SOURCE_HOSTS = ('pypi.io', 'files.pythonhosted.org', 'pypi.python.org') @@ -166,15 +168,14 @@ return url filename = os.path.basename(parsed.path) - modname = filename[:filename.rfind('-')] + modname = filename[: filename.rfind('-')] # TODO the following condition checks if the filename starts with a macro, # and expects that if it does, the macro is called "modname". This is not # always the case. It would be better to detect the name of the macro and # browse local definitions to find its value. if modname[0] == '%': - if (modname == '%modname' or modname == '%{modname}') \ - and self.modname: + if (modname == '%modname' or modname == '%{modname}') and self.modname: modname = self.modname else: # don't know what to do @@ -188,8 +189,7 @@ else: nested = True lines = self.paragraph.flatten_output(False, nested) - if len(self.paragraph.items['define']) > 0 or \ - len(self.paragraph.items['bconds']) > 0: + if len(self.paragraph.items['define']) > 0 or len(self.paragraph.items['bconds']) > 0: self._condition_define = True self.paragraph = self._oldstore.pop(-1) self.paragraph.items['conditions'] += lines @@ -453,8 +453,7 @@ self._add_line_to('define', line) # catch "modname" for use in pypi url rewriting - if (line.startswith('%define') or line.startswith('%global')) and \ - line.find('modname') >= 0: + if (line.startswith('%define') or line.startswith('%global')) and line.find('modname') >= 0: define, name, value = line.split(None, 2) self.modname = value diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmpreambleelements.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmpreambleelements.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmpreambleelements.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmpreambleelements.py 2018-12-13 12:30:17.000000000 +0100 @@ -102,10 +102,7 @@ ] # categories that are sorted based on key value (eg Patch0 before Patch1) - categories_with_sorted_keyword_tokens = ( - 'source', - 'patch', - ) + categories_with_sorted_keyword_tokens = ('source', 'patch') def __init__(self, options): self.items = {} @@ -178,8 +175,7 @@ for group in self.items['buildrequires']: buildrequires += add_group(group) # Check if we need the pkgconfig - if not self.br_pkgconfig_required and \ - find_pkgconfig_statement(buildrequires): + if not self.br_pkgconfig_required and find_pkgconfig_statement(buildrequires): self.br_pkgconfig_required = True # only in case we are in main scope if not nested: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmregexp.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmregexp.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmregexp.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmregexp.py 2018-12-13 12:30:17.000000000 +0100 @@ -18,8 +18,14 @@ re_spec_install = re.compile(r'^%install\s*$', re.IGNORECASE) re_spec_clean = re.compile(r'^%clean\s*$', re.IGNORECASE) re_spec_check = re.compile(r'^%check\s*$', re.IGNORECASE) - re_spec_scriptlets = re.compile(r'(?:^%pretrans(\s+|$))|(?:^%pre(\s+|$))|(?:^%post(\s+|$))|(?:^%verifyscript(\s+|$))|(?:^%preun(\s+|$))|(?:^%postun(\s+|$))|(?:^%posttrans(\s+|$))', re.IGNORECASE) - re_spec_triggers = re.compile(r'(?:^%filetriggerin(\s+|$))|(?:^%filetriggerun(\s+|$))|(?:^%filetriggerpostun(\s+|$))|(?:^%transfiletriggerin(\s+|$))|(?:^%transfiletriggerun(\s+|$))|(?:^%transfiletriggerpostun(\s+|$))', re.IGNORECASE) + re_spec_scriptlets = re.compile( + r'(?:^%pretrans(\s+|$))|(?:^%pre(\s+|$))|(?:^%post(\s+|$))|(?:^%verifyscript(\s+|$))|(?:^%preun(\s+|$))|(?:^%postun(\s+|$))|(?:^%posttrans(\s+|$))', + re.IGNORECASE, + ) + re_spec_triggers = re.compile( + r'(?:^%filetriggerin(\s+|$))|(?:^%filetriggerun(\s+|$))|(?:^%filetriggerpostun(\s+|$))|(?:^%transfiletriggerin(\s+|$))|(?:^%transfiletriggerun(\s+|$))|(?:^%transfiletriggerpostun(\s+|$))', + re.IGNORECASE, + ) re_spec_files = re.compile(r'^%files(\s+|$)', re.IGNORECASE) re_spec_changelog = re.compile(r'^%changelog\s*$', re.IGNORECASE) @@ -96,7 +102,7 @@ re_suseupdateconfig = re.compile(r'(%{?suse_update_config|${?\?suse_update_config:)') re_configure = re.compile(r'(^|(.*\s)?)./configure(\s.*|)$') re_cmake = re.compile(r'(^|(.*\s)?)cmake(\s.*|)$') - re_qmake_qt5 = re.compile(r'(^|(.*\s)?)qmake-qt5(\s.*|)$') + re_qmake5 = re.compile(r'(^|(.*\s)?)qmake-qt5(\s.*|)$') re_meson = re.compile(r'(^|(.*\s)?)meson(\s.*|)$') # rpmcopyright @@ -142,13 +148,16 @@ # find start of macro: # either beggining of string or something which is not '%' or : # where : is used after macro declaration we should not curlify - r'(^|([^%:]))' + + r'(^|([^%:]))' + + # macro itself: # '%' followed by either number not starting with '0' # or by chars where first is a-z or A-Z or underscore - r'%([1-9]\d*|[a-zA-Z_]\w*' + + r'%([1-9]\d*|[a-zA-Z_]\w*' + + # possibly followed by parens - r'(\s*\([^)]*\))?' + + r'(\s*\([^)]*\))?' + + # beyond the end of the macro r')(|(\W))' ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmrequirestoken.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmrequirestoken.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmrequirestoken.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmrequirestoken.py 2018-12-13 12:30:17.000000000 +0100 @@ -51,9 +51,17 @@ self.name = self._format_name(self.name) if not self.prefix: - raise RpmException('No defined prefix in RequiresToken: prefix "{0}" name "{1}" operator "{2}" version "{3}"'.format(self.prefix, self.name, self.operator, self.version)) + raise RpmException( + 'No defined prefix in RequiresToken: prefix "{0}" name "{1}" operator "{2}" version "{3}"'.format( + self.prefix, self.name, self.operator, self.version + ) + ) if not self.name: - raise RpmException('No defined name in RequiresToken: prefix "{0}" name "{1}" operator "{2}" version "{3}"'.format(self.prefix, self.name, self.operator, self.version)) + raise RpmException( + 'No defined name in RequiresToken: prefix "{0}" name "{1}" operator "{2}" version "{3}"'.format( + self.prefix, self.name, self.operator, self.version + ) + ) string = self.prefix + self.name if self.version and not self.operator: raise RpmException('Have defined version and no operator %s' % self.version) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmsection.py new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmsection.py --- old/spec-cleaner-spec-cleaner-1.1.1/spec_cleaner/rpmsection.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/spec_cleaner/rpmsection.py 2018-12-13 12:30:17.000000000 +0100 @@ -83,21 +83,19 @@ # Also if we are jumping away just after writing one macroed line # we don't want to create new line if newline and len(self.lines) >= 1: - if self.lines[-1] != '' and \ - self.lines[-1] != '%changelog' and not \ - self.lines[-1].startswith('%if') and not \ - self.lines[-1].startswith('%pre') and not \ - self.lines[-1].startswith('%post'): + if ( + self.lines[-1] != '' + and self.lines[-1] != '%changelog' + and not self.lines[-1].startswith('%if') + and not self.lines[-1].startswith('%pre') + and not self.lines[-1].startswith('%post') + ): self.lines.append('') - if new_class != 'RpmScriptlets' and \ - (self.lines[-1].startswith('%pre') or - self.lines[-1].startswith('%post')): + if new_class != 'RpmScriptlets' and (self.lines[-1].startswith('%pre') or self.lines[-1].startswith('%post')): self.lines.append('') # remove the newlines around ifs if they are not wanted if len(self.lines) >= 2: - if self.lines[-1] == '' and \ - (self.lines[-2].startswith('%if') or - self.lines[-2].startswith('%else')): + if self.lines[-1] == '' and (self.lines[-2].startswith('%if') or self.lines[-2].startswith('%else')): self.lines.pop() for line in self.lines: @@ -185,14 +183,68 @@ Remove the macro calls for utilities and rather use direct commands. OBS ensures there is only one anyway. """ - r = {'id_u': 'id -u', 'ln_s': 'ln -s', 'lzma': 'xz --format-lzma', 'mkdir_p': 'mkdir -p', - 'awk': 'gawk', 'cc': 'gcc', 'cpp': 'gcc -E', 'cxx': 'g++', 'remsh': 'rsh', } + r = { + 'id_u': 'id -u', + 'ln_s': 'ln -s', + 'lzma': 'xz --format-lzma', + 'mkdir_p': 'mkdir -p', + 'awk': 'gawk', + 'cc': 'gcc', + 'cpp': 'gcc -E', + 'cxx': 'g++', + 'remsh': 'rsh', + } for i in r: line = line.replace('%{__' + i + '}', r[i]) if self.minimal: line = line.replace('%__' + i, r[i]) - for i in ('aclocal', 'ar', 'as', 'autoconf', 'autoheader', 'automake', 'bzip2', 'cat', 'chgrp', 'chmod', 'chown', 'cp', 'cpio', 'file', 'gpg', 'grep', 'gzip', 'id', 'install', 'ld', 'libtoolize', 'make', 'mkdir', 'mv', 'nm', 'objcopy', 'objdump', 'patch', 'perl', 'python', 'python2', 'python3', 'pypy3', 'ranlib', 'restorecon', 'rm', 'rsh', 'sed', 'semodule', 'ssh', 'strip', 'tar', 'unzip', 'xz'): + for i in ( + 'aclocal', + 'ar', + 'as', + 'autoconf', + 'autoheader', + 'automake', + 'bzip2', + 'cat', + 'chgrp', + 'chmod', + 'chown', + 'cp', + 'cpio', + 'file', + 'gpg', + 'grep', + 'gzip', + 'id', + 'install', + 'ld', + 'libtoolize', + 'make', + 'mkdir', + 'mv', + 'nm', + 'objcopy', + 'objdump', + 'patch', + 'perl', + 'python', + 'python2', + 'python3', + 'pypy3', + 'ranlib', + 'restorecon', + 'rm', + 'rsh', + 'sed', + 'semodule', + 'ssh', + 'strip', + 'tar', + 'unzip', + 'xz', + ): line = line.replace('%{__' + i + '}', i) if self.minimal: line = line.replace('%__' + i, i) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/tests/acceptance-tests.py new/spec-cleaner-spec-cleaner-1.1.2/tests/acceptance-tests.py --- old/spec-cleaner-spec-cleaner-1.1.1/tests/acceptance-tests.py 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/tests/acceptance-tests.py 2018-12-13 12:30:17.000000000 +0100 @@ -10,7 +10,6 @@ from spec_cleaner import RpmSpecCleaner -@pytest.fixture(scope='session') def tests(): """ Generate list of tests we are going to use according to what is on hdd @@ -19,7 +18,6 @@ return [os.path.basename(f) for f in glob(testglob)] -@pytest.fixture(scope='session') def space_tests(): """ Generate list of tests we are going to use according to what is on hdd @@ -62,10 +60,7 @@ if not infile: infile = os.path.join('tests', 'in', test) - full_options = { - 'specfile': infile, - 'output': outfile, - } + full_options = {'specfile': infile, 'output': outfile} full_options.update(self.option_presets) full_options.update(options) @@ -120,7 +115,7 @@ ('tex.spec', 'tex', {'tex': True}), ('perl.spec', 'perl', {'perl': True}), ('cmake.spec', 'cmake', {'cmake': True}), - ] + ], ) def test_single_output(self, tmpfile, test, compare_dir, options): self._run_individual_test(test, compare_dir, outfile=tmpfile, options=options) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-1.1.1/tests/out/macros.spec new/spec-cleaner-spec-cleaner-1.1.2/tests/out/macros.spec --- old/spec-cleaner-spec-cleaner-1.1.1/tests/out/macros.spec 2018-08-20 09:08:50.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-1.1.2/tests/out/macros.spec 2018-12-13 12:30:17.000000000 +0100 @@ -20,7 +20,7 @@ # FIXME: you should use the %%configure macro CFLAGS="-g" ./configure -# FIXME: you should use %qmake_qt5 macro +# FIXME: you should use %qmake5 macro qmake-qt5 %{name}.pro -spec linux-g++ # FIXME: you should use %%meson macros