Skip to content

Commit

Permalink
Issue Metacello#209: add exception handler to nuke the .zip and .err …
Browse files Browse the repository at this point in the history
…files in the case of an archive extract error
  • Loading branch information
dalehenrich committed Oct 6, 2013
1 parent 9d7e7f8 commit fcbea82
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
Expand Up @@ -2,7 +2,7 @@ github support
downloadFile: url to: outputFileName
"download from <url> into <outputFileName>"

| archive zipfile errorFileName |
| archive zipfile errorFileName stream |
"Make a unique name for the error log and ensure that we can write the files"
errorFileName := self downloadErrorFileNameFor: outputFileName.
(ServerFileDirectory on: outputFileName) forceNewFileNamed: outputFileName.
Expand All @@ -14,8 +14,12 @@ downloadFile: url to: outputFileName
zipfile := ServerFileDirectory on: outputFileName.
zipfile containingDirectory
readOnlyFileNamed: zipfile localName
do: [ :fileStream |
| stream |
stream := RWBinaryOrTextStream on: fileStream contents.
archive readFrom: stream ].
do: [ :fileStream | stream := RWBinaryOrTextStream on: fileStream contents ].
[ archive readFrom: stream ]
on: Error
do: [ :ex |
(ServerFileDirectory on: '/tmp')
deleteFileNamed: outputFileName;
deleteFileNamed: (self downloadErrorFileNameFor: errorFileName).
ex pass ].
^ archive
Expand Up @@ -4,6 +4,7 @@ extractRepositoryFrom: zipFile to: directory

| errorMessage |
(ServerFileDirectory on: directory) assureExistence.
(ServerFileDirectory on: '/tmp') deleteFileNamed: 'zip.err'.
System
performOnServer:
'/usr/bin/unzip -u ' , zipFile , ' -d ' , directory , ' 2> /tmp/zip.err'.
Expand Down
Expand Up @@ -8,9 +8,9 @@
"copyClass:as:inCategory:" : "dkh 11/10/2011 09:52",
"createRepository:" : "dkh 03/23/2013 08:50",
"defaultPlatformAttributes" : "dkh 11/13/2009 16:37",
"downloadFile:to:" : "dkh 07/01/2013 09:08",
"downloadFile:to:" : "dkh 10/06/2013 16:24",
"extractAtrributesFrom:" : "dkh 11/10/2011 09:52",
"extractRepositoryFrom:to:" : "dkh 07/01/2013 08:33",
"extractRepositoryFrom:to:" : "dkh 10/06/2013 14:53",
"extractTypeFromDescription:" : "dkh 03/23/2013 08:54",
"fileDirectoryClass" : "dkh 07/09/2012 04:46",
"stoneVersionAttributes" : "dkh 11/10/2011 09:52",
Expand Down
@@ -1 +1 @@
(name 'Metacello-Platform.gemstone-dkh.32' message 'fix google Issue 184: github zip download failures due to filesystem issues' id '31075f98-3e1f-4e14-9601-168c8828693e' date '07/01/2013' time '10:57:45' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.31' message 'switch to using #select and #unselect for MetacelloPlatform' id 'de47ee88-5444-487e-be7e-1f59d5fac067' date '05/05/2013' time '13:46:05' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.30' message 'add cache repository type so one can refer to a cache repository by oop rather than by global name ... needed for unambiguos reference to a cache repository: cache://42871553@gemstone' id 'bc705062-32f6-4b41-aba9-2a356881184c' date '03/23/2013' time '09:28:35' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.29' message 'get tests passing (two changed methods in entirety constitute bugfix ...)fix ...)' id '80e40d22-2564-4d39-a3b2-16a76c74ee69' date '02/25/2013' time '16:16:03' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.28' message 'checkpoint ... write from GemStone ... no code changes' id '2101bec9-b015-479c-bac6-adbec4e080a5' date '02/25/2013' time '16:10:28' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.27' message 'mods to get tests passing in GemStone' id 'e13d319d-4d73-4c65-b50d-9491ef635558' date '02/25/2013' time '16:04:11' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.26' message 'Issue #39: gemstone tests green' id 'af135c0d-fa87-415e-bca0-23597cc9c760' date '07/09/2012' time '18:00:32' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.25' message 'issue #39 port to gemstone' id '18545fe8-f66f-4dbb-af03-f9ded23cc3c6' date '07/09/2012' time '11:48:41' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.24' message '1.0-beta.32 (dkh.665):- fix Issue 109: pkgSpec for Metacello configuration doesn''t work for GemStone ServerDirectory repository http://code.google.com/p/metacello/issues/detail?id=109' id '9184ebfc-ea45-453b-be84-7a4f8e689d1c' date '01/19/2012' time '15:13:16' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.23' message '- force a load, so that #gemstone10beta311PostLoadDoIt gets triggered' id '299b1de6-f5c6-48a2-8db7-db30ad9ae6ae' date '11/14/2011' time '14:11:23' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.22' message '1.0-beta.31 (dkh.634):- fix for GemStone version of Pharo Issue 4613 .... derive attributes from GemStone version string' id '8486a1c8-bac3-43dc-a7bf-4e5c8e0aa024' date '10/11/2011' time '14:31:17' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.21' message '1.0-beta.30 (dkh.623):- persistent author initials can be set by defining #''''GS_tODE_AuthorInitials'''' in UserGlobals with desired author initials string (in support of tODE) [GemStone only]''' id 'd6312423-eeec-4c8f-899c-a8afafa35e01' date '07/19/2011' time '11:41:58' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.20' message '- add #maglev attribute for conditional maglev code' id '74d0e559-08c1-4134-861d-527e328d98dd' date '02/02/2011' time '20:07:41' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.19' message '- fix up gemstone-related tests/errors' id '27fa2a3a-ec9d-48e3-9887-c8e99ed0c3c5' date '01/16/2011' time '14:09:49' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.18' message '- implement copyClass:as:inCategory:' id 'd76b70c6-80de-4164-ba94-9cc348acc7db' date '11/18/2010' time '16:24:05' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.17' message '- portable copyClass for toolbox-clean up some old toolbox cruft' id '35ef84f2-1073-4115-b363-90365ac147bd' date '11/17/2010' time '16:21:03' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.16' message '- fix Issue 32: http://code.google.com/p/metacello/issues/detail?id=32 "Connect repositories as MCServerDirectory rather than MCDirectory" - Metacello-Platform.gemstone - Metacello-TestsPlatform.gemstone' id '141e8463-720a-4acd-8177-ca01688ebe5f' date '03/12/1910' time '01:46:16' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.15' message '- remove GoferAPITest>>expectedFailures ' id 'f36f8e62-c162-4f2e-a094-8012d754d473' date '02/11/1910' time '11:25:16' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.14' message '- remove some obsolete methods' id '52d89e7b-0585-49bc-b180-f9aafa6b7b17' date '02/10/1910' time '09:56:38' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.13' message '- fix valueSupplyingMetacelloAnswers for complex blocks' id '8b5535c0-74cf-4869-9aa2-ee87aa357597' date '01/20/1910' time '16:02:11' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.12' message '- pick up latest Gofer-Core and Gofer-Tests- some more version caching for speed- better workingCopy resolution for MetacelloCachingGoferResolvedReference- adjust tests - no longer inheriting pragmas ... too expensive' id '03c4f166-a8da-4979-807b-f85a35fc95e7' date '01/15/1910' time '17:45:32' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-dkh.11' message '- fix problems with GemStone Metacello when runnng without OB' id '2385ae1e-836b-419e-a1aa-45a5c42aa48f' date '01/06/1910' time '11:24:53' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.10' message '- port to latest version of Gofer (Gofer-dkh.105)' id '859122f3-5fc3-4512-bfda-dd75325af4fc' date '12/15/2009' time '11:54:59' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.9' message '- avoid adding extra IV, since MetacelloGemStonePlatform is in the load stack ... avoid migration issues for G/S' id 'bccee966-4431-4744-bcac-ad931e9c44d2' date '11/14/2009' time '09:53:40' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.8' message '- GemStone attributes, now may include: #gemstone #''gs2.x'' #''gs2.3.x'' #''gs2.4.x'' and #''gs3.x'' for finer grainded resolution of Stone version' id '34ffc547-3953-4844-aaac-6aebf77cf701' date '11/13/2009' time '16:41:54' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.7' message '- add #transact: to platform to support GemStone optional transactions' id 'd26cdbda-62da-458a-a372-f3cb73397a7b' date '10/23/2009' time '12:17:35' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.6' message '- implement #ceateRepository:' id '4e7e6bba-a254-48e8-a00c-096a4e2959bb' date '10/22/2009' time '16:32:25' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.5' message '- add support for initials and timestamp' id 'edaee15f-192c-40d5-aaeb-db39a9e30b1e' date '10/16/2009' time '13:48:59' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.4' message '- allow caching of nil currentVersions' id '2c30d9aa-a4f5-46c7-a340-7dc688fcd18f' date '08/20/2009' time '15:48:48' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.3' message '- add caching- add #initialize ' id '005e6864-4430-4846-9bc5-799d11fbf371' date '08/20/2009' time '15:36:30' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.2' message '- move #confirm: to platform, since ui not always present (at least for GemStone)' id '2357cfa5-0d29-4c68-a9c8-f880f1e1a0f1' date '08/11/2009' time '10:21:14' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.1' message '- GemStone-specific metacello support' id '243a54b1-2084-4127-afe4-4df86aa71a20' date '08/09/2009' time '11:21:42' author 'dkh' ancestors ((name 'Metacello-Platform.squeak-dkh.1' message '- Squeak-specific metacello support' id '7045edec-ac01-4485-bd21-efac82f0c9ef' date '08/09/2009' time '11:13:57' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'Metacello-Platform.gemstone-dkh.33' message 'Issue #209: add exception handler to nuke the .zip and .err files in the case of an archive extract error' id '6893fdf6-f2aa-4ad5-87b2-dc81666f68af' date '10/06/2013' time '16:26:48' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.32' message 'fix google Issue 184: github zip download failures due to filesystem issues' id '31075f98-3e1f-4e14-9601-168c8828693e' date '07/01/2013' time '10:57:45' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.31' message 'switch to using #select and #unselect for MetacelloPlatform' id 'de47ee88-5444-487e-be7e-1f59d5fac067' date '05/05/2013' time '13:46:05' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.30' message 'add cache repository type so one can refer to a cache repository by oop rather than by global name ... needed for unambiguos reference to a cache repository: cache://42871553@gemstone' id 'bc705062-32f6-4b41-aba9-2a356881184c' date '03/23/2013' time '09:28:35' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.29' message 'get tests passing (two changed methods in entirety constitute bugfix ...)fix ...)' id '80e40d22-2564-4d39-a3b2-16a76c74ee69' date '02/25/2013' time '16:16:03' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.28' message 'checkpoint ... write from GemStone ... no code changes' id '2101bec9-b015-479c-bac6-adbec4e080a5' date '02/25/2013' time '16:10:28' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.27' message 'mods to get tests passing in GemStone' id 'e13d319d-4d73-4c65-b50d-9491ef635558' date '02/25/2013' time '16:04:11' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.26' message 'Issue #39: gemstone tests green' id 'af135c0d-fa87-415e-bca0-23597cc9c760' date '07/09/2012' time '18:00:32' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.25' message 'issue #39 port to gemstone' id '18545fe8-f66f-4dbb-af03-f9ded23cc3c6' date '07/09/2012' time '11:48:41' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.24' message '1.0-beta.32 (dkh.665):- fix Issue 109: pkgSpec for Metacello configuration doesn''t work for GemStone ServerDirectory repository http://code.google.com/p/metacello/issues/detail?id=109' id '9184ebfc-ea45-453b-be84-7a4f8e689d1c' date '01/19/2012' time '15:13:16' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.23' message '- force a load, so that #gemstone10beta311PostLoadDoIt gets triggered' id '299b1de6-f5c6-48a2-8db7-db30ad9ae6ae' date '11/14/2011' time '14:11:23' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.22' message '1.0-beta.31 (dkh.634):- fix for GemStone version of Pharo Issue 4613 .... derive attributes from GemStone version string' id '8486a1c8-bac3-43dc-a7bf-4e5c8e0aa024' date '10/11/2011' time '14:31:17' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.21' message '1.0-beta.30 (dkh.623):- persistent author initials can be set by defining #''''GS_tODE_AuthorInitials'''' in UserGlobals with desired author initials string (in support of tODE) [GemStone only]''' id 'd6312423-eeec-4c8f-899c-a8afafa35e01' date '07/19/2011' time '11:41:58' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.20' message '- add #maglev attribute for conditional maglev code' id '74d0e559-08c1-4134-861d-527e328d98dd' date '02/02/2011' time '20:07:41' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.19' message '- fix up gemstone-related tests/errors' id '27fa2a3a-ec9d-48e3-9887-c8e99ed0c3c5' date '01/16/2011' time '14:09:49' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.18' message '- implement copyClass:as:inCategory:' id 'd76b70c6-80de-4164-ba94-9cc348acc7db' date '11/18/2010' time '16:24:05' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.17' message '- portable copyClass for toolbox-clean up some old toolbox cruft' id '35ef84f2-1073-4115-b363-90365ac147bd' date '11/17/2010' time '16:21:03' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.16' message '- fix Issue 32: http://code.google.com/p/metacello/issues/detail?id=32 "Connect repositories as MCServerDirectory rather than MCDirectory" - Metacello-Platform.gemstone - Metacello-TestsPlatform.gemstone' id '141e8463-720a-4acd-8177-ca01688ebe5f' date '03/12/1910' time '01:46:16' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.15' message '- remove GoferAPITest>>expectedFailures ' id 'f36f8e62-c162-4f2e-a094-8012d754d473' date '02/11/1910' time '11:25:16' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.14' message '- remove some obsolete methods' id '52d89e7b-0585-49bc-b180-f9aafa6b7b17' date '02/10/1910' time '09:56:38' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.13' message '- fix valueSupplyingMetacelloAnswers for complex blocks' id '8b5535c0-74cf-4869-9aa2-ee87aa357597' date '01/20/1910' time '16:02:11' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-DaleHenrichs.12' message '- pick up latest Gofer-Core and Gofer-Tests- some more version caching for speed- better workingCopy resolution for MetacelloCachingGoferResolvedReference- adjust tests - no longer inheriting pragmas ... too expensive' id '03c4f166-a8da-4979-807b-f85a35fc95e7' date '01/15/1910' time '17:45:32' author 'DaleHenrichs' ancestors ((name 'Metacello-Platform.gemstone-dkh.11' message '- fix problems with GemStone Metacello when runnng without OB' id '2385ae1e-836b-419e-a1aa-45a5c42aa48f' date '01/06/1910' time '11:24:53' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.10' message '- port to latest version of Gofer (Gofer-dkh.105)' id '859122f3-5fc3-4512-bfda-dd75325af4fc' date '12/15/2009' time '11:54:59' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.9' message '- avoid adding extra IV, since MetacelloGemStonePlatform is in the load stack ... avoid migration issues for G/S' id 'bccee966-4431-4744-bcac-ad931e9c44d2' date '11/14/2009' time '09:53:40' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.8' message '- GemStone attributes, now may include: #gemstone #''gs2.x'' #''gs2.3.x'' #''gs2.4.x'' and #''gs3.x'' for finer grainded resolution of Stone version' id '34ffc547-3953-4844-aaac-6aebf77cf701' date '11/13/2009' time '16:41:54' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.7' message '- add #transact: to platform to support GemStone optional transactions' id 'd26cdbda-62da-458a-a372-f3cb73397a7b' date '10/23/2009' time '12:17:35' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.6' message '- implement #ceateRepository:' id '4e7e6bba-a254-48e8-a00c-096a4e2959bb' date '10/22/2009' time '16:32:25' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.5' message '- add support for initials and timestamp' id 'edaee15f-192c-40d5-aaeb-db39a9e30b1e' date '10/16/2009' time '13:48:59' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.4' message '- allow caching of nil currentVersions' id '2c30d9aa-a4f5-46c7-a340-7dc688fcd18f' date '08/20/2009' time '15:48:48' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.3' message '- add caching- add #initialize ' id '005e6864-4430-4846-9bc5-799d11fbf371' date '08/20/2009' time '15:36:30' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.2' message '- move #confirm: to platform, since ui not always present (at least for GemStone)' id '2357cfa5-0d29-4c68-a9c8-f880f1e1a0f1' date '08/11/2009' time '10:21:14' author 'dkh' ancestors ((name 'Metacello-Platform.gemstone-dkh.1' message '- GemStone-specific metacello support' id '243a54b1-2084-4127-afe4-4df86aa71a20' date '08/09/2009' time '11:21:42' author 'dkh' ancestors ((name 'Metacello-Platform.squeak-dkh.1' message '- Squeak-specific metacello support' id '7045edec-ac01-4485-bd21-efac82f0c9ef' date '08/09/2009' time '11:13:57' author 'dkh' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
Expand Down

0 comments on commit fcbea82

Please sign in to comment.