55import json
66import os
77import subprocess
8- import sys
98import tempfile
10- import time
119from collections .abc import Mapping
1210from collections .abc import Sequence
1311from datetime import datetime
@@ -92,11 +90,11 @@ def check_and_update_melange_image(image: str) -> None:
9290
9391 if result .returncode != 0 :
9492 # Image doesn't exist locally, pull it
95- print (
96- f"Melange image not found locally, pulling { image } ..." ,
97- file = sys .stderr ,
93+ subprocess .run (
94+ ["docker" , "pull" , image ],
95+ check = True ,
96+ capture_output = True ,
9897 )
99- subprocess .run (["docker" , "pull" , image ], check = True )
10098 return
10199
102100 # Parse the creation date
@@ -106,28 +104,16 @@ def check_and_update_melange_image(image: str) -> None:
106104 age_days = (now - created_date ).days
107105
108106 if age_days > 30 :
109- print (
110- f"⚠️ Melange image is { age_days } days old (created { created_date .strftime ('%Y-%m-%d' )} )" ,
111- file = sys .stderr ,
107+ # Pull updated image
108+ subprocess .run (
109+ ["docker" , "pull" , image ],
110+ check = True ,
111+ capture_output = True ,
112112 )
113- print (f"⚠️ Pulling updated melange image: { image } " , file = sys .stderr )
114- print (
115- "⚠️ Press Ctrl+C now to abort or wait 15 seconds to continue..." ,
116- file = sys .stderr ,
117- )
118-
119- # Give user 15 seconds to abort
120- time .sleep (15 )
121-
122- print (f"Pulling { image } ..." , file = sys .stderr )
123- subprocess .run (["docker" , "pull" , image ], check = True )
124- print ("✓ Melange image updated successfully" , file = sys .stderr )
125113
126- except KeyboardInterrupt :
127- print ("\n ⚠️ Update aborted by user, using existing image" , file = sys .stderr )
128114 except Exception as e :
129- print ( f"Warning: Failed to check/update melange image: { e } " , file = sys . stderr )
130- print ("Continuing with existing image..." , file = sys . stderr )
115+ # Print warning to stdout (like epoch check does with echo )
116+ print (f"Warning: Failed to check/update melange image: { e } " )
131117
132118
133119def main (argv : Sequence [str ] | None = None ) -> int :
0 commit comments