From b3ccc398cfd30ad9e243a041933204ea2e567535 Mon Sep 17 00:00:00 2001
From: EuAndreh
Date: Wed, 22 Mar 2023 12:11:24 -0300
Subject: Support Homebrew
---
Formula/git-permalink-0-1-0.rb | 17 ++++++++++
Formula/git-permalink-0-2-0.rb | 17 ++++++++++
Formula/guile-heredoc.rb | 17 ++++++++++
Formula/remembering-0-1-2.rb | 17 ++++++++++
Formula/td-latest.rb | 17 ----------
Formula/td.rb | 17 ++++++++++
Makefile | 21 ++++++++++---
README.md | 10 ++++--
TODOs.md | 2 +-
paku.lock | 25 +++++++++------
src/bin/paku | 70 +++++++++++++++++++++++++++++++++++++++---
tests/checks/deb.sh | 1 +
tests/checks/homebrew.sh | 25 +++++++++++++++
13 files changed, 216 insertions(+), 40 deletions(-)
create mode 100644 Formula/git-permalink-0-1-0.rb
create mode 100644 Formula/git-permalink-0-2-0.rb
create mode 100644 Formula/guile-heredoc.rb
create mode 100644 Formula/remembering-0-1-2.rb
delete mode 100644 Formula/td-latest.rb
create mode 100644 Formula/td.rb
create mode 100755 tests/checks/homebrew.sh
diff --git a/Formula/git-permalink-0-1-0.rb b/Formula/git-permalink-0-1-0.rb
new file mode 100644
index 0000000..a7368a5
--- /dev/null
+++ b/Formula/git-permalink-0-1-0.rb
@@ -0,0 +1,17 @@
+class GitPermalink010 < Formula
+ desc 'Git extension to generate web permalinks of files in a repository'
+ homepage 'https://euandre.org/s/git-permalink'
+ url 'https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.1.0.tar.xz'
+ sha256 '252c98e349fed8df180ace540675b69a811ff56a9f06fa505eb475e047648a1f'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install', "PREFIX=#{prefix}"
+ end
+
+ test do
+ system "#{bin}/git-permalink", '-V'
+ end
+end
diff --git a/Formula/git-permalink-0-2-0.rb b/Formula/git-permalink-0-2-0.rb
new file mode 100644
index 0000000..d28af13
--- /dev/null
+++ b/Formula/git-permalink-0-2-0.rb
@@ -0,0 +1,17 @@
+class GitPermalink020 < Formula
+ desc 'Git extension to generate web permalinks of files in a repository'
+ homepage 'https://euandre.org/s/git-permalink'
+ url 'https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.2.0.tar.xz'
+ sha256 '9ea6562812f6127771bc2b86919ea63056fcc0f5c1e556875855c924ee8b1183'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install', "PREFIX=#{prefix}"
+ end
+
+ test do
+ system "#{bin}/git-permalink", '-V'
+ end
+end
diff --git a/Formula/guile-heredoc.rb b/Formula/guile-heredoc.rb
new file mode 100644
index 0000000..3f24ecf
--- /dev/null
+++ b/Formula/guile-heredoc.rb
@@ -0,0 +1,17 @@
+class GuileHeredoc < Formula
+ desc 'Guile heredoc syntax'
+ homepage 'https://euandre.org/s/guile-heredoc'
+ url 'https://euandre.org/git/guile-heredoc/snapshot/guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz'
+ sha256 '4d6e5171f36d48ab2341cc9e3346262f9ec7c9f0fd3d88ec6e204ef2160821f8'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install', "PREFIX=#{prefix}"
+ end
+
+ test do
+ system "#{bin}/guile-heredoc", '-V'
+ end
+end
diff --git a/Formula/remembering-0-1-2.rb b/Formula/remembering-0-1-2.rb
new file mode 100644
index 0000000..7366d97
--- /dev/null
+++ b/Formula/remembering-0-1-2.rb
@@ -0,0 +1,17 @@
+class Remembering012 < Formula
+ desc 'Add memory to dmenu, fzf and similar tools'
+ homepage 'https://euandre.org/s/remembering'
+ url 'https://euandre.org/git/remembering/snapshot/remembering-v0.1.2.tar.xz'
+ sha256 'bbf0fd451d3de3b09a01cfbcc74482741463f9d8ac73ba6024e538c203b1dfeb'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install', "PREFIX=#{prefix}"
+ end
+
+ test do
+ system "#{bin}/remembering", '-V'
+ end
+end
diff --git a/Formula/td-latest.rb b/Formula/td-latest.rb
deleted file mode 100644
index 723c77d..0000000
--- a/Formula/td-latest.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class TdLatest < Formula
- desc 'Minimalistic bug tracker CLI'
- homepage 'https://euandreh.xyz/td/'
- url 'https://euandreh.xyz/td.git/snapshot/td-7a1d07c1051ff48f17c915f99e20b629ed0a6a70.tar.gz'
- sha256 '4857ac55dbc9790c0aa5b3b7c0c8eadcaed29e201cea46d8b1dd4248d574acc7'
- license 'AGPL-3.0-or-later'
-
- def install
- system 'make'
- system 'make', 'check'
- system 'make', 'install', "PREFIX=#{prefix}"
- end
-
- test do
- system "#{bin}/td", '-V'
- end
-end
diff --git a/Formula/td.rb b/Formula/td.rb
new file mode 100644
index 0000000..af0d84d
--- /dev/null
+++ b/Formula/td.rb
@@ -0,0 +1,17 @@
+class Td < Formula
+ desc 'Minimalistic bug tracker CLI'
+ homepage 'https://euandre.org/s/td'
+ url 'https://euandre.org/git/td/snapshot/td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz'
+ sha256 'a25561ae8062788bfb79df2de5f26e5f1100638fbeabff934490cdf0a9dde105'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install', "PREFIX=#{prefix}"
+ end
+
+ test do
+ system "#{bin}/td", '-V'
+ end
+end
diff --git a/Makefile b/Makefile
index e0d7de2..2fc55b0 100644
--- a/Makefile
+++ b/Makefile
@@ -12,10 +12,10 @@
-all: EuAndreh.key guix nix debian
+all: EuAndreh.key guix nix debian homebrew
-paku.lock: src/bin/paku
+paku.lock: src/bin/paku Makefile
touch $@
@@ -78,6 +78,13 @@ debian.mk: paku.lock
debian: debian.mk
$(MAKE) -f debian.mk
+homebrew: Formula
+
+Formula: paku.lock
+ mkdir -p $@
+ perl src/bin/paku homebrew $@
+ touch $@
+
public/debian: debian
mkdir -p $(@D)
@@ -94,10 +101,14 @@ upload: public
rsync -avzP --delete public/ euandre.org:/srv/www/s/package-repository/
HTTP-REMOTE = 'https://euandre.org/s/package-repository'
-check-ubuntu:
- sh tests/vm-check.sh -x -t deb -H ubuntu-x86_64-headless -r $(HTTP-REMOTE)
+GIT-REMOTE = 'git://euandre.org/package-repository'
+check-ubuntu-deb:
+ sh tests/vm-check.sh -x -H ubuntu-x86_64-headless -r $(HTTP-REMOTE) -t deb
+
+check-ubuntu-homebrew:
+ sh tests/vm-check.sh -x -H ubuntu-x86_64-headless -r $(GIT-REMOTE) -t homebrew
-check: check-ubuntu
+check: all check-ubuntu-deb check-ubuntu-homebrew
clean:
diff --git a/README.md b/README.md
index f956cf7..99a87e6 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,7 @@ See the list of packages [online].
## How to add this to different OSes
+
### Guix
Add this channel to your `~/.config/guix/channels.scm`:
@@ -31,6 +32,7 @@ Add this channel to your `~/.config/guix/channels.scm`:
See also the Guix manual for usage on channels:
+
### NixOS
Adding the overlay to your `/etc/nixos/configuration.nix`:
@@ -39,12 +41,13 @@ Adding the overlay to your `/etc/nixos/configuration.nix`:
nixpkgs = {
overlays = [
(import (fetchTarball {
- url = "https://euandre.org/git/package-repository/snapshot/package-repository-main.tar.gz";
+ url = "https://euandre.org/git/package-repository/snapshot/package-repository-main.tar.xz";
}) { inherit pkgs; })
];
};
```
+
### Debian
```shell
@@ -52,9 +55,12 @@ $ wget -qO- https://euandre.org/s/package-repository/debian/public-key.asc | sud
$ sudo apt-add-repository 'deb https://euandre.org/s/package-repository/debian ./'
```
-### Homebrew
+### Homebrew
+```shell
+$ brew tap --force-auto-update org/euandre https://euandre.org/git/package-repository/
+```
## Contributing
diff --git a/TODOs.md b/TODOs.md
index 80181f2..740cb02 100644
--- a/TODOs.md
+++ b/TODOs.md
@@ -19,7 +19,7 @@
- [ ] illumos (pkgsrc)
- [ ] openSUSE (Zypper)
- [ ] Alpine (apk)
-- [ ] Homebrew
+- [x] Homebrew
- [ ] Flatpack
- [ ] AppImage
- [ ] Haiku
diff --git a/paku.lock b/paku.lock
index 12c2cf9..6fb8f7b 100644
--- a/paku.lock
+++ b/paku.lock
@@ -20,8 +20,9 @@
"inputs": [],
"version": "v0.1.0",
"label": "0-1-0",
- "sha256": "1jb0rgcj5b4bkm5gds3l0dymf3gd644r2njmirs9345vf54if45y",
- "sha256base32": "07waci3y0xdlbr8gl1lzdbsiz0csnrshcm6f18cdzn7y97irhb15",
+ "sha256": "252c98e349fed8df180ace540675b69a811ff56a9f06fa505eb475e047648a1f",
+ "sha256guix": "07waci3y0xdlbr8gl1lzdbsiz0csnrshcm6f18cdzn7y97irhb15",
+ "sha256nix": "1jb0rgcj5b4bkm5gds3l0dymf3gd644r2njmirs9345vf54if45y",
"url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.1.0.tar.xz",
"base-url": "https://euandre.org/s/git-permalink",
"fname": "git-permalink-v0.1.0.tar.xz",
@@ -40,8 +41,9 @@
"inputs": [],
"version": "v0.2.0",
"label": "0-2-0",
- "sha256": "1bzx4gdfc87jfshaqifxpc3llp2j98wkzjjslzwbrqn59jzakxc9",
- "sha256base32": "10qiigp29jamb23mdrf1yp0gqmihlsg931ibpiqpf4pn28l5d9ly",
+ "sha256": "9ea6562812f6127771bc2b86919ea63056fcc0f5c1e556875855c924ee8b1183",
+ "sha256guix": "10qiigp29jamb23mdrf1yp0gqmihlsg931ibpiqpf4pn28l5d9ly",
+ "sha256nix": "1bzx4gdfc87jfshaqifxpc3llp2j98wkzjjslzwbrqn59jzakxc9",
"url": "https://euandre.org/git/git-permalink/snapshot/git-permalink-v0.2.0.tar.xz",
"base-url": "https://euandre.org/s/git-permalink",
"fname": "git-permalink-v0.2.0.tar.xz",
@@ -60,8 +62,9 @@
"inputs": [],
"version": "v0.1.2",
"label": "0-1-2",
- "sha256": "1mrkyfcgz77hw7mpgqrnsaws9qng2awf8flslzf1s1gikk3zljns",
- "sha256base32": "1syzn41w4f754ihblwxcv3wn653lh92cgg6g06db1qrx3m2zvw5v",
+ "sha256": "bbf0fd451d3de3b09a01cfbcc74482741463f9d8ac73ba6024e538c203b1dfeb",
+ "sha256guix": "1syzn41w4f754ihblwxcv3wn653lh92cgg6g06db1qrx3m2zvw5v",
+ "sha256nix": "1mrkyfcgz77hw7mpgqrnsaws9qng2awf8flslzf1s1gikk3zljns",
"url": "https://euandre.org/git/remembering/snapshot/remembering-v0.1.2.tar.xz",
"base-url": "https://euandre.org/s/remembering",
"fname": "remembering-v0.1.2.tar.xz",
@@ -80,8 +83,9 @@
"inputs": [],
"version": "4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8",
"label": "latest",
- "sha256": "1xqr2vc270jydk508pbkhcchmbg74w4bf83ch2d85nqja14r64n9",
- "sha256base32": "01g1vnlz1kch8j9zzaxyixih04azdvrfabfzg7xqny32h2p62md2",
+ "sha256": "a25561ae8062788bfb79df2de5f26e5f1100638fbeabff934490cdf0a9dde105",
+ "sha256guix": "01g1vnlz1kch8j9zzaxyixih04azdvrfabfzg7xqny32h2p62md2",
+ "sha256nix": "1xqr2vc270jydk508pbkhcchmbg74w4bf83ch2d85nqja14r64n9",
"url": "https://euandre.org/git/td/snapshot/td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz",
"base-url": "https://euandre.org/s/td",
"fname": "td-4a8a7a2662c94b2581f587e9a4b81feba4f5e7d8.tar.xz",
@@ -111,8 +115,9 @@
"type": "latest",
"version": "065435cdce609604e33b879b9be3e81ab89f3e7b",
"label": "latest",
- "sha256": "179qq17mgi4kakhj9w1dk26afljh5yad4j9ih9d8wms70x6h211m",
- "sha256base32": "1y1110bg4ki0dvn8hggxy34wg7ig4r3377nc84isnj3dydqm2vjd",
+ "sha256": "4d6e5171f36d48ab2341cc9e3346262f9ec7c9f0fd3d88ec6e204ef2160821f8",
+ "sha256guix": "1y1110bg4ki0dvn8hggxy34wg7ig4r3377nc84isnj3dydqm2vjd",
+ "sha256nix": "179qq17mgi4kakhj9w1dk26afljh5yad4j9ih9d8wms70x6h211m",
"url": "https://euandre.org/git/guile-heredoc/snapshot/guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz",
"base-url": "https://euandre.org/s/guile-heredoc",
"fname": "guile-heredoc-065435cdce609604e33b879b9be3e81ab89f3e7b.tar.xz",
diff --git a/src/bin/paku b/src/bin/paku
index 622f8ef..55372b6 100755
--- a/src/bin/paku
+++ b/src/bin/paku
@@ -123,7 +123,7 @@ sub emit_packages() {
}
sub emit_release() {
- my $f = $ARGV[0];
+ my $f = $ARGV[0] or die 'Missing "Packages" file';
my $name = File::Basename::basename $f;
my $size = (stat($f))[7];
@@ -189,7 +189,7 @@ sub emit_nix() {
src = fetchTarball {
url =
"$pkg->{url}";
- sha256 = "$pkg->{sha256}";
+ sha256 = "$pkg->{sha256nix}";
};
nativeBuildInputs = with pkgs; [
@@ -279,7 +279,7 @@ sub emit_guix() {
(method url-fetch)
(uri "$pkg->{url}")
(sha256
- (base32 "$pkg->{sha256base32}"))))
+ (base32 "$pkg->{sha256guix}"))))
(build-system gnu-build-system)
(native-inputs
EOF
@@ -459,6 +459,42 @@ sub emit_debian() {
print @targets;
}
+sub pascal_case($s) {
+ return join('', map(ucfirst, split '-', $s))
+}
+
+sub emit_homebrew() {
+ my $d = $ARGV[0] or die 'Missing "Formula/" directory';
+ my $json = load_json();
+ for my $pkg (@{$json->{packages}}) {
+ my $name = $pkg->{name} . (
+ $pkg->{label} eq 'latest' ? '' : "-$pkg->{label}"
+ );
+ open(my $fh, '>', "$d/$name.rb");
+ my $class_name = pascal_case $name;
+ print $fh <<~EOF;
+ class $class_name < Formula
+ desc '$pkg->{description}'
+ homepage '$pkg->{'base-url'}'
+ url '$pkg->{url}'
+ sha256 '$pkg->{sha256}'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install', "PREFIX=#{prefix}"
+ end
+
+ test do
+ system "#{bin}/$pkg->{name}", '-V'
+ end
+ end
+ EOF
+ close $fh;
+ }
+}
+
sub emit_html() {
my $json = load_json();
print <<~EOF;
@@ -545,6 +581,16 @@ sub emit_html() {
\$ nix-env -i $pkg->{name}$suffix
+
+ Homebrew
+
+ After following the
+ Homebrew instructions
+ to include this repository as a tap
, you can
+ install it with:
+
+ \$ brew install $pkg->{name}$suffix
+
EOF
@@ -584,7 +630,6 @@ sub emit_html() {
Include my public key for validating the repository
signatures:
- ~/.config/guix/channels.scm
:
\$ wget -qO- https://euandre.org/s/package-repository/debian/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/euandre.org.asc
@@ -609,7 +654,7 @@ sub emit_html() {
nixpkgs = {
overlays = [
(import (fetchTarball {
- url = "https://euandre.org/git/package-repository/snapshot/package-repository-main.tar.gz";
+ url = "https://euandre.org/git/package-repository/snapshot/package-repository-main.tar.xz";
}) { inherit pkgs; })
];
};
@@ -618,6 +663,20 @@ sub emit_html() {
org-euandre
attribute set.
+
+ Homebrew instructions
+
+ Add this repository as a tap:
+
+ \$ brew tap --force-auto-update org/euandre https://euandre.org/git/package-repository/
+
+ The explicit --force-auto-update
option
+ is required, because homebrew(1)
will only
+ fetch updates automatically for repositories hosted on
+ GitHub. With this option, repositories not on GitHub
+ are treated equally.
+
+