force consistent timestamps for SVN downloads
to make checksumming work correctly
This commit is contained in:
parent
1af3a75039
commit
e4554a170a
|
@ -92,8 +92,9 @@ class Cask::SubversionDownloadStrategy < SubversionDownloadStrategy
|
|||
end
|
||||
|
||||
# This primary reason for redefining this method is the trust_cert
|
||||
# option, controllable from the Cask definition. The rest of this
|
||||
# method is similar to Homebrew's, but translated to local idiom.
|
||||
# option, controllable from the Cask definition. We also force
|
||||
# consistent timestamps. The rest of this method is similar to
|
||||
# Homebrew's, but translated to local idiom.
|
||||
def fetch_repo target, url, revision=cask_url.revision, ignore_externals=false
|
||||
# Use "svn up" when the repository already exists locally.
|
||||
# This saves on bandwidth and will have a similar effect to verifying the
|
||||
|
@ -104,6 +105,9 @@ class Cask::SubversionDownloadStrategy < SubversionDownloadStrategy
|
|||
# SVN shipped with XCode 3.1.4 can't force a checkout.
|
||||
args << '--force' unless MacOS.version == :leopard
|
||||
|
||||
# make timestamps consistent for checksumming
|
||||
args.concat(%w[--config-option config:miscellany:use-commit-times=yes])
|
||||
|
||||
if cask_url.trust_cert
|
||||
args << '--trust-server-cert'
|
||||
args << '--non-interactive'
|
||||
|
|
|
@ -139,6 +139,8 @@ describe Cask::CurlDownloadStrategy do
|
|||
'/usr/bin/svn',
|
||||
'checkout',
|
||||
'--force',
|
||||
'--config-option',
|
||||
'config:miscellany:use-commit-times=yes',
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
])
|
||||
|
@ -153,6 +155,8 @@ describe Cask::CurlDownloadStrategy do
|
|||
'/usr/bin/svn',
|
||||
'checkout',
|
||||
'--force',
|
||||
'--config-option',
|
||||
'config:miscellany:use-commit-times=yes',
|
||||
'--trust-server-cert',
|
||||
'--non-interactive',
|
||||
cask.url.to_s,
|
||||
|
@ -169,6 +173,8 @@ describe Cask::CurlDownloadStrategy do
|
|||
'/usr/bin/svn',
|
||||
'checkout',
|
||||
'--force',
|
||||
'--config-option',
|
||||
'config:miscellany:use-commit-times=yes',
|
||||
cask.url.to_s,
|
||||
downloader.cached_location,
|
||||
'-r',
|
||||
|
@ -198,17 +204,19 @@ describe Cask::CurlDownloadStrategy do
|
|||
shutup { downloader.fetch }.must_equal downloader.tarball_path
|
||||
end
|
||||
end
|
||||
# does not work yet, for numerous reasons
|
||||
# does not work yet, because (for unknown reasons), the tar command
|
||||
# returns an error code when running under the test suite
|
||||
# it 'creates a tarball matching the expected checksum' do
|
||||
# cask = Cask.load('svn-download-check-cask')
|
||||
# downloader = Cask::SubversionDownloadStrategy.new(cask)
|
||||
# # special mocking required for tar to have something to work with
|
||||
# def downloader.fetch_repo(target, url, revision=nil, ignore_externals=false)
|
||||
# target.mkpath
|
||||
# FileUtils.touch(target.join('empty_file'))
|
||||
# FileUtils.touch(target.join('empty_file.txt'))
|
||||
# File.utime(1000,1000,target.join('empty_file.txt'))
|
||||
# end
|
||||
# shutup { downloader.fetch }.must_equal downloader.tarball_path
|
||||
# d = Cask::Download.new(cask)
|
||||
# d._check_sums(downloader.tarball_path, cask.sums)
|
||||
# d.send(:_check_sums, downloader.tarball_path, cask.sums)
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@ class SvnDownloadCask < TestCask
|
|||
url 'http://example.com/trunk/projectdir/subdir', :using => :svn
|
||||
homepage 'http://example.com/'
|
||||
version '1.2.3'
|
||||
sha1 '39f3444fcb5d49618c2d62dd7b34304ea5f97a3a'
|
||||
sha1 '9fbff30e151d9e662ed30acf51f1d374d3282ea0'
|
||||
link 'TestCask.app'
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@ class SvnDownloadCheckCask < TestCask
|
|||
url 'http://example.com/trunk/projectdir/subdir', :using => :svn
|
||||
homepage 'http://example.com/'
|
||||
version '1.2.3'
|
||||
sha1 '39f3444fcb5d49618c2d62dd7b34304ea5f97a3a'
|
||||
sha1 '9fbff30e151d9e662ed30acf51f1d374d3282ea0'
|
||||
link 'TestCask.app'
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@ class SvnDownloadRevisionCask < TestCask
|
|||
url 'http://example.com/trunk/projectdir/subdir', :using => :svn, :revision => '10'
|
||||
homepage 'http://example.com/'
|
||||
version '1.2.3'
|
||||
sha1 '39f3444fcb5d49618c2d62dd7b34304ea5f97a3a'
|
||||
sha1 '9fbff30e151d9e662ed30acf51f1d374d3282ea0'
|
||||
link 'TestCask.app'
|
||||
end
|
||||
|
|
|
@ -2,6 +2,6 @@ class SvnDownloadTrustCask < TestCask
|
|||
url 'http://example.com/trunk/projectdir/subdir', :using => :svn, :trust_cert => true
|
||||
homepage 'http://example.com/'
|
||||
version '1.2.3'
|
||||
sha1 '39f3444fcb5d49618c2d62dd7b34304ea5f97a3a'
|
||||
sha1 '9fbff30e151d9e662ed30acf51f1d374d3282ea0'
|
||||
link 'TestCask.app'
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue