openSUSE Commits
Threads by month
- ----- 2025 -----
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
September 2015
- 1 participants
- 1128 discussions
Hello community,
here is the log from the commit of package python3-fixtures for openSUSE:Factory checked in at 2015-09-30 05:49:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-fixtures (Old)
and /work/SRC/openSUSE:Factory/.python3-fixtures.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-fixtures"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-fixtures/python3-fixtures.changes 2015-05-11 19:49:16.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python3-fixtures.new/python3-fixtures.changes 2015-09-30 05:49:27.000000000 +0200
@@ -1,0 +2,16 @@
+Tue Jun 30 23:06:13 UTC 2015 - arun(a)gmx.de
+
+- update to version 1.3.1:
+ * Clarify the intent around _setUp
+ * Handle BaseException resource leaks as well
+
+- changes from version 1.3.0:
+ * Remove trailing whitespace
+ * Deal with resource leaks during setUp
+ * Missed NEWS entry
+ * Fine tune the mock patch
+ * Add a new mockpatch fixture
+ * Document where the project home and source are
+ * Ignore built things
+
+-------------------------------------------------------------------
Old:
----
fixtures-1.2.0.tar.gz
New:
----
fixtures-1.3.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-fixtures.spec ++++++
--- /var/tmp/diff_new_pack.Mf9tpT/_old 2015-09-30 05:49:28.000000000 +0200
+++ /var/tmp/diff_new_pack.Mf9tpT/_new 2015-09-30 05:49:28.000000000 +0200
@@ -17,7 +17,7 @@
Name: python3-fixtures
-Version: 1.2.0
+Version: 1.3.1
Release: 0
Summary: Fixtrues, reusable state for writing clean tests and more
License: Apache-2.0 or BSD-3-Clause
++++++ fixtures-1.2.0.tar.gz -> fixtures-1.3.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/AUTHORS new/fixtures-1.3.1/AUTHORS
--- old/fixtures-1.2.0/AUTHORS 2015-05-05 00:14:19.000000000 +0200
+++ new/fixtures-1.3.1/AUTHORS 2015-06-30 04:22:04.000000000 +0200
@@ -9,6 +9,7 @@
Jonathan Lange <jml(a)canonical.com>
Jonathan Lange <jml(a)mumak.net>
Joshua Harlow <harlowja(a)yahoo-inc.com>
+Julien Danjou <julien(a)danjou.info>
Martin Pool <mbp(a)canonical.com>
Robert Collins <robertc(a)robertcollins.net>
Sean Dague <sean(a)dague.net>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/ChangeLog new/fixtures-1.3.1/ChangeLog
--- old/fixtures-1.2.0/ChangeLog 2015-05-05 00:14:19.000000000 +0200
+++ new/fixtures-1.3.1/ChangeLog 2015-06-30 04:22:04.000000000 +0200
@@ -1,6 +1,25 @@
CHANGES
=======
+1.3.1
+-----
+
+* Release 1.3.1
+* Clarify the intent around _setUp
+* Handle BaseException resource leaks as well
+
+1.3.0
+-----
+
+* Release 1.3.0
+* Remove trailing whitespace
+* Deal with resource leaks during setUp
+* Missed NEWS entry
+* Fine tune the mock patch
+* Add a new mockpatch fixture
+* Document where the project home and source are
+* Ignore built things
+
1.2.0
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/NEWS new/fixtures-1.3.1/NEWS
--- old/fixtures-1.2.0/NEWS 2015-05-04 23:50:18.000000000 +0200
+++ new/fixtures-1.3.1/NEWS 2015-06-30 04:21:13.000000000 +0200
@@ -6,6 +6,27 @@
NEXT
~~~~
+1.3.1
+~~~~~
+
+* ``Fixture.setUp`` now uses a bare except: and will thus catch BaseException.
+ Any non-Exception-subclass errors are raised verbatim after calling
+ ``cleanUp``, to avoid inappropriate masking in callers. (Robert Collins)
+
+1.3.0
+~~~~~
+
+* Add MockPatch, MockPatchMultiple, MockPatchObject - adapters to mock.
+ (Julien Danjou, Robert Collins)
+
+* Fixture.setUp should no longer be overridden in subclasses. Instead
+ override _setUp. This permits the Fixture base class to detect failures
+ during _setUp and trigger any registered cleanups, attach any details
+ to the failure exception and propogate that to callers. Overriding of
+ setUp is still supported: this adds a new interface for simpler
+ implementation of the contract of a fixture.
+ (Robert Collins, #1456361, #1456353)
+
1.2.0
~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/PKG-INFO new/fixtures-1.3.1/PKG-INFO
--- old/fixtures-1.2.0/PKG-INFO 2015-05-05 00:14:19.000000000 +0200
+++ new/fixtures-1.3.1/PKG-INFO 2015-06-30 04:22:04.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: fixtures
-Version: 1.2.0
+Version: 1.3.1
Summary: Fixtures, reusable state for writing clean tests and more.
Home-page: https://launchpad.net/python-fixtures
Author: Robert Collins
@@ -87,19 +87,20 @@
Creating Fixtures
=================
- Minimally, subclass Fixture, define setUp to initialize your state and schedule
+ Minimally, subclass Fixture, define _setUp to initialize your state and schedule
a cleanup for when cleanUp is called and you're done::
>>> import unittest
>>> import fixtures
>>> class NoddyFixture(fixtures.Fixture):
- ... def setUp(self):
- ... super(NoddyFixture, self).setUp()
+ ... def _setUp(self):
... self.frobnozzle = 42
... self.addCleanup(delattr, self, 'frobnozzle')
- This will initialize frobnozzle when setUp is called, and when cleanUp is
- called get rid of the frobnozzle attribute.
+ This will initialize frobnozzle when ``setUp`` is called, and when ``cleanUp``
+ is called get rid of the frobnozzle attribute. Prior to version 1.3.0 fixtures
+ recommended overriding ``setUp``. This is still supported, but since it is
+ harder to write leak-free fixtures in this fashion, it is not recommended.
If your fixture has diagnostic data - for instance the log file of an
application server, or log messages, it can expose that by creating a content
@@ -107,8 +108,7 @@
>>> from testtools.content import text_content
>>> class WithLog(fixtures.Fixture):
- ... def setUp(self):
- ... super(WithLog, self).setUp()
+ ... def _setUp(self):
... self.addDetail('message', text_content('foo bar baz'))
The method ``useFixture`` will use another fixture, call ``setUp`` on it, call
@@ -116,8 +116,7 @@
the fixture. This allows simple composition of different fixtures.
>>> class ReusingFixture(fixtures.Fixture):
- ... def setUp(self):
- ... super(ReusingFixture, self).setUp()
+ ... def _setUp(self):
... self.noddy = self.useFixture(NoddyFixture())
There is a helper for adapting a function or function pair into Fixtures. it
@@ -162,9 +161,9 @@
clean up after a fixture has been used, all fixtures define a ``cleanUp``
method which should be called when a fixture is finished with.
- Because its nice to be able to build a particular set of related fixtures in
- advance of using them, fixtures also have define a ``setUp`` method which
- should be called before trying to use them.
+ Because it's nice to be able to build a particular set of related fixtures in
+ advance of using them, fixtures also have a ``setUp`` method which should be
+ called before trying to use them.
One common desire with fixtures that are expensive to create is to reuse them
in many test cases; to support this the base Fixture also defines a ``reset``
@@ -211,8 +210,7 @@
>>> import sys
>>> from fixtures.fixture import MultipleExceptions
>>> class BrokenFixture(fixtures.Fixture):
- ... def setUp(self):
- ... fixtures.Fixture.setUp(self)
+ ... def _setUp(self):
... self.addCleanup(lambda:1/0)
... self.addCleanup(lambda:1/0)
>>> fixture = BrokenFixture()
@@ -226,12 +224,32 @@
Fixtures often expose diagnostic details that can be useful for tracking down
issues. The ``getDetails`` method will return a dict of all the attached
- details. Each detail object is an instance of ``testtools.content.Content``.
+ details, but can only be called before ``cleanUp`` is called. Each detail
+ object is an instance of ``testtools.content.Content``.
>>> with WithLog() as l:
... print(l.getDetails()['message'].as_text())
foo bar baz
+ Errors in setUp
+ +++++++++++++++
+
+ The examples above used ``_setUp`` rather than ``setUp`` because the base
+ class implementation of ``setUp`` acts to reduce the chance of leaking
+ external resources if an error is raised from ``_setUp``. Specifically,
+ ``setUp`` contains a try:/except: block which catches all exceptions, captures
+ any registered detail objects, and calls ``self.cleanUp`` before propogating
+ the error. As long as you take care to register any cleanups before calling
+ the code that may fail, this will cause them to be cleaned up. The captured
+ detail objects are provided to the args of the raised exception.
+
+ If the error that occured was a subclass of ``Exception`` then ``setUp`` will
+ raise ``MultipleExceptions`` with the last element being a ``SetupError`` that
+ contains the detail objects. Otherwise, to prevent causing normally
+ uncatchable errors like KeyboardInterrupt being caught inappropriately in the
+ calling layer, the original exception will be raised as-is and no diagnostic
+ data other than that from the original exception will be available.
+
Shared Dependencies
+++++++++++++++++++
@@ -308,7 +326,8 @@
In addition to the Fixture, FunctionFixture and MethodFixture classes fixtures
includes a number of precanned fixtures. The API docs for fixtures will list
- the complete set of these, should the dcs be out of date or not to hand.
+ the complete set of these, should the dcs be out of date or not to hand. For
+ the complete feature set of each fixture please see the API docs.
ByteStream
++++++++++
@@ -348,6 +367,34 @@
>>> from testtools.compat import BytesIO
>>> fixture = fixtures.FakePopen(lambda _:{'stdout': BytesIO('foobar')})
+ MockPatchObject
+ +++++++++++++++
+
+ Adapts ``mock.patch.object`` to be used as a Fixture.
+
+ >>> class Fred:
+ ... value = 1
+ >>> fixture = fixtures.MockPatchObject(Fred, 'value', 2)
+ >>> with fixture:
+ ... Fred().value
+ 2
+ >>> Fred().value
+ 1
+
+ MockPatch
+ +++++++++
+
+ Adapts ``mock.patch`` to be used as a Fixture.
+
+ >>> fixture = fixtures.MockPatch('subprocess.Popen.returncode', 3)
+
+ MockPatchMultiple
+ +++++++++++++++++
+
+ Adapts ``mock.patch.multiple`` to be used as a Fixture.
+
+ >>> fixture = fixtures.MockPatch('subprocess.Popen', returncode=3)
+
MonkeyPatch
+++++++++++
@@ -447,6 +494,13 @@
*Note:* Currently supported only on Unix because it relies on the ``alarm``
system call.
+ Contributing
+ ============
+
+ Fixtures has its project homepage on Launchpad
+ <https://launchpad.net/python-fixtures>. Source code is hosted on GitHub
+ <https://github.com/testing-cabal/fixtures>.
+
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/README new/fixtures-1.3.1/README
--- old/fixtures-1.2.0/README 2014-09-25 04:37:13.000000000 +0200
+++ new/fixtures-1.3.1/README 2015-06-30 02:56:38.000000000 +0200
@@ -79,19 +79,20 @@
Creating Fixtures
=================
-Minimally, subclass Fixture, define setUp to initialize your state and schedule
+Minimally, subclass Fixture, define _setUp to initialize your state and schedule
a cleanup for when cleanUp is called and you're done::
>>> import unittest
>>> import fixtures
>>> class NoddyFixture(fixtures.Fixture):
- ... def setUp(self):
- ... super(NoddyFixture, self).setUp()
+ ... def _setUp(self):
... self.frobnozzle = 42
... self.addCleanup(delattr, self, 'frobnozzle')
-This will initialize frobnozzle when setUp is called, and when cleanUp is
-called get rid of the frobnozzle attribute.
+This will initialize frobnozzle when ``setUp`` is called, and when ``cleanUp``
+is called get rid of the frobnozzle attribute. Prior to version 1.3.0 fixtures
+recommended overriding ``setUp``. This is still supported, but since it is
+harder to write leak-free fixtures in this fashion, it is not recommended.
If your fixture has diagnostic data - for instance the log file of an
application server, or log messages, it can expose that by creating a content
@@ -99,8 +100,7 @@
>>> from testtools.content import text_content
>>> class WithLog(fixtures.Fixture):
- ... def setUp(self):
- ... super(WithLog, self).setUp()
+ ... def _setUp(self):
... self.addDetail('message', text_content('foo bar baz'))
The method ``useFixture`` will use another fixture, call ``setUp`` on it, call
@@ -108,8 +108,7 @@
the fixture. This allows simple composition of different fixtures.
>>> class ReusingFixture(fixtures.Fixture):
- ... def setUp(self):
- ... super(ReusingFixture, self).setUp()
+ ... def _setUp(self):
... self.noddy = self.useFixture(NoddyFixture())
There is a helper for adapting a function or function pair into Fixtures. it
@@ -154,9 +153,9 @@
clean up after a fixture has been used, all fixtures define a ``cleanUp``
method which should be called when a fixture is finished with.
-Because its nice to be able to build a particular set of related fixtures in
-advance of using them, fixtures also have define a ``setUp`` method which
-should be called before trying to use them.
+Because it's nice to be able to build a particular set of related fixtures in
+advance of using them, fixtures also have a ``setUp`` method which should be
+called before trying to use them.
One common desire with fixtures that are expensive to create is to reuse them
in many test cases; to support this the base Fixture also defines a ``reset``
@@ -203,8 +202,7 @@
>>> import sys
>>> from fixtures.fixture import MultipleExceptions
>>> class BrokenFixture(fixtures.Fixture):
- ... def setUp(self):
- ... fixtures.Fixture.setUp(self)
+ ... def _setUp(self):
... self.addCleanup(lambda:1/0)
... self.addCleanup(lambda:1/0)
>>> fixture = BrokenFixture()
@@ -218,12 +216,32 @@
Fixtures often expose diagnostic details that can be useful for tracking down
issues. The ``getDetails`` method will return a dict of all the attached
-details. Each detail object is an instance of ``testtools.content.Content``.
+details, but can only be called before ``cleanUp`` is called. Each detail
+object is an instance of ``testtools.content.Content``.
>>> with WithLog() as l:
... print(l.getDetails()['message'].as_text())
foo bar baz
+Errors in setUp
++++++++++++++++
+
+The examples above used ``_setUp`` rather than ``setUp`` because the base
+class implementation of ``setUp`` acts to reduce the chance of leaking
+external resources if an error is raised from ``_setUp``. Specifically,
+``setUp`` contains a try:/except: block which catches all exceptions, captures
+any registered detail objects, and calls ``self.cleanUp`` before propogating
+the error. As long as you take care to register any cleanups before calling
+the code that may fail, this will cause them to be cleaned up. The captured
+detail objects are provided to the args of the raised exception.
+
+If the error that occured was a subclass of ``Exception`` then ``setUp`` will
+raise ``MultipleExceptions`` with the last element being a ``SetupError`` that
+contains the detail objects. Otherwise, to prevent causing normally
+uncatchable errors like KeyboardInterrupt being caught inappropriately in the
+calling layer, the original exception will be raised as-is and no diagnostic
+data other than that from the original exception will be available.
+
Shared Dependencies
+++++++++++++++++++
@@ -300,7 +318,8 @@
In addition to the Fixture, FunctionFixture and MethodFixture classes fixtures
includes a number of precanned fixtures. The API docs for fixtures will list
-the complete set of these, should the dcs be out of date or not to hand.
+the complete set of these, should the dcs be out of date or not to hand. For
+the complete feature set of each fixture please see the API docs.
ByteStream
++++++++++
@@ -340,6 +359,34 @@
>>> from testtools.compat import BytesIO
>>> fixture = fixtures.FakePopen(lambda _:{'stdout': BytesIO('foobar')})
+MockPatchObject
++++++++++++++++
+
+Adapts ``mock.patch.object`` to be used as a Fixture.
+
+ >>> class Fred:
+ ... value = 1
+ >>> fixture = fixtures.MockPatchObject(Fred, 'value', 2)
+ >>> with fixture:
+ ... Fred().value
+ 2
+ >>> Fred().value
+ 1
+
+MockPatch
++++++++++
+
+Adapts ``mock.patch`` to be used as a Fixture.
+
+ >>> fixture = fixtures.MockPatch('subprocess.Popen.returncode', 3)
+
+MockPatchMultiple
++++++++++++++++++
+
+Adapts ``mock.patch.multiple`` to be used as a Fixture.
+
+ >>> fixture = fixtures.MockPatch('subprocess.Popen', returncode=3)
+
MonkeyPatch
+++++++++++
@@ -438,3 +485,10 @@
*Note:* Currently supported only on Unix because it relies on the ``alarm``
system call.
+
+Contributing
+============
+
+Fixtures has its project homepage on Launchpad
+<https://launchpad.net/python-fixtures>. Source code is hosted on GitHub
+<https://github.com/testing-cabal/fixtures>.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/__init__.py new/fixtures-1.3.1/fixtures/__init__.py
--- old/fixtures-1.2.0/fixtures/__init__.py 2015-05-04 23:49:57.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/__init__.py 2015-06-22 08:56:00.000000000 +0200
@@ -54,12 +54,17 @@
'LogHandler',
'LoggerFixture',
'MethodFixture',
+ 'MockPatch',
+ 'MockPatchMultiple',
+ 'MockPatchObject',
'MonkeyPatch',
+ 'MultipleExceptions',
'NestedTempfile',
'PackagePathEntry',
'PopenFixture',
'PythonPackage',
'PythonPathEntry',
+ 'SetupError',
'StringStream',
'TempDir',
'TempHomeDir',
@@ -76,6 +81,8 @@
Fixture,
FunctionFixture,
MethodFixture,
+ MultipleExceptions,
+ SetupError,
)
from fixtures._fixtures import (
ByteStream,
@@ -86,6 +93,9 @@
FakePopen,
LoggerFixture,
LogHandler,
+ MockPatch,
+ MockPatchMultiple,
+ MockPatchObject,
MonkeyPatch,
NestedTempfile,
PackagePathEntry,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/__init__.py new/fixtures-1.3.1/fixtures/_fixtures/__init__.py
--- old/fixtures-1.2.0/fixtures/_fixtures/__init__.py 2015-05-04 23:49:57.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/__init__.py 2015-06-22 02:24:03.000000000 +0200
@@ -25,6 +25,9 @@
'FakePopen',
'LoggerFixture',
'LogHandler',
+ 'MockPatch',
+ 'MockPatchMultiple',
+ 'MockPatchObject',
'MonkeyPatch',
'NestedTempfile',
'PackagePathEntry',
@@ -49,6 +52,11 @@
LoggerFixture,
LogHandler,
)
+from fixtures._fixtures.mockpatch import (
+ MockPatch,
+ MockPatchMultiple,
+ MockPatchObject,
+ )
from fixtures._fixtures.monkeypatch import MonkeyPatch
from fixtures._fixtures.popen import (
FakePopen,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/environ.py new/fixtures-1.3.1/fixtures/_fixtures/environ.py
--- old/fixtures-1.2.0/fixtures/_fixtures/environ.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/environ.py 2015-06-22 08:56:00.000000000 +0200
@@ -40,8 +40,7 @@
self.varname = varname
self.newvalue = newvalue
- def setUp(self):
- super(EnvironmentVariable, self).setUp()
+ def _setUp(self):
varname = self.varname
orig_value = os.environ.get(varname)
if orig_value is not None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/logger.py new/fixtures-1.3.1/fixtures/_fixtures/logger.py
--- old/fixtures-1.2.0/fixtures/_fixtures/logger.py 2015-03-26 21:33:59.000000000 +0100
+++ new/fixtures-1.3.1/fixtures/_fixtures/logger.py 2015-06-22 08:56:00.000000000 +0200
@@ -46,8 +46,7 @@
self._level = level
self._nuke_handlers = nuke_handlers
- def setUp(self):
- super(LogHandler, self).setUp()
+ def _setUp(self):
logger = getLogger(self._name)
if self._level:
self.addCleanup(logger.setLevel, logger.level)
@@ -95,8 +94,7 @@
self._nuke_handlers = nuke_handlers
self._formatter = formatter
- def setUp(self):
- super(FakeLogger, self).setUp()
+ def _setUp(self):
name = _u("pythonlogging:'%s'") % self._name
output = self.useFixture(StringStream(name)).stream
self._output = output
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/mockpatch.py new/fixtures-1.3.1/fixtures/_fixtures/mockpatch.py
--- old/fixtures-1.2.0/fixtures/_fixtures/mockpatch.py 1970-01-01 01:00:00.000000000 +0100
+++ new/fixtures-1.3.1/fixtures/_fixtures/mockpatch.py 2015-06-22 08:56:00.000000000 +0200
@@ -0,0 +1,71 @@
+# Copyright 2010 United States Government as represented by the
+# Administrator of the National Aeronautics and Space Administration.
+# Copyright 2013 Hewlett-Packard Development Company, L.P.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import extras
+
+import fixtures
+
+mock = extras.try_imports(['unittest.mock', 'mock'], None)
+mock_default = extras.try_imports(
+ ['unittest.mock.DEFAULT', 'mock.DEFAULT'], None)
+
+
+class _Base(fixtures.Fixture):
+ def _setUp(self):
+ _p = self._get_p()
+ self.addCleanup(_p.stop)
+ self.mock = _p.start()
+
+
+class MockPatchObject(_Base):
+ """Deal with code around mock."""
+
+ def __init__(self, obj, attr, new=mock_default, **kwargs):
+ super(MockPatchObject, self).__init__()
+ self._get_p = lambda: mock.patch.object(obj, attr, new, **kwargs)
+
+
+class MockPatch(_Base):
+ """Deal with code around mock.patch."""
+
+ def __init__(self, obj, new=mock_default, **kwargs):
+ super(MockPatch, self).__init__()
+ self._get_p = lambda: mock.patch(obj, new, **kwargs)
+
+
+class MockPatchMultiple(_Base):
+ """Deal with code around mock.patch.multiple."""
+
+ # Default value to trigger a MagicMock to be created for a named
+ # attribute.
+ DEFAULT = mock_default
+
+ def __init__(self, obj, **kwargs):
+ """Initialize the mocks
+
+ Pass name=value to replace obj.name with value.
+
+ Pass name=Multiple.DEFAULT to replace obj.name with a
+ MagicMock instance.
+
+ :param obj: Object or name containing values being mocked.
+ :type obj: str or object
+ :param kwargs: names and values of attributes of obj to be mocked.
+
+ """
+ super(MockPatchMultiple, self).__init__()
+ self._get_p = lambda: mock.patch.multiple(obj, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/monkeypatch.py new/fixtures-1.3.1/fixtures/_fixtures/monkeypatch.py
--- old/fixtures-1.2.0/fixtures/_fixtures/monkeypatch.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/monkeypatch.py 2015-06-22 08:56:00.000000000 +0200
@@ -42,8 +42,7 @@
self.name = name
self.new_value = new_value
- def setUp(self):
- Fixture.setUp(self)
+ def _setUp(self):
location, attribute = self.name.rsplit('.', 1)
# Import, swallowing all errors as any element of location may be
# a class or some such thing.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/packagepath.py new/fixtures-1.3.1/fixtures/_fixtures/packagepath.py
--- old/fixtures-1.2.0/fixtures/_fixtures/packagepath.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/packagepath.py 2015-06-22 08:56:00.000000000 +0200
@@ -39,8 +39,7 @@
self.packagename = packagename
self.directory = directory
- def setUp(self):
- Fixture.setUp(self)
+ def _setUp(self):
path = sys.modules[self.packagename].__path__
if self.directory in path:
return
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/popen.py new/fixtures-1.3.1/fixtures/_fixtures/popen.py
--- old/fixtures-1.2.0/fixtures/_fixtures/popen.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/popen.py 2015-06-22 08:56:00.000000000 +0200
@@ -95,8 +95,7 @@
super(FakePopen, self).__init__()
self.get_info = get_info
- def setUp(self):
- super(FakePopen, self).setUp()
+ def _setUp(self):
self.addCleanup(setattr, subprocess, 'Popen', subprocess.Popen)
subprocess.Popen = self
self.procs = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/pythonpackage.py new/fixtures-1.3.1/fixtures/_fixtures/pythonpackage.py
--- old/fixtures-1.2.0/fixtures/_fixtures/pythonpackage.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/pythonpackage.py 2015-06-22 08:56:00.000000000 +0200
@@ -47,8 +47,7 @@
self.modulelist = modulelist
self.init = init
- def setUp(self):
- Fixture.setUp(self)
+ def _setUp(self):
self.base = self.useFixture(TempDir()).path
base = self.base
root = os.path.join(base, self.packagename)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/pythonpath.py new/fixtures-1.3.1/fixtures/_fixtures/pythonpath.py
--- old/fixtures-1.2.0/fixtures/_fixtures/pythonpath.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/pythonpath.py 2015-06-22 08:56:00.000000000 +0200
@@ -35,8 +35,7 @@
"""
self.directory = directory
- def setUp(self):
- Fixture.setUp(self)
+ def _setUp(self):
if self.directory in sys.path:
return
self.addCleanup(sys.path.remove, self.directory)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/streams.py new/fixtures-1.3.1/fixtures/_fixtures/streams.py
--- old/fixtures-1.2.0/fixtures/_fixtures/streams.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/streams.py 2015-06-22 08:56:00.000000000 +0200
@@ -42,8 +42,7 @@
self._detail_name = detail_name
self._stream_factory = stream_factory
- def setUp(self):
- super(Stream, self).setUp()
+ def _setUp(self):
write_stream, read_stream = self._stream_factory()
self.stream = write_stream
self.addDetail(self._detail_name,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/tempdir.py new/fixtures-1.3.1/fixtures/_fixtures/tempdir.py
--- old/fixtures-1.2.0/fixtures/_fixtures/tempdir.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/tempdir.py 2015-06-22 08:56:00.000000000 +0200
@@ -39,8 +39,7 @@
"""
self.rootdir = rootdir
- def setUp(self):
- super(TempDir, self).setUp()
+ def _setUp(self):
self.path = tempfile.mkdtemp(dir=self.rootdir)
self.addCleanup(shutil.rmtree, self.path, ignore_errors=True)
@@ -63,8 +62,7 @@
down.
"""
- def setUp(self):
- super(NestedTempfile, self).setUp()
+ def _setUp(self):
tempdir = self.useFixture(TempDir()).path
patch = fixtures.MonkeyPatch("tempfile.tempdir", tempdir)
self.useFixture(patch)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/temphomedir.py new/fixtures-1.3.1/fixtures/_fixtures/temphomedir.py
--- old/fixtures-1.2.0/fixtures/_fixtures/temphomedir.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/temphomedir.py 2015-06-22 08:56:00.000000000 +0200
@@ -27,6 +27,6 @@
:ivar path: the path of the temporary directory.
"""
- def setUp(self):
- super(TempHomeDir, self).setUp()
+ def _setUp(self):
+ super(TempHomeDir, self)._setUp()
self.useFixture(fixtures.EnvironmentVariable("HOME", self.path))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/timeout.py new/fixtures-1.3.1/fixtures/_fixtures/timeout.py
--- old/fixtures-1.2.0/fixtures/_fixtures/timeout.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/timeout.py 2015-06-22 08:56:00.000000000 +0200
@@ -51,8 +51,7 @@
def signal_handler(self, signum, frame):
raise TimeoutException()
- def setUp(self):
- super(Timeout, self).setUp()
+ def _setUp(self):
if self.alarm_fn is None:
return # Can't run on Windows
if self.gentle:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/_fixtures/warnings.py new/fixtures-1.3.1/fixtures/_fixtures/warnings.py
--- old/fixtures-1.2.0/fixtures/_fixtures/warnings.py 2015-05-04 23:49:57.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/_fixtures/warnings.py 2015-06-22 08:56:00.000000000 +0200
@@ -34,8 +34,7 @@
def _showwarning(self, *args, **kwargs):
self.captures.append(warnings.WarningMessage(*args, **kwargs))
- def setUp(self):
- super(WarningsCapture, self).setUp()
+ def _setUp(self):
patch = fixtures.MonkeyPatch("warnings.showwarning", self._showwarning)
self.useFixture(patch)
self.captures = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/fixture.py new/fixtures-1.3.1/fixtures/fixture.py
--- old/fixtures-1.2.0/fixtures/fixture.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/fixture.py 2015-06-30 03:01:38.000000000 +0200
@@ -18,11 +18,13 @@
'FunctionFixture',
'MethodFixture',
'MultipleExceptions',
+ 'SetupError',
]
import itertools
import sys
+import six
from testtools.compat import (
advance_iterator,
reraise,
@@ -49,6 +51,13 @@
target_details[name] = content_object
+class SetupError(Exception):
+ """Setup failed.
+
+ args[0] will be a details dict.
+ """
+
+
class Fixture(object):
"""A Fixture representing some state or resource.
@@ -97,6 +106,10 @@
This should not typically be overridden, see addCleanup instead.
+ cleanUp may be called once and only once after setUp() has been called.
+ The base implementation of setUp will automatically call cleanUp if
+ an exception occurs within setUp itself.
+
:param raise_first: Deprecated parameter from before testtools gained
MultipleExceptions. raise_first defaults to True. When True
if a single exception is raised, it is reraised after all the
@@ -111,7 +124,7 @@
try:
return self._cleanups(raise_errors=raise_first)
finally:
- self._clear_cleanups()
+ self._remove_state()
def _clear_cleanups(self):
"""Clean the cleanup queue without running them.
@@ -126,6 +139,15 @@
self._details = {}
self._detail_sources = []
+ def _remove_state(self):
+ """Remove the internal state.
+
+ Called from cleanUp to put the fixture back into a not-ready state.
+ """
+ self._cleanups = None
+ self._details = None
+ self._detail_sources = None
+
def __enter__(self):
self.setUp()
return self
@@ -134,7 +156,7 @@
try:
self._cleanups()
finally:
- self._clear_cleanups()
+ self._remove_state()
return False # propogate exceptions from the with body.
def getDetails(self):
@@ -153,16 +175,56 @@
def setUp(self):
"""Prepare the Fixture for use.
- This should be overridden by most concrete fixtures. When overriding
- be sure to include self.addCleanup calls to restore the fixture to
- an un-setUp state, so that a single Fixture instance can be reused.
+ This should not be overridden. Concrete fixtures should implement
+ _setUp. Overriding of setUp is still supported, just not recommended.
- After setUp is called, the fixture will have one or more attributes
+ After setUp has completed, the fixture will have one or more attributes
which can be used (these depend totally on the concrete subclass).
+ :raises: MultipleExceptions if _setUp fails. The last exception
+ captured within the MultipleExceptions will be a SetupError
+ exception.
:return: None.
+
+ :changed in 1.3: The recommendation to override setUp has been
+ reversed - before 1.3, setUp() should be overridden, now it should
+ not be.
+ :changed in 1.3.1: BaseException is now caught, and only subclasses of
+ Exception are wrapped in MultipleExceptions.
"""
self._clear_cleanups()
+ try:
+ self._setUp()
+ except:
+ err = sys.exc_info()
+ details = {}
+ if gather_details is not None:
+ # Materialise all details since we're about to cleanup.
+ gather_details(self.getDetails(), details)
+ else:
+ details = self.getDetails()
+ errors = [err] + self.cleanUp(raise_first=False)
+ try:
+ raise SetupError(details)
+ except SetupError as e:
+ errors.append(sys.exc_info())
+ if issubclass(err[0], Exception):
+ raise MultipleExceptions(*errors)
+ else:
+ six.reraise(*err)
+
+ def _setUp(self):
+ """Template method for subclasses to override.
+
+ Override this to customise the fixture. When overriding
+ be sure to include self.addCleanup calls to restore the fixture to
+ an un-setUp state, so that a single Fixture instance can be reused.
+
+ Fixtures will never have a body in _setUp - calling super() is
+ entirely at the discretion of subclasses.
+
+ :return: None.
+ """
def reset(self):
"""Reset a setUp Fixture to the 'just setUp' state again.
@@ -183,15 +245,23 @@
"""Use another fixture.
The fixture will be setUp, and self.addCleanup(fixture.cleanUp) called.
+ If the fixture fails to set up, useFixture will attempt to gather its
+ details into this fixture's details to aid in debugging.
:param fixture: The fixture to use.
:return: The fixture, after setting it up and scheduling a cleanup for
it.
+ :raises: Any errors raised by the fixture's setUp method.
"""
try:
fixture.setUp()
+ except MultipleExceptions as e:
+ if e.args[-1][0] is SetupError:
+ combine_details(e.args[-1][1].args[0], self._details)
+ raise
except:
- # The child failed to come up, capture any details it has (copying
+ # The child failed to come up and didn't raise MultipleExceptions
+ # which we can understand... capture any details it has (copying
# the content, it may go away anytime).
if gather_details is not None:
gather_details(fixture.getDetails(), self._details)
@@ -249,8 +319,7 @@
self.cleanup_fn = cleanup_fn
self.reset_fn = reset_fn
- def setUp(self):
- super(FunctionFixture, self).setUp()
+ def _setUp(self):
fn_result = self.setup_fn()
self._maybe_cleanup(fn_result)
@@ -323,8 +392,7 @@
reset = getattr(obj, 'reset', None)
self._reset = reset
- def setUp(self):
- super(MethodFixture, self).setUp()
+ def _setUp(self):
self._setup()
def cleanUp(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/tests/_fixtures/__init__.py new/fixtures-1.3.1/fixtures/tests/_fixtures/__init__.py
--- old/fixtures-1.2.0/fixtures/tests/_fixtures/__init__.py 2015-03-26 03:46:21.000000000 +0100
+++ new/fixtures-1.3.1/fixtures/tests/_fixtures/__init__.py 2015-06-22 02:24:03.000000000 +0200
@@ -17,6 +17,7 @@
test_modules = [
'environ',
'logger',
+ 'mockpatch',
'monkeypatch',
'packagepath',
'popen',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/tests/_fixtures/test_mockpatch.py new/fixtures-1.3.1/fixtures/tests/_fixtures/test_mockpatch.py
--- old/fixtures-1.2.0/fixtures/tests/_fixtures/test_mockpatch.py 1970-01-01 01:00:00.000000000 +0100
+++ new/fixtures-1.3.1/fixtures/tests/_fixtures/test_mockpatch.py 2015-06-22 02:24:03.000000000 +0200
@@ -0,0 +1,72 @@
+# Copyright 2014 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+
+import extras
+mock = extras.try_imports(['unittest.mock', 'mock'], None)
+import testtools
+
+from fixtures import (
+ MockPatch,
+ MockPatchMultiple,
+ MockPatchObject,
+)
+
+
+class Foo(object):
+ def bar(self):
+ return self
+
+
+def mocking_bar(self):
+ return 'mocked!'
+
+
+class TestMockPatch(testtools.TestCase):
+ def test_mock_patch_with_replacement(self):
+ self.useFixture(MockPatch('%s.Foo.bar' % (__name__), mocking_bar))
+ instance = Foo()
+ self.assertEqual(instance.bar(), 'mocked!')
+
+ def test_mock_patch_without_replacement(self):
+ self.useFixture(MockPatch('%s.Foo.bar' % (__name__)))
+ instance = Foo()
+ self.assertIsInstance(instance.bar(), mock.MagicMock)
+
+
+class TestMockMultiple(testtools.TestCase):
+ def test_mock_multiple_with_replacement(self):
+ self.useFixture(MockPatchMultiple('%s.Foo' % (__name__),
+ bar=mocking_bar))
+ instance = Foo()
+ self.assertEqual(instance.bar(), 'mocked!')
+
+ def test_mock_patch_without_replacement(self):
+ self.useFixture(MockPatchMultiple(
+ '%s.Foo' % (__name__),
+ bar=MockPatchMultiple.DEFAULT))
+ instance = Foo()
+ self.assertIsInstance(instance.bar(), mock.MagicMock)
+
+
+class TestMockPatchObject(testtools.TestCase):
+ def test_mock_patch_object_with_replacement(self):
+ self.useFixture(MockPatchObject(Foo, 'bar', mocking_bar))
+ instance = Foo()
+ self.assertEqual(instance.bar(), 'mocked!')
+
+ def test_mock_patch_object_without_replacement(self):
+ self.useFixture(MockPatchObject(Foo, 'bar'))
+ instance = Foo()
+ self.assertIsInstance(instance.bar(), mock.MagicMock)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures/tests/test_fixture.py new/fixtures-1.3.1/fixtures/tests/test_fixture.py
--- old/fixtures-1.2.0/fixtures/tests/test_fixture.py 2014-09-25 04:31:06.000000000 +0200
+++ new/fixtures-1.3.1/fixtures/tests/test_fixture.py 2015-06-30 02:51:08.000000000 +0200
@@ -122,7 +122,7 @@
@require_gather_details
def test_useFixture_details_captured_from_setUp(self):
# Details added during fixture set-up are gathered even if setUp()
- # fails with an exception.
+ # fails with an unknown exception.
class SomethingBroke(Exception): pass
class BrokenFixture(fixtures.Fixture):
def setUp(self):
@@ -143,6 +143,24 @@
{"content": text_content("foobar")},
simple_fixture.getDetails())
+ @require_gather_details
+ def test_useFixture_details_captured_from_setUp_MultipleExceptions(self):
+ # Details added during fixture set-up are gathered even if setUp()
+ # fails with (cleanly - with MultipleExceptions / SetupError).
+ class SomethingBroke(Exception): pass
+ class BrokenFixture(fixtures.Fixture):
+ def _setUp(self):
+ self.addDetail('content', text_content("foobar"))
+ raise SomethingBroke()
+ class SimpleFixture(fixtures.Fixture):
+ def _setUp(self):
+ self.useFixture(BrokenFixture())
+ simple = SimpleFixture()
+ e = self.assertRaises(fixtures.MultipleExceptions, simple.setUp)
+ self.assertEqual(
+ {"content": text_content("foobar")},
+ e.args[-1][1].args[0])
+
def test_getDetails(self):
fixture = fixtures.Fixture()
with fixture:
@@ -162,7 +180,7 @@
self.assertEqual({}, parent.getDetails())
# After cleanup the child details are still gone.
child.addDetail('foo', 'content')
- self.assertEqual({}, parent.getDetails())
+ self.assertRaises(TypeError, parent.getDetails)
def test_duplicate_details_are_disambiguated(self):
parent = fixtures.Fixture()
@@ -185,7 +203,74 @@
self.assertEqual({}, fixture.getDetails())
fixture.addDetail('foo', 'content')
# Cleanup clears the details too.
- self.assertEqual({}, fixture.getDetails())
+ self.assertRaises(TypeError, fixture.getDetails)
+
+ def test_setUp_subclassed(self):
+ # Even though its no longer recommended, we need to be sure that
+ # overriding setUp and calling super().setUp still works.
+ class Subclass(fixtures.Fixture):
+ def setUp(self):
+ super(Subclass, self).setUp()
+ self.fred = 1
+ self.addCleanup(setattr, self, 'fred', 2)
+ with Subclass() as f:
+ self.assertEqual(1, f.fred)
+ self.assertEqual(2, f.fred)
+
+ def test__setUp(self):
+ # _setUp is called, and cleanups can be registered by it.
+ class Subclass(fixtures.Fixture):
+ def _setUp(self):
+ self.fred = 1
+ self.addCleanup(setattr, self, 'fred', 2)
+ with Subclass() as f:
+ self.assertEqual(1, f.fred)
+ self.assertEqual(2, f.fred)
+
+ def test__setUp_fails(self):
+ # when _setUp fails, the fixture is left ready-to-setUp, and any
+ # details added during _setUp are captured.
+ class Subclass(fixtures.Fixture):
+ def _setUp(self):
+ self.addDetail('log', text_content('stuff'))
+ 1/0
+ f = Subclass()
+ e = self.assertRaises(fixtures.MultipleExceptions, f.setUp)
+ self.assertRaises(TypeError, f.cleanUp)
+ self.assertIsInstance(e.args[0][1], ZeroDivisionError)
+ self.assertIsInstance(e.args[1][1], fixtures.SetupError)
+ self.assertEqual('stuff', e.args[1][1].args[0]['log'].as_text())
+
+ def test__setUp_fails_cleanUp_fails(self):
+ # when _setUp fails, cleanups are called, and their failure is captured
+ # into the MultipleExceptions instance.
+ class Subclass(fixtures.Fixture):
+ def _setUp(self):
+ self.addDetail('log', text_content('stuff'))
+ self.addCleanup(lambda: 1/0)
+ raise Exception('fred')
+ f = Subclass()
+ e = self.assertRaises(fixtures.MultipleExceptions, f.setUp)
+ self.assertRaises(TypeError, f.cleanUp)
+ self.assertEqual(Exception, e.args[0][0])
+ self.assertEqual(ZeroDivisionError, e.args[1][0])
+ self.assertEqual(fixtures.SetupError, e.args[2][0])
+ self.assertEqual('stuff', e.args[2][1].args[0]['log'].as_text())
+
+ def test_setup_failures_with_base_exception(self):
+ # when _setUp fails with a BaseException (or subclass thereof) that
+ # exception is propogated as is, but we still call cleanups etc.
+ class MyBase(BaseException):pass
+ log = []
+ class Subclass(fixtures.Fixture):
+ def _setUp(self):
+ self.addDetail('log', text_content('stuff'))
+ self.addCleanup(log.append, 'cleaned')
+ raise MyBase('fred')
+ f = Subclass()
+ e = self.assertRaises(MyBase, f.setUp)
+ self.assertRaises(TypeError, f.cleanUp)
+ self.assertEqual(['cleaned'], log)
class TestFunctionFixture(testtools.TestCase):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures.egg-info/PKG-INFO new/fixtures-1.3.1/fixtures.egg-info/PKG-INFO
--- old/fixtures-1.2.0/fixtures.egg-info/PKG-INFO 2015-05-05 00:14:19.000000000 +0200
+++ new/fixtures-1.3.1/fixtures.egg-info/PKG-INFO 2015-06-30 04:22:04.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: fixtures
-Version: 1.2.0
+Version: 1.3.1
Summary: Fixtures, reusable state for writing clean tests and more.
Home-page: https://launchpad.net/python-fixtures
Author: Robert Collins
@@ -87,19 +87,20 @@
Creating Fixtures
=================
- Minimally, subclass Fixture, define setUp to initialize your state and schedule
+ Minimally, subclass Fixture, define _setUp to initialize your state and schedule
a cleanup for when cleanUp is called and you're done::
>>> import unittest
>>> import fixtures
>>> class NoddyFixture(fixtures.Fixture):
- ... def setUp(self):
- ... super(NoddyFixture, self).setUp()
+ ... def _setUp(self):
... self.frobnozzle = 42
... self.addCleanup(delattr, self, 'frobnozzle')
- This will initialize frobnozzle when setUp is called, and when cleanUp is
- called get rid of the frobnozzle attribute.
+ This will initialize frobnozzle when ``setUp`` is called, and when ``cleanUp``
+ is called get rid of the frobnozzle attribute. Prior to version 1.3.0 fixtures
+ recommended overriding ``setUp``. This is still supported, but since it is
+ harder to write leak-free fixtures in this fashion, it is not recommended.
If your fixture has diagnostic data - for instance the log file of an
application server, or log messages, it can expose that by creating a content
@@ -107,8 +108,7 @@
>>> from testtools.content import text_content
>>> class WithLog(fixtures.Fixture):
- ... def setUp(self):
- ... super(WithLog, self).setUp()
+ ... def _setUp(self):
... self.addDetail('message', text_content('foo bar baz'))
The method ``useFixture`` will use another fixture, call ``setUp`` on it, call
@@ -116,8 +116,7 @@
the fixture. This allows simple composition of different fixtures.
>>> class ReusingFixture(fixtures.Fixture):
- ... def setUp(self):
- ... super(ReusingFixture, self).setUp()
+ ... def _setUp(self):
... self.noddy = self.useFixture(NoddyFixture())
There is a helper for adapting a function or function pair into Fixtures. it
@@ -162,9 +161,9 @@
clean up after a fixture has been used, all fixtures define a ``cleanUp``
method which should be called when a fixture is finished with.
- Because its nice to be able to build a particular set of related fixtures in
- advance of using them, fixtures also have define a ``setUp`` method which
- should be called before trying to use them.
+ Because it's nice to be able to build a particular set of related fixtures in
+ advance of using them, fixtures also have a ``setUp`` method which should be
+ called before trying to use them.
One common desire with fixtures that are expensive to create is to reuse them
in many test cases; to support this the base Fixture also defines a ``reset``
@@ -211,8 +210,7 @@
>>> import sys
>>> from fixtures.fixture import MultipleExceptions
>>> class BrokenFixture(fixtures.Fixture):
- ... def setUp(self):
- ... fixtures.Fixture.setUp(self)
+ ... def _setUp(self):
... self.addCleanup(lambda:1/0)
... self.addCleanup(lambda:1/0)
>>> fixture = BrokenFixture()
@@ -226,12 +224,32 @@
Fixtures often expose diagnostic details that can be useful for tracking down
issues. The ``getDetails`` method will return a dict of all the attached
- details. Each detail object is an instance of ``testtools.content.Content``.
+ details, but can only be called before ``cleanUp`` is called. Each detail
+ object is an instance of ``testtools.content.Content``.
>>> with WithLog() as l:
... print(l.getDetails()['message'].as_text())
foo bar baz
+ Errors in setUp
+ +++++++++++++++
+
+ The examples above used ``_setUp`` rather than ``setUp`` because the base
+ class implementation of ``setUp`` acts to reduce the chance of leaking
+ external resources if an error is raised from ``_setUp``. Specifically,
+ ``setUp`` contains a try:/except: block which catches all exceptions, captures
+ any registered detail objects, and calls ``self.cleanUp`` before propogating
+ the error. As long as you take care to register any cleanups before calling
+ the code that may fail, this will cause them to be cleaned up. The captured
+ detail objects are provided to the args of the raised exception.
+
+ If the error that occured was a subclass of ``Exception`` then ``setUp`` will
+ raise ``MultipleExceptions`` with the last element being a ``SetupError`` that
+ contains the detail objects. Otherwise, to prevent causing normally
+ uncatchable errors like KeyboardInterrupt being caught inappropriately in the
+ calling layer, the original exception will be raised as-is and no diagnostic
+ data other than that from the original exception will be available.
+
Shared Dependencies
+++++++++++++++++++
@@ -308,7 +326,8 @@
In addition to the Fixture, FunctionFixture and MethodFixture classes fixtures
includes a number of precanned fixtures. The API docs for fixtures will list
- the complete set of these, should the dcs be out of date or not to hand.
+ the complete set of these, should the dcs be out of date or not to hand. For
+ the complete feature set of each fixture please see the API docs.
ByteStream
++++++++++
@@ -348,6 +367,34 @@
>>> from testtools.compat import BytesIO
>>> fixture = fixtures.FakePopen(lambda _:{'stdout': BytesIO('foobar')})
+ MockPatchObject
+ +++++++++++++++
+
+ Adapts ``mock.patch.object`` to be used as a Fixture.
+
+ >>> class Fred:
+ ... value = 1
+ >>> fixture = fixtures.MockPatchObject(Fred, 'value', 2)
+ >>> with fixture:
+ ... Fred().value
+ 2
+ >>> Fred().value
+ 1
+
+ MockPatch
+ +++++++++
+
+ Adapts ``mock.patch`` to be used as a Fixture.
+
+ >>> fixture = fixtures.MockPatch('subprocess.Popen.returncode', 3)
+
+ MockPatchMultiple
+ +++++++++++++++++
+
+ Adapts ``mock.patch.multiple`` to be used as a Fixture.
+
+ >>> fixture = fixtures.MockPatch('subprocess.Popen', returncode=3)
+
MonkeyPatch
+++++++++++
@@ -447,6 +494,13 @@
*Note:* Currently supported only on Unix because it relies on the ``alarm``
system call.
+ Contributing
+ ============
+
+ Fixtures has its project homepage on Launchpad
+ <https://launchpad.net/python-fixtures>. Source code is hosted on GitHub
+ <https://github.com/testing-cabal/fixtures>.
+
Platform: UNKNOWN
Classifier: Development Status :: 6 - Mature
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures.egg-info/SOURCES.txt new/fixtures-1.3.1/fixtures.egg-info/SOURCES.txt
--- old/fixtures-1.2.0/fixtures.egg-info/SOURCES.txt 2015-05-05 00:14:19.000000000 +0200
+++ new/fixtures-1.3.1/fixtures.egg-info/SOURCES.txt 2015-06-30 04:22:04.000000000 +0200
@@ -13,6 +13,7 @@
requirements.txt
setup.cfg
setup.py
+test-requirements.txt
tox.ini
fixtures/__init__.py
fixtures/callmany.py
@@ -28,6 +29,7 @@
fixtures/_fixtures/__init__.py
fixtures/_fixtures/environ.py
fixtures/_fixtures/logger.py
+fixtures/_fixtures/mockpatch.py
fixtures/_fixtures/monkeypatch.py
fixtures/_fixtures/packagepath.py
fixtures/_fixtures/popen.py
@@ -46,6 +48,7 @@
fixtures/tests/_fixtures/__init__.py
fixtures/tests/_fixtures/test_environ.py
fixtures/tests/_fixtures/test_logger.py
+fixtures/tests/_fixtures/test_mockpatch.py
fixtures/tests/_fixtures/test_monkeypatch.py
fixtures/tests/_fixtures/test_packagepath.py
fixtures/tests/_fixtures/test_popen.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures.egg-info/pbr.json new/fixtures-1.3.1/fixtures.egg-info/pbr.json
--- old/fixtures-1.2.0/fixtures.egg-info/pbr.json 2015-05-05 00:14:19.000000000 +0200
+++ new/fixtures-1.3.1/fixtures.egg-info/pbr.json 2015-06-30 04:22:04.000000000 +0200
@@ -1 +1 @@
-{"is_release": true, "git_version": "f7502e8"}
\ No newline at end of file
+{"is_release": true, "git_version": "09afde5"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/fixtures.egg-info/requires.txt new/fixtures-1.3.1/fixtures.egg-info/requires.txt
--- old/fixtures-1.2.0/fixtures.egg-info/requires.txt 2015-05-05 00:14:19.000000000 +0200
+++ new/fixtures-1.3.1/fixtures.egg-info/requires.txt 2015-06-30 04:22:04.000000000 +0200
@@ -1,2 +1,3 @@
pbr>=0.11
+six
testtools>=0.9.22
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/requirements.txt new/fixtures-1.3.1/requirements.txt
--- old/fixtures-1.2.0/requirements.txt 2015-05-04 06:04:12.000000000 +0200
+++ new/fixtures-1.3.1/requirements.txt 2015-06-30 02:52:47.000000000 +0200
@@ -1,2 +1,3 @@
pbr>=0.11
+six
testtools>=0.9.22
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fixtures-1.2.0/test-requirements.txt new/fixtures-1.3.1/test-requirements.txt
--- old/fixtures-1.2.0/test-requirements.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/fixtures-1.3.1/test-requirements.txt 2015-06-22 02:24:03.000000000 +0200
@@ -0,0 +1 @@
+mock;python_version<'3.3'
1
0
Hello community,
here is the log from the commit of package python-jsonschema for openSUSE:Factory checked in at 2015-09-30 05:49:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-jsonschema (Old)
and /work/SRC/openSUSE:Factory/.python-jsonschema.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-jsonschema"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-jsonschema/python-jsonschema.changes 2014-11-13 09:17:34.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.python-jsonschema.new/python-jsonschema.changes 2015-09-30 05:49:10.000000000 +0200
@@ -1,0 +2,13 @@
+Mon Jun 15 02:16:17 UTC 2015 - arun(a)gmx.de
+
+- update to version 2.5.1:
+ (no changelog available)
+- update to version 2.5.0:
+ * Improved performance on CPython by adding caching around ref
+ resolution (#203)
+- specfile:
+ * add python-vcversioner
+- drop test requirements and %check section, which is broken
+- Fix update-alternatives usage
+
+-------------------------------------------------------------------
Old:
----
jsonschema-2.4.0.tar.gz
New:
----
jsonschema-2.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-jsonschema.spec ++++++
--- /var/tmp/diff_new_pack.yoQcXK/_old 2015-09-30 05:49:11.000000000 +0200
+++ /var/tmp/diff_new_pack.yoQcXK/_new 2015-09-30 05:49:11.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-jsonschema
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 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
@@ -17,7 +17,7 @@
Name: python-jsonschema
-Version: 2.4.0
+Version: 2.5.1
Release: 0
Summary: An implementation of JSON-Schema validation for Python
License: MIT
@@ -26,8 +26,11 @@
Source: http://pypi.python.org/packages/source/j/jsonschema/jsonschema-%{version}.t…
BuildRequires: python-devel
BuildRequires: python-setuptools
+BuildRequires: python-functools32
+BuildRequires: python-vcversioner
# Test build requirements
BuildRequires: python-mock
+Requires: python-functools32
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -50,31 +53,34 @@
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+
+# Prepare for update-alternatives usage
+mkdir -p %{buildroot}%{_sysconfdir}/alternatives
mv %{buildroot}%{_bindir}/jsonschema %{buildroot}%{_bindir}/jsonschema-%{py_ver}
-ln -s %{_bindir}/jsonschema-%{py_ver} %{buildroot}%{_bindir}/jsonschema
+ln -s -f %{_sysconfdir}/alternatives/jsonschema %{buildroot}%{_bindir}/jsonschema
+# create a dummy target for /etc/alternatives/jsonschema
+touch %{buildroot}%{_sysconfdir}/alternatives/jsonschema
%if 0%{?suse_version} > 1110
%check
python -m unittest jsonschema.tests.test_jsonschema_test_suite
%endif
-%pre
-[ -h %{_bindir}/jsonschema ] || rm -f %{_bindir}/jsonschema
-
%post
-update-alternatives --install \
- %{_bindir}/jsonschema jsonschema %{_bindir}/jsonschema-%{py_ver} 20
+%_sbindir/update-alternatives \
+ --install %{_bindir}/jsonschema jsonschema %{_bindir}/jsonschema-%{py_ver} 30
%preun
if [ $1 -eq 0 ] ; then
- update-alternatives --remove jsonschema %{_bindir}/jsonschema-%{py_ver}
+ %_sbindir/update-alternatives --remove jsonschema %{_bindir}/jsonschema-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc COPYING README.rst
-%ghost %{_bindir}/jsonschema
+%{_bindir}/jsonschema
%{_bindir}/jsonschema-%{py_ver}
+%ghost %{_sysconfdir}/alternatives/jsonschema
%{python_sitelib}/*
%changelog
++++++ jsonschema-2.4.0.tar.gz -> jsonschema-2.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/CHANGELOG.rst new/jsonschema-2.5.1/CHANGELOG.rst
--- old/jsonschema-2.4.0/CHANGELOG.rst 2014-08-19 02:53:22.000000000 +0200
+++ new/jsonschema-2.5.1/CHANGELOG.rst 2015-06-05 16:26:18.000000000 +0200
@@ -1,3 +1,9 @@
+v2.5.0
+------
+
+* Improved performance on CPython by adding caching around ref resolution
+ (#203)
+
v2.4.0
------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/MANIFEST.in new/jsonschema-2.5.1/MANIFEST.in
--- old/jsonschema-2.4.0/MANIFEST.in 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/MANIFEST.in 2015-04-13 17:23:46.000000000 +0200
@@ -1,4 +1,5 @@
include *.rst
include COPYING
include tox.ini
+include version.txt
recursive-include json *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/PKG-INFO new/jsonschema-2.5.1/PKG-INFO
--- old/jsonschema-2.4.0/PKG-INFO 2014-08-19 02:55:48.000000000 +0200
+++ new/jsonschema-2.5.1/PKG-INFO 2015-06-08 21:37:24.000000000 +0200
@@ -1,12 +1,19 @@
Metadata-Version: 1.1
Name: jsonschema
-Version: 2.4.0
+Version: 2.5.1
Summary: An implementation of JSON Schema validation for Python
Home-page: http://github.com/Julian/jsonschema
Author: Julian Berman
Author-email: Julian(a)GrayVines.com
License: MIT
-Description: ==========
+Description: .. image:: https://img.shields.io/pypi/v/jsonschema.svg
+ :target: https://pypi.python.org/pypi/jsonschema
+ .. image:: https://travis-ci.org/Julian/jsonschema.svg?branch=master
+ :target: https://travis-ci.org/Julian/jsonschema
+ .. image:: https://img.shields.io/pypi/l/jsonschema.svg
+ :target: https://pypi.python.org/pypi/jsonschema
+
+ ==========
jsonschema
==========
@@ -57,25 +64,18 @@
Release Notes
-------------
- * A simple CLI was added for validation
- * Validation errors now keep full absolute paths and absolute schema paths in
- their ``absolute_path`` and ``absolute_schema_path`` attributes. The ``path``
- and ``schema_path`` attributes are deprecated in favor of ``relative_path``
- and ``relative_schema_path``\ .
+ Version 2.5.0 is mainly a performance release. The interface for `RefResolver`
+ was extended to add methods that improve performance on CPython.
- *Note:* Support for Python 3.2 was dropped in this release, and installation
- now uses setuptools.
+ Support for custom `RefResolver` objects with the legacy interface should *not*
+ be affected. If you notice something amiss please file an issue ticket.
Running the Test Suite
----------------------
- ``jsonschema`` uses the wonderful `Tox <http://tox.readthedocs.org>`_ for its
- test suite. (It really is wonderful, if for some reason you haven't heard of
- it, you really should use it for your projects).
-
- Assuming you have ``tox`` installed (perhaps via ``pip install tox`` or your
- package manager), just run ``tox`` in the directory of your source checkout to
+ If you have ``tox`` installed (perhaps via ``pip install tox`` or your
+ package manager), running``tox`` in the directory of your source checkout will
run ``jsonschema``'s test suite on all of the versions of Python ``jsonschema``
supports. Note that you'll need to have all of those versions installed in
order to run the tests on each of them, otherwise ``tox`` will skip (and fail)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/README.rst new/jsonschema-2.5.1/README.rst
--- old/jsonschema-2.4.0/README.rst 2014-08-19 02:53:32.000000000 +0200
+++ new/jsonschema-2.5.1/README.rst 2015-06-08 18:03:55.000000000 +0200
@@ -1,3 +1,10 @@
+.. image:: https://img.shields.io/pypi/v/jsonschema.svg
+ :target: https://pypi.python.org/pypi/jsonschema
+.. image:: https://travis-ci.org/Julian/jsonschema.svg?branch=master
+ :target: https://travis-ci.org/Julian/jsonschema
+.. image:: https://img.shields.io/pypi/l/jsonschema.svg
+ :target: https://pypi.python.org/pypi/jsonschema
+
==========
jsonschema
==========
@@ -49,25 +56,18 @@
Release Notes
-------------
-* A simple CLI was added for validation
-* Validation errors now keep full absolute paths and absolute schema paths in
- their ``absolute_path`` and ``absolute_schema_path`` attributes. The ``path``
- and ``schema_path`` attributes are deprecated in favor of ``relative_path``
- and ``relative_schema_path``\ .
+Version 2.5.0 is mainly a performance release. The interface for `RefResolver`
+was extended to add methods that improve performance on CPython.
-*Note:* Support for Python 3.2 was dropped in this release, and installation
-now uses setuptools.
+Support for custom `RefResolver` objects with the legacy interface should *not*
+be affected. If you notice something amiss please file an issue ticket.
Running the Test Suite
----------------------
-``jsonschema`` uses the wonderful `Tox <http://tox.readthedocs.org>`_ for its
-test suite. (It really is wonderful, if for some reason you haven't heard of
-it, you really should use it for your projects).
-
-Assuming you have ``tox`` installed (perhaps via ``pip install tox`` or your
-package manager), just run ``tox`` in the directory of your source checkout to
+If you have ``tox`` installed (perhaps via ``pip install tox`` or your
+package manager), running``tox`` in the directory of your source checkout will
run ``jsonschema``'s test suite on all of the versions of Python ``jsonschema``
supports. Note that you'll need to have all of those versions installed in
order to run the tests on each of them, otherwise ``tox`` will skip (and fail)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/README.md new/jsonschema-2.5.1/json/README.md
--- old/jsonschema-2.4.0/json/README.md 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/README.md 2015-06-05 16:26:18.000000000 +0200
@@ -60,21 +60,70 @@
This suite is being used by:
- * [json-schema-validator (Java)](https://github.com/fge/json-schema-validator)
- * [jsonschema (python)](https://github.com/Julian/jsonschema)
- * [aeson-schema (haskell)](https://github.com/timjb/aeson-schema)
- * [direct-schema (javascript)](https://github.com/IreneKnapp/direct-schema)
- * [jsonschema (javascript)](https://github.com/tdegrunt/jsonschema)
- * [JaySchema (javascript)](https://github.com/natesilva/jayschema)
- * [z-schema (javascript)](https://github.com/zaggino/z-schema)
- * [jassi (javascript)](https://github.com/iclanzan/jassi)
- * [json-schema-valid (javascript)](https://github.com/ericgj/json-schema-valid)
- * [jesse (Erlang)](https://github.com/klarna/jesse)
- * [json-schema (PHP)](https://github.com/justinrainbow/json-schema)
- * [gojsonschema (Go)](https://github.com/sigu-399/gojsonschema)
- * [json_schema (Dart)](https://github.com/patefacio/json_schema)
- * [tv4 (JavaScript)](https://github.com/geraintluff/tv4)
- * [Jsonary (JavaScript)](https://github.com/jsonary-js/jsonary)
+### Coffeescript ###
+
+* [jsck](https://github.com/pandastrike/jsck)
+
+### Dart ###
+
+* [json_schema](https://github.com/patefacio/json_schema)
+
+### Erlang ###
+
+* [jesse](https://github.com/klarna/jesse)
+
+### Go ###
+
+* [gojsonschema](https://github.com/sigu-399/gojsonschema)
+
+### Haskell ###
+
+* [aeson-schema](https://github.com/timjb/aeson-schema)
+* [hjsonschema](https://github.com/seagreen/hjsonschema)
+
+### Java ###
+
+* [json-schema-validator](https://github.com/fge/json-schema-validator)
+
+### Javascript ###
+
+* [json-schema-benchmark](https://github.com/Muscula/json-schema-benchmark)
+* [direct-schema](https://github.com/IreneKnapp/direct-schema)
+* [is-my-json-valid](https://github.com/mafintosh/is-my-json-valid)
+* [jassi](https://github.com/iclanzan/jassi)
+* [JaySchema](https://github.com/natesilva/jayschema)
+* [json-schema-valid](https://github.com/ericgj/json-schema-valid)
+* [Jsonary](https://github.com/jsonary-js/jsonary)
+* [jsonschema](https://github.com/tdegrunt/jsonschema)
+* [request-validator](https://github.com/bugventure/request-validator)
+* [skeemas](https://github.com/Prestaul/skeemas)
+* [tv4](https://github.com/geraintluff/tv4)
+* [z-schema](https://github.com/zaggino/z-schema)
+* [jsen](https://github.com/bugventure/jsen)
+
+### .NET ###
+
+* [Newtonsoft.Json.Schema](https://github.com/JamesNK/Newtonsoft.Json.Schema)
+
+### PHP ###
+
+* [json-schema](https://github.com/justinrainbow/json-schema)
+
+### Python ###
+
+* [jsonschema](https://github.com/Julian/jsonschema)
+
+### Ruby ###
+
+* [json-schema](https://github.com/hoxworth/json-schema)
+
+### Rust ###
+
+* [valico](https://github.com/rustless/valico)
+
+### Swift ###
+
+* [JSONSchema](https://github.com/kylef/JSONSchema.swift)
If you use it as well, please fork and send a pull request adding yourself to
the list :).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft3/additionalProperties.json new/jsonschema-2.5.1/json/tests/draft3/additionalProperties.json
--- old/jsonschema-2.4.0/json/tests/draft3/additionalProperties.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft3/additionalProperties.json 2015-04-13 17:23:46.000000000 +0200
@@ -56,6 +56,25 @@
]
},
{
+ "description":
+ "additionalProperties can exist by itself",
+ "schema": {
+ "additionalProperties": {"type": "boolean"}
+ },
+ "tests": [
+ {
+ "description": "an additional valid property is valid",
+ "data": {"foo" : true},
+ "valid": true
+ },
+ {
+ "description": "an additional invalid property is invalid",
+ "data": {"foo" : 1},
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "additionalProperties are allowed by default",
"schema": {"properties": {"foo": {}, "bar": {}}},
"tests": [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft3/default.json new/jsonschema-2.5.1/json/tests/draft3/default.json
--- old/jsonschema-2.4.0/json/tests/draft3/default.json 1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-2.5.1/json/tests/draft3/default.json 2015-04-13 17:23:46.000000000 +0200
@@ -0,0 +1,49 @@
+[
+ {
+ "description": "invalid type for default",
+ "schema": {
+ "properties": {
+ "foo": {
+ "type": "integer",
+ "default": []
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "valid when property is specified",
+ "data": {"foo": 13},
+ "valid": true
+ },
+ {
+ "description": "still valid when the invalid default is used",
+ "data": {},
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "invalid string value for default",
+ "schema": {
+ "properties": {
+ "bar": {
+ "type": "string",
+ "minLength": 4,
+ "default": "bad"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "valid when property is specified",
+ "data": {"bar": "good"},
+ "valid": true
+ },
+ {
+ "description": "still valid when the invalid default is used",
+ "data": {},
+ "valid": true
+ }
+ ]
+ }
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft3/optional/bignum.json new/jsonschema-2.5.1/json/tests/draft3/optional/bignum.json
--- old/jsonschema-2.4.0/json/tests/draft3/optional/bignum.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft3/optional/bignum.json 2014-10-27 23:20:13.000000000 +0100
@@ -22,6 +22,28 @@
]
},
{
+ "description": "integer",
+ "schema": {"type": "integer"},
+ "tests": [
+ {
+ "description": "a negative bignum is an integer",
+ "data": -12345678910111213141516171819202122232425262728293031,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "number",
+ "schema": {"type": "number"},
+ "tests": [
+ {
+ "description": "a negative bignum is a number",
+ "data": -98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ }
+ ]
+ },
+ {
"description": "string",
"schema": {"type": "string"},
"tests": [
@@ -56,5 +78,30 @@
"valid": false
}
]
+ },
+ {
+ "description": "integer comparison",
+ "schema": {"minimum": -18446744073709551615},
+ "tests": [
+ {
+ "description": "comparison works for very negative numbers",
+ "data": -18446744073709551600,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "float comparison with high precision on negative numbers",
+ "schema": {
+ "minimum": -972783798187987123879878123.18878137,
+ "exclusiveMinimum": true
+ },
+ "tests": [
+ {
+ "description": "comparison works for very negative numbers",
+ "data": -972783798187987123879878123.188781371,
+ "valid": false
+ }
+ ]
}
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft3/pattern.json new/jsonschema-2.5.1/json/tests/draft3/pattern.json
--- old/jsonschema-2.4.0/json/tests/draft3/pattern.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft3/pattern.json 2015-06-05 16:26:18.000000000 +0200
@@ -19,5 +19,16 @@
"valid": true
}
]
+ },
+ {
+ "description": "pattern is not anchored",
+ "schema": {"pattern": "a+"},
+ "tests": [
+ {
+ "description": "matches a substring",
+ "data": "xxaayy",
+ "valid": true
+ }
+ ]
}
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft3/ref.json new/jsonschema-2.5.1/json/tests/draft3/ref.json
--- old/jsonschema-2.4.0/json/tests/draft3/ref.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft3/ref.json 2015-06-05 16:26:18.000000000 +0200
@@ -86,19 +86,34 @@
},
"tests": [
{
- "description": "slash",
+ "description": "slash invalid",
"data": {"slash": "aoeu"},
"valid": false
},
{
- "description": "tilda",
+ "description": "tilda invalid",
"data": {"tilda": "aoeu"},
"valid": false
},
{
- "description": "percent",
+ "description": "percent invalid",
"data": {"percent": "aoeu"},
"valid": false
+ },
+ {
+ "description": "slash valid",
+ "data": {"slash": 123},
+ "valid": true
+ },
+ {
+ "description": "tilda valid",
+ "data": {"tilda": 123},
+ "valid": true
+ },
+ {
+ "description": "percent valid",
+ "data": {"percent": 123},
+ "valid": true
}
]
},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft4/additionalProperties.json new/jsonschema-2.5.1/json/tests/draft4/additionalProperties.json
--- old/jsonschema-2.4.0/json/tests/draft4/additionalProperties.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft4/additionalProperties.json 2015-04-13 17:23:46.000000000 +0200
@@ -56,6 +56,25 @@
]
},
{
+ "description":
+ "additionalProperties can exist by itself",
+ "schema": {
+ "additionalProperties": {"type": "boolean"}
+ },
+ "tests": [
+ {
+ "description": "an additional valid property is valid",
+ "data": {"foo" : true},
+ "valid": true
+ },
+ {
+ "description": "an additional invalid property is invalid",
+ "data": {"foo" : 1},
+ "valid": false
+ }
+ ]
+ },
+ {
"description": "additionalProperties are allowed by default",
"schema": {"properties": {"foo": {}, "bar": {}}},
"tests": [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft4/default.json new/jsonschema-2.5.1/json/tests/draft4/default.json
--- old/jsonschema-2.4.0/json/tests/draft4/default.json 1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-2.5.1/json/tests/draft4/default.json 2015-04-13 17:23:46.000000000 +0200
@@ -0,0 +1,49 @@
+[
+ {
+ "description": "invalid type for default",
+ "schema": {
+ "properties": {
+ "foo": {
+ "type": "integer",
+ "default": []
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "valid when property is specified",
+ "data": {"foo": 13},
+ "valid": true
+ },
+ {
+ "description": "still valid when the invalid default is used",
+ "data": {},
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "invalid string value for default",
+ "schema": {
+ "properties": {
+ "bar": {
+ "type": "string",
+ "minLength": 4,
+ "default": "bad"
+ }
+ }
+ },
+ "tests": [
+ {
+ "description": "valid when property is specified",
+ "data": {"bar": "good"},
+ "valid": true
+ },
+ {
+ "description": "still valid when the invalid default is used",
+ "data": {},
+ "valid": true
+ }
+ ]
+ }
+]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft4/maxLength.json new/jsonschema-2.5.1/json/tests/draft4/maxLength.json
--- old/jsonschema-2.4.0/json/tests/draft4/maxLength.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft4/maxLength.json 2014-10-27 23:20:13.000000000 +0100
@@ -20,7 +20,7 @@
},
{
"description": "ignores non-strings",
- "data": 10,
+ "data": 100,
"valid": true
},
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft4/optional/bignum.json new/jsonschema-2.5.1/json/tests/draft4/optional/bignum.json
--- old/jsonschema-2.4.0/json/tests/draft4/optional/bignum.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft4/optional/bignum.json 2014-10-27 23:20:13.000000000 +0100
@@ -22,6 +22,28 @@
]
},
{
+ "description": "integer",
+ "schema": {"type": "integer"},
+ "tests": [
+ {
+ "description": "a negative bignum is an integer",
+ "data": -12345678910111213141516171819202122232425262728293031,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "number",
+ "schema": {"type": "number"},
+ "tests": [
+ {
+ "description": "a negative bignum is a number",
+ "data": -98249283749234923498293171823948729348710298301928331,
+ "valid": true
+ }
+ ]
+ },
+ {
"description": "string",
"schema": {"type": "string"},
"tests": [
@@ -56,5 +78,30 @@
"valid": false
}
]
+ },
+ {
+ "description": "integer comparison",
+ "schema": {"minimum": -18446744073709551615},
+ "tests": [
+ {
+ "description": "comparison works for very negative numbers",
+ "data": -18446744073709551600,
+ "valid": true
+ }
+ ]
+ },
+ {
+ "description": "float comparison with high precision on negative numbers",
+ "schema": {
+ "minimum": -972783798187987123879878123.18878137,
+ "exclusiveMinimum": true
+ },
+ "tests": [
+ {
+ "description": "comparison works for very negative numbers",
+ "data": -972783798187987123879878123.188781371,
+ "valid": false
+ }
+ ]
}
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft4/pattern.json new/jsonschema-2.5.1/json/tests/draft4/pattern.json
--- old/jsonschema-2.4.0/json/tests/draft4/pattern.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft4/pattern.json 2015-06-05 16:26:18.000000000 +0200
@@ -19,5 +19,16 @@
"valid": true
}
]
+ },
+ {
+ "description": "pattern is not anchored",
+ "schema": {"pattern": "a+"},
+ "tests": [
+ {
+ "description": "matches a substring",
+ "data": "xxaayy",
+ "valid": true
+ }
+ ]
}
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/json/tests/draft4/ref.json new/jsonschema-2.5.1/json/tests/draft4/ref.json
--- old/jsonschema-2.4.0/json/tests/draft4/ref.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/json/tests/draft4/ref.json 2015-06-05 16:26:18.000000000 +0200
@@ -86,19 +86,34 @@
},
"tests": [
{
- "description": "slash",
+ "description": "slash invalid",
"data": {"slash": "aoeu"},
"valid": false
},
{
- "description": "tilda",
+ "description": "tilda invalid",
"data": {"tilda": "aoeu"},
"valid": false
},
{
- "description": "percent",
+ "description": "percent invalid",
"data": {"percent": "aoeu"},
"valid": false
+ },
+ {
+ "description": "slash valid",
+ "data": {"slash": 123},
+ "valid": true
+ },
+ {
+ "description": "tilda valid",
+ "data": {"tilda": 123},
+ "valid": true
+ },
+ {
+ "description": "percent valid",
+ "data": {"percent": 123},
+ "valid": true
}
]
},
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/__init__.py new/jsonschema-2.5.1/jsonschema/__init__.py
--- old/jsonschema-2.4.0/jsonschema/__init__.py 2014-08-19 02:54:09.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/__init__.py 2015-04-13 17:23:46.000000000 +0200
@@ -19,8 +19,6 @@
Draft3Validator, Draft4Validator, RefResolver, validate
)
-
-__version__ = "2.4.0"
-
+from jsonschema._version import __version__
# flake8: noqa
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/_utils.py new/jsonschema-2.5.1/jsonschema/_utils.py
--- old/jsonschema-2.4.0/jsonschema/_utils.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/_utils.py 2015-04-13 17:23:46.000000000 +0200
@@ -54,7 +54,7 @@
"""
- data = pkgutil.get_data(__package__, "schemas/{0}.json".format(name))
+ data = pkgutil.get_data('jsonschema', "schemas/{0}.json".format(name))
return json.loads(data.decode("utf-8"))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/_validators.py new/jsonschema-2.5.1/jsonschema/_validators.py
--- old/jsonschema-2.4.0/jsonschema/_validators.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/_validators.py 2015-04-13 17:23:46.000000000 +0200
@@ -5,9 +5,6 @@
from jsonschema.compat import iteritems
-FLOAT_TOLERANCE = 10 ** -15
-
-
def patternProperties(validator, patternProperties, instance, schema):
if not validator.is_type(instance, "object"):
return
@@ -77,10 +74,10 @@
return
if schema.get("exclusiveMinimum", False):
- failed = float(instance) <= minimum
+ failed = instance <= minimum
cmp = "less than or equal to"
else:
- failed = float(instance) < minimum
+ failed = instance < minimum
cmp = "less than"
if failed:
@@ -111,8 +108,8 @@
return
if isinstance(dB, float):
- mod = instance % dB
- failed = (mod > FLOAT_TOLERANCE) and (dB - mod) > FLOAT_TOLERANCE
+ quotient = instance / dB
+ failed = int(quotient) != quotient
else:
failed = instance % dB
@@ -193,9 +190,20 @@
def ref(validator, ref, instance, schema):
- with validator.resolver.resolving(ref) as resolved:
- for error in validator.descend(instance, resolved):
- yield error
+ resolve = getattr(validator.resolver, "resolve", None)
+ if resolve is None:
+ with validator.resolver.resolving(ref) as resolved:
+ for error in validator.descend(instance, resolved):
+ yield error
+ else:
+ scope, resolved = validator.resolver.resolve(ref)
+ validator.resolver.push_scope(scope)
+
+ try:
+ for error in validator.descend(instance, resolved):
+ yield error
+ finally:
+ validator.resolver.pop_scope()
def type_draft3(validator, types, instance, schema):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/_version.py new/jsonschema-2.5.1/jsonschema/_version.py
--- old/jsonschema-2.4.0/jsonschema/_version.py 1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-2.5.1/jsonschema/_version.py 2015-06-08 21:37:21.000000000 +0200
@@ -0,0 +1,5 @@
+
+# This file is automatically generated by setup.py.
+__version__ = '2.5.1'
+__sha__ = 'g3f459b7'
+__revision__ = 'g3f459b7'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/compat.py new/jsonschema-2.5.1/jsonschema/compat.py
--- old/jsonschema-2.4.0/jsonschema/compat.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/compat.py 2015-04-13 17:23:46.000000000 +0200
@@ -1,6 +1,6 @@
-from __future__ import unicode_literals
-import sys
import operator
+import sys
+
try:
from collections import MutableMapping, Sequence # noqa
@@ -8,9 +8,11 @@
from collections.abc import MutableMapping, Sequence # noqa
PY3 = sys.version_info[0] >= 3
+PY26 = sys.version_info[:2] == (2, 6)
if PY3:
zip = zip
+ from functools import lru_cache
from io import StringIO
from urllib.parse import (
unquote, urljoin, urlunsplit, SplitResult, urlsplit as _urlsplit
@@ -31,6 +33,11 @@
int_types = int, long
iteritems = operator.methodcaller("iteritems")
+ if PY26:
+ from repoze.lru import lru_cache
+ else:
+ from functools32 import lru_cache
+
# On python < 3.3 fragments are not handled properly with unknown schemes
def urlsplit(url):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/exceptions.py new/jsonschema-2.5.1/jsonschema/exceptions.py
--- old/jsonschema-2.4.0/jsonschema/exceptions.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/exceptions.py 2014-10-27 23:20:13.000000000 +0100
@@ -27,6 +27,18 @@
schema_path=(),
parent=None,
):
+ super(_Error, self).__init__(
+ message,
+ validator,
+ path,
+ cause,
+ context,
+ validator_value,
+ instance,
+ schema,
+ schema_path,
+ parent,
+ )
self.message = message
self.path = self.relative_path = deque(path)
self.schema_path = self.relative_schema_path = deque(schema_path)
@@ -86,7 +98,7 @@
return self.relative_path
path = deque(self.relative_path)
- path.extendleft(parent.absolute_path)
+ path.extendleft(reversed(parent.absolute_path))
return path
@property
@@ -96,7 +108,7 @@
return self.relative_schema_path
path = deque(self.relative_schema_path)
- path.extendleft(parent.absolute_schema_path)
+ path.extendleft(reversed(parent.absolute_schema_path))
return path
def _set(self, **kwargs):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/schemas/draft4.json new/jsonschema-2.5.1/jsonschema/schemas/draft4.json
--- old/jsonschema-2.4.0/jsonschema/schemas/draft4.json 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/schemas/draft4.json 2014-09-12 20:06:51.000000000 +0200
@@ -123,6 +123,9 @@
"default": false,
"type": "boolean"
},
+ "format": {
+ "type": "string"
+ },
"id": {
"format": "uri",
"type": "string"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/tests/test_exceptions.py new/jsonschema-2.5.1/jsonschema/tests/test_exceptions.py
--- old/jsonschema-2.4.0/jsonschema/tests/test_exceptions.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/tests/test_exceptions.py 2014-10-27 23:20:13.000000000 +0100
@@ -273,7 +273,7 @@
self.assertIsInstance(tree["foo"], exceptions.ErrorTree)
-class TestErrorReprStr(unittest.TestCase):
+class TestErrorInitReprStr(unittest.TestCase):
def make_error(self, **kwargs):
defaults = dict(
message=u"hello",
@@ -295,6 +295,10 @@
self.assertEqual(message_line, error.message)
self.assertEqual(rest, expected)
+ def test_it_calls_super_and_sets_args(self):
+ error = self.make_error()
+ self.assertGreater(len(error.args), 1)
+
def test_repr(self):
self.assertEqual(
repr(exceptions.ValidationError(message="Hello!")),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/tests/test_validators.py new/jsonschema-2.5.1/jsonschema/tests/test_validators.py
--- old/jsonschema-2.4.0/jsonschema/tests/test_validators.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/tests/test_validators.py 2015-04-13 17:23:46.000000000 +0200
@@ -425,6 +425,106 @@
self.assertEqual(e5.validator, "minItems")
self.assertEqual(e6.validator, "enum")
+ def test_recursive(self):
+ schema = {
+ "definitions": {
+ "node": {
+ "anyOf": [{
+ "type": "object",
+ "required": ["name", "children"],
+ "properties": {
+ "name": {
+ "type": "string",
+ },
+ "children": {
+ "type": "object",
+ "patternProperties": {
+ "^.*$": {
+ "$ref": "#/definitions/node",
+ },
+ },
+ },
+ },
+ }],
+ },
+ },
+ "type": "object",
+ "required": ["root"],
+ "properties": {
+ "root": {"$ref": "#/definitions/node"},
+ }
+ }
+
+ instance = {
+ "root": {
+ "name": "root",
+ "children": {
+ "a": {
+ "name": "a",
+ "children": {
+ "ab": {
+ "name": "ab",
+ # missing "children"
+ }
+ }
+ },
+ },
+ },
+ }
+ validator = Draft4Validator(schema)
+
+ e, = validator.iter_errors(instance)
+ self.assertEqual(e.absolute_path, deque(["root"]))
+ self.assertEqual(
+ e.absolute_schema_path, deque(["properties", "root", "anyOf"]),
+ )
+
+ e1, = e.context
+ self.assertEqual(e1.absolute_path, deque(["root", "children", "a"]))
+ self.assertEqual(
+ e1.absolute_schema_path, deque(
+ [
+ "properties",
+ "root",
+ "anyOf",
+ 0,
+ "properties",
+ "children",
+ "patternProperties",
+ "^.*$",
+ "anyOf",
+ ],
+ ),
+ )
+
+ e2, = e1.context
+ self.assertEqual(
+ e2.absolute_path, deque(
+ ["root", "children", "a", "children", "ab"],
+ ),
+ )
+ self.assertEqual(
+ e2.absolute_schema_path, deque(
+ [
+ "properties",
+ "root",
+ "anyOf",
+ 0,
+ "properties",
+ "children",
+ "patternProperties",
+ "^.*$",
+ "anyOf",
+ 0,
+ "properties",
+ "children",
+ "patternProperties",
+ "^.*$",
+ "anyOf"
+ ],
+ ),
+ )
+
def test_additionalProperties(self):
instance = {"bar": "bar", "foo": 2}
schema = {
@@ -533,17 +633,32 @@
resolver = RefResolver("", {})
schema = {"$ref" : mock.Mock()}
- @contextmanager
- def resolving():
- yield {"type": "integer"}
-
- with mock.patch.object(resolver, "resolving") as resolve:
- resolve.return_value = resolving()
+ with mock.patch.object(resolver, "resolve") as resolve:
+ resolve.return_value = "url", {"type": "integer"}
with self.assertRaises(ValidationError):
self.validator_class(schema, resolver=resolver).validate(None)
resolve.assert_called_once_with(schema["$ref"])
+ def test_it_delegates_to_a_legacy_ref_resolver(self):
+ """
+ Legacy RefResolvers support only the context manager form of
+ resolution.
+
+ """
+
+ class LegacyRefResolver(object):
+ @contextmanager
+ def resolving(this, ref):
+ self.assertEqual(ref, "the ref")
+ yield {"type" : "integer"}
+
+ resolver = LegacyRefResolver()
+ schema = {"$ref" : "the ref"}
+
+ with self.assertRaises(ValidationError):
+ self.validator_class(schema, resolver=resolver).validate(None)
+
def test_is_type_is_true_for_valid_type(self):
self.assertTrue(self.validator.is_type("foo", "string"))
@@ -675,11 +790,11 @@
self.assertEqual(resolved, self.referrer["properties"]["foo"])
def test_it_resolves_local_refs_with_id(self):
- schema = {"id": "foo://bar/schema#", "a": {"foo": "bar"}}
+ schema = {"id": "http://bar/schema#", "a": {"foo": "bar"}}
resolver = RefResolver.from_schema(schema)
with resolver.resolving("#/a") as resolved:
self.assertEqual(resolved, schema["a"])
- with resolver.resolving("foo://bar/schema#/a") as resolved:
+ with resolver.resolving("http://bar/schema#/a") as resolved:
self.assertEqual(resolved, schema["a"])
def test_it_retrieves_stored_refs(self):
@@ -716,6 +831,7 @@
schema = {"id" : "foo"}
resolver = RefResolver.from_schema(schema)
self.assertEqual(resolver.base_uri, "foo")
+ self.assertEqual(resolver.resolution_scope, "foo")
with resolver.resolving("") as resolved:
self.assertEqual(resolved, schema)
with resolver.resolving("#") as resolved:
@@ -729,6 +845,7 @@
schema = {}
resolver = RefResolver.from_schema(schema)
self.assertEqual(resolver.base_uri, "")
+ self.assertEqual(resolver.resolution_scope, "")
with resolver.resolving("") as resolved:
self.assertEqual(resolved, schema)
with resolver.resolving("#") as resolved:
@@ -763,9 +880,7 @@
)
with resolver.resolving(ref):
pass
- with resolver.resolving(ref):
- pass
- self.assertEqual(foo_handler.call_count, 2)
+ self.assertEqual(foo_handler.call_count, 1)
def test_if_you_give_it_junk_you_get_a_resolution_error(self):
ref = "foo://bar"
@@ -776,6 +891,13 @@
pass
self.assertEqual(str(err.exception), "Oh no! What's this?")
+ def test_helpful_error_message_on_failed_pop_scope(self):
+ resolver = RefResolver("", {})
+ resolver.pop_scope()
+ with self.assertRaises(RefResolutionError) as exc:
+ resolver.pop_scope()
+ self.assertIn("Failed to pop the scope", str(exc.exception))
+
def sorted_errors(errors):
def key(error):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema/validators.py new/jsonschema-2.5.1/jsonschema/validators.py
--- old/jsonschema-2.4.0/jsonschema/validators.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema/validators.py 2015-04-13 17:23:46.000000000 +0200
@@ -12,7 +12,7 @@
from jsonschema import _utils, _validators
from jsonschema.compat import (
Sequence, urljoin, urlsplit, urldefrag, unquote, urlopen,
- str_types, int_types, iteritems,
+ str_types, int_types, iteritems, lru_cache,
)
from jsonschema.exceptions import ErrorTree # Backwards compatibility # noqa
from jsonschema.exceptions import RefResolutionError, SchemaError, UnknownType
@@ -79,7 +79,10 @@
if _schema is None:
_schema = self.schema
- with self.resolver.in_scope(_schema.get(u"id", u"")):
+ scope = _schema.get(u"id")
+ if scope:
+ self.resolver.push_scope(scope)
+ try:
ref = _schema.get(u"$ref")
if ref is not None:
validators = [(u"$ref", ref)]
@@ -103,6 +106,9 @@
if k != u"$ref":
error.schema_path.appendleft(k)
yield error
+ finally:
+ if scope:
+ self.resolver.pop_scope()
def descend(self, instance, schema, path=None, schema_path=None):
for error in self.iter_errors(instance, schema):
@@ -227,19 +233,33 @@
first resolution
:argument dict handlers: a mapping from URI schemes to functions that
should be used to retrieve them
+ :arguments functools.lru_cache urljoin_cache: a cache that will be used for
+ caching the results of joining the resolution scope to subscopes.
+ :arguments functools.lru_cache remote_cache: a cache that will be used for
+ caching the results of resolved remote URLs.
"""
def __init__(
- self, base_uri, referrer, store=(), cache_remote=True, handlers=(),
+ self,
+ base_uri,
+ referrer,
+ store=(),
+ cache_remote=True,
+ handlers=(),
+ urljoin_cache=None,
+ remote_cache=None,
):
- self.base_uri = base_uri
- self.resolution_scope = base_uri
- # This attribute is not used, it is for backwards compatibility
+ if urljoin_cache is None:
+ urljoin_cache = lru_cache(1024)(urljoin)
+ if remote_cache is None:
+ remote_cache = lru_cache(1024)(self.resolve_from_url)
+
self.referrer = referrer
self.cache_remote = cache_remote
self.handlers = dict(handlers)
+ self._scopes_stack = [base_uri]
self.store = _utils.URIDict(
(id, validator.META_SCHEMA)
for id, validator in iteritems(meta_schemas)
@@ -247,26 +267,52 @@
self.store.update(store)
self.store[base_uri] = referrer
+ self._urljoin_cache = urljoin_cache
+ self._remote_cache = remote_cache
+
@classmethod
def from_schema(cls, schema, *args, **kwargs):
"""
Construct a resolver from a JSON schema object.
- :argument schema schema: the referring schema
+ :argument schema: the referring schema
:rtype: :class:`RefResolver`
"""
return cls(schema.get(u"id", u""), schema, *args, **kwargs)
+ def push_scope(self, scope):
+ self._scopes_stack.append(
+ self._urljoin_cache(self.resolution_scope, scope),
+ )
+
+ def pop_scope(self):
+ try:
+ self._scopes_stack.pop()
+ except IndexError:
+ raise RefResolutionError(
+ "Failed to pop the scope from an empty stack. "
+ "`pop_scope()` should only be called once for every "
+ "`push_scope()`",
+ )
+
+ @property
+ def resolution_scope(self):
+ return self._scopes_stack[-1]
+
+ @property
+ def base_uri(self):
+ uri, _ = urldefrag(self.resolution_scope)
+ return uri
+
@contextlib.contextmanager
def in_scope(self, scope):
- old_scope = self.resolution_scope
- self.resolution_scope = urljoin(old_scope, scope)
+ self.push_scope(scope)
try:
yield
finally:
- self.resolution_scope = old_scope
+ self.pop_scope()
@contextlib.contextmanager
def resolving(self, ref):
@@ -278,25 +324,28 @@
"""
- full_uri = urljoin(self.resolution_scope, ref)
- uri, fragment = urldefrag(full_uri)
- if not uri:
- uri = self.base_uri
-
- if uri in self.store:
- document = self.store[uri]
- else:
+ url, resolved = self.resolve(ref)
+ self.push_scope(url)
+ try:
+ yield resolved
+ finally:
+ self.pop_scope()
+
+ def resolve(self, ref):
+ url = self._urljoin_cache(self.resolution_scope, ref)
+ return url, self._remote_cache(url)
+
+ def resolve_from_url(self, url):
+ url, fragment = urldefrag(url)
+ try:
+ document = self.store[url]
+ except KeyError:
try:
- document = self.resolve_remote(uri)
+ document = self.resolve_remote(url)
except Exception as exc:
raise RefResolutionError(exc)
- old_base_uri, self.base_uri = self.base_uri, uri
- try:
- with self.in_scope(uri):
- yield self.resolve_fragment(document, fragment)
- finally:
- self.base_uri = old_base_uri
+ return self.resolve_fragment(document, fragment)
def resolve_fragment(self, document, fragment):
"""
@@ -332,8 +381,9 @@
"""
Resolve a remote ``uri``.
- Does not check the store first, but stores the retrieved document in
- the store if :attr:`RefResolver.cache_remote` is True.
+ If called directly, does not check the store first, but after
+ retrieving the document at the specified URI it will be saved in
+ the store if :attr:`cache_remote` is True.
.. note::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema.egg-info/PKG-INFO new/jsonschema-2.5.1/jsonschema.egg-info/PKG-INFO
--- old/jsonschema-2.4.0/jsonschema.egg-info/PKG-INFO 2014-08-19 02:55:46.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema.egg-info/PKG-INFO 2015-06-08 21:37:21.000000000 +0200
@@ -1,12 +1,19 @@
Metadata-Version: 1.1
Name: jsonschema
-Version: 2.4.0
+Version: 2.5.1
Summary: An implementation of JSON Schema validation for Python
Home-page: http://github.com/Julian/jsonschema
Author: Julian Berman
Author-email: Julian(a)GrayVines.com
License: MIT
-Description: ==========
+Description: .. image:: https://img.shields.io/pypi/v/jsonschema.svg
+ :target: https://pypi.python.org/pypi/jsonschema
+ .. image:: https://travis-ci.org/Julian/jsonschema.svg?branch=master
+ :target: https://travis-ci.org/Julian/jsonschema
+ .. image:: https://img.shields.io/pypi/l/jsonschema.svg
+ :target: https://pypi.python.org/pypi/jsonschema
+
+ ==========
jsonschema
==========
@@ -57,25 +64,18 @@
Release Notes
-------------
- * A simple CLI was added for validation
- * Validation errors now keep full absolute paths and absolute schema paths in
- their ``absolute_path`` and ``absolute_schema_path`` attributes. The ``path``
- and ``schema_path`` attributes are deprecated in favor of ``relative_path``
- and ``relative_schema_path``\ .
+ Version 2.5.0 is mainly a performance release. The interface for `RefResolver`
+ was extended to add methods that improve performance on CPython.
- *Note:* Support for Python 3.2 was dropped in this release, and installation
- now uses setuptools.
+ Support for custom `RefResolver` objects with the legacy interface should *not*
+ be affected. If you notice something amiss please file an issue ticket.
Running the Test Suite
----------------------
- ``jsonschema`` uses the wonderful `Tox <http://tox.readthedocs.org>`_ for its
- test suite. (It really is wonderful, if for some reason you haven't heard of
- it, you really should use it for your projects).
-
- Assuming you have ``tox`` installed (perhaps via ``pip install tox`` or your
- package manager), just run ``tox`` in the directory of your source checkout to
+ If you have ``tox`` installed (perhaps via ``pip install tox`` or your
+ package manager), running``tox`` in the directory of your source checkout will
run ``jsonschema``'s test suite on all of the versions of Python ``jsonschema``
supports. Note that you'll need to have all of those versions installed in
order to run the tests on each of them, otherwise ``tox`` will skip (and fail)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema.egg-info/SOURCES.txt new/jsonschema-2.5.1/jsonschema.egg-info/SOURCES.txt
--- old/jsonschema-2.4.0/jsonschema.egg-info/SOURCES.txt 2014-08-19 02:55:47.000000000 +0200
+++ new/jsonschema-2.5.1/jsonschema.egg-info/SOURCES.txt 2015-06-08 21:37:24.000000000 +0200
@@ -5,6 +5,7 @@
setup.cfg
setup.py
tox.ini
+version.txt
json/.gitignore
json/.travis.yml
json/LICENSE
@@ -15,6 +16,7 @@
json/remotes/folder/folderInteger.json
json/tests/draft3/additionalItems.json
json/tests/draft3/additionalProperties.json
+json/tests/draft3/default.json
json/tests/draft3/dependencies.json
json/tests/draft3/disallow.json
json/tests/draft3/divisibleBy.json
@@ -43,6 +45,7 @@
json/tests/draft4/additionalProperties.json
json/tests/draft4/allOf.json
json/tests/draft4/anyOf.json
+json/tests/draft4/default.json
json/tests/draft4/definitions.json
json/tests/draft4/dependencies.json
json/tests/draft4/enum.json
@@ -75,6 +78,7 @@
jsonschema/_reflect.py
jsonschema/_utils.py
jsonschema/_validators.py
+jsonschema/_version.py
jsonschema/cli.py
jsonschema/compat.py
jsonschema/exceptions.py
@@ -83,6 +87,8 @@
jsonschema.egg-info/SOURCES.txt
jsonschema.egg-info/dependency_links.txt
jsonschema.egg-info/entry_points.txt
+jsonschema.egg-info/pbr.json
+jsonschema.egg-info/requires.txt
jsonschema.egg-info/top_level.txt
jsonschema/schemas/draft3.json
jsonschema/schemas/draft4.json
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema.egg-info/pbr.json new/jsonschema-2.5.1/jsonschema.egg-info/pbr.json
--- old/jsonschema-2.4.0/jsonschema.egg-info/pbr.json 1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-2.5.1/jsonschema.egg-info/pbr.json 2015-06-08 21:37:21.000000000 +0200
@@ -0,0 +1 @@
+{"is_release": true, "git_version": "3f459b7"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/jsonschema.egg-info/requires.txt new/jsonschema-2.5.1/jsonschema.egg-info/requires.txt
--- old/jsonschema-2.4.0/jsonschema.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-2.5.1/jsonschema.egg-info/requires.txt 2015-06-08 21:37:21.000000000 +0200
@@ -0,0 +1,12 @@
+
+[:python_version=='2.6']
+argparse
+repoze.lru
+
+[:python_version=='2.7']
+functools32
+
+[format]
+rfc3987
+strict-rfc3339
+webcolors
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/setup.py new/jsonschema-2.5.1/setup.py
--- old/jsonschema-2.4.0/setup.py 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/setup.py 2015-06-08 18:04:36.000000000 +0200
@@ -1,9 +1,9 @@
-from setuptools import setup
+import os
-from jsonschema import __version__
+from setuptools import setup
-with open("README.rst") as readme:
+with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme:
long_description = readme.read()
classifiers = [
@@ -21,11 +21,18 @@
"Programming Language :: Python :: Implementation :: PyPy",
]
+extras_require = {
+ "format" : ["rfc3987", "strict-rfc3339", "webcolors"],
+ ":python_version=='2.6'": ["argparse", "repoze.lru"],
+ ":python_version=='2.7'": ["functools32"],
+}
+
setup(
name="jsonschema",
- version=__version__,
packages=["jsonschema", "jsonschema.tests"],
package_data={"jsonschema": ["schemas/*.json"]},
+ setup_requires=["vcversioner"],
+ extras_require=extras_require,
author="Julian Berman",
author_email="Julian(a)GrayVines.com",
classifiers=classifiers,
@@ -34,4 +41,5 @@
long_description=long_description,
url="http://github.com/Julian/jsonschema",
entry_points={"console_scripts": ["jsonschema = jsonschema.cli:main"]},
+ vcversioner={"version_module_paths" : ["jsonschema/_version.py"]},
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/tox.ini new/jsonschema-2.5.1/tox.ini
--- old/jsonschema-2.4.0/tox.ini 2014-07-06 04:55:07.000000000 +0200
+++ new/jsonschema-2.5.1/tox.ini 2015-04-13 17:23:46.000000000 +0200
@@ -1,56 +1,39 @@
[tox]
-envlist = py26, py27, pypy, py34, docs, style
+envlist = py{26,27,34,py,py3}, docs, style
+
[testenv]
+changedir = {envtmpdir}
+setenv =
+ JSON_SCHEMA_TEST_SUITE = {toxinidir}/json
commands =
- py.test [] jsonschema
- {envpython} -m doctest README.rst
-deps =
- {[testenv:notpy34]deps}
- {[testenv:py34]deps}
+ py26: trial [] jsonschema
+ py{27,34,py,py3}: green [] jsonschema
-[testenv:py26]
+ {envpython} -m doctest {toxinidir}/README.rst
+ py{26,27,34}: sphinx-build -b doctest {toxinidir}/docs {envtmpdir}/html
deps =
- {[testenv:notpy34]deps}
- {[testenv:all]deps}
- argparse
- unittest2
+ -e{toxinidir}[format]
-[testenv:py34]
-commands =
- py.test [] jsonschema
- {envpython} -m doctest README.rst
- sphinx-build -b doctest docs {envtmpdir}/html
-deps =
- {[testenv:all]deps}
- {[testenv:notpy26]deps}
+ py26: twisted
+ py{27,34,py,py3}: green
-[testenv:notpy34]
-deps =
- mock
+ py26: unittest2
+ py{26,27,py,py3}: mock
-[testenv:notpy26]
-deps =
- rfc3987
+ py{26,27,34}: lxml
+ py{26,27,34,py}: sphinx
-[testenv:all]
-deps =
- lxml
- pytest
- sphinx
- strict-rfc3339
- webcolors
[testenv:coverage]
commands =
- coverage run --branch --source jsonschema [] {envbindir}/py.test jsonschema
+ coverage run --branch --source {toxinidir}/jsonschema [] {envbindir}/green jsonschema
coverage report --show-missing
coverage html
deps =
- {[testenv:notpy34]deps}
- {[testenv:py34]deps}
coverage
+
[testenv:docs]
basepython = python
changedir = docs
@@ -59,13 +42,12 @@
commands =
sphinx-build [] -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
+
[testenv:style]
deps = flake8
commands =
- flake8 [] --max-complexity 10 jsonschema
+ flake8 [] --max-complexity 10 {toxinidir}/jsonschema
+
[flake8]
ignore = E203,E302,E303,E701,F811
-
-[pytest]
-addopts = -r s -s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/jsonschema-2.4.0/version.txt new/jsonschema-2.5.1/version.txt
--- old/jsonschema-2.4.0/version.txt 1970-01-01 01:00:00.000000000 +0100
+++ new/jsonschema-2.5.1/version.txt 2015-06-08 21:37:21.000000000 +0200
@@ -0,0 +1 @@
+v2.5.1-0-g3f459b7
\ No newline at end of file
1
0
Hello community,
here is the log from the commit of package python3-jsonschema for openSUSE:Factory checked in at 2015-09-30 05:49:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-jsonschema (Old)
and /work/SRC/openSUSE:Factory/.python3-jsonschema.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-jsonschema"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python3-jsonschema/python3-jsonschema.changes 2014-05-02 14:02:37.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python3-jsonschema.new/python3-jsonschema.changes 2015-09-30 05:49:06.000000000 +0200
@@ -1,0 +2,41 @@
+Thu Aug 13 12:21:32 UTC 2015 - toddrme2178(a)gmail.com
+
+- Implement update-alternatives
+
+-------------------------------------------------------------------
+Mon Jun 15 02:16:17 UTC 2015 - arun(a)gmx.de
+
+- update to version 2.5.1:
+ (no changelog available)
+
+-------------------------------------------------------------------
+Fri Jun 5 15:46:36 UTC 2015 - arun(a)gmx.de
+
+- specfile:
+ * add python3-vcversioner
+
+- update to version 2.5.0:
+ * Improved performance on CPython by adding caching around ref
+ resolution (#203)
+
+-------------------------------------------------------------------
+Wed Jan 7 17:03:12 UTC 2015 - jmatejek(a)suse.com
+
+- drop test requirements and %check section, which is broken
+- make a symlink out of /usr/bin/jsonschema
+
+-------------------------------------------------------------------
+Mon Jan 5 20:30:08 UTC 2015 - arun(a)gmx.de
+
+- specfile:
+ * update copyright year
+ * added setuptools as a requirement
+ * add /usr/bin/jsonschema (should this be done using update-alternatives?)
+
+- update to version 2.4.0:
+ * Added a CLI (#134)
+ * Added absolute path and absolute schema path to errors (#120)
+ * Added relevance
+ * Meta-schemas are now loaded via pkgutil
+
+-------------------------------------------------------------------
Old:
----
jsonschema-2.3.0.tar.gz
New:
----
jsonschema-2.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-jsonschema.spec ++++++
--- /var/tmp/diff_new_pack.dNoL1a/_old 2015-09-30 05:49:07.000000000 +0200
+++ /var/tmp/diff_new_pack.dNoL1a/_new 2015-09-30 05:49:07.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python3-jsonschema
#
-# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: python3-jsonschema
-Version: 2.3.0
+Version: 2.5.1
Release: 0
Summary: An implementation of JSON-Schema validation for Python
License: MIT
@@ -26,16 +26,15 @@
Source: http://pypi.python.org/packages/source/j/jsonschema/jsonschema-%{version}.t…
BuildRequires: python3
BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-vcversioner
# Test build requirements
BuildRequires: python3-mock
-BuildRequires: python3-unittest2
Requires: python3
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-%if 0%{?suse_version} && 0%{?suse_version} <= 1110
-%{!?python3_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%else
BuildArch: noarch
-%endif
%description
jsonschema is an implementation of JSON Schema (currently in Draft 3)
@@ -50,14 +49,32 @@
%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
-%if 0%{?suse_version} > 1110
-%check
-#python3 tests.py
-%endif
+# Prepare for update-alternatives usage
+mkdir -p %{buildroot}%{_sysconfdir}/alternatives
+mv %{buildroot}%{_bindir}/jsonschema %{buildroot}%{_bindir}/jsonschema-%{py3_ver}
+ln -s -f %{_sysconfdir}/alternatives/jsonschema %{buildroot}%{_bindir}/jsonschema
+# create a dummy target for /etc/alternatives/jsonschema
+touch %{buildroot}%{_sysconfdir}/alternatives/jsonschema
+
+# Currently fails on Python 3.x
+# %check
+# python3 -m unittest jsonschema.tests.test_jsonschema_test_suite
+
+%post
+%_sbindir/update-alternatives \
+ --install %{_bindir}/jsonschema jsonschema %{_bindir}/jsonschema-%{py3_ver} 30
+
+%preun
+if [ $1 -eq 0 ] ; then
+ %_sbindir/update-alternatives --remove jsonschema %{_bindir}/jsonschema-%{py3_ver}
+fi
%files
%defattr(-,root,root,-)
%doc COPYING README.rst
+%{_bindir}/jsonschema
+%{_bindir}/jsonschema-%{py3_ver}
+%ghost %{_sysconfdir}/alternatives/jsonschema
%{python3_sitelib}/*
%changelog
++++++ jsonschema-2.3.0.tar.gz -> jsonschema-2.5.1.tar.gz ++++++
++++ 3512 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package rubygem-eventmachine for openSUSE:Factory checked in at 2015-09-30 05:48:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-eventmachine (Old)
and /work/SRC/openSUSE:Factory/.rubygem-eventmachine.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-eventmachine"
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-eventmachine/rubygem-eventmachine.changes 2015-06-23 11:55:56.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-eventmachine.new/rubygem-eventmachine.changes 2015-09-30 05:48:58.000000000 +0200
@@ -1,0 +2,18 @@
+Fri Aug 7 04:29:43 UTC 2015 - coolo(a)suse.com
+
+- updated to version 1.0.8
+ see installed CHANGELOG.md
+
+ ## 1.0.8 (August 6, 2015)
+ * fix kqueue assertion failed, postpone ArmKqueueWriter until all events are processed [#51, #176, #372, #401, #619]
+ * fix Rubinius GC, crank the machine from Ruby space when running Rubinius [#201, #202, #617]
+ * test to show that LineText2 preserves whitespace and newlines [#32, #622]
+ * bump up compiler warnings and resolve them [#616]
+ * fix Windows x64 use uintptr_t instead of unsigned long for binding pointers [#612, #615]
+ * fix linetext2 unroll tail recursion to avoid stack level too deep [#609]
+ * fix for compilation with SSL on windows [#601]
+ * open file descriptors and sockets with O_CLOEXEC where possible [#298, #488, #591]
+ * fix SmtpClient: send second EHLO after STARTTLS. [#589]
+ * fix nul-terminated strings in C, use StringValueCStr instead of StringValuePtr
+
+-------------------------------------------------------------------
Old:
----
eventmachine-1.0.7.gem
New:
----
eventmachine-1.0.8.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-eventmachine.spec ++++++
--- /var/tmp/diff_new_pack.QgoVt3/_old 2015-09-30 05:48:59.000000000 +0200
+++ /var/tmp/diff_new_pack.QgoVt3/_new 2015-09-30 05:48:59.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-eventmachine
-Version: 1.0.7
+Version: 1.0.8
Release: 0
%define mod_name eventmachine
%define mod_full_name %{mod_name}-%{version}
@@ -34,10 +34,10 @@
BuildRequires: pkg-config
# /MANUAL
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-BuildRequires: ruby-macros >= 5
BuildRequires: %{rubydevel}
BuildRequires: %{rubygem gem2rpm}
BuildRequires: %{rubygem rdoc > 3.10}
+BuildRequires: ruby-macros >= 5
Url: http://rubyeventmachine.com
Source: http://rubygems.org/gems/%{mod_full_name}.gem
Source1: rubygem-eventmachine-rpmlintrc
++++++ eventmachine-1.0.7.gem -> eventmachine-1.0.8.gem ++++++
++++ 4029 lines of diff (skipped)
1
0
Hello community,
here is the log from the commit of package rubygem-ruby_parser for openSUSE:Factory checked in at 2015-09-30 05:48:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-ruby_parser (Old)
and /work/SRC/openSUSE:Factory/.rubygem-ruby_parser.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-ruby_parser"
Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-ruby_parser/rubygem-ruby_parser.changes 2015-06-12 20:30:38.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-ruby_parser.new/rubygem-ruby_parser.changes 2015-09-30 05:48:56.000000000 +0200
@@ -1,0 +2,17 @@
+Fri Aug 7 04:31:24 UTC 2015 - coolo(a)suse.com
+
+- updated to version 3.7.1
+ see installed History.txt
+
+ === 3.7.1 / 2015-08-06
+
+ * 1 minor enhancement:
+
+ * Improved understandability of lexing postfix symbols.
+
+ * 2 bug fixes:
+
+ * Fixed timeout caused by regexp backtracking bug w/ long strings in 2.2 parser. (presidentbeef)
+ * Rename DEBUG env toggle to RB_LINENO_DEBUG. (tenderlove)
+
+-------------------------------------------------------------------
Old:
----
ruby_parser-3.7.0.gem
New:
----
ruby_parser-3.7.1.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-ruby_parser.spec ++++++
--- /var/tmp/diff_new_pack.4jefyr/_old 2015-09-30 05:48:57.000000000 +0200
+++ /var/tmp/diff_new_pack.4jefyr/_new 2015-09-30 05:48:57.000000000 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-ruby_parser
-Version: 3.7.0
+Version: 3.7.1
Release: 0
%define mod_name ruby_parser
%define mod_full_name %{mod_name}-%{version}
++++++ ruby_parser-3.7.0.gem -> ruby_parser-3.7.1.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/History.txt new/History.txt
--- old/History.txt 2015-05-29 00:04:32.000000000 +0200
+++ new/History.txt 2015-08-06 23:31:41.000000000 +0200
@@ -1,3 +1,14 @@
+=== 3.7.1 / 2015-08-06
+
+* 1 minor enhancement:
+
+ * Improved understandability of lexing postfix symbols.
+
+* 2 bug fixes:
+
+ * Fixed timeout caused by regexp backtracking bug w/ long strings in 2.2 parser. (presidentbeef)
+ * Rename DEBUG env toggle to RB_LINENO_DEBUG. (tenderlove)
+
=== 3.7.0 / 2015-05-28
* 2 major enhancements:
Files old/checksums.yaml.gz and new/checksums.yaml.gz differ
Files old/checksums.yaml.gz.sig and new/checksums.yaml.gz.sig differ
Files old/data.tar.gz.sig and new/data.tar.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/ruby_lexer.rb new/lib/ruby_lexer.rb
--- old/lib/ruby_lexer.rb 2015-05-29 00:04:33.000000000 +0200
+++ new/lib/ruby_lexer.rb 2015-08-06 23:31:42.000000000 +0200
@@ -662,6 +662,23 @@
return result(:expr_end, :tSYMBOL, symbol)
end
+ def was_label?
+ @was_label = ruby22_label?
+ true
+ end
+
+ def process_label_or_string text
+ if @was_label && text =~ /:$/ then
+ @was_label = nil
+ return process_label text
+ elsif text =~ /:$/ then
+ ss.pos -= 1 # put back ":"
+ text = text[0..-2]
+ end
+
+ result :expr_end, :tSTRING, text[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'")
+ end
+
def process_label text
result = process_symbol text
result[0] = :tLABEL
@@ -1202,7 +1219,7 @@
require "ruby_lexer.rex"
-if ENV["DEBUG"] then
+if ENV["RP_LINENO_DEBUG"] then
class RubyLexer
alias :old_lineno= :lineno=
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/ruby_lexer.rex new/lib/ruby_lexer.rex
--- old/lib/ruby_lexer.rex 2015-05-29 00:04:33.000000000 +0200
+++ new/lib/ruby_lexer.rex 2015-08-06 23:31:42.000000000 +0200
@@ -93,9 +93,7 @@
/\[/ process_square_bracket
-# TODO: make this conditional on ruby 2.2
-ruby22_label? /\'#{SSTRING}\':/o process_label
- /\'#{SSTRING}\'/o { result :expr_end, :tSTRING, matched[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'") } # " stupid emacs
+was_label? /\'#{SSTRING}\':?/o process_label_or_string
: /\|/
| /\|\|\=/ { result :expr_beg, :tOP_ASGN, "||" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/ruby_lexer.rex.rb new/lib/ruby_lexer.rex.rb
--- old/lib/ruby_lexer.rex.rb 2015-05-29 00:04:33.000000000 +0200
+++ new/lib/ruby_lexer.rex.rb 2015-08-06 23:31:42.000000000 +0200
@@ -163,10 +163,8 @@
end # group /[+\d]/
when text = ss.scan(/\[/) then
process_square_bracket text
- when ruby22_label? && (text = ss.scan(/\'#{SSTRING}\':/o)) then
- process_label text
- when text = ss.scan(/\'#{SSTRING}\'/o) then
- action { result :expr_end, :tSTRING, matched[1..-2].gsub(/\\\\/, "\\").gsub(/\\'/, "'") } # " stupid emacs
+ when was_label? && (text = ss.scan(/\'#{SSTRING}\':?/o)) then
+ process_label_or_string text
when ss.check(/\|/) then
case
when text = ss.scan(/\|\|\=/) then
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/ruby_parser_extras.rb new/lib/ruby_parser_extras.rb
--- old/lib/ruby_parser_extras.rb 2015-05-29 00:04:33.000000000 +0200
+++ new/lib/ruby_parser_extras.rb 2015-08-06 23:31:42.000000000 +0200
@@ -91,7 +91,7 @@
end
module RubyParserStuff
- VERSION = "3.7.0" unless constants.include? "VERSION" # SIGH
+ VERSION = "3.7.1" unless constants.include? "VERSION" # SIGH
attr_accessor :lexer, :in_def, :in_single, :file
attr_reader :env, :comments
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2015-05-29 00:04:32.000000000 +0200
+++ new/metadata 2015-08-06 23:31:41.000000000 +0200
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: ruby_parser
version: !ruby/object:Gem::Version
- version: 3.7.0
+ version: 3.7.1
platform: ruby
authors:
- Ryan Davis
@@ -29,7 +29,7 @@
xJcC6UN6NHMOVMyAXsr2HR0gRRx4ofN1LoP2KhXzSr8UMvQYlwPmE0N5GQv1b5AO
VpzF30vNaJK6ZT7xlIsIlwmH
-----END CERTIFICATE-----
-date: 2015-05-28 00:00:00.000000000 Z
+date: 2015-08-06 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: sexp_processor
@@ -46,6 +46,20 @@
- !ruby/object:Gem::Version
version: '4.1'
- !ruby/object:Gem::Dependency
+ name: minitest
+ requirement: !ruby/object:Gem::Requirement
+ requirements:
+ - - ~>
+ - !ruby/object:Gem::Version
+ version: '5.7'
+ type: :development
+ prerelease: false
+ version_requirements: !ruby/object:Gem::Requirement
+ requirements:
+ - - ~>
+ - !ruby/object:Gem::Version
+ version: '5.7'
+- !ruby/object:Gem::Dependency
name: rdoc
requirement: !ruby/object:Gem::Requirement
requirements:
Files old/metadata.gz.sig and new/metadata.gz.sig differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/test_ruby_parser.rb new/test/test_ruby_parser.rb
--- old/test/test_ruby_parser.rb 2015-05-29 00:04:33.000000000 +0200
+++ new/test/test_ruby_parser.rb 2015-08-06 23:31:42.000000000 +0200
@@ -575,6 +575,14 @@
# TODO: add more including interpolation etc
end
+ def test_str_backslashes
+ long_string = '\n' * 100
+ rb = "x '#{long_string}'"
+ pt = s(:call, nil, :x, s(:str, long_string))
+
+ assert_parse rb, pt
+ end
+
def test_str_pct_Q_nested
rb = "%Q[before [#\{nest}] after]"
pt = s(:dstr, "before [", s(:evstr, s(:call, nil, :nest)), s(:str, "] after"))
1
0
Hello community,
here is the log from the commit of package virtualbox for openSUSE:13.1:Update checked in at 2015-09-29 10:13:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/virtualbox (Old)
and /work/SRC/openSUSE:13.1:Update/.virtualbox.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "virtualbox"
Changes:
--------
New Changes file:
NO CHANGES FILE!!!
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ _link ++++++
--- /var/tmp/diff_new_pack.liTCqM/_old 2015-09-29 10:14:01.000000000 +0200
+++ /var/tmp/diff_new_pack.liTCqM/_new 2015-09-29 10:14:01.000000000 +0200
@@ -1 +1 @@
-<link package='virtualbox.4012' cicount='copy' />
+<link package='virtualbox.4030' cicount='copy' />
1
0
Hello community,
here is the log from the commit of package perl-Net-IP.4033 for openSUSE:13.1:Update checked in at 2015-09-29 10:13:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/perl-Net-IP.4033 (Old)
and /work/SRC/openSUSE:13.1:Update/.perl-Net-IP.4033.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Net-IP.4033"
Changes:
--------
New Changes file:
--- /dev/null 2015-09-24 09:51:01.260026505 +0200
+++ /work/SRC/openSUSE:13.1:Update/.perl-Net-IP.4033.new/perl-Net-IP.changes 2015-09-29 10:13:53.000000000 +0200
@@ -0,0 +1,100 @@
+-------------------------------------------------------------------
+Wed Sep 16 15:13:49 UTC 2015 - vcizek(a)suse.com
+
+- ipcount: fix the use of + in the address range (boo#942108)
+ * added ipcount-invalid_chars_in_IP.patch
+
+-------------------------------------------------------------------
+Sat Jun 8 07:11:10 UTC 2013 - coolo(a)suse.com
+
+- updated to 1.26
+ - 81138 ip types
+ - 80164 hexip does not change when ip changes (fix: hexformat needs to be cleared by set)
+ - 4898 double compression
+ - 73232 invalid ipv6 1:2:3:4:5:6:7
+ - 73105 invalid ip 1:2
+ - 73104 expand 1::2::3
+ - 71042 ip_reverse 2001:4f8:3:36:0:0:0:235
+ - 45165 ip_range_to_prefix updated documentation
+ - 32232 excepts 61-217-102-8.hinet-ip.hinet.net as range
+
+-------------------------------------------------------------------
+Fri Nov 18 11:07:40 UTC 2011 - coolo(a)suse.com
+
+- use original .tar.gz
+
+-------------------------------------------------------------------
+Tue Nov 30 19:20:35 UTC 2010 - coolo(a)novell.com
+
+- switch to perl_requires macro
+
+-------------------------------------------------------------------
+Mon Nov 29 18:30:45 UTC 2010 - coolo(a)novell.com
+
+- remove /var/adm/perl-modules
+
+-------------------------------------------------------------------
+Tue Oct 19 08:38:50 UTC 2010 - coolo(a)novell.com
+
+- add perl as explicit buildrequire
+
+-------------------------------------------------------------------
+Sun Jan 10 15:43:32 CET 2010 - jengelh(a)medozas.de
+
+- enable parallel build
+
+-------------------------------------------------------------------
+Thu Aug 21 16:31:55 CEST 2008 - anicka(a)suse.cz
+
+- fix undefined value (bnc#418946)
+
+-------------------------------------------------------------------
+Fri Dec 14 16:03:57 CET 2007 - anicka(a)suse.cz
+
+- update to 1.25
+ * Math::BigInt is now mandatory
+ * Several bugfixes done
+ * Bugfix in overlaps function
+ * Updated Makefile
+ * ran perltidy on the code
+
+-------------------------------------------------------------------
+Wed Jan 25 21:39:51 CET 2006 - mls(a)suse.de
+
+- converted neededforbuild to BuildRequires
+
+-------------------------------------------------------------------
+Wed Sep 28 22:13:51 CEST 2005 - dmueller(a)suse.de
+
+ - add norootforbuild
+
+-------------------------------------------------------------------
+Sun Jul 31 16:24:13 CEST 2005 - cthiel(a)suse.de
+
+- update to version 1.23
+
+-------------------------------------------------------------------
+Fri Aug 22 15:23:28 CEST 2003 - mjancar(a)suse.cz
+
+- require the perl version we build with
+
+-------------------------------------------------------------------
+Fri Aug 1 01:49:18 CEST 2003 - ro(a)suse.de
+
+- update to 1.20 / package binaries
+
+-------------------------------------------------------------------
+Mon Jul 28 11:32:22 CEST 2003 - ro(a)suse.de
+
+- install to vendor locations
+
+-------------------------------------------------------------------
+Sun Jun 22 22:25:07 CEST 2003 - coolo(a)suse.de
+
+- package directories
+
+-------------------------------------------------------------------
+Tue Apr 22 14:57:17 CEST 2003 - schubi(a)suse.de
+
+- initial
+
New:
----
Net-IP-1.26.tar.gz
ipcount-invalid_chars_in_IP.patch
perl-Net-IP-1.25-zero_address.diff
perl-Net-IP.changes
perl-Net-IP.spec
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Net-IP.spec ++++++
#
# spec file for package perl-Net-IP
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# 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/
#
Name: perl-Net-IP
Url: http://cpan.org/modules/by-module/Net/
Provides: perl_Net-IP
Obsoletes: perl_Net-IP
Summary: allow easy manipulation of IPv4 and IPv6 addresses
License: Artistic-1.0
Group: Development/Libraries/Perl
Version: 1.26
Release: 0
Source: Net-IP-%{version}.tar.gz
Patch: %{name}-1.25-zero_address.diff
Patch1: ipcount-invalid_chars_in_IP.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{perl_requires}
BuildRequires: perl
BuildRequires: perl-macros
%description
This is the Net::IP module, designed to allow easy manipulation of IPv4
and IPv6 addresses.
Authors:
--------
Manuel Valente
%prep
%setup -n Net-IP-%{version} -q
%patch
%patch1 -p1
%build
perl Makefile.PL
make %{?_smp_mflags}
%check
make test
%install
make DESTDIR=$RPM_BUILD_ROOT install_vendor
%perl_process_packlist
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc Changes MANIFEST README
/usr/bin/*
%{_mandir}/man3/*
%dir %perl_vendorlib/Net
%perl_vendorlib/Net/IP.pm
%dir %perl_vendorarch/auto/Net
%perl_vendorarch/auto/Net/IP
%changelog
++++++ ipcount-invalid_chars_in_IP.patch ++++++
Index: Net-IP-1.26/ipcount
===================================================================
--- Net-IP-1.26.orig/ipcount 2005-10-18 11:59:52.000000000 +0200
+++ Net-IP-1.26/ipcount 2015-09-16 13:50:21.639082216 +0200
@@ -51,6 +51,7 @@ getopts ('rd:',\%opts);
scalar (@ARGV) < 1 and usage();
my $arg = join '',@ARGV;
$arg =~ s/\s+//g;
+$arg =~ s/\+/ \+ /g;
my $ip = new Net::IP($arg) or die ("Cannot create IP object $arg: ".Error());
@@ -77,7 +78,7 @@ if ($opts{d})
while ($current->bincomp ('lt', $last))
{
- $new_ip->set($current->last_ip.'+'.$size) or die (Error());
+ $new_ip->set($current->last_ip.' + '.$size) or die (Error());
print $new_ip->print,"\n";
if ($opts{r})
@@ -85,7 +86,7 @@ if ($opts{d})
print $new_ip->reverse_ip,"\n";
}
- $current->set($new_ip->last_ip .'+ 1') or die (Error());
+ $current->set($new_ip->last_ip .' + 1') or die (Error());
$count++;
}
++++++ perl-Net-IP-1.25-zero_address.diff ++++++
--- IP.pm
+++ IP.pm
@@ -410,7 +410,7 @@
my $int = ip_bintoint($self->binip());
- if (!$int) {
+ if (ref($int) ne "Math::BigInt") {
$self->{error} = $ERROR;
$self->{errno} = $ERRNO;
return;
1
0
Hello community,
here is the log from the commit of package patchinfo.4032 for openSUSE:13.1:Update checked in at 2015-09-29 10:13:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/patchinfo.4032 (Old)
and /work/SRC/openSUSE:13.1:Update/.patchinfo.4032.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "patchinfo.4032"
Changes:
--------
New Changes file:
NO CHANGES FILE!!!
New:
----
_patchinfo
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ _patchinfo ++++++
<patchinfo>
<category>recommended</category>
<rating>moderate</rating>
<packager>vitezslav_cizek</packager>
<summary>Recommended update for tftp</summary>
<description>This recommended update for tftp fixes the following issues:
- respond from the destination address taken from the first udp
message's ancillary data (bnc#928283)
* added tftp-multi-addresses.patch
- tftp-hpa-0.48-macros-crash.patch:
prevent buffer overflow in handling of \x macro (bnc#793883)
- tftp-hpa-0.48-macros-v6mapped.patch:
for \i and \x, expand v6-mapped addresses as native IPv4
(bnc#793883)
- patches come from Michal Kubecek
</description>
<issue id="928283" tracker="bnc">tftp fails to send file over secondary IP on an interface</issue>
<issue id="793883" tracker="bnc">tftpd remapping broken with IPv6 enabled</issue>
</patchinfo>
1
0
Hello community,
here is the log from the commit of package tftp.4032 for openSUSE:13.2:Update checked in at 2015-09-29 10:13:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.2:Update/tftp.4032 (Old)
and /work/SRC/openSUSE:13.2:Update/.tftp.4032.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tftp.4032"
Changes:
--------
New Changes file:
--- /dev/null 2015-09-24 09:51:01.260026505 +0200
+++ /work/SRC/openSUSE:13.2:Update/.tftp.4032.new/tftp.changes 2015-09-29 10:13:47.000000000 +0200
@@ -0,0 +1,428 @@
+-------------------------------------------------------------------
+Fri Sep 18 13:23:21 UTC 2015 - vcizek(a)suse.com
+
+- respond from the destination address taken from the first udp
+ message's ancillary data (bnc#928283)
+ * added tftp-multi-addresses.patch
+
+-------------------------------------------------------------------
+Fri Sep 18 13:22:12 UTC 2015 - vcizek(a)suse.com
+
+- tftp-hpa-0.48-macros-crash.patch:
+ prevent buffer overflow in handling of \x macro (bnc#793883)
+- tftp-hpa-0.48-macros-v6mapped.patch:
+ for \i and \x, expand v6-mapped addresses as native IPv4
+ (bnc#793883)
+- patches come from Michal Kubecek
+
+-------------------------------------------------------------------
+Tue Mar 25 23:35:16 UTC 2014 - crrodriguez(a)opensuse.org
+
+- drop tftp-hpa-0.43_old-autoconf.diff not needed for any
+ product still in active maintenance.
+- Use correct systemd macros in %pre, %post..
+- config.h must be included *everywhere* (tftp-config_h.patch)
+- tftp.service:
+ * This service needs to be started after network.target
+ * Use PrivateDevices=yes
+
+-------------------------------------------------------------------
+Thu Apr 18 09:57:36 UTC 2013 - vcizek(a)suse.com
+
+- change ownership of /srv/tftpboot to tftp:tftp, otherwise tftp
+ daemon can't write there (bnc#813226)
+
+-------------------------------------------------------------------
+Thu Feb 7 13:07:03 UTC 2013 - vcizek(a)suse.com
+
+- create capabilites provided by both tftp and atftp
+ (bnc#801481 or bnc#725378)
+
+-------------------------------------------------------------------
+Wed Dec 5 19:54:20 UTC 2012 - dimstar(a)opensuse.org
+
+- Add systemd socket activation units.
+- Change inet-daemon to be recommended only, as we can now also
+ activate by means of systemd sockets.
+
+-------------------------------------------------------------------
+Tue Sep 4 13:09:09 UTC 2012 - vcizek(a)suse.com
+
+- update to 5.2
+ - fixes a breakage with recent Linux kernel versions when a
+ single interface has multiple IP addresses (bnc#774861)
+
+-------------------------------------------------------------------
+Tue Dec 20 20:30:25 UTC 2011 - coolo(a)suse.com
+
+- add autoconf as buildrequire to avoid implicit dependency
+
+-------------------------------------------------------------------
+Fri Nov 11 14:51:55 UTC 2011 - vcizek(a)suse.com
+
+- added rules for SuSEfirewall2 (bnc#729793)
+ thanks to Lukas Ocilka
+
+-------------------------------------------------------------------
+Tue Sep 6 13:01:31 UTC 2011 - vcizek(a)suse.com
+
+- added missing PreReq: pwdutils
+
+-------------------------------------------------------------------
+Fri Jun 24 07:09:50 UTC 2011 - puzel(a)novell.com
+
+- unbreak tftp by changing to user to run as in tftpd itself,
+ not via xinetd (bnc#682340)
+
+-------------------------------------------------------------------
+Thu Jun 23 12:17:37 UTC 2011 - puzel(a)novell.com
+
+- update to version-5.1
+ - Add -P option to write a PID file. Patch by Ferenc Wagner.
+ - Bounce the syslog socket in standalone mode, in case the
+ syslog daemon has been restarted. Patch by Ferenc Wagner.
+ - Build fixes.
+ - Fix handling of block number wraparound after a successful
+ options negotiation.
+ - Fix a buffer overflow in option parsing.
+- fixes bnc#699714, CVE-2011-2199
+
+-------------------------------------------------------------------
+Sat Dec 11 00:00:00 UTC 2010 - chris(a)computersalat.de
+
+- fix spec
+ o added missing path /srv/tftpboot in files section
+
+-------------------------------------------------------------------
+Fri Dec 3 13:51:50 UTC 2010 - puzel(a)novell.com
+
+- update to version 5.0
+ * Try to on platforms with getaddrinfo() without AI_ADDRCONFIG or
+ AI_CANONNAME.
+ * Implement the "rollover" option, for clients which want block
+ number to rollover to anything other than zero.
+ * Correctly disable PMTU in standalone mode.
+ * Add IPv6 support. Patch by Karsten Keil.
+ * Support systems with editline instead of readline.
+ * Support long options in the server.
+- drop tftp-hpa-0.43_readline.diff (not needed)
+- drop tftp-hpa-0.46_libedit.patch (solved in upstream)
+- build with readline support
+- clean up specfile
+
+-------------------------------------------------------------------
+Fri Oct 29 23:33:18 UTC 2010 - chris(a)computersalat.de
+
+- fix pre
+ o no check before addding group/user (darix)
+- fix files
+ o provide /srv/tftpboot
+
+-------------------------------------------------------------------
+Wed Oct 13 21:05:23 UTC 2010 - chris(a)computersalat.de
+
+- add group/user tftp (bnc#472283)
+- set TFTP default DIR to /srv/tftpboot (bnc#248008,507011)
+- added Conflicts atftp, cause of overlapping binaries
+
+-------------------------------------------------------------------
+Fri Oct 1 12:07:50 UTC 2010 - puzel(a)novell.com
+
+- add tftp-hpa-0.48-tzfix.patch (bnc#630297)
+
+-------------------------------------------------------------------
+Tue Jun 29 08:57:01 UTC 2010 - puzel(a)novell.com
+
+- add tftp-hpa-0.49-fortify-strcpy-crash.patch (bnc#617675)
+
+-------------------------------------------------------------------
+Mon Sep 1 14:45:15 CEST 2008 - mrueckert(a)suse.de
+
+- drop lineedit support again
+- fix build to include %{optflags} with using configure
+
+-------------------------------------------------------------------
+Wed Aug 27 16:20:32 CEST 2008 - olh(a)suse.de
+
+- do not require autoconf 2.61
+ binutils-devel is not available in 11.0 or earlier
+
+-------------------------------------------------------------------
+Wed Aug 6 16:04:07 CEST 2008 - kkeil(a)suse.de
+
+- Update to current git version with enhanced IPv6 support included
+
+-------------------------------------------------------------------
+Fri Jul 18 17:56:28 CEST 2008 - kkeil(a)suse.de
+
+- Update to git version 0.48 for mainline compatibility; code is
+ still the same but formatting was cleaned up
+- Implement IPv6 (fate #304343)
+
+-------------------------------------------------------------------
+Thu Feb 1 21:05:23 CET 2007 - mrueckert(a)suse.de
+
+- update to version 0.48:
+ - Unbreak -l -s in the server, which was broken in 0.47.
+- additional changes from 0.47:
+ - Add -L option to the server to run standalone without
+ detaching from the shell.
+ - Parallel make fix.
+
+-------------------------------------------------------------------
+Tue Jan 9 11:37:58 CET 2007 - mrueckert(a)suse.de
+
+- update to version 0.46:
+ - Minor portability improvements.
+- additional change from 0.45:
+ Add -l (literal) option to the client, to override the special
+ treatment of the colon (:) character as a hostname separator.
+- replaced tftp-hpa-0.43_syntax.diff with tftp-hpa-0.46_colon_check.patch:
+ restore a behavior which was broken with 0.35
+- merged tftp-hpa-0.43_signdness.patch with
+ tftp-hpa-0.43_bcopy_secfix.patch. new patch:
+ tftp-hpa-0.46_bcopy_secfix.patch.
+- added tftp-hpa-0.46_libedit.patch:
+ Build against libedit to enable lineediting support.
+
+-------------------------------------------------------------------
+Thu Dec 7 04:09:55 CET 2006 - mrueckert(a)suse.de
+
+- update to version 0.44:
+ - Allow the client to specify a range of local port numbers, just
+ like the server can.
+ - Fix sending SIGHUP to update the regular expression table.
+
+-------------------------------------------------------------------
+Fri Oct 20 19:04:32 CEST 2006 - mrueckert(a)suse.de
++++ 231 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.2:Update/.tftp.4032.new/tftp.changes
New:
----
tftp-config_h.patch
tftp-hpa-0.43_include_sys_params.patch
tftp-hpa-0.46_colon_check.patch
tftp-hpa-0.48-macros-crash.patch
tftp-hpa-0.48-macros-v6mapped.patch
tftp-hpa-0.48-tzfix.patch
tftp-hpa-0.49-fortify-strcpy-crash.patch
tftp-hpa-5.2.tar.bz2
tftp-multi-addresses.patch
tftp.changes
tftp.fw
tftp.service
tftp.socket
tftp.spec
tftp.xinetd
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ tftp.spec ++++++
#
# spec file for package tftp
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# 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/
#
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
Name: tftp
Version: 5.2
Release: 0
Summary: Trivial File Transfer Protocol (TFTP)
License: BSD-3-Clause
Group: Productivity/Networking/Ftp/Clients
Url: http://www.kernel.org/pub/software/network/tftp/
Source: http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.bz2
Source1: tftp.xinetd
Source2: tftp.fw
Source3: tftp.service
Source4: tftp.socket
Patch0: tftp-hpa-0.43_include_sys_params.patch
Patch1: tftp-hpa-0.46_colon_check.patch
Patch4: tftp-hpa-0.49-fortify-strcpy-crash.patch
Patch5: tftp-hpa-0.48-tzfix.patch
Patch43: tftp-config_h.patch
Patch6: tftp-multi-addresses.patch
Patch7: tftp-hpa-0.48-macros-crash.patch
Patch8: tftp-hpa-0.48-macros-v6mapped.patch
Provides: tftp(client)
Provides: tftp(server)
PreReq: pwdutils
BuildRequires: autoconf
BuildRequires: pwdutils
BuildRequires: tcpd-devel
BuildRequires: pkgconfig(systemd)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1110
BuildRequires: binutils-devel
%endif
Recommends: inet-daemon
Requires: netcfg
Conflicts: atftp
%{?systemd_requires}
%description
The Trivial File Transfer Protocol (TFTP) is normally used only for
booting diskless workstations and for getting or saving network
component configuration files.
%prep
%setup -n %{name}-hpa-%{version}
%patch0
%patch1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7
%patch8
%if 0%{?suse_version} < 1030
%patch42
%endif
%patch43 -p1
%build
autoreconf -fi
%configure \
--enable-largefile \
--with-tcpwrappers \
--with-remap \
--with-ipv6
make
%install
%makeinstall INSTALLROOT=%{buildroot} MANDIR="%{_mandir}"
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/xinetd.d/tftp
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 %SOURCE2 $RPM_BUILD_ROOT/%{_fwdefdir}/tftp
install -d -m 0750 %{buildroot}/srv/tftpboot
# Install systemd unit / socket (As an alternativ to xinetd activation)
install -d %{buildroot}%{_unitdir}
install -m 0644 %{S:3} %{S:4} %{buildroot}%{_unitdir}
%pre
# This group/user is shared with atftp, so please
# keep this in sync with atftp.spec
# add group
%{_sbindir}/groupadd -r tftp 2>/dev/null || :
# add user
%{_sbindir}/useradd -c "TFTP account" -d /srv/tftpboot -G tftp -g tftp \
-r -s /bin/false tftp 2>/dev/null || :
%service_add_pre %{name}.service %{name}.socket
%post
%service_add_post %{name}.service %{name}.socket
%preun
%service_del_preun %{name}.service %{name}.socket
%postun
%service_del_postun %{name}.service %{name}.socket
%clean
rm -rf %{buildroot};
%files
%defattr(-,root,root)
%doc README README.security tftpd/sample.rules
%{_bindir}/tftp
%{_sbindir}/in.tftpd
%{_mandir}/man1/tftp.1.gz
%{_mandir}/man8/in.tftpd.8.gz
%{_mandir}/man8/tftpd.8.gz
%{_unitdir}/tftp.service
%{_unitdir}/tftp.socket
%config(noreplace) %{_sysconfdir}/xinetd.d/tftp
%config %{_fwdefdir}/tftp
%dir %attr(0750,tftp,tftp) /srv/tftpboot
%changelog
++++++ tftp-config_h.patch ++++++
--- tftp-hpa-5.2.orig/MCONFIG.in
+++ tftp-hpa-5.2/MCONFIG.in
@@ -51,7 +51,7 @@ INSTALL_DATA = @INSTALL_DATA@
# Compiler and compiler flags
CC = @CC@
-CFLAGS = @CFLAGS@ -I$(SRCROOT)
+CFLAGS = @CFLAGS@ -I$(SRCROOT) -include config.h
# Link flags
LDFLAGS = @LDFLAGS@
--- tftp-hpa-5.2.orig/tftp/Makefile
+++ tftp-hpa-5.2/tftp/Makefile
@@ -9,7 +9,7 @@ OBJS = tftp.$(O) main.$(O)
all: tftp$(X) tftp.1
tftp$(X): $(OBJS)
- $(CC) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(TFTP_LIBS) -o $@
$(OBJS): ../common/tftpsubs.h
--- tftp-hpa-5.2.orig/tftpd/Makefile
+++ tftp-hpa-5.2/tftpd/Makefile
@@ -9,7 +9,7 @@ OBJS = tftpd.$(O) recvfrom.$(O) misc.$(O
all: tftpd$(X) tftpd.8
tftpd$(X): $(OBJS)
- $(CC) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ $(TFTPD_LIBS) -o $@
$(OBJS): ../common/tftpsubs.h
++++++ tftp-hpa-0.43_include_sys_params.patch ++++++
Index: tftp/main.c
===================================================================
--- tftp/main.c.orig
+++ tftp/main.c
@@ -39,6 +39,7 @@
* TFTP User Program -- Command Interface.
*/
#include <sys/file.h>
+#include <sys/param.h>
#include <ctype.h>
#ifdef WITH_READLINE
#include <readline/readline.h>
++++++ tftp-hpa-0.46_colon_check.patch ++++++
Index: tftp/main.c
===================================================================
--- tftp/main.c.orig
+++ tftp/main.c
@@ -308,7 +308,7 @@ int main(int argc, char *argv[])
bsd_signal(SIGINT, intr);
- if (peerargc) {
+ if (peerargc > 1) {
/* Set peer */
if (sigsetjmp(toplevel, 1) != 0)
exit(EX_NOHOST);
@@ -634,11 +634,14 @@ void get(int argc, char *argv[])
return;
}
if (!connected) {
- for (n = 1; n < argc; n++)
+ for (n = 1; n < argc; n++) {
if (literal || strchr(argv[n], ':') == 0) {
getusage(argv[0]);
return;
}
+ if (argc == 3)
+ break;
+ }
}
for (n = 1; n < argc; n++) {
src = strchr(argv[n], ':');
++++++ tftp-hpa-0.48-macros-crash.patch ++++++
diff -up tftpd/tftpd.c.orig-len tftpd/tftpd.c
--- tftpd/tftpd.c.orig-len 2012-12-11 16:31:29.658043427 +0100
+++ tftpd/tftpd.c 2012-12-11 16:32:22.234018253 +0100
@@ -1287,24 +1287,24 @@ static int rewrite_macros(char macro, ch
return strlen(p);
case 'x':
- if (output) {
- if (from.sa.sa_family == AF_INET) {
+ if (from.sa.sa_family == AF_INET) {
+ if (output)
sprintf(output, "%08lX",
(unsigned long)ntohl(from.si.sin_addr.s_addr));
- l = 8;
+ l = 8;
#ifdef HAVE_IPV6
- } else {
- unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
- p = tb;
- for (l = 0; l < 16; l++) {
- sprintf(p, "%02X", *c);
- c++;
- p += 2;
- }
+ } else {
+ unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
+ p = tb;
+ for (l = 0; l < 16; l++) {
+ sprintf(p, "%02X", *c);
+ c++;
+ p += 2;
+ }
+ if (output)
strcpy(output, tb);
- l = strlen(tb);
+ l = strlen(tb);
#endif
- }
}
return l;
++++++ tftp-hpa-0.48-macros-v6mapped.patch ++++++
diff -up tftpd/tftpd.c.orig-v6map tftpd/tftpd.c
--- tftpd/tftpd.c.orig-v6map 2012-12-11 17:06:53.156624476 +0100
+++ tftpd/tftpd.c 2012-12-11 17:13:08.705298341 +0100
@@ -1263,6 +1263,21 @@ static void do_opt(const char *opt, cons
#ifdef WITH_REGEX
+#ifdef HAVE_IPV6
+static inline int is_v6_mapped(const union sock_addr* pa)
+{
+ const char v6_mapped[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xFF, 0xFF };
+
+ if (from.sa.sa_family != AF_INET6)
+ return 0;
+ if (memcmp(&pa->s6.sin6_addr.s6_addr, v6_mapped, sizeof(v6_mapped)))
+ return 0;
+
+ return 1;
+}
+#endif
+
/*
* This is called by the remap engine when it encounters macros such
* as \i. It should write the output in "output" if non-NULL, and
@@ -1274,10 +1289,20 @@ static int rewrite_macros(char macro, ch
{
char *p, tb[INET6_ADDRSTRLEN];
int l=0;
+ const union sock_addr *pfrom = &from;
+
+#ifdef HAVE_IPV6
+ union sock_addr ipv4_from;
+ if (is_v6_mapped(&from)) {
+ ipv4_from.si.sin_family = AF_INET;
+ memcpy(&ipv4_from.si.sin_addr, from.s6.sin6_addr.s6_addr + 12, 4);
+ pfrom = &ipv4_from;
+ }
+#endif
switch (macro) {
case 'i':
- p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
+ p = (char *)inet_ntop(pfrom->sa.sa_family, SOCKADDR_P(pfrom),
tb, INET6_ADDRSTRLEN);
if (output && p)
strcpy(output, p);
@@ -1287,14 +1312,14 @@ static int rewrite_macros(char macro, ch
return strlen(p);
case 'x':
- if (from.sa.sa_family == AF_INET) {
+ if (pfrom->sa.sa_family == AF_INET) {
if (output)
sprintf(output, "%08lX",
- (unsigned long)ntohl(from.si.sin_addr.s_addr));
+ (unsigned long)ntohl(pfrom->si.sin_addr.s_addr));
l = 8;
#ifdef HAVE_IPV6
} else {
- unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
+ unsigned char *c = (unsigned char *)SOCKADDR_P(pfrom);
p = tb;
for (l = 0; l < 16; l++) {
sprintf(p, "%02X", *c);
++++++ tftp-hpa-0.48-tzfix.patch ++++++
Index: tftp-hpa-5.1/tftpd/tftpd.c
===================================================================
--- tftp-hpa-5.1.orig/tftpd/tftpd.c
+++ tftp-hpa-5.1/tftpd/tftpd.c
@@ -384,6 +384,14 @@ int main(int argc, char **argv)
const char *pidfile = NULL;
u_short tp_opcode;
+ time_t my_time = 0;
+ struct tm* p_tm;
+ char envtz[10];
+ my_time = time(NULL);
+ p_tm = localtime(&my_time);
+ snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", (p_tm->tm_gmtoff * -1)/3600);
+ setenv("TZ", envtz, 0);
+
/* basename() is way too much of a pain from a portability standpoint */
p = strrchr(argv[0], '/');
++++++ tftp-hpa-0.49-fortify-strcpy-crash.patch ++++++
Index: tftp-hpa-git-0.48/tftp/tftp.c
===================================================================
--- tftp-hpa-git-0.48.orig/tftp/tftp.c 2008-07-31 12:46:57.000000000 +0200
+++ tftp-hpa-git-0.48/tftp/tftp.c 2010-06-29 12:14:48.000000000 +0200
@@ -279,15 +279,16 @@ makerequest(int request, const char *nam
struct tftphdr *tp, const char *mode)
{
char *cp;
+ size_t len;
tp->th_opcode = htons((u_short) request);
cp = (char *)&(tp->th_stuff);
- strcpy(cp, name);
- cp += strlen(name);
- *cp++ = '\0';
- strcpy(cp, mode);
- cp += strlen(mode);
- *cp++ = '\0';
+ len = strlen(name) + 1;
+ memcpy(cp, name, len);
+ cp += len;
+ len = strlen(mode) + 1;
+ memcpy(cp, mode, len);
+ cp += len;
return (cp - (char *)tp);
}
++++++ tftp-multi-addresses.patch ++++++
Index: tftp-hpa-5.2/tftpd/recvfrom.c
===================================================================
--- tftp-hpa-5.2.orig/tftpd/recvfrom.c 2015-04-30 11:04:45.994568260 +0200
+++ tftp-hpa-5.2/tftpd/recvfrom.c 2015-05-14 16:02:28.104576816 +0200
@@ -148,17 +148,17 @@ myrecvfrom(int s, void *buf, int len, un
#endif
/* Try to enable getting the return address */
+ /* Before the first packet we don't know the address family of the
+ * connection, so we set both ipv4 and ipv6 socket options
+ */
#ifdef IP_RECVDSTADDR
- if (from->sa_family == AF_INET)
setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
#endif
#ifdef IP_PKTINFO
- if (from->sa_family == AF_INET)
setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
#endif
#ifdef HAVE_IPV6
#ifdef IPV6_RECVPKTINFO
- if (from->sa_family == AF_INET6)
setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
#endif
#endif
@@ -190,7 +190,7 @@ myrecvfrom(int s, void *buf, int len, un
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL;
cmptr = CMSG_NXTHDR(&msg, cmptr)) {
- if (from->sa_family == AF_INET) {
+ if (cmptr->cmsg_level == IPPROTO_IP) {
myaddr->sa.sa_family = AF_INET;
#ifdef IP_RECVDSTADDR
if (cmptr->cmsg_level == IPPROTO_IP &&
@@ -209,15 +209,26 @@ myrecvfrom(int s, void *buf, int len, un
sizeof(struct in_addr));
}
#endif
+ if (from->sa_family == AF_INET6) {
+ from->sa_family = AF_INET;
+ /* Unmap the ipv4 address from ipv6.
+ * The ipv6 mapped address is in format:
+ * 10 0x0 bytes, 2 0xff bytes, 4 bytes of the ipv4 address
+ * so we cut out the first 12 bytes of the ipv6 and
+ * interpret the rest as the ipv4
+ */
+ ((struct sockaddr_in *)from)->sin_addr = *((struct in_addr *)(((struct sockaddr_in6 *)from)->sin6_addr.s6_addr+12));
+ }
}
#ifdef HAVE_IPV6
- else if (from->sa_family == AF_INET6) {
+ else if (cmptr->cmsg_level == IPPROTO_IPV6) {
myaddr->sa.sa_family = AF_INET6;
#ifdef IP6_RECVDSTADDR
if (cmptr->cmsg_level == IPPROTO_IPV6 &&
- cmptr->cmsg_type == IPV6_RECVDSTADDR )
+ cmptr->cmsg_type == IPV6_RECVDSTADDR ) {
memcpy(&myaddr->s6.sin6_addr, CMSG_DATA(cmptr),
sizeof(struct in6_addr));
+ }
#endif
#ifdef HAVE_STRUCT_IN6_PKTINFO
++++++ tftp.fw ++++++
## Name: TFTP Server
## Description: Opens ports for tftp service.
# space separated list of allowed UDP ports
UDP="tftp"
++++++ tftp.service ++++++
[Unit]
Description=Tftp Server
Wants=network.target
After=network.target
[Service]
ExecStart=/usr/sbin/in.tftpd -u tftp -s /srv/tftpboot
StandardInput=socket
PrivateDevices=yes
++++++ tftp.socket ++++++
[Unit]
Description=Tftp Server Activation Socket
[Socket]
ListenDatagram=69
[Install]
WantedBy=sockets.target
++++++ tftp.xinetd ++++++
# default: off
# description: tftp service is provided primarily for booting or when a \
# router need an upgrade. Most sites run this only on machines acting as \
# "boot servers".
# The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
flags = IPv6 IPv4
user = root
server = /usr/sbin/in.tftpd
server_args = -u tftp -s /srv/tftpboot
# per_source = 11
# cps = 100 2
disable = yes
}
1
0
Hello community,
here is the log from the commit of package tftp.4032 for openSUSE:13.1:Update checked in at 2015-09-29 10:13:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:13.1:Update/tftp.4032 (Old)
and /work/SRC/openSUSE:13.1:Update/.tftp.4032.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "tftp.4032"
Changes:
--------
New Changes file:
--- /dev/null 2015-09-24 09:51:01.260026505 +0200
+++ /work/SRC/openSUSE:13.1:Update/.tftp.4032.new/tftp.changes 2015-09-29 10:13:40.000000000 +0200
@@ -0,0 +1,417 @@
+-------------------------------------------------------------------
+Fri Sep 18 13:23:21 UTC 2015 - vcizek(a)suse.com
+
+- respond from the destination address taken from the first udp
+ message's ancillary data (bnc#928283)
+ * added tftp-multi-addresses.patch
+
+-------------------------------------------------------------------
+Fri Sep 18 13:22:12 UTC 2015 - vcizek(a)suse.com
+
+- tftp-hpa-0.48-macros-crash.patch:
+ prevent buffer overflow in handling of \x macro (bnc#793883)
+- tftp-hpa-0.48-macros-v6mapped.patch:
+ for \i and \x, expand v6-mapped addresses as native IPv4
+ (bnc#793883)
+- patches come from Michal Kubecek
+
+-------------------------------------------------------------------
+Thu Apr 18 09:57:36 UTC 2013 - vcizek(a)suse.com
+
+- change ownership of /srv/tftpboot to tftp:tftp, otherwise tftp
+ daemon can't write there (bnc#813226)
+
+-------------------------------------------------------------------
+Thu Feb 7 13:07:03 UTC 2013 - vcizek(a)suse.com
+
+- create capabilites provided by both tftp and atftp
+ (bnc#801481 or bnc#725378)
+
+-------------------------------------------------------------------
+Wed Dec 5 19:54:20 UTC 2012 - dimstar(a)opensuse.org
+
+- Add systemd socket activation units.
+- Change inet-daemon to be recommended only, as we can now also
+ activate by means of systemd sockets.
+
+-------------------------------------------------------------------
+Tue Sep 4 13:09:09 UTC 2012 - vcizek(a)suse.com
+
+- update to 5.2
+ - fixes a breakage with recent Linux kernel versions when a
+ single interface has multiple IP addresses (bnc#774861)
+
+-------------------------------------------------------------------
+Tue Dec 20 20:30:25 UTC 2011 - coolo(a)suse.com
+
+- add autoconf as buildrequire to avoid implicit dependency
+
+-------------------------------------------------------------------
+Fri Nov 11 14:51:55 UTC 2011 - vcizek(a)suse.com
+
+- added rules for SuSEfirewall2 (bnc#729793)
+ thanks to Lukas Ocilka
+
+-------------------------------------------------------------------
+Tue Sep 6 13:01:31 UTC 2011 - vcizek(a)suse.com
+
+- added missing PreReq: pwdutils
+
+-------------------------------------------------------------------
+Fri Jun 24 07:09:50 UTC 2011 - puzel(a)novell.com
+
+- unbreak tftp by changing to user to run as in tftpd itself,
+ not via xinetd (bnc#682340)
+
+-------------------------------------------------------------------
+Thu Jun 23 12:17:37 UTC 2011 - puzel(a)novell.com
+
+- update to version-5.1
+ - Add -P option to write a PID file. Patch by Ferenc Wagner.
+ - Bounce the syslog socket in standalone mode, in case the
+ syslog daemon has been restarted. Patch by Ferenc Wagner.
+ - Build fixes.
+ - Fix handling of block number wraparound after a successful
+ options negotiation.
+ - Fix a buffer overflow in option parsing.
+- fixes bnc#699714, CVE-2011-2199
+
+-------------------------------------------------------------------
+Sat Dec 11 00:00:00 UTC 2010 - chris(a)computersalat.de
+
+- fix spec
+ o added missing path /srv/tftpboot in files section
+
+-------------------------------------------------------------------
+Fri Dec 3 13:51:50 UTC 2010 - puzel(a)novell.com
+
+- update to version 5.0
+ * Try to on platforms with getaddrinfo() without AI_ADDRCONFIG or
+ AI_CANONNAME.
+ * Implement the "rollover" option, for clients which want block
+ number to rollover to anything other than zero.
+ * Correctly disable PMTU in standalone mode.
+ * Add IPv6 support. Patch by Karsten Keil.
+ * Support systems with editline instead of readline.
+ * Support long options in the server.
+- drop tftp-hpa-0.43_readline.diff (not needed)
+- drop tftp-hpa-0.46_libedit.patch (solved in upstream)
+- build with readline support
+- clean up specfile
+
+-------------------------------------------------------------------
+Fri Oct 29 23:33:18 UTC 2010 - chris(a)computersalat.de
+
+- fix pre
+ o no check before addding group/user (darix)
+- fix files
+ o provide /srv/tftpboot
+
+-------------------------------------------------------------------
+Wed Oct 13 21:05:23 UTC 2010 - chris(a)computersalat.de
+
+- add group/user tftp (bnc#472283)
+- set TFTP default DIR to /srv/tftpboot (bnc#248008,507011)
+- added Conflicts atftp, cause of overlapping binaries
+
+-------------------------------------------------------------------
+Fri Oct 1 12:07:50 UTC 2010 - puzel(a)novell.com
+
+- add tftp-hpa-0.48-tzfix.patch (bnc#630297)
+
+-------------------------------------------------------------------
+Tue Jun 29 08:57:01 UTC 2010 - puzel(a)novell.com
+
+- add tftp-hpa-0.49-fortify-strcpy-crash.patch (bnc#617675)
+
+-------------------------------------------------------------------
+Mon Sep 1 14:45:15 CEST 2008 - mrueckert(a)suse.de
+
+- drop lineedit support again
+- fix build to include %{optflags} with using configure
+
+-------------------------------------------------------------------
+Wed Aug 27 16:20:32 CEST 2008 - olh(a)suse.de
+
+- do not require autoconf 2.61
+ binutils-devel is not available in 11.0 or earlier
+
+-------------------------------------------------------------------
+Wed Aug 6 16:04:07 CEST 2008 - kkeil(a)suse.de
+
+- Update to current git version with enhanced IPv6 support included
+
+-------------------------------------------------------------------
+Fri Jul 18 17:56:28 CEST 2008 - kkeil(a)suse.de
+
+- Update to git version 0.48 for mainline compatibility; code is
+ still the same but formatting was cleaned up
+- Implement IPv6 (fate #304343)
+
+-------------------------------------------------------------------
+Thu Feb 1 21:05:23 CET 2007 - mrueckert(a)suse.de
+
+- update to version 0.48:
+ - Unbreak -l -s in the server, which was broken in 0.47.
+- additional changes from 0.47:
+ - Add -L option to the server to run standalone without
+ detaching from the shell.
+ - Parallel make fix.
+
+-------------------------------------------------------------------
+Tue Jan 9 11:37:58 CET 2007 - mrueckert(a)suse.de
+
+- update to version 0.46:
+ - Minor portability improvements.
+- additional change from 0.45:
+ Add -l (literal) option to the client, to override the special
+ treatment of the colon (:) character as a hostname separator.
+- replaced tftp-hpa-0.43_syntax.diff with tftp-hpa-0.46_colon_check.patch:
+ restore a behavior which was broken with 0.35
+- merged tftp-hpa-0.43_signdness.patch with
+ tftp-hpa-0.43_bcopy_secfix.patch. new patch:
+ tftp-hpa-0.46_bcopy_secfix.patch.
+- added tftp-hpa-0.46_libedit.patch:
+ Build against libedit to enable lineediting support.
+
+-------------------------------------------------------------------
+Thu Dec 7 04:09:55 CET 2006 - mrueckert(a)suse.de
+
+- update to version 0.44:
+ - Allow the client to specify a range of local port numbers, just
+ like the server can.
+ - Fix sending SIGHUP to update the regular expression table.
+
+-------------------------------------------------------------------
+Fri Oct 20 19:04:32 CEST 2006 - mrueckert(a)suse.de
+
+- update to version 0.43:
+ - Fix double-free error on ^c in client.
+ - Try to deal with clients that send TFTP requests to broadcasts
+ (apparently some recent Sun boxes do this instead of using the
+ address told by DHCP. Bad Sun! Bad Sun!)
+ - Portability fixes.
+- removed first chunk from tftp-hpa-0.40.diff and renamed it to
+ tftp-hpa-0.43_include_sys_params.patch. the first chunk was
+ fixed upstream.
+- patches rediffed and renamed:
++++ 220 more lines (skipped)
++++ between /dev/null
++++ and /work/SRC/openSUSE:13.1:Update/.tftp.4032.new/tftp.changes
New:
----
tftp-hpa-0.43_include_sys_params.patch
tftp-hpa-0.43_old-autoconf.diff
tftp-hpa-0.46_colon_check.patch
tftp-hpa-0.48-macros-crash.patch
tftp-hpa-0.48-macros-v6mapped.patch
tftp-hpa-0.48-tzfix.patch
tftp-hpa-0.49-fortify-strcpy-crash.patch
tftp-hpa-5.2.tar.bz2
tftp-multi-addresses.patch
tftp.changes
tftp.fw
tftp.service
tftp.socket
tftp.spec
tftp.xinetd
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ tftp.spec ++++++
#
# spec file for package tftp
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# 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/
#
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
%if 0%{?suse_version} >= 1230
%define _systemddir /usr/lib/systemd/
%else
%define _systemddir /lib/systemd/
%endif
%define _unitdir %{_systemddir}/system
Name: tftp
Version: 5.2
Release: 0
Summary: Trivial File Transfer Protocol (TFTP)
License: BSD-3-Clause
Group: Productivity/Networking/Ftp/Clients
Url: http://www.kernel.org/pub/software/network/tftp/
Source: http://www.kernel.org/pub/software/network/tftp/tftp-hpa-%{version}.tar.bz2
Source1: tftp.xinetd
Source2: tftp.fw
Source3: tftp.service
Source4: tftp.socket
Patch0: tftp-hpa-0.43_include_sys_params.patch
Patch1: tftp-hpa-0.46_colon_check.patch
Patch4: tftp-hpa-0.49-fortify-strcpy-crash.patch
Patch5: tftp-hpa-0.48-tzfix.patch
Patch42: tftp-hpa-0.43_old-autoconf.diff
Patch6: tftp-multi-addresses.patch
Patch7: tftp-hpa-0.48-macros-crash.patch
Patch8: tftp-hpa-0.48-macros-v6mapped.patch
Provides: tftp(client)
Provides: tftp(server)
PreReq: pwdutils
BuildRequires: autoconf
BuildRequires: pwdutils
BuildRequires: tcpd-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1110
BuildRequires: binutils-devel
%endif
Recommends: inet-daemon
Requires: netcfg
Conflicts: atftp
%description
The Trivial File Transfer Protocol (TFTP) is normally used only for
booting diskless workstations and for getting or saving network
component configuration files.
%prep
%setup -n %{name}-hpa-%{version}
%patch0
%patch1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7
%patch8
%if 0%{?suse_version} < 1030
%patch42
%endif
%build
autoreconf -fi
%configure \
--enable-largefile \
--with-tcpwrappers \
--with-remap \
--without-editline \
--with-ipv6
make
%install
%makeinstall INSTALLROOT=%{buildroot} MANDIR="%{_mandir}"
install -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/xinetd.d/tftp
mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir}
install -m 644 %SOURCE2 $RPM_BUILD_ROOT/%{_fwdefdir}/tftp
install -d -m 0750 %{buildroot}/srv/tftpboot
# Install systemd unit / socket (As an alternativ to xinetd activation)
install -d %{buildroot}%{_unitdir}
install -m 0644 %{S:3} %{S:4} %{buildroot}%{_unitdir}
%pre
# This group/user is shared with atftp, so please
# keep this in sync with atftp.spec
# add group
%{_sbindir}/groupadd -r tftp 2>/dev/null || :
# add user
%{_sbindir}/useradd -c "TFTP account" -d /srv/tftpboot -G tftp -g tftp \
-r -s /bin/false tftp 2>/dev/null || :
%clean
rm -rf %{buildroot};
%files
%defattr(-,root,root)
%doc README README.security tftpd/sample.rules
%{_bindir}/tftp
%{_sbindir}/in.tftpd
%{_mandir}/man1/tftp.1.gz
%{_mandir}/man8/in.tftpd.8.gz
%{_mandir}/man8/tftpd.8.gz
%dir %{_systemddir}
%dir %{_unitdir}
%{_unitdir}/tftp.service
%{_unitdir}/tftp.socket
%config(noreplace) %{_sysconfdir}/xinetd.d/tftp
%config %{_fwdefdir}/tftp
%dir %attr(0750,tftp,tftp) /srv/tftpboot
%changelog
++++++ tftp-hpa-0.43_include_sys_params.patch ++++++
Index: tftp/main.c
===================================================================
--- tftp/main.c.orig
+++ tftp/main.c
@@ -39,6 +39,7 @@
* TFTP User Program -- Command Interface.
*/
#include <sys/file.h>
+#include <sys/param.h>
#include <ctype.h>
#ifdef WITH_READLINE
#include <readline/readline.h>
++++++ tftp-hpa-0.43_old-autoconf.diff ++++++
openSuSE 10.3 shipped with autoconf 2.61
openSuSE 10.1 shipped with autoconf 2.60
openSuSE 9.1 shipped with autoconf 2.59
---
configure.in | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
--- configure.in.orig
+++ configure.in
@@ -2,11 +2,10 @@ dnl
dnl autoconf input file to generate MCONFIG
dnl
-AC_PREREQ(2.61)
+AC_PREREQ(2.42)
AC_INIT(MCONFIG.in)
AC_PREFIX_DEFAULT(/usr)
-AC_USE_SYSTEM_EXTENSIONS
AC_ISC_POSIX
AC_PROG_CC
++++++ tftp-hpa-0.46_colon_check.patch ++++++
Index: tftp/main.c
===================================================================
--- tftp/main.c.orig
+++ tftp/main.c
@@ -308,7 +308,7 @@ int main(int argc, char *argv[])
bsd_signal(SIGINT, intr);
- if (peerargc) {
+ if (peerargc > 1) {
/* Set peer */
if (sigsetjmp(toplevel, 1) != 0)
exit(EX_NOHOST);
@@ -634,11 +634,14 @@ void get(int argc, char *argv[])
return;
}
if (!connected) {
- for (n = 1; n < argc; n++)
+ for (n = 1; n < argc; n++) {
if (literal || strchr(argv[n], ':') == 0) {
getusage(argv[0]);
return;
}
+ if (argc == 3)
+ break;
+ }
}
for (n = 1; n < argc; n++) {
src = strchr(argv[n], ':');
++++++ tftp-hpa-0.48-macros-crash.patch ++++++
diff -up tftpd/tftpd.c.orig-len tftpd/tftpd.c
--- tftpd/tftpd.c.orig-len 2012-12-11 16:31:29.658043427 +0100
+++ tftpd/tftpd.c 2012-12-11 16:32:22.234018253 +0100
@@ -1287,24 +1287,24 @@ static int rewrite_macros(char macro, ch
return strlen(p);
case 'x':
- if (output) {
- if (from.sa.sa_family == AF_INET) {
+ if (from.sa.sa_family == AF_INET) {
+ if (output)
sprintf(output, "%08lX",
(unsigned long)ntohl(from.si.sin_addr.s_addr));
- l = 8;
+ l = 8;
#ifdef HAVE_IPV6
- } else {
- unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
- p = tb;
- for (l = 0; l < 16; l++) {
- sprintf(p, "%02X", *c);
- c++;
- p += 2;
- }
+ } else {
+ unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
+ p = tb;
+ for (l = 0; l < 16; l++) {
+ sprintf(p, "%02X", *c);
+ c++;
+ p += 2;
+ }
+ if (output)
strcpy(output, tb);
- l = strlen(tb);
+ l = strlen(tb);
#endif
- }
}
return l;
++++++ tftp-hpa-0.48-macros-v6mapped.patch ++++++
diff -up tftpd/tftpd.c.orig-v6map tftpd/tftpd.c
--- tftpd/tftpd.c.orig-v6map 2012-12-11 17:06:53.156624476 +0100
+++ tftpd/tftpd.c 2012-12-11 17:13:08.705298341 +0100
@@ -1263,6 +1263,21 @@ static void do_opt(const char *opt, cons
#ifdef WITH_REGEX
+#ifdef HAVE_IPV6
+static inline int is_v6_mapped(const union sock_addr* pa)
+{
+ const char v6_mapped[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0xFF, 0xFF };
+
+ if (from.sa.sa_family != AF_INET6)
+ return 0;
+ if (memcmp(&pa->s6.sin6_addr.s6_addr, v6_mapped, sizeof(v6_mapped)))
+ return 0;
+
+ return 1;
+}
+#endif
+
/*
* This is called by the remap engine when it encounters macros such
* as \i. It should write the output in "output" if non-NULL, and
@@ -1274,10 +1289,20 @@ static int rewrite_macros(char macro, ch
{
char *p, tb[INET6_ADDRSTRLEN];
int l=0;
+ const union sock_addr *pfrom = &from;
+
+#ifdef HAVE_IPV6
+ union sock_addr ipv4_from;
+ if (is_v6_mapped(&from)) {
+ ipv4_from.si.sin_family = AF_INET;
+ memcpy(&ipv4_from.si.sin_addr, from.s6.sin6_addr.s6_addr + 12, 4);
+ pfrom = &ipv4_from;
+ }
+#endif
switch (macro) {
case 'i':
- p = (char *)inet_ntop(from.sa.sa_family, SOCKADDR_P(&from),
+ p = (char *)inet_ntop(pfrom->sa.sa_family, SOCKADDR_P(pfrom),
tb, INET6_ADDRSTRLEN);
if (output && p)
strcpy(output, p);
@@ -1287,14 +1312,14 @@ static int rewrite_macros(char macro, ch
return strlen(p);
case 'x':
- if (from.sa.sa_family == AF_INET) {
+ if (pfrom->sa.sa_family == AF_INET) {
if (output)
sprintf(output, "%08lX",
- (unsigned long)ntohl(from.si.sin_addr.s_addr));
+ (unsigned long)ntohl(pfrom->si.sin_addr.s_addr));
l = 8;
#ifdef HAVE_IPV6
} else {
- unsigned char *c = (unsigned char *)SOCKADDR_P(&from);
+ unsigned char *c = (unsigned char *)SOCKADDR_P(pfrom);
p = tb;
for (l = 0; l < 16; l++) {
sprintf(p, "%02X", *c);
++++++ tftp-hpa-0.48-tzfix.patch ++++++
Index: tftp-hpa-5.1/tftpd/tftpd.c
===================================================================
--- tftp-hpa-5.1.orig/tftpd/tftpd.c
+++ tftp-hpa-5.1/tftpd/tftpd.c
@@ -384,6 +384,14 @@ int main(int argc, char **argv)
const char *pidfile = NULL;
u_short tp_opcode;
+ time_t my_time = 0;
+ struct tm* p_tm;
+ char envtz[10];
+ my_time = time(NULL);
+ p_tm = localtime(&my_time);
+ snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", (p_tm->tm_gmtoff * -1)/3600);
+ setenv("TZ", envtz, 0);
+
/* basename() is way too much of a pain from a portability standpoint */
p = strrchr(argv[0], '/');
++++++ tftp-hpa-0.49-fortify-strcpy-crash.patch ++++++
Index: tftp-hpa-git-0.48/tftp/tftp.c
===================================================================
--- tftp-hpa-git-0.48.orig/tftp/tftp.c 2008-07-31 12:46:57.000000000 +0200
+++ tftp-hpa-git-0.48/tftp/tftp.c 2010-06-29 12:14:48.000000000 +0200
@@ -279,15 +279,16 @@ makerequest(int request, const char *nam
struct tftphdr *tp, const char *mode)
{
char *cp;
+ size_t len;
tp->th_opcode = htons((u_short) request);
cp = (char *)&(tp->th_stuff);
- strcpy(cp, name);
- cp += strlen(name);
- *cp++ = '\0';
- strcpy(cp, mode);
- cp += strlen(mode);
- *cp++ = '\0';
+ len = strlen(name) + 1;
+ memcpy(cp, name, len);
+ cp += len;
+ len = strlen(mode) + 1;
+ memcpy(cp, mode, len);
+ cp += len;
return (cp - (char *)tp);
}
++++++ tftp-multi-addresses.patch ++++++
Index: tftp-hpa-5.2/tftpd/recvfrom.c
===================================================================
--- tftp-hpa-5.2.orig/tftpd/recvfrom.c 2015-04-30 11:04:45.994568260 +0200
+++ tftp-hpa-5.2/tftpd/recvfrom.c 2015-05-14 16:02:28.104576816 +0200
@@ -148,17 +148,17 @@ myrecvfrom(int s, void *buf, int len, un
#endif
/* Try to enable getting the return address */
+ /* Before the first packet we don't know the address family of the
+ * connection, so we set both ipv4 and ipv6 socket options
+ */
#ifdef IP_RECVDSTADDR
- if (from->sa_family == AF_INET)
setsockopt(s, IPPROTO_IP, IP_RECVDSTADDR, &on, sizeof(on));
#endif
#ifdef IP_PKTINFO
- if (from->sa_family == AF_INET)
setsockopt(s, IPPROTO_IP, IP_PKTINFO, &on, sizeof(on));
#endif
#ifdef HAVE_IPV6
#ifdef IPV6_RECVPKTINFO
- if (from->sa_family == AF_INET6)
setsockopt(s, IPPROTO_IPV6, IPV6_RECVPKTINFO, &on, sizeof(on));
#endif
#endif
@@ -190,7 +190,7 @@ myrecvfrom(int s, void *buf, int len, un
for (cmptr = CMSG_FIRSTHDR(&msg); cmptr != NULL;
cmptr = CMSG_NXTHDR(&msg, cmptr)) {
- if (from->sa_family == AF_INET) {
+ if (cmptr->cmsg_level == IPPROTO_IP) {
myaddr->sa.sa_family = AF_INET;
#ifdef IP_RECVDSTADDR
if (cmptr->cmsg_level == IPPROTO_IP &&
@@ -209,15 +209,26 @@ myrecvfrom(int s, void *buf, int len, un
sizeof(struct in_addr));
}
#endif
+ if (from->sa_family == AF_INET6) {
+ from->sa_family = AF_INET;
+ /* Unmap the ipv4 address from ipv6.
+ * The ipv6 mapped address is in format:
+ * 10 0x0 bytes, 2 0xff bytes, 4 bytes of the ipv4 address
+ * so we cut out the first 12 bytes of the ipv6 and
+ * interpret the rest as the ipv4
+ */
+ ((struct sockaddr_in *)from)->sin_addr = *((struct in_addr *)(((struct sockaddr_in6 *)from)->sin6_addr.s6_addr+12));
+ }
}
#ifdef HAVE_IPV6
- else if (from->sa_family == AF_INET6) {
+ else if (cmptr->cmsg_level == IPPROTO_IPV6) {
myaddr->sa.sa_family = AF_INET6;
#ifdef IP6_RECVDSTADDR
if (cmptr->cmsg_level == IPPROTO_IPV6 &&
- cmptr->cmsg_type == IPV6_RECVDSTADDR )
+ cmptr->cmsg_type == IPV6_RECVDSTADDR ) {
memcpy(&myaddr->s6.sin6_addr, CMSG_DATA(cmptr),
sizeof(struct in6_addr));
+ }
#endif
#ifdef HAVE_STRUCT_IN6_PKTINFO
++++++ tftp.fw ++++++
## Name: TFTP Server
## Description: Opens ports for tftp service.
# space separated list of allowed UDP ports
UDP="tftp"
++++++ tftp.service ++++++
[Unit]
Description=Tftp Server
[Service]
ExecStart=/usr/sbin/in.tftpd -u tftp -s /srv/tftpboot
StandardInput=socket
++++++ tftp.socket ++++++
[Unit]
Description=Tftp Server Activation Socket
[Socket]
ListenDatagram=69
[Install]
WantedBy=sockets.target
++++++ tftp.xinetd ++++++
# default: off
# description: tftp service is provided primarily for booting or when a \
# router need an upgrade. Most sites run this only on machines acting as \
# "boot servers".
# The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
flags = IPv6 IPv4
user = root
server = /usr/sbin/in.tftpd
server_args = -u tftp -s /srv/tftpboot
# per_source = 11
# cps = 100 2
disable = yes
}
1
0