Hello community, here is the log from the commit of package spec-cleaner for openSUSE:Factory checked in at 2014-09-03 18:22:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/spec-cleaner (Old) and /work/SRC/openSUSE:Factory/.spec-cleaner.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "spec-cleaner" Changes: -------- --- /work/SRC/openSUSE:Factory/spec-cleaner/spec-cleaner.changes 2014-07-08 16:59:10.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.spec-cleaner.new/spec-cleaner.changes 2014-09-03 21:10:55.000000000 +0200 @@ -1,0 +2,18 @@ +Fri Aug 29 10:46:17 UTC 2014 - tchva...@suse.com + +- py3 include arpgarse itself. + +------------------------------------------------------------------- +Wed Aug 13 12:28:45 UTC 2014 - tchva...@suse.com + +- Version bump to 0.6.1: + * Fixup release with working spec-cleaner script executable + +------------------------------------------------------------------- +Wed Aug 13 12:09:35 UTC 2014 - tchva...@suse.com + +- Version bump to 0.6.0: + * Use setuptools and nosetests for building&testing + * Various bugfixes as found by java icedtea cleaning + +------------------------------------------------------------------- Old: ---- spec-cleaner-0.5.9.tar.gz New: ---- spec-cleaner-0.6.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ spec-cleaner.spec ++++++ --- /var/tmp/diff_new_pack.F19LTI/_old 2014-09-03 21:10:57.000000000 +0200 +++ /var/tmp/diff_new_pack.F19LTI/_new 2014-09-03 21:10:57.000000000 +0200 @@ -18,23 +18,18 @@ Name: spec-cleaner -Version: 0.5.9 +Version: 0.6.1 Release: 0 Summary: .spec file cleaner License: BSD-3-Clause Group: Development/Tools/Other Url: http://github.com/openSUSE/spec-cleaner Source0: https://github.com/openSUSE/%{name}/archive/%{name}-%{version}.tar.gz -BuildRequires: python -Requires: python-argparse +BuildRequires: python3-mock +BuildRequires: python3-nose +BuildRequires: python3-setuptools BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch -# This is just for tests -# It is conditional so we built on older distros too -# Drop after 12.2 and older are not targeted here -%if 0%{?suse_version} > 01220 -BuildRequires: python3 -%endif %description This script cleans spec file according to some arbitrary style guide. The @@ -45,15 +40,13 @@ %setup -q -n %{name}-%{name}-%{version} %build +python3 setup.py build %check -make check -j1 +python3 setup.py test %install -make DESTDIR=%{buildroot} install %{?_smp_mflags} \ - LIBEXECDIR=%{_libexecdir} \ - LIBDIR=%{_libdir} \ - SITEDIR=%{python_sitelib} +python3 setup.py install --root="%{buildroot}" %files %defattr(-, root, root) @@ -62,23 +55,25 @@ %dir %{_libexecdir}/obs/service/ %{_libexecdir}/obs/service/clean_spec_file %{_libexecdir}/obs/service/clean_spec_file.service -%dir %{python_sitelib}/spec_cleaner/ -%{python_sitelib}/spec_cleaner/__init__.py* -%{python_sitelib}/spec_cleaner/fileutils.py* -%{python_sitelib}/spec_cleaner/rpmbuild.py* -%{python_sitelib}/spec_cleaner/rpmcheck.py* -%{python_sitelib}/spec_cleaner/rpmcleaner.py* -%{python_sitelib}/spec_cleaner/rpmcopyright.py* -%{python_sitelib}/spec_cleaner/rpmdescription.py* -%{python_sitelib}/spec_cleaner/rpmexception.py* -%{python_sitelib}/spec_cleaner/rpmfiles.py* -%{python_sitelib}/spec_cleaner/rpminstall.py* -%{python_sitelib}/spec_cleaner/rpmpreamble.py* -%{python_sitelib}/spec_cleaner/rpmprep.py* -%{python_sitelib}/spec_cleaner/rpmprune.py* -%{python_sitelib}/spec_cleaner/rpmregexp.py* -%{python_sitelib}/spec_cleaner/rpmscriplets.py* -%{python_sitelib}/spec_cleaner/rpmsection.py* +%dir %{python3_sitelib}/spec_cleaner/ +%{python3_sitelib}/spec_cleaner/__init__.py +%{python3_sitelib}/spec_cleaner/fileutils.py +%{python3_sitelib}/spec_cleaner/rpmbuild.py +%{python3_sitelib}/spec_cleaner/rpmcheck.py +%{python3_sitelib}/spec_cleaner/rpmcleaner.py +%{python3_sitelib}/spec_cleaner/rpmcopyright.py +%{python3_sitelib}/spec_cleaner/rpmdescription.py +%{python3_sitelib}/spec_cleaner/rpmexception.py +%{python3_sitelib}/spec_cleaner/rpmfiles.py +%{python3_sitelib}/spec_cleaner/rpminstall.py +%{python3_sitelib}/spec_cleaner/rpmpreamble.py +%{python3_sitelib}/spec_cleaner/rpmprep.py +%{python3_sitelib}/spec_cleaner/rpmprune.py +%{python3_sitelib}/spec_cleaner/rpmregexp.py +%{python3_sitelib}/spec_cleaner/rpmscriplets.py +%{python3_sitelib}/spec_cleaner/rpmsection.py +%{python3_sitelib}/spec_cleaner/__pycache__ +%{python3_sitelib}/spec_cleaner-%{version}-py%{py3_ver}.egg-info %dir %{_datadir}/%{name}/ %{_datadir}/%{name}/excludes-bracketing.txt %{_datadir}/%{name}/licenses_changes.txt ++++++ spec-cleaner-0.5.9.tar.gz -> spec-cleaner-0.6.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/.gitignore new/spec-cleaner-spec-cleaner-0.6.1/.gitignore --- old/spec-cleaner-spec-cleaner-0.5.9/.gitignore 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/.gitignore 2014-08-13 14:23:57.000000000 +0200 @@ -1 +1,6 @@ +build/ +dist/ +*.egg-info/ *.pyc +.coverage +.coveralls.yml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/.travis.yml new/spec-cleaner-spec-cleaner-0.6.1/.travis.yml --- old/spec-cleaner-spec-cleaner-0.5.9/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/.travis.yml 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,11 @@ +language: python +python: + - "2.7" + - "3.3" +install: + - pip install python-coveralls mock + - sudo apt-get install -y rpm +script: + - nosetests --with-coverage --cover-package=spec_cleaner --cover-inclusive +after_success: + - coveralls diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/MANIFEST.in new/spec-cleaner-spec-cleaner-0.6.1/MANIFEST.in --- old/spec-cleaner-spec-cleaner-0.5.9/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/MANIFEST.in 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,5 @@ +include AUTHORS COPYING README.rst +include obs/* +include data/*.txt +recursive-include tests * +include pkgconfig-update.* license-update.sh Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/Makefile new/spec-cleaner-spec-cleaner-0.6.1/Makefile --- old/spec-cleaner-spec-cleaner-0.5.9/Makefile 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/Makefile 2014-08-13 14:23:57.000000000 +0200 @@ -1,10 +1,3 @@ -PREFIX ?= /usr -BINDIR ?= $(PREFIX)/bin -DATADIR ?= $(PREFIX)/share -LIBEXECDIR ?= $(PREFIX)/libexec -LIBDIR ?= $(PREFIX)/lib -SITEDIR ?= $(LIBDIR)/python2.7/site-packages - all: data/pkgconfig_conversions.txt data/licenses_changes.txt data/pkgconfig_conversions.txt: pkgconfig-update.sed pkgconfig-update.sh @@ -12,87 +5,3 @@ data/licenses_changes.txt: license-update.sh @sh license-update.sh > $@ - -install: bin/spec-cleaner - @echo "Installing package to $(DESTDIR)" ; \ - install -d $(DESTDIR)$(BINDIR) ; \ - install -m 755 bin/spec-cleaner $(DESTDIR)/$(BINDIR) - @install -d $(DESTDIR)$(DATADIR)/spec-cleaner/ ; \ - install -m 644 data/licenses_changes.txt $(DESTDIR)$(DATADIR)/spec-cleaner/ ; \ - install -m 644 data/pkgconfig_conversions.txt $(DESTDIR)$(DATADIR)/spec-cleaner/ ; \ - install -m 644 data/excludes-bracketing.txt $(DESTDIR)$(DATADIR)/spec-cleaner/ - @install -d $(DESTDIR)$(LIBEXECDIR)/obs/service/ ; \ - install -m 755 obs/clean_spec_file $(DESTDIR)$(LIBEXECDIR)/obs/service/ ; \ - install -m 644 obs/clean_spec_file.service $(DESTDIR)$(LIBEXECDIR)/obs/service/ - @install -d $(DESTDIR)$(SITEDIR)/spec_cleaner ; \ - install -m 755 spec_cleaner/__init__.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmcleaner.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmcopyright.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmexception.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmsection.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/fileutils.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmbuild.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmdescription.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmfiles.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpminstall.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmpreamble.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmprep.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmprune.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmscriplets.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmregexp.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ ; \ - install -m 644 spec_cleaner/rpmcheck.py $(DESTDIR)$(SITEDIR)/spec_cleaner/ - -test: check - -check: spec_cleaner/__init__.py - @if [ -x /usr/bin/python2 ]; then \ - echo "Running tests in python2:" ; \ - for i in tests/in/*.spec; do \ - CORRECT="`echo $$i | sed 's|^tests/in|tests/out|'`" ; \ - NEW="` echo $$i | sed 's|^tests/in|tests/tmp|'`" ; \ - TEST="` echo $$i | sed 's|^tests/in/\(.*\).spec|\1|'`" ; \ - python2 spec_cleaner/__init__.py -p -f $$i | sed "s|`date +%Y`|2013|" > "$$NEW" ; \ - echo -n " * test '$$TEST': " ; \ - if [ "`diff "$$CORRECT" "$$NEW" 2>&1`" ]; then \ - echo "failed" ; \ - FAILED="$$FAILED $$TEST" ; \ - else \ - echo "passed" ; \ - fi ; \ - done ; \ - fi ; \ - if [ -x /usr/bin/python3 ]; then \ - echo "Running tests in python3:" ; \ - for i in tests/in/*.spec; do \ - CORRECT="`echo $$i | sed 's|^tests/in|tests/out|'`" ; \ - NEW="` echo $$i | sed 's|^tests/in|tests/tmp|'`" ; \ - TEST="` echo $$i | sed 's|^tests/in/\(.*\).spec|\1|'`" ; \ - python3 spec_cleaner/__init__.py -p -f $$i | sed "s|`date +%Y`|2013|" > "$$NEW" ; \ - echo -n " * test '$$TEST': " ; \ - if [ "`diff "$$CORRECT" "$$NEW" 2>&1`" ]; then \ - echo "failed" ; \ - FAILED="$$FAILED $$TEST" ; \ - else \ - echo "passed" ; \ - fi ; \ - done ; \ - fi ; \ - echo ; \ - if [ "$$FAILED" ]; then \ - echo "`echo $$FAILED | wc -w` tests out of `echo tests/in/*.spec | wc -w` failed:" ; \ - echo " $$FAILED" ; \ - echo ; \ - echo "Check errors by running:"; \ - for i in $$FAILED; do echo " diff -Naru tests/out/$$i.spec tests/tmp/$$i.spec"; done; \ - echo ; \ - exit 1 ; \ - else \ - echo "All tests passed!" ; \ - echo ; \ - fi - -clean: - rm -rf tests/tmp/* \ - rm -rf spec_cleaner/*.pyc - -.PHONY: install check test clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/README.md new/spec-cleaner-spec-cleaner-0.6.1/README.md --- old/spec-cleaner-spec-cleaner-0.5.9/README.md 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/README.md 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -spec-cleaner -============ - -spec-cleaner is a tool that is planned to be replacement for "osc service localrun format_spec_file". -It is intended to provide same or better features in order for us to be able to unify all the spec files in obs. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/README.rst new/spec-cleaner-spec-cleaner-0.6.1/README.rst --- old/spec-cleaner-spec-cleaner-0.5.9/README.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/README.rst 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,11 @@ +============ +spec-cleaner +============ + +.. image:: https://travis-ci.org/openSUSE/spec-cleaner.svg?branch=master + :target: https://travis-ci.org/openSUSE/spec-cleaner +.. image:: https://coveralls.io/repos/openSUSE/spec-cleaner/badge.png + :target: https://coveralls.io/r/openSUSE/spec-cleaner + +spec-cleaner is a tool that is planned to be replacement for "osc service localrun format_spec_file". +It is intended to provide same or better features in order for us to be able to unify all the spec files in obs. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/bin/spec-cleaner new/spec-cleaner-spec-cleaner-0.6.1/bin/spec-cleaner --- old/spec-cleaner-spec-cleaner-0.5.9/bin/spec-cleaner 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/bin/spec-cleaner 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -#!/usr/bin/env python -# vim: set ts=4 sw=4 et: coding=UTF-8 -# -# Copyright (c) 2013, SUSE LINUX Products GmbH, Nuernberg, Germany -# All rights reserved. -# See COPYING for details. - -import sys - -from spec_cleaner import main - -try: - sys.exit(main(sys.argv[1:])) -except KeyboardInterrupt: - pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/data/excludes-bracketing.txt new/spec-cleaner-spec-cleaner-0.6.1/data/excludes-bracketing.txt --- old/spec-cleaner-spec-cleaner-0.5.9/data/excludes-bracketing.txt 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/data/excludes-bracketing.txt 2014-08-13 14:23:57.000000000 +0200 @@ -8,6 +8,7 @@ config defattr define +defined description desktop_database_post[^\s]* dir @@ -55,8 +56,9 @@ py_compile requires_eq restart_on_update -setup service_(add|del)_[^\s]* +setup +set_permissions stop_on_removal suse_update_desktop_file systemd_requires diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/data/licenses_changes.txt new/spec-cleaner-spec-cleaner-0.6.1/data/licenses_changes.txt --- old/spec-cleaner-spec-cleaner-0.5.9/data/licenses_changes.txt 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/data/licenses_changes.txt 2014-08-13 14:23:57.000000000 +0200 @@ -167,6 +167,7 @@ CC-BY-SA-3.0 CC BY-SA V3.0 CC-BY-SA-3.0 CC-BY-SA-3.0 CC-BY-SA-3.0+ CC-BY-SA-3.0+ +CC-BY-SA-4.0 http://creativecommons.org/licenses/by-sa/4.0/legalcode CC0-1.0 CC0-1.0 CC0-1.0+ CC0-1.0+ CDDL-1.0 CDDL @@ -514,6 +515,7 @@ OLDAP-2.8 openldap 2.8 OLDAP-2.8+ OLDAP-2.8+ OPL-1.0 OPL-1.0 +OPL-1.0 Open Publication License 1.0 OPL-1.0+ OPL-1.0+ OSL-1.0 OSL-1.0 OSL-1.0+ OSL-1.0+ @@ -561,6 +563,7 @@ Ruby GPL-2.0+ or Ruby Ruby GPLv2+ or Ruby Ruby Ruby +Ruby same as ruby's Ruby+ Ruby+ SAX-PD SAX-PD SAX-PD+ SAX-PD+ @@ -598,6 +601,8 @@ SUSE-DMTF+ SUSE-DMTF+ SUSE-Docbook-XSL Copyright (C) 1999-2007 Norman Walsh SUSE-Docbook-XSL+ SUSE-Docbook-XSL+ +SUSE-EULA SUSE End User License Agreement +SUSE-EULA+ SUSE-EULA+ SUSE-Egenix-1.1.0 Egenix Public License Agreement 1.1.0 (e.g. python-egenix-mx-base) http://www.egenix.com/products/python/mxBase/eGenix.com-Public-License-1.1.0.pdf SUSE-Egenix-1.1.0+ SUSE-Egenix-1.1.0+ SUSE-FHS See for example, the "FHS" license here: https://launchpad.net/ubuntu/precise/+source/debian-policy/+copyright @@ -623,6 +628,8 @@ SUSE-GPL-2.0-with-FLOSS-exception+ SUSE-GPL-2.0-with-FLOSS-exception+ SUSE-GPL-2.0-with-OSI-exception GPL-2.0 with linking exception for OSI licenses (see elfutils e.g.) SUSE-GPL-2.0-with-OSI-exception+ SUSE-GPL-2.0-with-OSI-exception+ +SUSE-GPL-2.0-with-linking-exception Copyright holder expressly allows GPL-2.0 component to be linked with components which are not GPL compatible +SUSE-GPL-2.0-with-linking-exception+ SUSE-GPL-2.0-with-linking-exception+ SUSE-GPL-2.0-with-openssl-exception SPDX does not have this exception SUSE-GPL-2.0-with-openssl-exception+ SUSE-GPL-2.0-with-openssl-exception+ SUSE-GPL-2.0-with-plugin-exception Many GPL-2.0 licensed applications grant an exception that permits non-free plugins (e.g. from gstreamer) to be linked against them @@ -671,12 +678,16 @@ SUSE-LGPL-2.1-with-digia-exception-1.1+ SUSE-LGPL-2.1-with-digia-exception-1.1+ SUSE-LGPL-2.1-with-nokia-exception-1.1 Part of the license choice in libqt4 SUSE-LGPL-2.1-with-nokia-exception-1.1+ SUSE-LGPL-2.1-with-nokia-exception-1.1+ +SUSE-LGPL-3.0-with-openssl-exception e.g python-psycopg2 +SUSE-LGPL-3.0-with-openssl-exception+ SUSE-LGPL-3.0-with-openssl-exception+ SUSE-Liberation LiberationFontsLicense (Fedora calls this the Liberation license - it will be easier to get it upstream if we adopt that) SUSE-Liberation+ SUSE-Liberation+ SUSE-MakeIndex http://pastebin.com/CYB22gju (the license used in csindex) SUSE-MakeIndex+ SUSE-MakeIndex+ SUSE-Manpages Manpages licenses (linux man pages e.g.) SUSE-Manpages+ SUSE-Manpages+ +SUSE-Matplotlib E.g. python -matplotlib -> LICENSE/LICENSE +SUSE-Matplotlib+ SUSE-Matplotlib+ SUSE-MgOpen MgOpen Fonts license (similar to Bitstream Vera but with additional language) SUSE-MgOpen+ SUSE-MgOpen+ SUSE-NetCDF SUSE-NetCDF @@ -733,10 +744,10 @@ SUSE-TGPPL-1.0+ SUSE-TGPPL-1.0+ SUSE-TeX http://en.wikipedia.org/wiki/TeX#License SUSE-TeX+ SUSE-TeX+ +SUSE-Ubuntu-Font-License-1.0 http://font.ubuntu.com/licence/ +SUSE-Ubuntu-Font-License-1.0+ SUSE-Ubuntu-Font-License-1.0+ SUSE-Vim SUSE-Vim SUSE-Vim+ SUSE-Vim+ -SUSE-WTFPL-2.0 http://sam.zoy.org/wtfpl/ -SUSE-WTFPL-2.0+ SUSE-WTFPL-2.0+ SUSE-XFree86-with-font-exception XFree86 with exception to clarify that a document embedding such fonts does not need to be licensed under the XFree86 license SUSE-XFree86-with-font-exception+ SUSE-XFree86-with-font-exception+ SUSE-XSL-Lint http://pastebin.com/cFxX3zCb (probably deprecated but found in docbook-dsssl-stylesheets) @@ -757,6 +768,7 @@ Sleepycat+ Sleepycat+ SugarCRM-1.1.3 SugarCRM-1.1.3 SugarCRM-1.1.3+ SugarCRM-1.1.3+ +Unicode http://www.unicode.org/copyright.html Unlicense Unlicense Unlicense+ Unlicense+ VSL-1.0 VSL-1.0 @@ -764,6 +776,7 @@ W3C W3C W3C W3C Software License W3C+ W3C+ +WTFPL SUSE-WTFPL-2.0 WTFPL WTFPL WTFPL+ WTFPL+ WXwindows WXwindows diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/setup.py new/spec-cleaner-spec-cleaner-0.6.1/setup.py --- old/spec-cleaner-spec-cleaner-0.5.9/setup.py 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/setup.py 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from setuptools import setup +import glob +from spec_cleaner import __version__ + +test_requires = [ + 'mock', + 'nose', +] + +setup( + name='spec_cleaner', + description = 'RPM .spec files cleaner', + 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', + platforms = ['Linux'], + keywords = ['SUSE', 'RPM', '.spec', 'cleaner'], + + tests_require=test_requires, + test_suite="nose.collector", + + packages = ['spec_cleaner'], + + data_files=[('/usr/lib/obs/service/', glob.glob('obs/*')), + ('/usr/share/spec-cleaner/', glob.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-0.5.9/spec_cleaner/__init__.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/__init__.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/__init__.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/__init__.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,18 +1,17 @@ -#!/usr/bin/env python # vim: set ts=4 sw=4 et: coding=UTF-8 # Copyright (c) 2013, SUSE LINUX Products GmbH, Nuernberg, Germany # All rights reserved. # See COPYING for details. -__version__ = '0.5.9' +__version__ = '0.6.1' import os import sys import argparse -from rpmexception import RpmWrongArgs, RpmException -from rpmcleaner import RpmSpecCleaner +from .rpmexception import RpmWrongArgs, RpmException +from .rpmcleaner import RpmSpecCleaner def process_args(argv): @@ -66,15 +65,14 @@ return options -def main(argv): +def main(): """ Main function that calls argument parsing ensures their sanity and then creates RpmSpecCleaner object that works with passed spec file. - :param argv: passed arguments """ try: - options = process_args(argv) + options = process_args(sys.argv[1:]) except RpmWrongArgs as e: sys.stderr.write('ERROR: {0}\n'.format(e)) return 1 @@ -92,9 +90,3 @@ return 1 return 0 - -if __name__ == '__main__': - try: - sys.exit(main(sys.argv[1:])) - except KeyboardInterrupt: - pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/fileutils.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/fileutils.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/fileutils.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/fileutils.py 2014-08-13 14:23:57.000000000 +0200 @@ -2,7 +2,7 @@ import os -from rpmexception import RpmException +from .rpmexception import RpmException class FileUtils: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmbuild.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmbuild.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmbuild.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmbuild.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,7 +1,7 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 # We basically extend rpmcheck -from rpmcheck import RpmCheck +from .rpmcheck import RpmCheck class RpmBuild(RpmCheck): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmcheck.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmcheck.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmcheck.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmcheck.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,6 +1,6 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 -from rpmsection import Section +from .rpmsection import Section class RpmCheck(Section): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmcleaner.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmcleaner.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmcleaner.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmcleaner.py 2014-08-13 14:23:57.000000000 +0200 @@ -7,21 +7,21 @@ import shlex import os.path -from rpmsection import Section -from rpmexception import RpmException -from rpmcopyright import RpmCopyright -from rpmdescription import RpmDescription -from rpmprune import RpmClean -from rpmprune import RpmChangelog -from rpmpreamble import RpmPreamble -from rpmpreamble import RpmPackage -from rpmprep import RpmPrep -from rpmbuild import RpmBuild -from rpmcheck import RpmCheck -from rpminstall import RpmInstall -from rpmscriplets import RpmScriptlets -from rpmfiles import RpmFiles -from rpmregexp import RegexpSingle +from .rpmsection import Section +from .rpmexception import RpmException +from .rpmcopyright import RpmCopyright +from .rpmdescription import RpmDescription +from .rpmprune import RpmClean +from .rpmprune import RpmChangelog +from .rpmpreamble import RpmPreamble +from .rpmpreamble import RpmPackage +from .rpmprep import RpmPrep +from .rpmbuild import RpmBuild +from .rpmcheck import RpmCheck +from .rpminstall import RpmInstall +from .rpmscriplets import RpmScriptlets +from .rpmfiles import RpmFiles +from .rpmregexp import RegexpSingle class RpmSpecCleaner: @@ -97,8 +97,10 @@ # check if the current line is starting new section, and if so # 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.reg.re_else.match(line) or self.reg.re_endif.match(line): - if hasattr(self.current_section, 'condition') and not self.current_section.condition: + if self.reg.re_else.match(line) or self.reg.re_endif.match(line) or \ + (type(self.current_section) is Section and self.reg.re_if.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 @@ -107,10 +109,9 @@ for (regexp, newclass) in self.section_starts: if regexp.match(line): # check if we are in if conditional and act accordingly if we change sections - if self._previous_nonempty_line and self.reg.re_if.match(self._previous_nonempty_line): - if hasattr(self.current_section, 'condition'): - self.current_section.condition = False - self.current_section._end_subparagraph(True) + if hasattr(self.current_section, 'condition') and self.current_section.condition: + self.current_section.condition = False + self.current_section._end_subparagraph(True) return newclass # if we still are here and we are just doing copyright @@ -127,8 +128,8 @@ # This avoids deleting %if before %files section that could # be deleted otherwise if isinstance(self.current_section, RpmClean): - if line == '': - return RpmPreamble + if line.strip() == '': + return Section # we are staying in the section return None @@ -150,13 +151,28 @@ line = line.rstrip('\r') new_class = self._detect_new_section(line) + # Following line is debug output with class info + # USE: 'spec-cleaner file > /dev/null' to see the stderr output + #sys.stderr.write("class: '{0}' line: '{1}'\n".format(new_class, line)) if new_class: - self.current_section.output(self.fout) + # We don't want to print newlines before %else and %endif + if new_class == Section and self.reg.re_else.match(line) or self.reg.re_endif.match(line): + newline = False + else: + newline = True + self.current_section.output(self.fout, newline) # we need to sent pkgconfig option to preamble and package if new_class == RpmPreamble or new_class == RpmPackage: self.current_section = new_class(self.specfile, self.pkgconfig) else: self.current_section = new_class(self.specfile) + # skip empty line adding if we are switching sections + if self._previous_line == '' and line == '': + continue + + # Do not store data from clean and skip out here + if isinstance(self.current_section, RpmClean): + continue self.current_section.add(line) self._previous_line = line diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmcopyright.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmcopyright.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmcopyright.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmcopyright.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,9 +1,9 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 import os -import time +import datetime -from rpmsection import Section +from .rpmsection import Section class RpmCopyright(Section): @@ -13,8 +13,10 @@ that are still relevant. Everything else is ignored. """ - copyrights = [] - buildrules = [] + def __init__(self, specfile): + Section.__init__(self, specfile) + self.copyrights = [] + self.buildrules = [] def _add_pkg_header(self): specname = os.path.splitext(os.path.basename(self.spec))[0] @@ -24,7 +26,7 @@ def _create_default_copyright(self): - year = time.strftime('%Y', time.localtime(time.time())) + year = datetime.datetime.now().year return '# Copyright (c) {0} SUSE LINUX Products GmbH, Nuernberg, Germany.'.format(year) @@ -77,7 +79,7 @@ return - def output(self, fout): + def output(self, fout, newline = True): self._add_pkg_header() self._add_copyright() self._add_default_license() @@ -85,4 +87,4 @@ # trailing enters # prep_spec does two so do the same self.lines.append('') self.lines.append('') - Section.output(self, fout) + Section.output(self, fout, newline) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmdescription.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmdescription.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmdescription.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmdescription.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,6 +1,6 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 -from rpmsection import Section +from .rpmsection import Section class RpmDescription(Section): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmfiles.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmfiles.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmfiles.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmfiles.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,6 +1,6 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 -from rpmsection import Section +from .rpmsection import Section class RpmFiles(Section): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpminstall.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpminstall.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpminstall.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpminstall.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,6 +1,6 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 -from rpmsection import Section +from .rpmsection import Section class RpmInstall(Section): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmpreamble.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmpreamble.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmpreamble.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmpreamble.py 2014-08-13 14:23:57.000000000 +0200 @@ -2,9 +2,9 @@ import re -from rpmsection import Section -from fileutils import FileUtils -from rpmexception import RpmException +from .rpmsection import Section +from .fileutils import FileUtils +from .rpmexception import RpmException LICENSES_CHANGES = 'licenses_changes.txt' @@ -33,18 +33,6 @@ line, even if we reorder the lines. """ - # Old storage - _oldstore = [] - - # Is the parsed variable multiline (ending with \) - multiline = False - - # Are we inside of conditional or not - condition = False - - # Is the condition with define or just regular one - _condition_define = False - category_to_key = { 'name': 'Name', 'version': 'Version', @@ -74,6 +62,8 @@ categories_order = [ 'define', 'define_conditions', + 'bconds', + 'bcond_conditions', 'name', 'version', 'release', @@ -122,6 +112,16 @@ def __init__(self, specfile, pkgconfig): Section.__init__(self, specfile) + # Old storage + self._oldstore = [] + # Is the parsed variable multiline (ending with \) + self.multiline = False + # Are we inside of conditional or not + self.condition = False + # Is the condition with define/global variables + self._condition_define = False + # Is the condition based probably on bcond evaluation + self._condition_bcond = False # do we want pkgconfig self.pkgconfig = pkgconfig # dict of license replacement options @@ -278,15 +278,26 @@ # If we are on endif we check the condition content # and if we find the defines we put it on top. - if endif: + if endif or not self.condition: if self._condition_define: + # If we have define conditions and possible bcond start + # we need to put it bellow bcond definitions as otherwise + # the switches do not have any effect + if self._condition_bcond: + self.paragraph['bcond_conditions'] += self.paragraph['conditions'] + else: + self.paragraph['define_conditions'] += self.paragraph['conditions'] # in case the nested condition contains define we consider all parents - # to require to be on top too + # to require to be on top too; if len(self._oldstore) == 0: self._condition_define = False - self.paragraph['define_conditions'] += self.paragraph['conditions'] else: self.paragraph['build_conditions'] += self.paragraph['conditions'] + + # bcond must be reseted when on top and can be set even outside of the + # define scope. So reset it here always + if len(self._oldstore) == 0: + self._condition_bcond = False self.paragraph['conditions'] = [] @@ -303,12 +314,11 @@ self.paragraph[i].sort(key=self._sort_helper_key) for group in self.paragraph[i]: lines += self._add_group(group) - if self.current_group: # the current group was not added to any category. It's just some # random stuff that should be at the end anyway. lines += self._add_group(self.current_group) - + self.current_group = '' return lines @@ -357,6 +367,10 @@ if not self.previous_line.startswith('#'): self.current_group.append('# FIXME: Use %requires_eq macro instead') return [ value ] + # we also skip all various rpm-macroed content as it is usually not easy + # to determine how that should be split + if value.startswith('%'): + return [ value ] tokens = [ item[1] for item in self.reg.re_requires_token.findall(value) ] # Split based on ',' here as it breaks up pattern matching later on @@ -487,6 +501,9 @@ elif self.reg.re_if.match(line): self._add_line_to('conditions', line) self.condition = True + # check for possibility of the bcond conditional + if "%{with" in line or "%{without" in line: + self._condition_bcond = True self._start_subparagraph() self.previous_line = line return @@ -529,7 +546,11 @@ self._add_line_value_to('patch', match.group(3), key = '%sPatch%s%s' % (match.group(1), zero, match.group(2))) return - elif self.reg.re_define.match(line) or self.reg.re_global.match(line) or self.reg.re_bcond_with.match(line): + elif self.reg.re_bcond_with.match(line): + self._add_line_to('bconds', line) + return + + elif self.reg.re_define.match(line) or self.reg.re_global.match(line) or self.reg.re_onelinecond.match(line): self._add_line_to('define', line) if line.endswith('\\'): self.multiline = True @@ -543,7 +564,7 @@ elif self.reg.re_prereq.match(line): match = self.reg.re_prereq.match(line) # add the comment about using proper macro which needs investingaton - if not self.previous_line.startswith('#'): + if not self.previous_line.startswith('#') and not self.previous_line.startswith('PreReq'): self.current_group.append('# FIXME: use proper Requires(pre/post/preun/...)') self._add_line_value_to('prereq', match.group(1)) return @@ -615,12 +636,10 @@ self._add_line_to('misc', line) - def output(self, fout): + def output(self, fout, newline = True): lines = self._end_paragraph() self.lines += lines - # append empty line to the end of the section - self.lines.append('') - Section.output(self, fout) + Section.output(self, fout, newline) class RpmPackage(RpmPreamble): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmprep.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmprep.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmprep.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmprep.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,6 +1,6 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 -from rpmsection import Section +from .rpmsection import Section class RpmPrep(Section): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmprune.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmprune.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmprune.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmprune.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,6 +1,6 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 -from rpmsection import Section +from .rpmsection import Section class RpmClean(Section): @@ -9,7 +9,7 @@ """ - def output(self, fout): + def output(self, fout, newline = True): pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmregexp.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmregexp.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmregexp.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmregexp.py 2014-08-13 14:23:57.000000000 +0200 @@ -3,7 +3,7 @@ import re import os -from fileutils import FileUtils +from .fileutils import FileUtils class Singleton: def __init__(self, klass): @@ -29,7 +29,7 @@ re_spec_install = re.compile('^%install\s*$', re.IGNORECASE) re_spec_clean = re.compile('^%clean\s*$', re.IGNORECASE) re_spec_check = re.compile('^%check\s*$', re.IGNORECASE) - re_spec_scriptlets = re.compile('(?:^%pretrans\s*)|(?:^%pre\s*)|(?:^%post\s*)|(?:^%preun\s*)|(?:^%postun\s*)|(?:^%posttrans\s*)', re.IGNORECASE) + re_spec_scriptlets = re.compile('(?:^%pretrans\s*)|(?:^%pre\s*)|(?:^%post\s*)|(?:^%verifyscript\s*)|(?:^%preun\s*)|(?:^%postun\s*)|(?:^%posttrans\s*)', re.IGNORECASE) re_spec_files = re.compile('^%files\s*', re.IGNORECASE) re_spec_changelog = re.compile('^%changelog\s*$', re.IGNORECASE) @@ -63,12 +63,13 @@ re_epoch = re.compile('^\s*Epoch:\s*(.*)', re.IGNORECASE) re_define = re.compile('^\s*%define\s*(.*)', re.IGNORECASE) re_global = re.compile('^\s*%global\s*(.*)', re.IGNORECASE) - re_bcond_with = re.compile('^\s*%bcond_with\s*(.*)', re.IGNORECASE) + re_bcond_with = re.compile('^\s*%bcond_with(out)?\s*(.*)', re.IGNORECASE) re_requires_token = re.compile('(\s*([^<>=\s]+(\s*[<>=]+\s*[^<>=\s]+)?)\s*)') re_autoreqprov = re.compile('^\s*AutoReqProv:.*$', re.IGNORECASE) # here we need to grab all submacros with rpm calls so just match almost everything re_rpm_command = re.compile('%\(.*\)') re_requires_eq = re.compile('^\s*%requires_eq\s*(.*)') + re_onelinecond = re.compile('^\s*%{!?[^?]*\?[^:]+:[^}]+}') # rpmbuild re_jobs = re.compile('%{(_smp_mflags|\?_smp_flags|\?jobs:\s*-j\s*%(jobs|{jobs}))}') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmscriplets.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmscriplets.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmscriplets.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmscriplets.py 2014-08-13 14:23:57.000000000 +0200 @@ -1,6 +1,6 @@ # vim: set ts=4 sw=4 et: coding=UTF-8 -from rpmsection import Section +from .rpmsection import Section class RpmScriptlets(Section): @@ -8,7 +8,7 @@ Do %post -p /sbin/ldconfig when only scriplet command is /sbin/ldconfig ''' - def output(self, fout): + def output(self, fout, newline = True): # if we have 2 or 3 lines where last one is empty nolines = len(self.lines) if nolines == 2 or ( nolines == 3 and self.lines[2] == ''): @@ -17,4 +17,4 @@ self.lines = [] self.lines.append('{0} -p /sbin/ldconfig'.format(pkg)) self.lines.append('') - Section.output(self, fout) + Section.output(self, fout, newline) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmsection.py new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmsection.py --- old/spec-cleaner-spec-cleaner-0.5.9/spec_cleaner/rpmsection.py 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/spec_cleaner/rpmsection.py 2014-08-13 14:23:57.000000000 +0200 @@ -2,7 +2,7 @@ import re -from rpmregexp import RegexpSingle +from .rpmregexp import RegexpSingle class Section(object): """ @@ -56,12 +56,23 @@ self.previous_line = line - def output(self, fout): - # always append one empty line at the end if it is not present + def output(self, fout, newline = True): + # Always append one empty line at the end if it is not present # and changelog is trailing part of our spec so do not put nothing # bellow - if self.lines[-1] != '' and self.lines[-1] != '%changelog': - self.lines.append('') + # Also if we are jumping away just after writing one macroed line + # we don't want to create new line + if len(self.lines) >= 1: + if self.lines[-1] != '' and \ + self.lines[-1] != '%changelog' and not \ + self.lines[-1].startswith('%if') and \ + newline: + self.lines.append('') + # remove the newlines around ifs if they are not wanted + if self.lines[-1] == '' and \ + (self.lines[-2].startswith('%if') or + self.lines[-2].startswith('%else')): + self.lines.pop() for line in self.lines: fout.write(line + '\n') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/README new/spec-cleaner-spec-cleaner-0.6.1/tests/README --- old/spec-cleaner-spec-cleaner-0.5.9/tests/README 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/README 1970-01-01 01:00:00.000000000 +0100 @@ -1,10 +0,0 @@ -This is test folder for spec-cleaner repository. - -There are 3 folders in, out and tmp. - -For each spec in the in folder there should be respective -spec in out folder with desired formatting. - -The tmp folder is used for holding the generated spec file -which if differ from out content will fail the testsuite. - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/acceptance-tests.py new/spec-cleaner-spec-cleaner-0.6.1/tests/acceptance-tests.py --- old/spec-cleaner-spec-cleaner-0.5.9/tests/acceptance-tests.py 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/acceptance-tests.py 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,107 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# + +import unittest +import os +import shutil +import tempfile +import difflib +import datetime +from mock import patch + +from spec_cleaner import RpmSpecCleaner + +class TestCompare(unittest.TestCase): + """ + We run individual tests to verify the content compared to expected results + """ + + def setUp(self): + """ + Declare global scope variables for further use. + """ + + self.input_dir = self._get_input_dir() + self.fixtures_dir = self._get_fixtures_dir() + self.tmp_dir = tempfile.mkdtemp() + self.tmp_file_rerun = tempfile.NamedTemporaryFile() + + def tearDown(self): + """ + Remove the tmp directory + """ + shutil.rmtree(self.tmp_dir) + + def _difftext(self, lines1, lines2, junk=None): + junk = junk or (' ', '\t') + # result is a generator + result = difflib.ndiff(lines1, lines2, charjunk=lambda x: x in junk) + read = [] + for line in result: + read.append(line) + # lines that don't start with a ' ' are diff ones + if not line.startswith(' '): + self.fail(''.join(read + list(result))) + + def assertStreamEqual(self, stream1, stream2, junk=None): + """compare two streams (using difflib and readlines())""" + # if stream2 is stream2, readlines() on stream1 will also read lines + # in stream2, so they'll appear different, although they're not + if stream1 is stream2: + return + # make sure we compare from the beginning of the stream + stream1.seek(0) + stream2.seek(0) + # ocmpare + self._difftext(stream1.readlines(), stream2.readlines(), junk) + + def _get_input_dir(self): + """ + Return path for input files used by tests + """ + return os.path.join(os.getcwd(), 'tests/in/') + + def _get_fixtures_dir(self): + """ + Return path for representative output specs + """ + return os.path.join(os.getcwd(), 'tests/out/') + + def _obtain_list_of_tests(self): + """ + Generate list of tests we are going to use according to what is on hdd + """ + + test_files = list() + + for spec in os.listdir(self.fixtures_dir): + if spec.endswith(".spec"): + test_files.append(spec) + + return test_files + + def _run_individual_test(self, infile, outfile): + """ + Run the cleaner as specified and store the output for further comparison. + """ + cleaner = RpmSpecCleaner(infile, outfile, True, False, False, 'vimdiff') + cleaner.run() + + @patch('spec_cleaner.rpmcopyright.datetime') + def test_input_files(self, datetime_mock): + datetime_mock.datetime.now.return_value = (datetime.datetime(2013, 1, 1)) + for test in self._obtain_list_of_tests(): + infile = os.path.join(self.input_dir, test) + compare = os.path.join(self.fixtures_dir, test) + tmp_file = os.path.join(self.tmp_dir, test) + + # first try to generate cleaned content from messed up + self._run_individual_test(infile, tmp_file) + with open(compare) as ref, open(tmp_file) as test: + self.assertStreamEqual(ref, test) + + # second run it again while ensuring it didn't change + self._run_individual_test(tmp_file, self.tmp_file_rerun.name) + with open(compare) as ref, open(self.tmp_file_rerun.name) as test: + self.assertStreamEqual(ref, test) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/in/bconds.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/in/bconds.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/in/bconds.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/in/bconds.spec 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,46 @@ +%{!?aarch64:%global aarch64 aarch64 arm64 armv8} +%global jit_arches %ix86 x86_64 %{aarch64} ppc64 ppc64le +%global test_arches %ix86 x86_64 ppc64 ppc64le +%global icedtea_version 2.5.1 +%global icedtea_sound_version 1.0.1 +%global mauvedate 2008-10-22 +%global buildoutputdir openjdk.build/ +# Convert an absolute path to a relative path. Each symbolic link is +# specified relative to the directory in which it is installed so that +# it will resolve properly within chrooted installations. +%global script 'use File::Spec; print File::Spec->abs2rel($ARGV[0], $ARGV[1])' +%global abs2rel perl -e %{script} +# Standard JPackage naming and versioning defines. +%global priority 17147 +%global javaver 1.7.0 +%global buildver 65 +# Standard JPackage directories and symbolic links. +%global sdklnk java-%{javaver}-openjdk +%global archname %{sdklnk} +%global jrelnk jre-%{javaver}-openjdk +%global sdkdir %{sdklnk}-%{javaver} +%global jredir %{sdkdir}/jre +%global sdkbindir %{_jvmdir}/%{sdklnk}/bin +%global jrebindir %{_jvmdir}/%{jrelnk}/bin +%global jvmjardir %{_jvmjardir}/%{sdkdir} +%global jvmjarlink %{_jvmjardir}/%{sdklnk} +# Prevent brp-java-repack-jars from being run. +%global __jar_repack 0 +# cacert symlink +%global cacerts %{_jvmdir}/%{jredir}/lib/security/cacerts +# real file made by update-ca-certificates +%global javacacerts %{_var}/lib/ca-certificates/java-cacerts +%global with_default_hotspot_tarball 1 +%ifarch %{aarch64} +%global _with_bootstrap 1 +%global _with_zero 1 +%endif +# turn zero on non jit arches by default +%ifnarch %{jit_arches} +%global _with_zero 1 +%endif +%bcond_with zero +%bcond_without bootstrap +%if %{with zero} +%define something 1 +%endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/in/cleansectionbig.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/in/cleansectionbig.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/in/cleansectionbig.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/in/cleansectionbig.spec 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,29 @@ + +%clean +rm -rf %{buildroot} + +%if 0%{?suse_version} +# TODO(must): Determine sensible non-SUSE versions of these, +# in particular restart_on_update and stop_on_removal. + +%verifyscript +%verify_permissions -e %{_sbindir}/hawk_chkpwd +%verify_permissions -e %{_sbindir}/hawk_invoke + +%pre +%service_add_pre hawk.service + +%post +%set_permissions %{_sbindir}/hawk_chkpwd +%set_permissions %{_sbindir}/hawk_invoke +%service_add_post hawk.service + +%preun +%service_del_preun hawk.service + +%postun +%service_del_postun hawk.service + +%triggerin -- lighttpd +%restart_on_update hawk +%endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/in/requires.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/in/requires.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/in/requires.spec 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/in/requires.spec 2014-08-13 14:23:57.000000000 +0200 @@ -6,6 +6,9 @@ Requires: aaa<3.2.1 zzz pkgconfig(glib-2.0) perl(DBD::SQLite) Requires: rrr >= %{version} kkk -PreReq: iii <= 4.2.1 jjj> %{version} eee=%{version}-%{release} bbb +PreReq: iii <= 4.2.1 jjj> %{version} eee=%{version}-%{release} aaa PreReq: aaa<3.2.1 zzz PreReq: rrr >= %{version} kkk + +BuildRequires: %{rubygem fast_gettext} +BuildRequires: %{rubygem rails >= 3.2} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/bconds.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/bconds.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/bconds.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/bconds.spec 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,65 @@ +# +# spec file for package bconds +# +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# 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 +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# 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/ +# + + +%{!?aarch64:%global aarch64 aarch64 arm64 armv8} +%global jit_arches %ix86 x86_64 %{aarch64} ppc64 ppc64le +%global test_arches %ix86 x86_64 ppc64 ppc64le +%global icedtea_version 2.5.1 +%global icedtea_sound_version 1.0.1 +%global mauvedate 2008-10-22 +%global buildoutputdir openjdk.build/ +# Convert an absolute path to a relative path. Each symbolic link is +# specified relative to the directory in which it is installed so that +# it will resolve properly within chrooted installations. +%global script 'use File::Spec; print File::Spec->abs2rel($ARGV[0], $ARGV[1])' +%global abs2rel perl -e %{script} +# Standard JPackage naming and versioning defines. +%global priority 17147 +%global javaver 1.7.0 +%global buildver 65 +# Standard JPackage directories and symbolic links. +%global sdklnk java-%{javaver}-openjdk +%global archname %{sdklnk} +%global jrelnk jre-%{javaver}-openjdk +%global sdkdir %{sdklnk}-%{javaver} +%global jredir %{sdkdir}/jre +%global sdkbindir %{_jvmdir}/%{sdklnk}/bin +%global jrebindir %{_jvmdir}/%{jrelnk}/bin +%global jvmjardir %{_jvmjardir}/%{sdkdir} +%global jvmjarlink %{_jvmjardir}/%{sdklnk} +# Prevent brp-java-repack-jars from being run. +%global __jar_repack 0 +# cacert symlink +%global cacerts %{_jvmdir}/%{jredir}/lib/security/cacerts +# real file made by update-ca-certificates +%global javacacerts %{_var}/lib/ca-certificates/java-cacerts +%global with_default_hotspot_tarball 1 +%ifarch %{aarch64} +%global _with_bootstrap 1 +%global _with_zero 1 +%endif +# turn zero on non jit arches by default +%ifnarch %{jit_arches} +%global _with_zero 1 +%endif +%bcond_with zero +%bcond_without bootstrap +%if %{with zero} +%define something 1 +%endif + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/cleansection.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/cleansection.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/cleansection.spec 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/cleansection.spec 2014-08-13 14:23:57.000000000 +0200 @@ -20,7 +20,6 @@ install bla %ifarch x86 - %files -n something %defattr(-,root,root) /bin/bla diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/cleansectionbig.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/cleansectionbig.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/cleansectionbig.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/cleansectionbig.spec 2014-08-13 14:23:57.000000000 +0200 @@ -0,0 +1,44 @@ +# +# spec file for package cleansectionbig +# +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# 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 +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# 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/ +# + + +%if 0%{?suse_version} +# TODO(must): Determine sensible non-SUSE versions of these, +# in particular restart_on_update and stop_on_removal. + +%verifyscript +%verify_permissions -e %{_sbindir}/hawk_chkpwd +%verify_permissions -e %{_sbindir}/hawk_invoke + +%pre +%service_add_pre hawk.service + +%post +%set_permissions %{_sbindir}/hawk_chkpwd +%set_permissions %{_sbindir}/hawk_invoke +%service_add_post hawk.service + +%preun +%service_del_preun hawk.service + +%postun +%service_del_postun hawk.service + +%triggerin -- lighttpd +%restart_on_update hawk +%endif + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/conditionalpkgs.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/conditionalpkgs.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/conditionalpkgs.spec 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/conditionalpkgs.spec 2014-08-13 14:23:57.000000000 +0200 @@ -49,16 +49,14 @@ http://httpd.apache.org/docs-2.2/upgrading.html. %if %{worker} - %package worker Summary: Apache 2 worker MPM (Multi-Processing Module) Group: Productivity/Networking/Web/Servers Requires: %{name} = %{version} Provides: %{pname}-MPM - %endif -%if %{prefork} +%if %{prefork} %package prefork Summary: Apache 2 "prefork" MPM (Multi-Processing Module) Group: Productivity/Networking/Web/Servers @@ -67,24 +65,21 @@ %if 0%{?suse_version} >= 901 && 0%{?sles_version} != 9 Provides: apache:%{_sbindir}/httpd %endif - %endif -%if %{event} +%if %{event} %package event Summary: Apache 2 event MPM (Multi-Processing Module) Group: Productivity/Networking/Web/Servers Requires: %{name} = %{version} Provides: %{pname}-MPM - %endif -%if %{itk} +%if %{itk} %package itk Summary: Apache 2 "ITK" MPM (Multi-Processing Module) Group: Productivity/Networking/Web/Servers Requires: %{name} = %{version} Provides: %{pname}-MPM - %endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/conditions.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/conditions.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/conditions.spec 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/conditions.spec 2014-08-13 14:23:57.000000000 +0200 @@ -32,7 +32,6 @@ %if %{distro} == "suse" # FIXME: use proper Requires(pre/post/preun/...) PreReq: %insserv_prereq -# FIXME: use proper Requires(pre/post/preun/...) PreReq: aaa_base %endif %if %{with editor} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/requires.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/requires.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/requires.spec 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/requires.spec 2014-08-13 14:23:57.000000000 +0200 @@ -16,6 +16,8 @@ # +BuildRequires: %{rubygem fast_gettext} +BuildRequires: %{rubygem rails >= 3.2} BuildRequires: aaa < 3.2.1 BuildRequires: bbb BuildRequires: eee = %{version}-%{release} @@ -35,13 +37,11 @@ Requires: zzz Requires: pkgconfig(glib-2.0) # FIXME: use proper Requires(pre/post/preun/...) +PreReq: aaa PreReq: aaa < 3.2.1 -# FIXME: use proper Requires(pre/post/preun/...) -PreReq: bbb PreReq: eee = %{version}-%{release} PreReq: iii <= 4.2.1 PreReq: jjj > %{version} -# FIXME: use proper Requires(pre/post/preun/...) PreReq: kkk PreReq: rrr >= %{version} PreReq: zzz diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/rpmcallpkg.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/rpmcallpkg.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/rpmcallpkg.spec 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/rpmcallpkg.spec 2014-08-13 14:23:57.000000000 +0200 @@ -17,7 +17,6 @@ %if %{with kde4} - %package -n %{name}-client-kde4 Summary: KDE 4 Backend for sflphone Group: Productivity/Telephony/SIP/Clients diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/out/sourcespatches.spec new/spec-cleaner-spec-cleaner-0.6.1/tests/out/sourcespatches.spec --- old/spec-cleaner-spec-cleaner-0.5.9/tests/out/sourcespatches.spec 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/out/sourcespatches.spec 2014-08-13 14:23:57.000000000 +0200 @@ -16,10 +16,10 @@ # -%bcond_with self_hosting # this is crazy define %define root %{version} %global test somethingelse +%bcond_with self_hosting Source: testfile.tar.bz2 Source2: testfile2.tar.bz2 Source15: anothersource.tar.xz diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec-cleaner-spec-cleaner-0.5.9/tests/tmp/.gitignore new/spec-cleaner-spec-cleaner-0.6.1/tests/tmp/.gitignore --- old/spec-cleaner-spec-cleaner-0.5.9/tests/tmp/.gitignore 2014-07-08 13:17:58.000000000 +0200 +++ new/spec-cleaner-spec-cleaner-0.6.1/tests/tmp/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -*.spec -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org