update to allow for missing rules file

This commit is contained in:
Kees Cook 2011-02-08 11:57:07 -08:00
parent 9ebaa17ad8
commit 6265047606
2 changed files with 11 additions and 1 deletions

View File

@ -243,3 +243,11 @@ class UpdateMaintainerTestCase(mox.MoxTestBase, unittest.TestCase):
self._files["rules"] = StringIO.StringIO(_COMPLEX_RULES)
update_maintainer(self._directory)
self.assertEqual(self._files["control"].getvalue(), _ABP_CONTROL)
def test_update_maintainer_missing_rules(self):
"""Test: Skip XSBC-Original test when debian/rules is missing."""
self._files["changelog"] = StringIO.StringIO(_LUCID_CHANGELOG)
self._files["control"] = StringIO.StringIO(_ABP_CONTROL)
self._files["rules"] = None
update_maintainer(self._directory)
self.assertEqual(self._files["control"].getvalue(), _ABP_UPDATED)

View File

@ -62,7 +62,9 @@ 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 open(os.path.join(debian_directory, "rules")).read():
rules_file = os.path.join(debian_directory, "rules")
if os.path.isfile(rules_file) and \
'XSBC-Original-' in open(rules_file).read():
if verbose:
print "XSBC-Original is managed by 'rules' file. Doing nothing."
return(0)