Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pm: adapt oma package manager #20

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 26 additions & 11 deletions acbs/pm.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,31 @@ def check_if_available(name: str) -> bool:


def install_from_repo(packages: List[str]):
logging.debug('Installing %s' % packages)
escaped = []
for package in packages:
escaped.append(escape_package_name_install(package))
command = ['apt-get', 'install', '-y', '-o', 'Dpkg::Options::=--force-confnew']
command.extend(escaped)
oma_is_success = install_from_repo_oma(packages)

if not oma_is_success:
logging.debug('Installing %s' % packages)
escaped = []
for package in packages:
escaped.append(escape_package_name_install(package))
command = ['apt-get', 'install', '-y', '-o', 'Dpkg::Options::=--force-confnew']
command.extend(escaped)
try:
subprocess.check_call(command, env={'DEBIAN_FRONTEND': 'noninteractive'})
except subprocess.CalledProcessError:
logging.warning(
'Failed to install dependencies, attempting to correct issues...')
fix_pm_states(escaped)
return

def install_from_repo_oma(packages: List[str]) -> bool:
logging.debug('Installing %s from oma' % packages)
command = ['oma', 'install', '-y', '--force-confnew', '--no-progress']
command.extend(packages)
try:
subprocess.check_call(command, env={'DEBIAN_FRONTEND': 'noninteractive'})
except subprocess.CalledProcessError:
subprocess.check_call(command)
except:
logging.warning(
'Failed to install dependencies, attempting to correct issues...')
fix_pm_states(escaped)
return
'Failed to use oma install dependencies, fallbacking to apt...')
return False
return True
Loading