@@ -78,7 +78,7 @@ public static List<CloudSmithPackageDetail> GetTargetList(
7878 VerbosityLevel verbosity )
7979 {
8080 string repoName = communityTargets ? _communityTargetsRepo : preview ? _refTargetsDevRepo : _refTargetsStableRepo ;
81- string requestUri = $ "{ _cloudsmithPackages } /{ repoName } /?tag={ platform } ";
81+ string requestUri = $ "{ _cloudsmithPackages } /{ repoName } /?&q=uploaded:>'2 months ago'& tag={ platform } ";
8282 List < CloudSmithPackageDetail > targetPackages = new ( ) ;
8383
8484 if ( verbosity > VerbosityLevel . Normal )
@@ -203,7 +203,7 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
203203 . ToList ( ) ;
204204 }
205205
206-
206+
207207 if ( ! skipDownload )
208208 {
209209 // try to perform request
@@ -220,6 +220,8 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
220220 string responseBody = await response . Content . ReadAsStringAsync ( ) ;
221221
222222 bool targetNotFound = false ;
223+ bool packageOutdated = false ;
224+ List < CloudsmithPackageInfo > packageInfo = null ;
223225
224226 // check for empty array
225227 if ( responseBody == "[]" )
@@ -229,7 +231,7 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
229231 else
230232 {
231233 // parse response
232- List < CloudsmithPackageInfo > packageInfo = JsonConvert . DeserializeObject < List < CloudsmithPackageInfo > > ( responseBody ) ;
234+ packageInfo = JsonConvert . DeserializeObject < List < CloudsmithPackageInfo > > ( responseBody ) ;
233235
234236 // if no specific version was requested, use latest available
235237 if ( string . IsNullOrEmpty ( _fwVersion ) )
@@ -242,9 +244,9 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
242244 {
243245 //get the download Url from the Cloudsmith Package info
244246 // addition check if the cloudsmith json return empty json
245- if ( packageInfo is null || packageInfo . Count == 0 )
246- {
247- return ExitCodes . E9005 ;
247+ if ( packageInfo is null || packageInfo . Count == 0 )
248+ {
249+ return ExitCodes . E9005 ;
248250 }
249251 else
250252 {
@@ -253,13 +255,22 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
253255 }
254256
255257 // sanity check for target name matching requested
256- if ( packageInfo . ElementAt ( 0 ) . TargetName != _targetName )
258+ if ( packageInfo . ElementAt ( 0 ) . TargetName != _targetName )
257259 {
258260 targetNotFound = true ;
259261 }
262+ else
263+ {
264+ // check package published date
265+ if ( packageInfo . ElementAt ( 0 ) . PackageDate < DateTime . UtcNow . AddMonths ( - 2 ) )
266+ {
267+ // if older than 2 months warn user
268+ packageOutdated = true ;
269+ }
270+ }
260271 }
261272
262- if ( targetNotFound )
273+ if ( targetNotFound )
263274 {
264275 // can't find this target
265276
@@ -290,6 +301,21 @@ protected async System.Threading.Tasks.Task<ExitCodes> DownloadAndExtractAsync()
290301 Console . ForegroundColor = ConsoleColor . White ;
291302 }
292303
304+ if ( packageOutdated )
305+ {
306+ Console . ForegroundColor = ConsoleColor . DarkYellow ;
307+ Console . WriteLine ( ) ;
308+
309+ Console . WriteLine ( "******************************* WARNING ******************************" ) ;
310+ Console . WriteLine ( $ "** This firmware package was released at { packageInfo . ElementAt ( 0 ) . PackageDate . ToShortDateString ( ) } **") ;
311+ Console . WriteLine ( "** The target it's probably outdated. **" ) ;
312+ Console . WriteLine ( "** Please check the current target names here: https://git.io/JyfuI **" ) ;
313+ Console . WriteLine ( "**********************************************************************" ) ;
314+
315+ Console . WriteLine ( ) ;
316+ Console . ForegroundColor = ConsoleColor . White ;
317+ }
318+
293319 // set exposed property
294320 Version = _fwVersion ;
295321
0 commit comments