Merge pull request #59 from Enlik/eapi7-bdepend

[entropy.spm] add support for BDEPEND (from EAPI 7)
This commit is contained in:
Fabio Erculiani
2018-08-18 09:24:23 +02:00
committed by GitHub
2 changed files with 75 additions and 8 deletions

View File

@@ -492,6 +492,7 @@ class PortagePlugin(SpmPlugin):
'depend': "DEPEND",
'rdepend': "RDEPEND",
'pdepend': "PDEPEND",
'bdepend': "BDEPEND", # since EAPI 7
'needed': "NEEDED",
'needed.elf.2': "NEEDED.ELF.2",
'inherited': "INHERITED",
@@ -705,7 +706,7 @@ class PortagePlugin(SpmPlugin):
return ["CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
"EAPI", "HOMEPAGE", "IUSE", "KEYWORDS",
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND",
"repository", "RESTRICT", "SLOT", "USE"
"BDEPEND", "repository", "RESTRICT", "SLOT", "USE"
]
def get_cache_directory(self, root = None):
@@ -1655,8 +1656,8 @@ class PortagePlugin(SpmPlugin):
data['eapi'] = None
portage_metadata = self._calculate_dependencies(
data['iuse'], data['use'], data['license'], data['depend'],
data['rdepend'], data['pdepend'], data['provide'], data['sources'],
data['eapi']
data['rdepend'], data['pdepend'], data['bdepend'],
data['provide'], data['sources'], data['eapi']
)
data['license'] = " ".join(portage_metadata['LICENSE'])
@@ -1679,6 +1680,7 @@ class PortagePlugin(SpmPlugin):
"RDEPEND": etpConst['dependency_type_ids']['rdepend_id'],
"PDEPEND": etpConst['dependency_type_ids']['pdepend_id'],
"DEPEND": etpConst['dependency_type_ids']['bdepend_id'],
"BDEPEND": etpConst['dependency_type_ids']['bdepend_id'],
}
dep_duplicates = set()
for dep_key, dep_val in dep_keys.items():
@@ -1780,7 +1782,7 @@ class PortagePlugin(SpmPlugin):
# clear unused metadata
del data['use'], data['iuse'], data['depend'], data['pdepend'], \
data['rdepend'], data['eapi']
data['rdepend'], data['bdepend'], data['eapi']
return data
@@ -4058,13 +4060,14 @@ class PortagePlugin(SpmPlugin):
return use, disabled_use
def _calculate_dependencies(self, my_iuse, my_use, my_license, my_depend,
my_rdepend, my_pdepend, my_provide, my_src_uri, my_eapi):
my_rdepend, my_pdepend, my_bdepend, my_provide, my_src_uri, my_eapi):
metadata = {
'LICENSE': my_license,
'DEPEND': my_depend,
'PDEPEND': my_pdepend,
'RDEPEND': my_rdepend,
'BDEPEND': my_bdepend,
'PROVIDE': my_provide,
'SRC_URI': my_src_uri,
}
@@ -4083,7 +4086,7 @@ class PortagePlugin(SpmPlugin):
metadata['USE'] = sorted([const_convert_to_unicode(x) for x in use])
metadata['USE_FORCE'] = sorted(use_force)
variables = "LICENSE", "RDEPEND", "DEPEND", "PDEPEND", \
"PROVIDE", "SRC_URI"
"BDEPEND", "PROVIDE", "SRC_URI"
for k in variables:
try:
@@ -4567,6 +4570,10 @@ class PortagePlugin(SpmPlugin):
'path': PortagePlugin.xpak_entries['depend'],
'critical': False,
},
'bdepend': {
'path': PortagePlugin.xpak_entries['bdepend'],
'critical': False,
},
'use': {
'path': PortagePlugin.xpak_entries['use'],
'critical': False,

View File

@@ -206,6 +206,7 @@ class SpmTest(unittest.TestCase):
>=dev-libs/dbus-glib-0.72 >=x11-libs/startup-notification-0.8
!<x11-base/xorg-x11-6.7.0-r2 >=x11-libs/cairo-1.6.0""".replace("\n", " ")
pdepend = ""
bdepend = ""
provide = ""
sources = ""
eapi = "2"
@@ -214,7 +215,7 @@ class SpmTest(unittest.TestCase):
try:
portage_metadata = spm._calculate_dependencies(
iuse, use, license,
depend, rdepend, pdepend, provide, sources, eapi)
depend, rdepend, pdepend, bdepend, provide, sources, eapi)
finally:
del os.environ['ETP_PORTAGE_CONDITIONAL_DEPS_ENABLE']
@@ -270,6 +271,7 @@ class SpmTest(unittest.TestCase):
""".replace("\n", " ")
rdepend = depend[:]
pdepend = depend[:]
bdepend = []
provide = ""
sources = ""
eapi = "2"
@@ -278,7 +280,7 @@ class SpmTest(unittest.TestCase):
try:
portage_metadata = spm._calculate_dependencies(
iuse, use, license,
depend, rdepend, pdepend, provide, sources, eapi)
depend, rdepend, pdepend, bdepend, provide, sources, eapi)
finally:
del os.environ['ETP_PORTAGE_CONDITIONAL_DEPS_ENABLE']
@@ -299,6 +301,64 @@ class SpmTest(unittest.TestCase):
resolved_deps.sort()
self.assertEqual(resolved_deps, expected_deps)
def test_eapi7_portage_bdepend(self):
spm_class = self.Client.Spm_class()
if spm_class.PLUGIN_NAME != "portage":
return
spm = self.Client.Spm()
iuse = "system-sqlite"
use = "amd64 dbus elibc_glibc kernel_linux multilib " + \
"startup-notification userland_GNU"
license = "MPL-1.1 GPL-2"
depend = """
=mail-client/thunderbird-3.1.1-r1:2
x11-misc/dwm
""".replace("\n", " ")
rdepend = ">=mail-client/thunderbird-3"
pdepend = "www-client/firefox:0"
bdepend = """
dev-lang/python[xml]
virtual/pkgconfig:0/1
""".replace("\n", " ")
provide = ""
sources = ""
eapi = "2"
os.environ['ETP_PORTAGE_CONDITIONAL_DEPS_ENABLE'] = "1"
try:
portage_metadata = spm._calculate_dependencies(
iuse, use, license,
depend, rdepend, pdepend, bdepend, provide, sources, eapi)
finally:
del os.environ['ETP_PORTAGE_CONDITIONAL_DEPS_ENABLE']
expected = {
'DEPEND': [
"=mail-client/thunderbird-3.1.1-r1:2",
"x11-misc/dwm"
],
'RDEPEND': [">=mail-client/thunderbird-3"],
'PDEPEND': ["www-client/firefox:0"],
'BDEPEND': [
"dev-lang/python[xml]",
"virtual/pkgconfig:0"
]
}
for k in ("RDEPEND", "PDEPEND", "DEPEND", "BDEPEND"):
resolved_deps = portage_metadata[k]
resolved_deps.sort()
expected_deps = expected[k]
expected_deps.sort()
self.assertEqual(resolved_deps, expected_deps)
def test_portage_or_selector(self):
spm_class = self.Client.Spm_class()
if spm_class.PLUGIN_NAME != "portage":