From 27c482f4e518d5e50bdadbbde7e3a3680486dd52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20D=C3=B6rbandt?= Date: Mon, 8 Jan 2024 20:42:31 +0100 Subject: [PATCH] Add initial sar building implementation --- .../instance/buildSar.st | 3 +++ .../instance/writeSarToFileNamed..st | 3 +++ .../methodProperties.json | 4 +++- .../instance/addToSar..st | 3 +++ .../methodProperties.json | 1 + .../SquotSarBuilder.class/README.md | 0 .../class/buildSarFrom..st | 3 +++ .../class/newWithWorkingCopy..st | 5 +++++ .../instance/addPackage.at..st | 8 ++++++++ .../instance/addPreambleLine..st | 3 +++ .../instance/addVersion.at..st | 12 ++++++++++++ .../instance/addedPackages..st | 3 +++ .../instance/addedPackages.st | 3 +++ .../instance/buildSar.st | 5 +++++ .../instance/initialize.st | 7 +++++++ .../SquotSarBuilder.class/instance/mappers.st | 3 +++ .../instance/preamble..st | 3 +++ .../instance/preamble.st | 3 +++ .../instance/workingCopy..st | 3 +++ .../instance/workingCopy.st | 3 +++ .../SquotSarBuilder.class/instance/zip..st | 3 +++ .../SquotSarBuilder.class/instance/zip.st | 3 +++ .../methodProperties.json | 19 +++++++++++++++++++ .../SquotSarBuilder.class/properties.json | 17 +++++++++++++++++ .../monticello.meta/categories.st | 1 + 25 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 src/Squot.package/SqueakWorkingCopy.class/instance/buildSar.st create mode 100644 src/Squot.package/SqueakWorkingCopy.class/instance/writeSarToFileNamed..st create mode 100644 src/Squot.package/SquotCodeMapper.class/instance/addToSar..st create mode 100644 src/Squot.package/SquotSarBuilder.class/README.md create mode 100644 src/Squot.package/SquotSarBuilder.class/class/buildSarFrom..st create mode 100644 src/Squot.package/SquotSarBuilder.class/class/newWithWorkingCopy..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/addPackage.at..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/addPreambleLine..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/addVersion.at..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/addedPackages..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/addedPackages.st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/buildSar.st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/initialize.st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/mappers.st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/preamble..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/preamble.st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/workingCopy..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/workingCopy.st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/zip..st create mode 100644 src/Squot.package/SquotSarBuilder.class/instance/zip.st create mode 100644 src/Squot.package/SquotSarBuilder.class/methodProperties.json create mode 100644 src/Squot.package/SquotSarBuilder.class/properties.json diff --git a/src/Squot.package/SqueakWorkingCopy.class/instance/buildSar.st b/src/Squot.package/SqueakWorkingCopy.class/instance/buildSar.st new file mode 100644 index 000000000..909ff2cfc --- /dev/null +++ b/src/Squot.package/SqueakWorkingCopy.class/instance/buildSar.st @@ -0,0 +1,3 @@ +sar +buildSar + ^ SquotSarBuilder buildSarFrom: self \ No newline at end of file diff --git a/src/Squot.package/SqueakWorkingCopy.class/instance/writeSarToFileNamed..st b/src/Squot.package/SqueakWorkingCopy.class/instance/writeSarToFileNamed..st new file mode 100644 index 000000000..80e4387ab --- /dev/null +++ b/src/Squot.package/SqueakWorkingCopy.class/instance/writeSarToFileNamed..st @@ -0,0 +1,3 @@ +sar +writeSarToFileNamed: aString + self buildSar writeToFileNamed: aString. \ No newline at end of file diff --git a/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json b/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json index 1b545f51b..e9e0fa5b5 100644 --- a/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json +++ b/src/Squot.package/SqueakWorkingCopy.class/methodProperties.json @@ -38,6 +38,7 @@ "basicName:" : "mad 12/8/2023 17:30", "branchName:" : "mad 6/4/2023 16:09", "branchesBaseName" : "mad 6/4/2023 16:09", + "buildSar" : "mad 11/14/2023 18:33", "changeSetsFromCommit:toCommit:" : "mad 9/6/2023 19:28", "changeSetsFromCommitToImage:" : "mad 9/6/2023 19:28", "changeSetsFromFSCommit:toFSCommit:" : "mad 9/20/2023 12:51", @@ -147,4 +148,5 @@ "updateHeadToRef:" : "mad 9/13/2023 21:36", "upstreamRemoteNameAndRefFor:" : "mad 12/13/2023 19:01", "upstreamRemoteNameAndRefForBranch:" : "mad 12/13/2023 19:02", - "withUnitOfWork:" : "mad 8/31/2023 12:58" } } + "withUnitOfWork:" : "mad 8/31/2023 12:58", + "writeSarToFileNamed:" : "mad 11/14/2023 18:34" } } diff --git a/src/Squot.package/SquotCodeMapper.class/instance/addToSar..st b/src/Squot.package/SquotCodeMapper.class/instance/addToSar..st new file mode 100644 index 000000000..0ccc696af --- /dev/null +++ b/src/Squot.package/SquotCodeMapper.class/instance/addToSar..st @@ -0,0 +1,3 @@ +sar +addToSar: aSarBuilder + aSarBuilder addPackage: self package at: self pathWithPackage. \ No newline at end of file diff --git a/src/Squot.package/SquotCodeMapper.class/methodProperties.json b/src/Squot.package/SquotCodeMapper.class/methodProperties.json index 2a2ddc212..9a6f897f7 100644 --- a/src/Squot.package/SquotCodeMapper.class/methodProperties.json +++ b/src/Squot.package/SquotCodeMapper.class/methodProperties.json @@ -6,6 +6,7 @@ "instance" : { "=" : "mad 9/26/2023 15:20", "aboutToStyle:with:requestor:at:" : "mad 11/7/2023 12:09", + "addToSar:" : "mad 11/14/2023 19:01", "changeSetFromFSCommit:toFSCommit:" : "mad 9/6/2023 19:03", "changeSetFromFSCommit:toImage:" : "mad 9/6/2023 19:03", "changeSetFromImage:toFSCommit:" : "mad 9/6/2023 19:03", diff --git a/src/Squot.package/SquotSarBuilder.class/README.md b/src/Squot.package/SquotSarBuilder.class/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/src/Squot.package/SquotSarBuilder.class/class/buildSarFrom..st b/src/Squot.package/SquotSarBuilder.class/class/buildSarFrom..st new file mode 100644 index 000000000..5c2173dc4 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/class/buildSarFrom..st @@ -0,0 +1,3 @@ +instance creation +buildSarFrom: aWorkingCopy + ^ (self newWithWorkingCopy: aWorkingCopy) buildSar \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/class/newWithWorkingCopy..st b/src/Squot.package/SquotSarBuilder.class/class/newWithWorkingCopy..st new file mode 100644 index 000000000..6ba3f6f0c --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/class/newWithWorkingCopy..st @@ -0,0 +1,5 @@ +instance creation +newWithWorkingCopy: aWorkingCopy + ^ self new + workingCopy: aWorkingCopy; + yourself \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/addPackage.at..st b/src/Squot.package/SquotSarBuilder.class/instance/addPackage.at..st new file mode 100644 index 000000000..25934c212 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/addPackage.at..st @@ -0,0 +1,8 @@ +building +addPackage: aPackage at: aPath + (self addedPackages includes: aPackage) ifTrue: [^ self]. + self + addVersion: ((MCWorkingCopy forPackage: aPackage) + newVersionWithName: aPackage name + message: 'Created by Squot for an export to a .sar') + at: aPath. \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/addPreambleLine..st b/src/Squot.package/SquotSarBuilder.class/instance/addPreambleLine..st new file mode 100644 index 000000000..ade88b420 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/addPreambleLine..st @@ -0,0 +1,3 @@ +accessing +addPreambleLine: aString + self preamble: self preamble, aString, String cr. \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/addVersion.at..st b/src/Squot.package/SquotSarBuilder.class/instance/addVersion.at..st new file mode 100644 index 000000000..3ea4c58c6 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/addVersion.at..st @@ -0,0 +1,12 @@ +building +addVersion: aVersion at: aPath + | stream mczPath | + (self addedPackages includes: aVersion package) ifTrue: [^ self]. + stream := RWBinaryOrTextStream on: (String new: 10000). + aVersion fileOutOn: stream. + mczPath := (SquotPathUtilities asString: aPath), '.mcz'. + (self zip addString: stream contents as: mczPath) + desiredCompressionLevel: 0. "mcz is already compressed" + self addPreambleLine: ('self fileInMonticelloZipVersionNamed: {1}.' + format: {mczPath printString}). + self addedPackages add: aVersion package. \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/addedPackages..st b/src/Squot.package/SquotSarBuilder.class/instance/addedPackages..st new file mode 100644 index 000000000..78e6b68e1 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/addedPackages..st @@ -0,0 +1,3 @@ +accessing +addedPackages: aSet + addedPackages := aSet \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/addedPackages.st b/src/Squot.package/SquotSarBuilder.class/instance/addedPackages.st new file mode 100644 index 000000000..bdb185833 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/addedPackages.st @@ -0,0 +1,3 @@ +accessing +addedPackages + ^ addedPackages \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/buildSar.st b/src/Squot.package/SquotSarBuilder.class/instance/buildSar.st new file mode 100644 index 000000000..d0b8338db --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/buildSar.st @@ -0,0 +1,5 @@ +building +buildSar + self mappers do: [:each | each addToSar: self]. + self zip addString: self preamble as: 'install/preamble'. + ^ self zip \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/initialize.st b/src/Squot.package/SquotSarBuilder.class/instance/initialize.st new file mode 100644 index 000000000..9ca15be3b --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/initialize.st @@ -0,0 +1,7 @@ +initialize-release +initialize + super initialize. + self + zip: ZipArchive new; + preamble: ''; + addedPackages: Set new. \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/mappers.st b/src/Squot.package/SquotSarBuilder.class/instance/mappers.st new file mode 100644 index 000000000..a2877f3df --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/mappers.st @@ -0,0 +1,3 @@ +accessing +mappers + ^ self workingCopy mappers \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/preamble..st b/src/Squot.package/SquotSarBuilder.class/instance/preamble..st new file mode 100644 index 000000000..6b7e7cf17 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/preamble..st @@ -0,0 +1,3 @@ +accessing +preamble: aString + preamble := aString \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/preamble.st b/src/Squot.package/SquotSarBuilder.class/instance/preamble.st new file mode 100644 index 000000000..442f73039 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/preamble.st @@ -0,0 +1,3 @@ +accessing +preamble + ^ preamble \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/workingCopy..st b/src/Squot.package/SquotSarBuilder.class/instance/workingCopy..st new file mode 100644 index 000000000..facb3a859 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/workingCopy..st @@ -0,0 +1,3 @@ +accessing +workingCopy: aWorkingCopy + workingCopy := aWorkingCopy \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/workingCopy.st b/src/Squot.package/SquotSarBuilder.class/instance/workingCopy.st new file mode 100644 index 000000000..685b55241 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/workingCopy.st @@ -0,0 +1,3 @@ +accessing +workingCopy + ^ workingCopy \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/zip..st b/src/Squot.package/SquotSarBuilder.class/instance/zip..st new file mode 100644 index 000000000..75efebb68 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/zip..st @@ -0,0 +1,3 @@ +accessing +zip: aZipArchive + zip := aZipArchive \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/instance/zip.st b/src/Squot.package/SquotSarBuilder.class/instance/zip.st new file mode 100644 index 000000000..e88b95ee9 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/instance/zip.st @@ -0,0 +1,3 @@ +accessing +zip + ^ zip \ No newline at end of file diff --git a/src/Squot.package/SquotSarBuilder.class/methodProperties.json b/src/Squot.package/SquotSarBuilder.class/methodProperties.json new file mode 100644 index 000000000..ce14fe8f7 --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/methodProperties.json @@ -0,0 +1,19 @@ +{ + "class" : { + "buildSarFrom:" : "mad 11/14/2023 18:28", + "newWithWorkingCopy:" : "mad 11/14/2023 18:27" }, + "instance" : { + "addPackage:at:" : "mad 11/14/2023 19:28", + "addPreambleLine:" : "mad 11/14/2023 18:46", + "addVersion:at:" : "mad 11/21/2023 15:15", + "addedPackages" : "mad 11/14/2023 19:05", + "addedPackages:" : "mad 1/8/2024 20:33", + "buildSar" : "mad 11/14/2023 18:30", + "initialize" : "mad 11/14/2023 19:05", + "mappers" : "mad 11/14/2023 18:35", + "preamble" : "mad 11/14/2023 18:30", + "preamble:" : "mad 11/14/2023 18:30", + "workingCopy" : "mad 11/14/2023 18:30", + "workingCopy:" : "mad 11/14/2023 18:30", + "zip" : "mad 11/14/2023 18:30", + "zip:" : "mad 11/14/2023 18:31" } } diff --git a/src/Squot.package/SquotSarBuilder.class/properties.json b/src/Squot.package/SquotSarBuilder.class/properties.json new file mode 100644 index 000000000..5b4981aea --- /dev/null +++ b/src/Squot.package/SquotSarBuilder.class/properties.json @@ -0,0 +1,17 @@ +{ + "category" : "Squot-Mapper-Sar", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + "workingCopy", + "zip", + "preamble", + "addedPackages" ], + "name" : "SquotSarBuilder", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/src/Squot.package/monticello.meta/categories.st b/src/Squot.package/monticello.meta/categories.st index 22c7a1f6c..7e3ac5366 100644 --- a/src/Squot.package/monticello.meta/categories.st +++ b/src/Squot.package/monticello.meta/categories.st @@ -43,4 +43,5 @@ SystemOrganization addCategory: #'Squot-Mapper-Blob'! SystemOrganization addCategory: #'Squot-Mapper-Sound'! SystemOrganization addCategory: #'Squot-Mapper-Multitext'! SystemOrganization addCategory: #'Squot-Mapper-Code'! +SystemOrganization addCategory: #'Squot-Mapper-Sar'! SystemOrganization addCategory: #'Squot-Mapper-Utilities'!