in dcrpm/rpmutil.py [0:0]
def query(self, rpm_name):
# type: (str) -> None
"""
The most basic sanity check, as `rpm -q $rpm_name` can return out of whack
results (like 'perl' >.>)
"""
try:
result = run_with_timeout(
[self.rpm_path, "--dbpath", self.dbpath, "-q", rpm_name],
RPM_CHECK_TIMEOUT_SEC,
)
stdout = result.stdout.strip().split()
if not len(stdout) == 1 or not stdout[0].startswith("{}-".format(rpm_name)):
raise DBNeedsRebuild()
except DBNeedsRebuild:
raise
except DcRPMException:
self.logger.error("rpm -q %s failed", rpm_name)
raise DBNeedsRecovery()