Anyone know how to script Monticello to load the latest version of a package
by name, from a given repository? Ramon Leon http://onsmalltalk.com |
On Dec 11, 2006, at 15:08 , Ramon Leon wrote:
> Anyone know how to script Monticello to load the latest version of > a package > by name, from a given repository? (MCConfiguration fromArray: #( repository ('http://host.domain/repo') dependency ('PkgName' 'PkgName-ai.1' '00000000-0000-0000-0000-000000000000') ) ) updateFromRepositories; upgrade. Of course, you can give multiple repositories and packages. For testing, you could #browse instead of #upgrade. Also, #upgrade is smart to not overload a newer version in the image. If needed, you could use #load or #merge instead. - Bert - |
In reply to this post by Ramon Leon-5
2006/12/12, Ramon Leon <[hidden email]>:
> Anyone know how to script Monticello to load the latest version of a package > by name, from a given repository? The following is the "Monticello Code" I use. I does not really load the latest version. It loads the version with the biggest version number. This has the advantage that it does not download all the versions in order to find out their timestamp. This works better for large repositories like Seaside. loadLatestPackage: aString from: aPath | repository versionsBlock versions tries version | repository := MCHttpRepository location: aPath user: username password: password. versionsBlock := [ (repository allVersionNames select: [ :each | each beginsWith: aString ]) asSortedCollection: [ :a :b | (a copyAfterLast: $.) asNumber <= (b copyAfterLast: $.) asNumber ] ] fixTemps. versions := versionsBlock value. tries := 0. [ versions isEmpty and: [ tries < 3 ] ] whileTrue: [ versions := versionsBlock value. tries := tries + 1 ]. versions isEmpty ifTrue: [ self error: 'problems when accessing squeaksource' ]. version := (repository versionReaderForFileNamed: versions last , '.mcz') version. version load. version workingCopy repositoryGroup addRepository: repository. Philippe |
>> Anyone know how to script Monticello to load the latest version of a
>> package >> by name, from a given repository? > > > The following is the "Monticello Code" I use. I does not really load > the latest version. It loads the version with the biggest version > number. This has the advantage that it does not download all the > versions in order to find out their timestamp. This works better for > large repositories like Seaside. > > Philippe Thanks, that's exactly what I'm looking for. I have a version I was using, but I was doing exactly that, loading them all and sorting by timestamp and it's dog slow. Bert, nice solution as well, but I don't use MCConfigurations just yet, only Monticello. Ramon Leon http://onsmalltalk.com |
In reply to this post by Bert Freudenberg
Bert Freudenberg puso en su mail :
>> Anyone know how to script Monticello to load the latest version of >> a package >> by name, from a given repository? > > (MCConfiguration fromArray: #( > repository ('http://host.domain/repo') > dependency ('PkgName' 'PkgName-ai.1' > '00000000-0000-0000-0000-000000000000') > ) ) updateFromRepositories; upgrade. > > Of course, you can give multiple repositories and packages. For > testing, you could #browse instead of #upgrade. Also, #upgrade is > smart to not overload a newer version in the image. If needed, you > could use #load or #merge instead. > > - Bert - I share one Cleaning the Monticello Browser |monti| monti := MCWorkingCopyBrowser new. monti unsortedWorkingCopies do:[:ea| ea unregister. ] How I could clean all repositories with some similar ? Can't discover yet Edgar __________________________________________________ Correo Yahoo! Espacio para todos tus mensajes, antivirus y antispam ¡gratis! ¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar |
In reply to this post by Ramon Leon-4
Ramon Leon wrote:
>>> Anyone know how to script Monticello to load the latest version of a >>> package >>> by name, from a given repository? (Installer repository: 'www.myserver.com') project: 'MyProject'; install: 'MyPackage'. or Installer squeaksource project: 'MyProject'; install: 'MyPackage'. will obtain the most recent version number/ latest Keith Send instant messages to your online friends http://uk.messenger.yahoo.com |
> Ramon Leon wrote:
> >>> Anyone know how to script Monticello to load the latest > version of a > >>> package by name, from a given repository? > (Installer repository: 'www.myserver.com') project: 'MyProject'; > install: 'MyPackage'. > > or > > Installer squeaksource project: 'MyProject'; install: 'MyPackage'. > > will obtain the most recent version number/ latest > > Keith This looks sweet, I'd love to use it, but it's not working. I have an ftp repository, and the installer seems to make too many assumptions about it http. Ramon Leon http://onsmalltalk.com |
In reply to this post by Philippe Marschall
> The following is the "Monticello Code" I use. I does not
> really load the latest version. It loads the version with the > biggest version number. This has the advantage that it does > not download all the versions in order to find out their > timestamp. This works better for large repositories like Seaside. > > loadLatestPackage: aString from: aPath > | repository versionsBlock versions tries version | > repository := MCHttpRepository > location: aPath > user: username > password: password. > > versionsBlock := [ (repository allVersionNames select: [ :each | > each beginsWith: aString ]) > asSortedCollection: [ :a :b | > (a copyAfterLast: $.) asNumber <= (b > copyAfterLast: $.) asNumber ] ] fixTemps. > versions := versionsBlock value. > > tries := 0. > [ versions isEmpty and: [ tries < 3 ] ] whileTrue: [ > versions := versionsBlock value. > tries := tries + 1 ]. > versions isEmpty ifTrue: [ self error: 'problems when > accessing squeaksource' ]. > > version := (repository versionReaderForFileNamed: > versions last , > '.mcz') version. > version load. > version workingCopy repositoryGroup addRepository: repository. > > Philippe Thanks, I ended up using this, derived from your code, but abstracting out the repository and loading, this just finds the newest package in a repository and returns it's version info. Works like a charm... findNewestVersionOf: aPackageName from: aRepository | versionsBlock versions tries | versionsBlock := [(aRepository allVersionNames select: [:each | each beginsWith: aPackageName]) asSortedCollection: [:a :b | (a copyAfterLast: $.) asNumber <= (b copyAfterLast: $.) asNumber]] fixTemps. versions := versionsBlock value. tries := 0. [versions isEmpty and: [tries < 3]] whileTrue: [versions := versionsBlock value. tries := tries + 1]. versions isEmpty ifTrue: [self error: 'problems when accessing repository']. ^aRepository versionInfoFromFileNamed: versions last , '.mcz' Ramon Leon http://onsmalltalk.com |
Free forum by Nabble | Edit this page |