mkvtoolnix/rake.d/tarball.rb
Moritz Bunkus ab6455f68c
build system: fix compatibility with Ruby 3.2.0
Several deprecated functions were removed: `Dir.exists?`,
`File.exists?` & `FileTest.exists?`.  Instead of those
`FileTest.exist?` must be used (without the `s`). See the release
notes for Ruby 3.2.0 as well as the issue for removing the functions:

https://www.ruby-lang.org/en/news/2022/12/25/ruby-3-2-0-released/
https://bugs.ruby-lang.org/issues/17391
2023-01-02 22:57:21 +01:00

21 lines
609 B
Ruby

def create_source_tarball suffix = ""
tarball = "#{Dir.pwd}/../mkvtoolnix-#{c(:PACKAGE_VERSION)}#{suffix}.tar.xz"
fail "#{tarball} does already exist" if FileTest.exist?(tarball)
Dir.mktmpdir do |dir|
clone_dir = "#{dir}/mkvtoolnix-#{c(:PACKAGE_VERSION)}"
commands = [
"git clone \"#{Dir.pwd}\" \"#{clone_dir}\"",
"cd #{clone_dir}",
"./autogen.sh",
"git submodule init",
"git submodule update",
"rm -rf .git",
"cd ..",
"tar cJf \"#{tarball}\" mkvtoolnix-#{c(:PACKAGE_VERSION)}",
]
system commands.join(" && ")
puts tarball
end
end