Permalink
Browse files

Issue #111: proposed bugfix

correctly process nested import statements
  original algorithm would only process one of the imports in the list
  before marking the version as complete ... can't process a version
  until all imports are defined ...
  implemented rudimentary loop detection
remove a Grease Core Reference in test configuration
  • Loading branch information...
Dale Henrichs
Dale Henrichs committed Sep 6, 2012
1 parent 9da98ae commit 66ba1b4af69fb9f275b1d16fdb80f0279e645384
@@ -1,47 +1,54 @@
accessing
packageSpecsInLoadOrder
-
- | orderedSpecs moved lastMovedSpecs count terminationLimit map specsWithIncludes firstTime |
- "specification order is the default order"
- map := self map.
- orderedSpecs := OrderedCollection new.
- self list do: [:member | | spec |
- spec := map at: member name ifAbsent: [].
- (spec == nil or: [ orderedSpecs includes: spec ])
- ifFalse: [ orderedSpecs add: spec ]].
- orderedSpecs isEmpty ifTrue: [ ^orderedSpecs ].
- moved := true.
- count := 0.
- terminationLimit := orderedSpecs size * 2.
- [ moved ] whileTrue: [
- count := count + 1.
- count > terminationLimit
- ifTrue: [
- "Cheap termination hack - an APPARENT loop"
- self error: 'Apparent loop in before/after dependency definitions' ].
- moved := false.
- orderedSpecs do: [:packageSpec |
- moved := moved or: [ self sortPackageSpecs: orderedSpecs for: packageSpec ]]].
- lastMovedSpecs := Set new.
- moved := true.
- count := 0.
- specsWithIncludes := orderedSpecs select: [:pkgSpec | pkgSpec includesForPackageOrdering isEmpty not].
- firstTime := true.
- [ moved ] whileTrue: [ | result |
- count := count + 1.
- "count > terminationLimit"
- count > 7
- ifTrue: [
- "Cheap termination hack - an APPARENT loop"
- self error: 'Apparent loop in before/after dependency definitions' ].
- moved := false.
- result := Set new.
- specsWithIncludes do: [:packageSpec |
- result addAll: (self applyIncludesTo: orderedSpecs for: packageSpec firstTime: firstTime) ].
- result size = lastMovedSpecs size
- ifTrue: [
- result do: [:name | (lastMovedSpecs includes: name) ifFalse: [ moved := true ]]]
- ifFalse: [ moved := true ].
- lastMovedSpecs := result.
- firstTime := false ].
- ^orderedSpecs
+ | orderedSpecs moved lastMovedSpecs count terminationLimit map specsWithIncludes firstTime |
+ "specification order is the default order"
+ map := self map.
+ orderedSpecs := OrderedCollection new.
+ self list
+ do: [ :member |
+ | spec |
+ spec := map at: member name ifAbsent: [ ].
+ (spec == nil or: [ orderedSpecs includes: spec ])
+ ifFalse: [ orderedSpecs add: spec ] ].
+ orderedSpecs isEmpty
+ ifTrue: [ ^ orderedSpecs ].
+ moved := true.
+ count := 0.
+ terminationLimit := orderedSpecs size * 2.
+ [ moved ]
+ whileTrue: [
+ count := count + 1.
+ count > terminationLimit
+ ifTrue: [
+ "Cheap termination hack - an APPARENT loop"
+ self error: 'Apparent loop in before/after dependency definitions' ].
+ moved := false.
+ orderedSpecs
+ do: [ :packageSpec | moved := moved or: [ self sortPackageSpecs: orderedSpecs for: packageSpec ] ] ].
+ lastMovedSpecs := Set new.
+ moved := true.
+ count := 0.
+ specsWithIncludes := orderedSpecs select: [ :pkgSpec | pkgSpec includesForPackageOrdering isEmpty not ].
+ firstTime := true.
+ [ moved ]
+ whileTrue: [
+ | result |
+ count := count + 1. "count > terminationLimit"
+ count > 14
+ ifTrue: [
+ "Cheap termination hack - an APPARENT loop"
+ self error: 'Apparent loop in before/after dependency definitions' ].
+ moved := false.
+ result := Set new.
+ specsWithIncludes
+ do: [ :packageSpec | result addAll: (self applyIncludesTo: orderedSpecs for: packageSpec firstTime: firstTime) ].
+ result size = lastMovedSpecs size
+ ifTrue: [
+ result
+ do: [ :name |
+ (lastMovedSpecs includes: name)
+ ifFalse: [ moved := true ] ] ]
+ ifFalse: [ moved := true ].
+ lastMovedSpecs := result.
+ firstTime := false ].
+ ^ orderedSpecs
@@ -8,7 +8,7 @@
"copy:to:" : "dkh 6/5/2012 19:01:24",
"merge:" : "dkh 6/5/2012 19:01:24",
"packageNamed:ifAbsent:" : "dkh 6/5/2012 19:01:24",
- "packageSpecsInLoadOrder" : "dkh 6/5/2012 19:01:24",
+ "packageSpecsInLoadOrder" : "dkh 9/6/2012 03:05",
"remove:" : "dkh 6/5/2012 19:01:24",
"slideIn:spec:baseIndex:seen:firstTime:" : "dkh 6/5/2012 19:01:24",
"sortPackageSpecs:for:" : "dkh 6/5/2012 19:01:24" } }
@@ -1,9 +1,14 @@
private
collectAllVersionsFromVersionImportPragmasInto: versionMap using: executionBlock satisfiedPragmas: pragmaDict
- | defined done completed |
+ | defined done completed count |
done := false.
completed := IdentitySet new.
- [ done ]
+ count := 0.
+ [
+ count := count + 1.
+ count > 10000
+ ifTrue: [ self error: 'Apparent loop in import expansion' ].
+ done ]
whileFalse: [
done := true.
pragmaDict
@@ -16,19 +21,24 @@ collectAllVersionsFromVersionImportPragmasInto: versionMap using: executionBlock
do: [ :pragma |
(completed includes: pragma)
ifFalse: [
+ | imports |
done := false.
- (pragma argumentAt: 2)
- do: [ :importedVersion |
- | version |
- (version := versionMap at: importedVersion ifAbsent: [ ]) ~~ nil
- ifTrue: [
- defined := true.
- completed add: pragma.
- versionSpec == nil
- ifTrue: [ versionSpec := version spec copy ]
- ifFalse: [ versionSpec := versionSpec mergeSpec: version spec copy ].
- versionSpec versionString: versionString.
- executionBlock value: versionSpec value: pragma ] ] ] ] ]
+ imports := pragma argumentAt: 2.
+ imports
+ detect: [ :importedVersion | (versionMap includesKey: importedVersion) not ]
+ ifNone: [
+ imports
+ do: [ :importedVersion |
+ | version |
+ (version := versionMap at: importedVersion ifAbsent: [ ]) ~~ nil
+ ifTrue: [
+ defined := true.
+ completed add: pragma.
+ versionSpec == nil
+ ifTrue: [ versionSpec := version spec copy ]
+ ifFalse: [ versionSpec := versionSpec mergeSpec: version spec copy ].
+ versionSpec versionString: versionString.
+ executionBlock value: versionSpec value: pragma ] ] ] ] ] ]
on: Error
do: [ :ex |
(MetacelloErrorInProjectConstructionNotification versionString: versionSpec versionString exception: ex)
@@ -9,7 +9,7 @@
"instance" : {
"calculate:project:" : "dkh 6/22/2012 12:43",
"collectAllSymbolicVersionsFromVersionPragmasInto:using:" : "dkh 6/5/2012 19:01:24",
- "collectAllVersionsFromVersionImportPragmasInto:using:satisfiedPragmas:" : "dkh 6/5/2012 19:01:24",
+ "collectAllVersionsFromVersionImportPragmasInto:using:satisfiedPragmas:" : "dkh 9/6/2012 03:05",
"collectAllVersionsFromVersionPragmasInto:using:" : "dkh 6/5/2012 19:01:24",
"collectDefaultSymbolicVersionsFromVersionPragmasFrom:into:using:" : "dkh 6/5/2012 19:01:24",
"commonDefaultSymbolicVersionResolverBlock" : "dkh 6/5/2012 19:01:24",

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -23,7 +23,7 @@ baseline310pharo: spec
package: 'Seaside-Tests-Pharo-Development'
with: [ spec requires: #('Seaside-Tests-Development' 'Seaside-Pharo-Development') ];
package: 'Seaside-Tests-Pharo-Email'
- with: [ spec requires: #('Seaside-Email' 'Seaside-Pharo-Email' 'Grease Core Tests') ];
+ with: [ spec requires: #('Seaside-Email' 'Seaside-Pharo-Email' ) ];
package: 'Seaside-Tests-Pharo-Functional'
with: [
spec
@@ -57,7 +57,7 @@
"baseline310jqueryui:" : "dkh 9/5/2012 16:44",
"baseline310json:" : "dkh 9/5/2012 16:44",
"baseline310ob:" : "dkh 9/5/2012 16:50",
- "baseline310pharo:" : "dkh 9/5/2012 16:51",
+ "baseline310pharo:" : "dkh 9/6/2012 03:09",
"baseline310rss:" : "dkh 9/5/2012 16:44",
"baseline310scriptaculous:" : "dkh 9/5/2012 16:44",
"baseline310welcome:" : "dkh 9/5/2012 16:44",
@@ -1 +1 @@
-(name 'ConfigurationOfIssue111-dkh.5' message 'Issue #111' id '08000000-1508-3c19-1508-3c1914000000' date '5 September 2012' time '4:56:05 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.4' message 'Issue #111' id '08000000-1508-e815-1508-e81514000000' date '5 September 2012' time '4:54:21 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.3' message 'Issue #111 ... copy of Seaside30 config and fails' id '08000000-1508-4811-1508-481114000000' date '5 September 2012' time '4:46:06 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.2' message 'remove dependent projects ... not needed to reproduce ' id '08000000-1508-5011-1508-501114000000' date '5 September 2012' time '4:21:19 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.1' message 'test configuration for Issue #111' id '08000000-1508-a211-1508-a21114000000' date '5 September 2012' time '4:05:08 pm' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
+(name 'ConfigurationOfIssue111-dkh.6' message 'remove Grease Core Tests reference' id 'b82a31fb-f0f1-4dd3-9156-31537357f0c0' date '6 September 2012' time '3:11:01.285 am' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.5' message 'Issue #111' id '08000000-1508-3c19-1508-3c1914000000' date '5 September 2012' time '4:56:05 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.4' message 'Issue #111' id '08000000-1508-e815-1508-e81514000000' date '5 September 2012' time '4:54:21 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.3' message 'Issue #111 ... copy of Seaside30 config and fails' id '08000000-1508-4811-1508-481114000000' date '5 September 2012' time '4:46:06 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.2' message 'remove dependent projects ... not needed to reproduce ' id '08000000-1508-5011-1508-501114000000' date '5 September 2012' time '4:21:19 pm' author 'dkh' ancestors ((name 'ConfigurationOfIssue111-dkh.1' message 'test configuration for Issue #111' id '08000000-1508-a211-1508-a21114000000' date '5 September 2012' time '4:05:08 pm' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())

0 comments on commit 66ba1b4

Please sign in to comment.