mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
action_utils: Ensure that package are unheld if dist upgrade fails
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
3aff47039f
commit
0022dc5889
@ -475,19 +475,20 @@ def apt_hold(packages):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
held_packages = []
|
held_packages = []
|
||||||
for package in packages:
|
try:
|
||||||
current_hold = subprocess.check_output(
|
for package in packages:
|
||||||
['apt-mark', 'showhold', package])
|
current_hold = subprocess.check_output(
|
||||||
if not current_hold:
|
['apt-mark', 'showhold', package])
|
||||||
process = subprocess.run(['apt-mark', 'hold', package],
|
if not current_hold:
|
||||||
check=False)
|
process = subprocess.run(['apt-mark', 'hold', package],
|
||||||
if process.returncode == 0: # success
|
check=False)
|
||||||
held_packages.append(package)
|
if process.returncode == 0: # success
|
||||||
|
held_packages.append(package)
|
||||||
|
|
||||||
yield held_packages
|
yield held_packages
|
||||||
|
finally:
|
||||||
for package in held_packages:
|
for package in held_packages:
|
||||||
subprocess.check_call(['apt-mark', 'unhold', package])
|
subprocess.check_call(['apt-mark', 'unhold', package])
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user