simg2img 1.1.1 (new formula)

Closes #20498.

Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
John Kelley 2017-11-10 02:42:50 -08:00 committed by ilovezfs
parent 43438fc7fe
commit e7c9b7110c

24
Formula/simg2img.rb Normal file
View file

@ -0,0 +1,24 @@
class Simg2img < Formula
desc "Tool to convert Android sparse images to raw images and back"
homepage "https://github.com/anestisb/android-simg2img"
url "https://github.com/anestisb/android-simg2img/archive/1.1.1.tar.gz"
sha256 "d096ca7e02b3ad5b87cbb6467d3766720355f32aa5ae9b9264d7ca7c486b0738"
head "https://github.com/anestisb/android-simg2img.git"
def install
system "make", "PREFIX=#{prefix}", "install"
end
test do
system "dd", "if=/dev/zero", "of=512k-zeros.img", "bs=512", "count=1024"
assert_equal 524288, (testpath/"512k-zeros.img").size?,
"Could not create 512k-zeros.img with 512KiB of zeros"
system bin/"img2simg", "512k-zeros.img", "512k-zeros.simg"
assert_equal 44, (testpath/"512k-zeros.simg").size?,
"Converting 512KiB of zeros did not result in a 44 byte simg"
system bin/"simg2img", "512k-zeros.simg", "new-512k-zeros.img"
assert_equal 524288, (testpath/"new-512k-zeros.img").size?,
"Converting a 44 byte simg did not result in 512KiB"
system "diff", "512k-zeros.img", "new-512k-zeros.img"
end
end