mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
util.rpm.is_rpm_installed function added
This commit is contained in:
parent
5bbb481629
commit
897ad54af6
16
gpoa/util/rpm.py
Normal file
16
gpoa/util/rpm.py
Normal file
@ -0,0 +1,16 @@
|
||||
import rpm
|
||||
|
||||
def is_rpm_installed(rpm_name):
|
||||
'''
|
||||
Check if the package named 'rpm_name' is installed
|
||||
'''
|
||||
ts = rpm.TransactionSet()
|
||||
pm = ts.dbMatch()
|
||||
pm.pattern('name', rpm.RPMMIRE_GLOB, rpm_name)
|
||||
|
||||
for pkg in pm:
|
||||
if pkg['name'] == rpm_name:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user