diff options
Diffstat (limited to 'src/software/openlmi/software/yumdb')
-rw-r--r-- | src/software/openlmi/software/yumdb/__init__.py | 6 | ||||
-rw-r--r-- | src/software/openlmi/software/yumdb/packageinfo.py | 9 | ||||
-rw-r--r-- | src/software/openlmi/software/yumdb/process.py | 8 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/software/openlmi/software/yumdb/__init__.py b/src/software/openlmi/software/yumdb/__init__.py index 13539bb..b5160b4 100644 --- a/src/software/openlmi/software/yumdb/__init__.py +++ b/src/software/openlmi/software/yumdb/__init__.py @@ -275,7 +275,7 @@ class YumDB(singletonmixin.Singleton): 'level=%d', self._session_level) new_session_job = jobs.YumBeginSession() self._worker.uplink.put(new_session_job) - (_, reply) = self._worker.downlink.get() + reply = self._worker.downlink.get() log_reply_error(new_session_job, reply) self._worker.uplink.put(job) self._expected.append(job.jobid) @@ -381,8 +381,8 @@ class YumDB(singletonmixin.Singleton): uplink = Queue() downlink = Queue() self._process = YumWorker(uplink, downlink, - yum_kwargs=self._yum_kwargs, - logging_config=YUM_WORKER_DEBUG_LOGGING_CONFIG) + yum_kwargs=self._yum_kwargs) + #logging_config=YUM_WORKER_DEBUG_LOGGING_CONFIG) self._process.start() cmpi_logging.logger.trace_info( "YumDB: YumWorker started with pid=%s", self._process.pid) diff --git a/src/software/openlmi/software/yumdb/packageinfo.py b/src/software/openlmi/software/yumdb/packageinfo.py index a088993..bfacc5d 100644 --- a/src/software/openlmi/software/yumdb/packageinfo.py +++ b/src/software/openlmi/software/yumdb/packageinfo.py @@ -152,6 +152,15 @@ class PackageInfo(object): for k, value in state.items(): setattr(self, k, value) + def __eq__(self, other): + return ( self.name == other.name + and self.version == other.version + and self.release == other.release + and self.arch == other.arch + and self.epoch == other.epoch + and ( (self.repoid is None or other.repoid is None) + or (self.repoid == other.repoid))) + def make_package_from_db(pkg): """ Create instance of PackageInfo from instance of diff --git a/src/software/openlmi/software/yumdb/process.py b/src/software/openlmi/software/yumdb/process.py index 5f43c35..0b0c4c1 100644 --- a/src/software/openlmi/software/yumdb/process.py +++ b/src/software/openlmi/software/yumdb/process.py @@ -77,8 +77,6 @@ def _get_package_filter_function(filters): if match is not None: for attr in ("name", "epoch", "version", "release", "arch"): match_attr = attr - if attr in {'version', 'release'}: - match_attr = attr[:3] filters[attr] = match.group(match_attr) filters.pop('nevra', None) filters.pop('envra', None) @@ -174,8 +172,11 @@ def _needs_database(method): """ Wrapper for the job handler method. """ + created_session = False self._init_database() #pylint: disable=W0212 if self._session_level == 0: #pylint: disable=W0212 + self._session_level = 1 #pylint: disable=W0212 + created_session = True self._lock_database() #pylint: disable=W0212 try: LOG.debug("calling job handler %s with args=(%s)", @@ -187,7 +188,8 @@ def _needs_database(method): LOG.debug("job handler %s finished", method.__name__) return result finally: - if self._session_level == 0: #pylint: disable=W0212 + if created_session is True: #pylint: disable=W0212 + self._session_level = 0 #pylint: disable=W0212 self._unlock_database() #pylint: disable=W0212 return _wrapper |