From 8b8938116bf805cfbd9d362ff65cab16ea0358ee Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Mon, 30 Jul 2012 22:19:05 +0200 Subject: [PATCH] Revert "[entropy.db] drop isPackageScopeAvailable(), unused" This reverts commit 492ace12e81aa77af293d9b658c14a025613d5f4. --- lib/entropy/db/__init__.py | 15 +++++++++++++++ lib/entropy/db/skel.py | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) 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