@@ -14,7 +14,7 @@ class UpdaterBase
1414 [ 2 ] : " Skipping %s of %s '%s': namespace '%s' doesn't conform to rules."
1515 [ 3 ] : " Skipping %s of unmanaged %s '%s'."
1616 [ 4 ] : " No remaining feed available to %s %s '%s' from."
17- [ 6 ] : " Couldn't retrieve data required to %s %s '%s'. Required version: %s."
17+ [ 6 ] : " The %s of %s '%s' failed because no suitable package could be found %s."
1818 [ 5 ] : " Skipped %s of %s '%s': Another update initiated by %s is already running."
1919 [ 10 ] : " Skipped %s of %s '%s': the update task is already running."
2020 [ 15 ] : " Couldn't %s %s '%s' because its requirements could not be satisfied:"
@@ -63,8 +63,11 @@ class UpdateTask extends UpdaterBase
6363 feedTrying : " Checking feed %d/%d (%s)..."
6464 upToDate : " %s '%s' is up-to-date (v%s)."
6565 alreadyUpdated : " %s v%s has already been installed."
66- noFeedAvailExt : " %s ( installed: %s; available: %s)"
66+ noFeedAvailExt : " (required: %s; installed: %s; available: %s)"
6767 noUpdate : " Feed has no new update."
68+ skippedOptional : " Skipped %s of optional dependency '%s': %s"
69+ optionalNoFeed : " No feed available to download module from."
70+ optionalNoUpdate : " No suitable download could be found %s."
6871 }
6972
7073 performUpdate : {
@@ -85,7 +88,7 @@ class UpdateTask extends UpdaterBase
8588 }
8689 }
8790
88- new : ( @record , targetVersion = 0 , @addFeeds , @exhaustive , @channel , @updater ) =>
91+ new : ( @record , targetVersion = 0 , @addFeeds , @exhaustive , @channel , @optional , @ updater) =>
8992 DependencyControl or= require " l0.DependencyControl"
9093 assert @record . __class == DependencyControl , " First parameter must be a #{DependencyControl.__name} object."
9194
@@ -96,7 +99,7 @@ class UpdateTask extends UpdaterBase
9699 return nil , - 1 unless @@config . c. updaterEnabled
97100 return nil , - 2 unless @record \ validateNamespace!
98101
99- set : ( targetVersion, @addFeeds , @exhaustive , @channel ) =>
102+ set : ( targetVersion, @addFeeds , @exhaustive , @channel , @optional ) =>
100103 @targetVersion = @record \ getVersionNumber targetVersion
101104 return @
102105
@@ -167,7 +170,13 @@ class UpdateTask extends UpdaterBase
167170 unless @triedFeeds [ feed] or haveFeeds[ feed]
168171 feeds[ # feeds+ 1 ] = feed
169172
170- return logUpdateError - 4 if # feeds == 0
173+ if # feeds == 0
174+ if @optional
175+ @@logger \ log msgs. run. skippedOptional, @record . name,
176+ @record . virtual and " download" or " update" , msgs. run. optionalNoFeed
177+ return 3
178+
179+ return logUpdateError - 4
171180
172181 -- get a lock on the updater
173182 success, otherHost = @updater \ getLock waitLock
@@ -212,6 +221,12 @@ class UpdateTask extends UpdaterBase
212221 res = msgs. run. noFeedAvailExt\ format @targetVersion == 0 and " any" or @record \ getVersionString( @targetVersion ) ,
213222 @record . virtual and " no" or @record \ getVersionString!,
214223 maxVer< 1 and " none" or @record \ getVersionString maxVer
224+
225+ if @optional
226+ @@logger \ log msgs. run. skippedOptional, @record . name, @record . virtual and " download" or " update" ,
227+ msgs. run. optionalNoUpdate\ format res
228+ return 3
229+
215230 return logUpdateError - 6 , res
216231
217232 code, res = @performUpdate updateRecord
@@ -386,7 +401,7 @@ class Updater extends UpdaterBase
386401 super . config = globalConfig
387402 super . logger = logger if logger
388403
389- addTask : ( record, targetVersion, addFeeds = {} , exhaustive, channel) =>
404+ addTask : ( record, targetVersion, addFeeds = {} , exhaustive, channel, optional ) =>
390405 DependencyControl or= require " l0.DependencyControl"
391406 if record. __class != DependencyControl
392407 depRec = { saveRecordToConfig : false , readGlobalScriptVars : false }
@@ -395,9 +410,9 @@ class Updater extends UpdaterBase
395410
396411 task = @tasks [ record. type][ record. namespace]
397412 if task
398- return task\ set targetVersion, addFeeds, exhaustive, channel
413+ return task\ set targetVersion, addFeeds, exhaustive, channel, optional
399414 else
400- task = UpdateTask record, targetVersion, addFeeds, exhaustive, channel, @
415+ task = UpdateTask record, targetVersion, addFeeds, exhaustive, channel, optional , @
401416 @tasks [ record. type][ record. namespace] = task
402417 return task, err
403418
0 commit comments