diff --git a/lib/entropy/db/__init__.py b/lib/entropy/db/__init__.py index 9ccecd0fb..b617e5e56 100644 --- a/lib/entropy/db/__init__.py +++ b/lib/entropy/db/__init__.py @@ -4787,6 +4787,21 @@ class EntropyRepository(EntropyRepositoryBase): return frozenset((y for x, y in data)) return data + def isPackageScopeAvailable(self, atom, slot, revision): + """ + Reimplemented from EntropyRepositoryBase. + """ + searchdata = (atom, slot, revision,) + cur = self._cursor().execute(""" + SELECT idpackage FROM baseinfo + where atom = (?) AND slot = (?) AND revision = (?) LIMIT 1 + """, searchdata) + rslt = cur.fetchone() + + if rslt: # check if it's masked + return self.maskFilter(rslt[0]) + return -1, 0 + def isBranchMigrationAvailable(self, repository, from_branch, to_branch): """ Reimplemented from EntropyRepositoryBase. diff --git a/lib/entropy/db/skel.py b/lib/entropy/db/skel.py index 8c26056ab..a34b29062 100644 --- a/lib/entropy/db/skel.py +++ b/lib/entropy/db/skel.py @@ -3517,6 +3517,23 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore): """ raise NotImplementedError() + def isPackageScopeAvailable(self, atom, slot, revision): + """ + Return whether given package scope is available. + Also check if package found is masked and return masking reason + identifier. + + @param atom: package atom string + @type atom: string + @param slot: package slot string + @type slot: string + @param revision: entropy package revision + @type revision: int + @return: tuple composed by (package_id or -1, idreason or 0,) + @rtype: tuple + """ + raise NotImplementedError() + def isBranchMigrationAvailable(self, repository, from_branch, to_branch): """ Returns whether branch migration metadata given by the provided key