1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-22 02:50:32 +03:00

util.rpm: functions to install and remove packages added

This commit is contained in:
Игорь Чудов 2020-01-10 19:06:12 +04:00
parent 5fed5140f4
commit 85ffc2a301
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -17,6 +17,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import rpm
import subprocess
def is_rpm_installed(rpm_name):
'''
@ -30,3 +31,22 @@ def is_rpm_installed(rpm_name):
return False
def update():
'''
Update APT-RPM database.
'''
subprocess.check_call(['/usr/bin/apt-get', 'update'])
def install_rpm(rpm_name):
'''
Install RPM from APT-RPM sources.
'''
update()
subprocess.check_call(['/usr/bin/apt-get', '-y', 'install', rpm_name])
def remove_rpm(rpm_name):
'''
Remove RPM from file system.
'''
subprocess.check_call(['/usr/bin/apt-get', '-y', 'remove', rpm_name])