Working through a Pier 3 to 3.1 upgrade. This has taken some work for quite a while, below are the notes from it:
As of 2015-Apr, Pier 3.1 was the active development version. For moving to Pharo 4.0, one of the main changes impacting Pier is that the TimeStamp class is being replaced by DateAndTime (code to switch).
Several smaller changes are:
parameterAt:ifPresent: is missing, when going to http://localhost:8080/pier - see Pier 3.1 Changes. *value:children|link*
An error pops up about nil receiving #key. It seems that a loop is being performed over a dictionary which was previously an array in PRLinkRenderer>>attributesFor:, so adding a nil check can get past this error.
This is very similar to Pier 2.0 to Pier 3.0 upgrades with a few differences:
PBPost allInstances do: [:post | post publication ifNotNil: [ post publication: (DateAndTime date: post publication asDate time: post publication asTime) ] ].
In case the PierToDo is loaded:
PRToDoTask allInstances do: [ :task | task due ifNotNil: [ task due: (DateAndTime date: task due asDate time: task due asTime) ] ].
Pier-Exporter-Code PRKernel instances size = 1 ifTrue: [ PRKernel instances anyOne name: 'pier_old' ]. PRKernelCreatorForPier new createKernel.
an error is raised from PRDocument>>parse::
Pillar doesn't support this tag : ''OUT_LOG} 1>>${OUT_LOG} ...Debugging into the problem, about 100 steps higher give the cause coming from PRKernelCreatorForPier>>your_page where it calls: #contents:, found that the original page had this ksh variable listed on the past in non-preformatted text. Code to create a new file-out:
| line count |
count := 0.
FileSystem workingDirectory / 'PRKernelCreatorForPier.old.st'
readStreamDo: [ :stream |
| newStream |
[ newStream := (FileSystem workingDirectory / 'PRKernelCreatorForPier.newer.st')
writeStream.
[ stream atEnd ]
whileFalse: [ line := stream nextLine.
(line isNotEmpty and: [ line first ~~ $= and: [ '*${*' match: line ] ])
ifTrue: [ count := count + 1.
newStream
nextPutAll: (line copyReplaceAll: '${' with: '\$\{');
cr ]
ifFalse: [ newStream
nextPutAll: line;
cr ] ] ]
ensure: [ newStream ifNotNil: [ newStream close ] ] ].
countIts also a good idea to look for $\{{{ and replace accordingly.
Another failure found during the upgrade was that PRImagePersistency>>saveImageAndBackupAs: raises a does-not-understand error for:
Smalltalk setMacFileInfoOn: (directory fullPathFor: changeName)
In older images only SmalltalkImage implements #setMacFileInfoOn:, in the pre-Pharo 5 images, this has aString asFileReference setMacType: 'STch' creator: 'FAST', which is only implemented by FileReference, and it has: self flag: 'TODO' - all other sends of this have been removed, seems safe to remove.
When a page has the wiki text like:
The first link will display correctly, the second gives the error:Page for testing anchors and links. @link Test for a link with a dot: = *name>.@link* *name>.@link* Test for when I have a link like: = *name>@link* *name>@link*
MessageNotUnderstood: receiver of "readStream" is nil Your request could not be completed. An exception occurred.
The remainder of the page is not displayed below the error, making this difficult to correct - the edit button is generally displayed below the page.
The error is coming from PRDocumentParser>>parse:, bypassing the problem is possible in:
PRPathLookup>>start: aStructure path: aString ifAbsent: aBlock ^ self new stream: (aString ifNil: [ '.' ] ) readStream; absentBlock: aBlock; lookup: aStructure
This causes the link to be a broken link (allows one to create a new structure).
Using an empty string instead of '.' causes the error to change to:
MessageNotUnderstood: receiver of "collect:" is nil
Last update to this was to set the nil replacement to: Link name should not be empty so when the link is clicked, the error is more obvious.