mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-04-14 03:41:08 +00:00
ubuntutools/test/test_update_maintainer.py: update test cases to
handle checking for debian/rules.
This commit is contained in:
parent
df38124295
commit
9ebaa17ad8
4
debian/changelog
vendored
4
debian/changelog
vendored
@ -15,8 +15,10 @@ ubuntu-dev-tools (0.116) UNRELEASED; urgency=low
|
||||
[ Kees Cook ]
|
||||
* ubuntutools/update_maintainer.py: do nothing if the rules file
|
||||
already manages XSBC-Original (e.g. python).
|
||||
* ubuntutools/test/test_update_maintainer.py: update test cases to
|
||||
handle checking for debian/rules.
|
||||
|
||||
-- Kees Cook <kees@ubuntu.com> Mon, 07 Feb 2011 10:42:07 -0800
|
||||
-- Kees Cook <kees@ubuntu.com> Tue, 08 Feb 2011 10:27:27 -0800
|
||||
|
||||
ubuntu-dev-tools (0.115) unstable; urgency=low
|
||||
|
||||
|
@ -120,6 +120,36 @@ VCS-Git: git://git.debian.org/pkg-mozext/adblock-plus.git
|
||||
Package: xul-ext-adblock-plus
|
||||
"""
|
||||
|
||||
_SIMPLE_RULES = """#!/usr/bin/make -f
|
||||
%:
|
||||
dh $@
|
||||
"""
|
||||
|
||||
_COMPLEX_RULES = """#!/usr/bin/make -f
|
||||
... from python2.6 ...
|
||||
distribution := $(shell lsb_release -is)
|
||||
|
||||
control-file:
|
||||
sed -e "s/@PVER@/$(PVER)/g" \
|
||||
-e "s/@VER@/$(VER)/g" \
|
||||
-e "s/@PYSTDDEP@/$(PYSTDDEP)/g" \
|
||||
-e "s/@PRIO@/$(PY_PRIO)/g" \
|
||||
-e "s/@MINPRIO@/$(PY_MINPRIO)/g" \
|
||||
debian/control.in > debian/control.tmp
|
||||
ifeq ($(distribution),Ubuntu)
|
||||
ifneq (,$(findstring ubuntu, $(PKGVERSION)))
|
||||
m='Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>'; \
|
||||
sed -i "/^Maintainer:/s/\(.*\)/Maintainer: $$m\nXSBC-Original-\1/" \
|
||||
debian/control.tmp
|
||||
endif
|
||||
endif
|
||||
[ -e debian/control ] \
|
||||
&& cmp -s debian/control debian/control.tmp \
|
||||
&& rm -f debian/control.tmp && exit 0; \
|
||||
mv debian/control.tmp debian/control
|
||||
... from python2.6 ...
|
||||
"""
|
||||
|
||||
#pylint: disable=R0904
|
||||
class UpdateMaintainerTestCase(mox.MoxTestBase, unittest.TestCase):
|
||||
"""TestCase object for ubuntutools.update_maintainer"""
|
||||
@ -129,6 +159,7 @@ class UpdateMaintainerTestCase(mox.MoxTestBase, unittest.TestCase):
|
||||
"changelog": None,
|
||||
"control": None,
|
||||
"control.in": None,
|
||||
"rules": None,
|
||||
}
|
||||
|
||||
def _fake_isfile(self, filename):
|
||||
@ -153,6 +184,7 @@ class UpdateMaintainerTestCase(mox.MoxTestBase, unittest.TestCase):
|
||||
super(UpdateMaintainerTestCase, self).setUp()
|
||||
self.mox.stubs.Set(__builtin__, 'open', self._fake_open)
|
||||
self.mox.stubs.Set(os.path, 'isfile', self._fake_isfile)
|
||||
self._files["rules"] = StringIO.StringIO(_SIMPLE_RULES)
|
||||
Logger.stdout = StringIO.StringIO()
|
||||
Logger.stderr = StringIO.StringIO()
|
||||
|
||||
@ -162,6 +194,7 @@ class UpdateMaintainerTestCase(mox.MoxTestBase, unittest.TestCase):
|
||||
self._files["changelog"] = None
|
||||
self._files["control"] = None
|
||||
self._files["control.in"] = None
|
||||
self._files["rules"] = None
|
||||
Logger.stdout = sys.stdout
|
||||
Logger.stderr = sys.stderr
|
||||
|
||||
@ -202,3 +235,11 @@ class UpdateMaintainerTestCase(mox.MoxTestBase, unittest.TestCase):
|
||||
self._files["control.in"] = StringIO.StringIO(_ABP_OLD_MAINTAINER)
|
||||
update_maintainer(self._directory, True)
|
||||
self.assertEqual(self._files["control.in"].getvalue(), _ABP_UPDATED)
|
||||
|
||||
def test_update_maintainer_skip_smart_rules(self):
|
||||
"""Test: Skip update when XSBC-Original in debian/rules."""
|
||||
self._files["changelog"] = StringIO.StringIO(_LUCID_CHANGELOG)
|
||||
self._files["control"] = StringIO.StringIO(_ABP_CONTROL)
|
||||
self._files["rules"] = StringIO.StringIO(_COMPLEX_RULES)
|
||||
update_maintainer(self._directory)
|
||||
self.assertEqual(self._files["control"].getvalue(), _ABP_CONTROL)
|
||||
|
@ -62,7 +62,7 @@ def update_maintainer(debian_directory, verbose=False):
|
||||
|
||||
# If the rules file accounts for XSBC-Original-Maintainer, we should not
|
||||
# touch it in this package (e.g. the python package).
|
||||
if 'XSBC-Original-' in file(os.path.join(debian_directory, "rules")).read():
|
||||
if 'XSBC-Original-' in open(os.path.join(debian_directory, "rules")).read():
|
||||
if verbose:
|
||||
print "XSBC-Original is managed by 'rules' file. Doing nothing."
|
||||
return(0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user