Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperkit 0.20180403 (new formula) #25593

Closed
wants to merge 30 commits into from
Closed

hyperkit 0.20180403 (new formula) #25593

wants to merge 30 commits into from

Conversation

alepee
Copy link
Contributor

@alepee alepee commented Mar 21, 2018

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

end

def caveats; <<~EOS
To enable qcow support in the block backend an OCaml OPAM development
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This formula should be built with qcow support rather than having a caveat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I though about it, thanks for your feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you have other feedbacks, or is it ok to merge this? @ilovezfs

@ilovezfs ilovezfs added the new formula PR adds a new formula to Homebrew/homebrew-core label Mar 21, 2018
sha256 "382933118da3835056203d3d05923b554f36cc41a555a821516e11ccb7d16bf3"

head do
url "https://github.com/hishamhm/htop.git"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bogus url

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh my.. thanks

@alepee
Copy link
Contributor Author

alepee commented Apr 3, 2018

@ilovezfs @glensc thank you for your previous reviews. I made some fixes and enhancements according to your feedbacks.

:tag => "v0.20180123",
:revision => "8bbe1da0166553a5b0ccff170bf9ccbd7d10753e"

head do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No head for new formulas, please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok 👌

depends_on "automake" => :build
end

option "with-qcow", "Enable support for qcow disk image format"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove option, build by default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure to understand. Why would you like to enable qcow support for every setup?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to ship as many formulas as possible without options, providing a full feature set for users without the need to compile themselves.

system "opam", "init", "--no-setup"
opam_dir = "#{buildpath}/.brew_home/.opam"
ENV["CAML_LD_LIBRARY_PATH"] = "#{opam_dir}/system/lib/stublibs:/usr/local/lib/ocaml/stublibs"
ENV["OPAMUTF8MSGS"] = "1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need that one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those values come from opam config env, they are necessary for opam to work properly.

system "make"
end

bin.install "build/hyperkit"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no make install procedure? No man page, no documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately not at the moment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now include man page

end

test do
pipe_output("#{bin}/hyperkit", "v")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a test that does something more than just output version number

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you; but I don't want either to boot a virtual machine. Any ideas?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try some operation and confirm that it fails?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fxcoudert Look at the xhyve formula, the only test there is -v. Hyperkit is based on xhyve.
https://github.com/Homebrew/homebrew-core/blob/master/Formula/xhyve.rb

@stale
Copy link

stale bot commented May 2, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label May 2, 2018
:revision => "8bbe1da0166553a5b0ccff170bf9ccbd7d10753e"

option "with-qcow", "Enable support for qcow disk image format"
if build.with? "qcow"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No option, make it default behaviour please.

@stale stale bot removed the stale No recent activity label May 4, 2018
homepage "https://github.com/moby/hyperkit"
url "https://github.com/moby/hyperkit.git",
:tag => "v0.20180123",
:revision => "8bbe1da0166553a5b0ccff170bf9ccbd7d10753e"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we build from a source archive rather than git checkout?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we could build from the source archives at https://github.com/moby/hyperkit/releases

homepage "https://github.com/moby/hyperkit"
url "https://github.com/moby/hyperkit/archive/v0.20180123.tar.gz"
sha256 "382933118da3835056203d3d05923b554f36cc41a555a821516e11ccb7d16bf3"
version "v0.20180123"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let version be automatically detected

depends_on "libev"

depends_on :xcode => ["9.0", :build]
depends_on :macos => :yosemite
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary, since Xcode 9.0 is only available on macOS 10.12.6 and later.

end

test do
pipe_output("#{bin}/hyperkit", "v")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe try some operation and confirm that it fails?


system "opam", "config", "exec", "--", "make"

bin.install "build/hyperkit"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No doc, no other file to install?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just added it to install procedure with c0de235

@stale
Copy link

stale bot commented Jun 21, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Jun 21, 2018
@ilovezfs
Copy link
Contributor

@alepee what's the status here?

@Stale chill.

@stale stale bot removed the stale No recent activity label Jun 24, 2018
@stale
Copy link

stale bot commented Jul 15, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

test do
assert_match(version.to_s, shell_output("#{bin}/hyperkit -v 2>&1"))
assert_match("kexec: failed to load kernel null",
shell_output("#{bin}/hyperkit -f kexec,null 2>&1", 134))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test failed with different messages depending on macos version. It can not boot a VM because test env does not have a CPU that supports EPT (x86 virtualization).
What can I test instead? Any idea?

Copy link
Contributor Author

@alepee alepee Jul 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high sierra

15:31:45 ==> /usr/local/Cellar/hyperkit/0.20180403/bin/hyperkit -v 2>&1
15:31:45 ==> /usr/local/Cellar/hyperkit/0.20180403/bin/hyperkit -f kexec,null 2>&1
15:31:45 sh: line 1: 21605 Abort trap: 6           /usr/local/Cellar/hyperkit/0.20180403/bin/hyperkit -f kexec,null 2>&1
15:31:45 Error: hyperkit: failed
15:31:45 </kexec:\ failed\ to\ load\ kernel\ null/> expected to be =~
15:31:45 <"hv_vm_create failed\n">.

sierra

15:31:25 ==> /usr/local/Cellar/hyperkit/0.20180403/bin/hyperkit -f kexec,null 2>&1
15:31:25 Error: hyperkit: failed
15:31:25 <134> expected but was
15:31:25 <1>.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to test the actual functionality of the virtualisation using hyperkit/xhyve/bhyve, which I do not see as a thing to be tested in the build of a brew package. Unless this test-case is a must (for eg. coverage or something) I would consider this test to be unnecessary.
If you want to test that the hyperkit executable is placed in the correct folder, and is part of the brew PATH, I would rather just do hyperkit -v (if that is the same as xhyve -v) just to see that the executable will run and return the correct Version values.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the xhyve formula, that is what they did.
https://github.com/Homebrew/homebrew-core/blob/master/Formula/xhyve.rb

Copy link

@artheus artheus Jul 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative you could test this instead hyperkit -f bootrom,null so it will look for a file and answer "Error opening bootrom "null": No such file or directory". Or you could just test and see that the shell exit code is not 0, instead of asserting that a string in the shell output would always be the same.
EDIT: This should always return error code 1, unless by some odd reason there is a file named null somewhere which it would pick up.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, You do not have to use assert_match to match the text output of shell_output. shell_output by itself is an assertion, which checks for the expected exit value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback @artheus, I already made a test to evaluate if version number of hyperkit is correct.
I will give a try to hyperkit -f bootrom,null

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -39,7 +39,5 @@ def install

test do
assert_match(version.to_s, shell_output("#{bin}/hyperkit -v 2>&1"))
assert_match('Error opening bootrom "null": No such file or directory',
shell_output("#{bin}/hyperkit -f bootrom,null 2>&1", 1))
Copy link
Contributor Author

@alepee alepee Jul 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same problem with hyperkit -f bootrom,null than:
https://github.com/Homebrew/homebrew-core/pull/25593/files/b4438325df9da8ef468077cafd4d4eeee86a4e1e#r204757986

Sierra

11:17:44 ==> /usr/local/Cellar/hyperkit/0.20180403/bin/hyperkit -f bootrom,null 2>&1
11:17:44 Error: hyperkit: failed
11:17:44 </Error\ opening\ bootrom\ "null":\ No\ such\ file\ or\ directory/> expected to be =~
11:17:44 <"Unable to create VM (-85377018)\nvmx_init: processor not supported by Hypervisor.framework\n">.

High Sierra

11:17:13 ==> /usr/local/Cellar/hyperkit/0.20180403/bin/hyperkit -f bootrom,null 2>&1
11:17:13 sh: line 1: 24782 Abort trap: 6           /usr/local/Cellar/hyperkit/0.20180403/bin/hyperkit -f bootrom,null 2>&1
11:17:13 Error: hyperkit: failed
11:17:13 <1> expected but was
11:17:13 <134>.

I removed this test, and just check that installed hyperkit version number match formula version number

@alepee
Copy link
Contributor Author

alepee commented Jul 30, 2018

@ilovezfs @fxcoudert @artheus, if testing returned version number is ok for you, this formula may be ready for merge.

hengenkaosu added a commit to hengenkaosu/homebrew-hyperkit that referenced this pull request Jul 30, 2018
Adds qcow support back in, should work across the board.
Credit to [alepee](https://github.com/alepee)
Pr for reference: [#25593](Homebrew/homebrew-core#25593)
@alepee
Copy link
Contributor Author

alepee commented Aug 7, 2018

@BrewTestBot
Copy link
Member

  • C: 9: col 3: dependency "aspcud" (line 9) should be put before dependency "opam" (line 8)

@BrewTestBot
Copy link
Member

  • C: 8: col 3: dependency "aspcud" (line 8) should be put before dependency "ocaml" (line 7)

def install
system "opam", "init", "--no-setup"
opam_dir = "#{buildpath}/.brew_home/.opam"
ENV["CAML_LD_LIBRARY_PATH"] = "#{opam_dir}/system/lib/stublibs:/usr/local/lib/ocaml/stublibs"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't assume /usr/local. You'll want to use:

Formula["ocaml"].opt_lib/"ocaml/stublibs"

here I guess, or some variation thereof.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your feedback, I just pushed an update

inreplace "#{opam_dir}/compilers/4.05.0/4.05.0/4.05.0.comp",
'["./configure"', '["./configure" "-no-graph"' # Avoid X11

ENV.deparallelize { system "opam", "switch", "4.05.0" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an upstream issue or an opam issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I replicate this from docker-machine-driver-xhyve Formula which also need opam to build with qcow support. It comes from 6667394 by @ilovezfs

@stale
Copy link

stale bot commented Sep 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Sep 1, 2018
@claui
Copy link
Contributor

claui commented Sep 2, 2018

@fxcoudert Anything left to do here?

@stale stale bot removed the stale No recent activity label Sep 2, 2018
@alepee
Copy link
Contributor Author

alepee commented Sep 13, 2018

Hello maintainers. It's been a long time since I first opened this pull request, I can understand you have a lot to do elsewhere, but it would be a great thing to take a few minutes to tackle this one 😘

@fxcoudert
Copy link
Member

@BrewTestBot test this please

@fxcoudert fxcoudert added the ready to merge PR can be merged once CI is green label Sep 13, 2018
@fxcoudert
Copy link
Member

Thanks @alepee for the pull request, I am glad we have been able to push that one over the finish line!

@fxcoudert fxcoudert closed this in fc557a9 Sep 14, 2018
@alepee
Copy link
Contributor Author

alepee commented Sep 14, 2018

Merci @fxcoudert, and all of you who gave me feedbacks along the way for this first fomula 😃

@lock lock bot added the outdated PR was locked due to age label Oct 14, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new formula PR adds a new formula to Homebrew/homebrew-core outdated PR was locked due to age ready to merge PR can be merged once CI is green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants