Exemple #1
0
 def testDelete(self):
     ops = (
         ekeyword.Op('^', 'arm', None),
         ekeyword.Op('^', 's390', None),
         ekeyword.Op('^', 'x86', None),
     )
     self._test('arm -s390 ~x86 bar', ops, 'bar')
Exemple #2
0
 def testModify(self):
     ops = (
         ekeyword.Op(None, "arm", None),
         ekeyword.Op("~", "s390", None),
         ekeyword.Op("-", "sh", None),
     )
     self._test("~arm s390 ~sh moo", ops, "arm ~s390 -sh moo")
Exemple #3
0
 def testAdd(self):
     ops = (
         ekeyword.Op(None, 'arm', None),
         ekeyword.Op('~', 's390', None),
         ekeyword.Op('-', 'sh', None),
     )
     self._test('moo', ops, 'arm ~s390 -sh moo')
Exemple #4
0
 def testModify(self):
     ops = (
         ekeyword.Op(None, 'arm', None),
         ekeyword.Op('~', 's390', None),
         ekeyword.Op('-', 'sh', None),
     )
     self._test('~arm s390 ~sh moo', ops, 'arm ~s390 -sh moo')
Exemple #5
0
 def testDelete(self):
     ops = (
         ekeyword.Op("^", "arm", None),
         ekeyword.Op("^", "s390", None),
         ekeyword.Op("^", "x86", None),
     )
     self._test("arm -s390 ~x86 bar", ops, "bar")
Exemple #6
0
 def testAdd(self):
     ops = (
         ekeyword.Op(None, "arm", None),
         ekeyword.Op("~", "s390", None),
         ekeyword.Op("-", "sh", None),
     )
     self._test("moo", ops, "arm ~s390 -sh moo")
Exemple #7
0
 def _testKeywords(self, line):
     ops = (
         ekeyword.Op(None, "arm", None),
         ekeyword.Op("~", "sparc", None),
     )
     return ekeyword.process_content("file", ["%s\n" % line],
                                     ops,
                                     quiet=True)
Exemple #8
0
 def _testKeywords(self, line):
     ops = (
         ekeyword.Op(None, 'arm', None),
         ekeyword.Op('~', 'sparc', None),
     )
     return ekeyword.process_content('file', ['%s\n' % line],
                                     ops,
                                     quiet=True)
Exemple #9
0
 def _testSmoke(self, style="color-inline", verbose=0, quiet=0):
     ops = (
         ekeyword.Op(None, "arm", None),
         ekeyword.Op("~", "sparc", None),
     )
     ekeyword.process_content("asdf", ['KEYWORDS="arm"'],
                              ops,
                              verbose=verbose,
                              quiet=quiet,
                              style=style)
Exemple #10
0
 def _testSmoke(self, style='color-inline', verbose=0, quiet=0):
     ops = (
         ekeyword.Op(None, 'arm', None),
         ekeyword.Op('~', 'sparc', None),
     )
     ekeyword.process_content('asdf', ['KEYWORDS="arm"'],
                              ops,
                              verbose=verbose,
                              quiet=quiet,
                              style=style)
Exemple #11
0
 def _testSmoke(self, dry_run):
     ops = (
         ekeyword.Op(None, "arm", None),
         ekeyword.Op("~", "sparc", None),
     )
     orig_content, new_content = self._process_ebuild(ops, dry_run=dry_run)
     if dry_run:
         self.assertEqual(orig_content, new_content)
     else:
         self.assertNotEqual(orig_content, new_content)
Exemple #12
0
 def testAllMultiUnstableStable(self):
     ops = (
         ekeyword.Op('~', 'all', None),
         ekeyword.Op(None, 'all', None),
     )
     arch_status = {
         'alpha': ('stable', '~arch'),
         'arm': ('stable', 'arch'),
         'm68k': ('exp', '~arch'),
         's390': ('exp', 'arch'),
     }
     self._test('-* ~* * alpha arm m68k s390', ops,
                '-* ~* * ~alpha arm ~m68k s390', arch_status)
Exemple #13
0
 def testAllMultiUnstableStable(self):
     ops = (
         ekeyword.Op("~", "all", None),
         ekeyword.Op(None, "all", None),
     )
     arch_status = {
         "alpha": ("stable", "~arch"),
         "arm": ("stable", "arch"),
         "m68k": ("exp", "~arch"),
         "s390": ("exp", "arch"),
     }
     self._test(
         "-* ~* * alpha arm m68k s390",
         ops,
         "-* ~* * ~alpha arm ~m68k s390",
         arch_status,
     )
Exemple #14
0
 def testAllStable(self):
     ops = (ekeyword.Op(None, 'all', None), )
     arch_status = {
         'alpha': ('stable', '~arch'),
         'arm': ('stable', 'arch'),
         'm68k': ('exp', '~arch'),
         's390': ('exp', 'arch'),
     }
     self._test('* ~alpha ~arm ~m68k ~mips ~s390 ~arm-linux', ops,
                '* ~alpha arm ~m68k ~mips s390 ~arm-linux', arch_status)
Exemple #15
0
 def testAllStable(self):
     ops = (ekeyword.Op(None, "all", None), )
     arch_status = {
         "alpha": ("stable", "~arch"),
         "arm": ("stable", "arch"),
         "m68k": ("exp", "~arch"),
         "s390": ("exp", "arch"),
     }
     self._test(
         "* ~alpha ~arm ~m68k ~mips ~s390 ~arm-linux",
         ops,
         "* ~alpha arm ~m68k ~mips s390 ~arm-linux",
         arch_status,
     )
Exemple #16
0
 def testSync(self):
     ops = (
         ekeyword.Op('=', 'arm64', 'arm'),
         ekeyword.Op('=', 'ppc64', 'ppc'),
         ekeyword.Op('=', 'amd64', 'x86'),
         ekeyword.Op('=', 'm68k', 'mips'),
         ekeyword.Op('=', 'ia64', 'alpha'),
         ekeyword.Op('=', 'sh', 'sparc'),
         ekeyword.Op('=', 's390', 's390x'),
         ekeyword.Op('=', 'boo', 'moo'),
     )
     self._test(
         'arm64 arm '
         '~ppc64 ~ppc '
         '~amd64 x86 '
         'm68k ~mips '
         '-ia64 alpha '
         'sh -sparc '
         's390 '
         'moo ', ops,
         'arm64 arm ~ppc64 ~ppc amd64 x86 ~m68k ~mips ia64 alpha '
         '-sh -sparc boo moo')
Exemple #17
0
 def testSync(self):
     ops = (
         ekeyword.Op("=", "arm64", "arm"),
         ekeyword.Op("=", "ppc64", "ppc"),
         ekeyword.Op("=", "amd64", "x86"),
         ekeyword.Op("=", "m68k", "mips"),
         ekeyword.Op("=", "ia64", "alpha"),
         ekeyword.Op("=", "sh", "sparc"),
         ekeyword.Op("=", "s390", "s390x"),
         ekeyword.Op("=", "boo", "moo"),
     )
     self._test(
         "arm64 arm "
         "~ppc64 ~ppc "
         "~amd64 x86 "
         "m68k ~mips "
         "-ia64 alpha "
         "sh -sparc "
         "s390 "
         "moo ",
         ops,
         "arm64 arm ~ppc64 ~ppc amd64 x86 ~m68k ~mips ia64 alpha "
         "-sh -sparc boo moo",
     )
Exemple #18
0
 def _test(self, arg, op):
     self.assertEqual(ekeyword.arg_to_op(arg), ekeyword.Op(*op))
Exemple #19
0
 def testManifestUpdated(self):
     """Verify `ebuild ... manifest` runs on updated files"""
     with mock.patch.object(subprocess, "check_call") as m:
         self._process_ebuild((ekeyword.Op("~", "arm", None), ),
                              manifest=True)
     m.assert_called_once_with(["ebuild", mock.ANY, "manifest"])
Exemple #20
0
 def testManifestNotUpdated(self):
     """Verify we don't run `ebuild ... manifest` on unmodified files"""
     with mock.patch.object(subprocess, "check_call") as m:
         self._process_ebuild((ekeyword.Op(None, "arm", None), ),
                              manifest=True)
     self.assertEqual(m.call_count, 0)
Exemple #21
0
 def testAllDisabled(self):
     """Make sure ~all does not change -arch to ~arch"""
     ops = (ekeyword.Op('~', 'all', None), )
     self._test('alpha -sparc ~x86', ops, '~alpha -sparc ~x86', {})
Exemple #22
0
 def testManifestUpdated(self):
     """Verify `ebuild ... manifest` runs on updated files"""
     with mock.patch.object(subprocess, 'check_call') as m:
         self._process_ebuild((ekeyword.Op('~', 'arm', None), ),
                              manifest=True)
     m.assert_called_once_with(['ebuild', mock.ANY, 'manifest'])
Exemple #23
0
 def testAllNoStatus(self):
     ops = (ekeyword.Op(None, 'all', None), )
     self.assertRaises(ValueError, self._test, '', ops, '')
Exemple #24
0
 def testAllDisabled(self):
     """Make sure ~all does not change -arch to ~arch"""
     ops = (ekeyword.Op("~", "all", None), )
     self._test("alpha -sparc ~x86", ops, "~alpha -sparc ~x86", {})
Exemple #25
0
 def testAllNoStatus(self):
     ops = (ekeyword.Op(None, "all", None), )
     self.assertRaises(ValueError, self._test, "", ops, "")