|
|
@ -76,19 +76,11 @@ import json
|
|
|
|
import shlex
|
|
|
|
import shlex
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import sys
|
|
|
|
try:
|
|
|
|
|
|
|
|
import rpm
|
|
|
|
|
|
|
|
USE_PYTHON = True
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
USE_PYTHON = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
URPMI_PATH = '/usr/sbin/urpmi'
|
|
|
|
URPMI_PATH = '/usr/sbin/urpmi'
|
|
|
|
URPME_PATH = '/usr/sbin/urpme'
|
|
|
|
URPME_PATH = '/usr/sbin/urpme'
|
|
|
|
|
|
|
|
|
|
|
|
def query_package(module, name):
|
|
|
|
def query_package(module, name):
|
|
|
|
if USE_PYTHON:
|
|
|
|
|
|
|
|
return rpm.TransactionSet().dbMatch(rpm.RPMTAG_NAME, name).count() != 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# rpm -q returns 0 if the package is installed,
|
|
|
|
# rpm -q returns 0 if the package is installed,
|
|
|
|
# 1 if it is not installed
|
|
|
|
# 1 if it is not installed
|
|
|
|
cmd = "rpm -q %s" % (name)
|
|
|
|
cmd = "rpm -q %s" % (name)
|
|
|
@ -99,9 +91,6 @@ def query_package(module, name):
|
|
|
|
return False
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
def query_package_provides(module, name):
|
|
|
|
def query_package_provides(module, name):
|
|
|
|
if USE_PYTHON:
|
|
|
|
|
|
|
|
return rpm.TransactionSet().dbMatch(rpm.RPMTAG_PROVIDES, name).count() != 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# rpm -q returns 0 if the package is installed,
|
|
|
|
# rpm -q returns 0 if the package is installed,
|
|
|
|
# 1 if it is not installed
|
|
|
|
# 1 if it is not installed
|
|
|
|
cmd = "rpm -q --provides %s" % (name)
|
|
|
|
cmd = "rpm -q --provides %s" % (name)
|
|
|
|