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

Installing latest master using brew install sandreas/tap/m4b-tool --HEAD #213

Open
kallegrens opened this issue Jan 12, 2023 · 7 comments
Open

Comments

@kallegrens
Copy link

Hello!

I would like to install the latest master using Homebrew on MacOS. How do I do this?

Following the guide in the README with brew install sandreas/tap/m4b-tool, it simply installs the release version 0.4.2, which is really old.

Usually I can do brew install <package name> --HEAD to pull the master. However, when doing this I get Error: No head is defined for sandreas/tap/m4b-tool.

Any ideas?

@kallegrens kallegrens changed the title Installing latest master using Hombrew MacOS Installing latest master using Homebrew MacOS Jan 12, 2023
@kallegrens kallegrens changed the title Installing latest master using Homebrew MacOS Installing latest master using Homebrew on MacOS Ventura Jan 12, 2023
@kallegrens kallegrens changed the title Installing latest master using Homebrew on MacOS Ventura Installing latest master using brew install sandreas/tap/m4b-tool --HEAD Jan 12, 2023
@kallegrens
Copy link
Author

kallegrens commented Jan 12, 2023

I figured out how to specify the head in the Ruby formula. The reference was found here: https://github.com/Homebrew/brew/blob/master/docs/Formula-Cookbook.md#unstable-versions-head

Using brew edit m4b-tool I edited the formula manually and added the line

head "https://github.com/sandreas/m4b-tool.git", using: :git

The full formula can be seen below.

# brew tap sandreas/tap
# brew install m4b-tool
class M4bTool < Formula
  version "0.4.2"
  desc "m4b-tool is a command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b"
  homepage "https://github.com/sandreas/m4b-tool"
  url "https://github.com/sandreas/m4b-tool/releases/download/v.#{version}/m4b-tool.tar.gz"
  sha256 "0ec79733770379dbd11ea9d76fd03d62d8aacca8e66730779f7caaa92f577ba7"
  head "https://github.com/sandreas/m4b-tool.git", using: :git

  depends_on "php"
  depends_on "sandreas/tap/mp4v2"
  depends_on "fdk-aac-encoder"
  # depends_on "homebrew-ffmpeg/ffmpeg/ffmpeg" => 'with-fdk-aac'

  def install
    bin.install "m4b-tool.phar" => "m4b-tool"
  end

  test do
    assert_equal "m4b-tool v.#{version}", shell_output("#{bin}/m4b-tool --version").chomp
  end

end

When calling brew install sandreas/tap/m4b-tool --HEAD I now get the error:

Error: An exception occurred within a child process:
  Errno::ENOENT: No such file or directory - m4b-tool.phar

So it seems we have to change the install-function?
Any thoughts?

@sandreas
Copy link
Owner

Did you see the install instructions for the latest pre-release?

Just replace the m4b-tool.phar file with the latest one:

# show m4b-tool install path, e.g. /usr/local/bin/m4b-tool
which m4b-tool

# download latest pre-release
cd /tmp
wget https://github.com/sandreas/m4b-tool/files/9721007/m4b-tool.tar.gz
tar xzf m4b-tool.tar.gz

# backup old version
sudo mv /usr/local/bin/m4b-tool /usr/local/bin/m4b-tool.2020-02-29.phar

# install new version
sudo mv m4b-tool.phar /usr/local/bin/m4b-tool && sudo chmod +x /usr/local/bin/m4b-tool

# check version
m4b-tool version

@kallegrens
Copy link
Author

kallegrens commented Jan 13, 2023

Hello!

I'm aware I can just build from source or just use the latest pre-release. However, what I was after was doing this using Homebrew. The reasons are several. Two of them are:

  • It allows me to share usage of the dependencies already installed.
  • It allows me to keep the package up to date really easy. brew upgrade m4b-tool --fetch-HEAD. And it should upgrade using the latest master.

I managed to install the latest pre-release using Homebrew by editing the formula and instead of pointing the head to the latest master I pointed it to the latest pre-release as such:

head "https://github.com/sandreas/m4b-tool/files/9721007/m4b-tool.tar.gz"

This installs nicely using brew install sandreas/tap/m4b-tool --HEAD. However, this still doesn't allow brew upgrade m4b-tool --fetch-HEAD, because it's not really cloning the master and building.

Unfortunately I'm not experienced in Ruby, nor with Homebrew. But, as mentioned before, probably we need to make the --HEAD-option use it's own way of installing.

@sandreas
Copy link
Owner

sandreas commented Jan 13, 2023

I managed to install the latest pre-release using Homebrew by editing the formula and instead of pointing the head to the latest master I pointed it to the latest pre-release as such:

Cool, I did not understand that at first. This is really helpful, thank you very much.

Unfortunately I'm not experienced in Ruby, nor with Homebrew. But, as mentioned before, probably we need to make the --HEAD-option use it's own way of installing.

Currently, I'm absolutely busy with other things. But I'll keep that in mind for the future and will definitely take a look at this.

BTW: @kallegrens the tap is open souce, too:
https://github.com/sandreas/homebrew-tap/blob/master/Formula/m4b-tool.rb

@sandreas
Copy link
Owner

Related to #217

The plan is to rework brew that a newer pre-release known as stable is the default install... as well as getting rid of some useless dependencies (sandreas/mp4v2 is deprecated in favour of enzo1982/mp4v2). I think integrating tone would also be a good idea.

@sandreas
Copy link
Owner

Got a PR, switched to a pretty new preview-release since 0.4.2 is unusable right now. Integration of tone has to be done, but this is something for later.

@kallegrens
Copy link
Author

Nice to see some progress here! Keep up the good work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants