From e7c9b7110c2193c2c353b0c0c73939d2d1da1b11 Mon Sep 17 00:00:00 2001 From: John Kelley Date: Fri, 10 Nov 2017 02:42:50 -0800 Subject: [PATCH] simg2img 1.1.1 (new formula) Closes #20498. Signed-off-by: ilovezfs --- Formula/simg2img.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Formula/simg2img.rb diff --git a/Formula/simg2img.rb b/Formula/simg2img.rb new file mode 100644 index 0000000000..5a7cc2ae17 --- /dev/null +++ b/Formula/simg2img.rb @@ -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