The Inbox: MonticelloConfigurations-cbc.80.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: MonticelloConfigurations-cbc.80.mcz

commits-2
A new version of MonticelloConfigurations was added to project The Inbox:
http://source.squeak.org/inbox/MonticelloConfigurations-cbc.80.mcz

==================== Summary ====================

Name: MonticelloConfigurations-cbc.80
Author: cbc
Time: 25 August 2010, 8:15:39.327 am
UUID: a8efd665-0556-c94c-a64c-6b125a1f6294
Ancestors: MonticelloConfigurations-cbc.79

Renamed variable to SkipPackages to reflect what its intent is better.

=============== Diff against MonticelloConfigurations-cbc.79 ===============

Item was changed:
  Object subclass: #MCMcmUpdater
  instanceVariableNames: ''
+ classVariableNames: 'DefaultUpdateURL LastUpdateMap SkipPackages UpdateMissingPackages'
- classVariableNames: 'DefaultUpdateURL LastUpdateMap UnloadedPackages UpdateMissingPackages'
  poolDictionaries: ''
  category: 'MonticelloConfigurations'!
 
  !MCMcmUpdater commentStamp: 'dtl 5/10/2010 23:22' prior: 0!
  MCMcmUpdater provides utility methods for updating Monticello packages from Monticello configurations.
 
  When Monticello configurations are stored in a repository, MCMcmUpdater acts as an update stream. It first ensures that each configuration map has been loaded in sequence, then updates the last configuration map to the most recent version for each specified package, and finally loads these versions to produce a fully updated configuration. !

Item was added:
+ ----- Method: MCMcmUpdater class>>skipPackages (in category 'updating') -----
+ skipPackages
+ ^SkipPackages ifNil: [SkipPackages := Set new]!

Item was changed:
  ----- Method: MCMcmUpdater class>>startLoading: (in category 'updating') -----
  startLoading: packageName
+ self skipPackages remove: packageName ifAbsent: [].!
- self unloadedPackages remove: packageName ifAbsent: [].!

Item was changed:
  ----- Method: MCMcmUpdater class>>skipLoading: (in category 'updating') -----
  skipLoading: packageName
+ self skipPackages add: packageName!
- self unloadedPackages add: packageName!

Item was changed:
  ----- Method: MCMcmUpdater class>>updateFromRepositories: (in category 'updating') -----
  updateFromRepositories: repositoryUrls
  "MCMcmUpdater updateFromRepositories: #(
  'http://squeaksource.com/MCUpdateTest'
  )"
 
  | repos config |
  Preferences enable: #upgradeIsMerge.
  LastUpdateMap ifNil:[LastUpdateMap := Dictionary new].
  "The list of repositories to consult in order"
  repos := repositoryUrls collect:[:url|
  MCRepositoryGroup default repositories
  detect:[:r| r description = url]
  ifNone:[ | r |
  r := MCHttpRepository location: url user: '' password: ''.
  MCRepositoryGroup default addRepository: r.
  r]].
 
  "The list of updates-author.version.mcm sorted by version"
  repos do:[:r| r cacheAllFileNamesDuring:[
  | minVersion updateList allNames |
  updateList := SortedCollection new.
  minVersion := LastUpdateMap at: r description ifAbsent:[0].
  "Find all the updates-author.version.mcm files"
  'Checking ', r description
  displayProgressAt: Sensor cursorPoint
  from: 0 to: 1 during:[:bar|
  bar value: 0.
  allNames := r allFileNames.
  ].
  allNames do:[:versionedName| | version base parts author type |
  parts := versionedName findTokens: '.-'.
  parts size = 4 ifTrue:[
  base := parts at: 1.
  author := parts at: 2.
  version := [(parts at: 3) asNumber] on: Error do:[:ex| ex return: 0].
  type := parts at: 4.
  ].
  (base = 'update' and:[version >= minVersion and:[type = 'mcm']])
  ifTrue:[updateList add: version -> versionedName]].
 
  "Proceed only if there are updates available at all."
  updateList ifNotEmpty: [
  "Now process each update file. Check if we have all dependencies and if not,
  load the entire configuration (this is mostly to skip older updates quickly)"
  updateList do:[:assoc|
  ProgressNotification signal: '' extra: 'Processing ', assoc value.
  config := r versionFromFileNamed: assoc value.
  "Skip packages that were specifically unloaded"
  config dependencies: (config dependencies
+ select:[:dep| self skipPackages includes: dep package name.]).
- select:[:dep| self unloadedPackages includes: dep package name.]).
  self updateMissingPackages ifFalse:[
  "Skip packages that are not in the image"
  config dependencies: (config dependencies
  select:[:dep| dep package hasWorkingCopy])].
  (config dependencies allSatisfy:[:dep| dep isFulfilled])
  ifFalse:[config upgrade].
  LastUpdateMap at: r description put: assoc key.
  ] displayingProgress: 'Processing configurations'.
  "We've loaded all the provided update configurations.
  Use the latest configuration to update all the remaining packages."
  config updateFromRepositories.
  config upgrade.
  ]].
  ].
  ^config!

Item was removed:
- ----- Method: MCMcmUpdater class>>unloadedPackages (in category 'updating') -----
- unloadedPackages
- ^UnloadedPackages ifNil: [UnloadedPackages := Set new]!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: MonticelloConfigurations-cbc.80.mcz

Bert Freudenberg
On 25.08.2010, at 15:15, [hidden email] wrote:

>   "Skip packages that were specifically unloaded"
>   config dependencies: (config dependencies
> + select:[:dep| self skipPackages includes: dep package name.]).
> - select:[:dep| self unloadedPackages includes: dep package name.]).

Did you actually try this code? Shouldn't it be "reject:"?

(and if you allow me a little nitpicking: there should be a space after the colon of a keyword selector, and no period before a closing bracket)

>
>  startLoading: packageName
> + self skipPackages remove: packageName ifAbsent: [].!
>
>  skipLoading: packageName
> + self skipPackages add: packageName!


Much nicer already. I don't like the selectors too much though. How about "skipPackage:" and "doNotSkipPackage:" instead? Hmm, I don't like those much better either. But "startLoading:" implies to actually start loading a package to me. Maybe "skipUpdatesFor:" and "enableUpdatesFor:"? Some native speaker help me out here ;)

- Bert -


cbc
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: MonticelloConfigurations-cbc.80.mcz

cbc
how about #skipTracking: and #enableTracking:?  Or
#disableUpdatesOfPackage: and #enableUpdatesOfPackage:?

And, yes, it should have been #reject:, not #select:.  IT was late at
night and I had no updates to load (not a good excuse...).

Incidentally, I am a native speaker.  I was once chastised as being
too much of a Math guy, though - in that I could apply an arbitrary
label to a variable and just work with it - even if the meaning
changes.  Great for reading/understanding code, not so good for
writing it, though.

-Chris

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: MonticelloConfigurations-cbc.80.mcz

Bert Freudenberg
On 25.08.2010, at 18:41, Chris Cunningham wrote:

> how about #skipTracking: and #enableTracking:?  Or
> #disableUpdatesOfPackage: and #enableUpdatesOfPackage:?

Both sound good to me. Also, an accessor to enable all / reset the skip list seems useful.

> And, yes, it should have been #reject:, not #select:.  IT was late at
> night and I had no updates to load (not a good excuse...).
>
> Incidentally, I am a native speaker.  I was once chastised as being
> too much of a Math guy, though - in that I could apply an arbitrary
> label to a variable and just work with it - even if the meaning
> changes.  Great for reading/understanding code, not so good for
> writing it, though.
>
> -Chris

Hehe :)

- Bert -