aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-02-20 03:37:39 -0300
committerEuAndreh <eu@euandre.org>2021-02-20 03:46:54 -0300
commitd3f2eed3e15a3380583c72a6f8e16cbe85614bed (patch)
treec6e0eab956c6fe606b865fe706300a05a821ac69
parentMakefile: Mark "all" target as .PHONY (diff)
downloadpackage-repository-d3f2eed3e15a3380583c72a6f8e16cbe85614bed.tar.gz
package-repository-d3f2eed3e15a3380583c72a6f8e16cbe85614bed.tar.xz
Add Homebrew initial packaging
Diffstat (limited to '')
-rw-r--r--Formula/autoqemu.rb18
-rw-r--r--Formula/fallible.rb16
-rw-r--r--Formula/remembering.rb18
-rw-r--r--paku.json7
-rwxr-xr-xscripts/paku96
5 files changed, 133 insertions, 22 deletions
diff --git a/Formula/autoqemu.rb b/Formula/autoqemu.rb
new file mode 100644
index 0000000..1f83094
--- /dev/null
+++ b/Formula/autoqemu.rb
@@ -0,0 +1,18 @@
+class Autoqemu < Formula
+ desc 'Installation and setup automation tool for QEMU virtual machines'
+ homepage 'https://autoqemu.euandreh.xyz'
+ url 'https://git.euandreh.xyz/autoqemu/snapshot/autoqemu-4d1a0b6314c4f6fcf31f80e608f6b03a316a7255.tar.gz'
+ sha256 'fd501b421c8e562d957a38c83ea42173b5e9dc9b1bb9cef300aee48088fe3afe'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system './configure', "--prefix=#{prefix}"
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install'
+ end
+
+ test do
+ system "#{bin}/autoqemu", '-V'
+ end
+end
diff --git a/Formula/fallible.rb b/Formula/fallible.rb
new file mode 100644
index 0000000..53d2177
--- /dev/null
+++ b/Formula/fallible.rb
@@ -0,0 +1,16 @@
+class Fallible < Formula
+ desc 'Fault injection library for stress-testing failure scenarios'
+ homepage 'https://fallible.euandreh.xyz'
+ url 'https://git.euandreh.xyz/fallible/snapshot/fallible-66a2ee41beaaffb9a9a6b521837c0967528845fa.tar.gz'
+ sha256 'da5c6e7ef4de276424b28095fde09b029af0b9eccaf91e8ab477bf2bc8b1b95e'
+ license 'AGPL-3.0-or-later'
+
+ depends_on 'valgrind' => :build
+
+ def install
+ system './configure', "--prefix=#{prefix}"
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install'
+ end
+end
diff --git a/Formula/remembering.rb b/Formula/remembering.rb
new file mode 100644
index 0000000..1007a0d
--- /dev/null
+++ b/Formula/remembering.rb
@@ -0,0 +1,18 @@
+class Remembering < Formula
+ desc 'Add memory to dmenu, fzf and similar tools.'
+ homepage 'https://remembering.euandreh.xyz'
+ url 'https://git.euandreh.xyz/remembering/snapshot/remembering-793b782617b0667eefa938a836f24d8a5e087bb0.tar.gz'
+ sha256 '0049501383ce7fc4d42a406f8193e1f05ff3e9a3dce3a9e40e56d9997f96f691'
+ license 'AGPL-3.0-or-later'
+
+ def install
+ system './configure', "--prefix=#{prefix}"
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install'
+ end
+
+ test do
+ system "#{bin}/remembering", '-V'
+ end
+end
diff --git a/paku.json b/paku.json
index 910226d..9ee03b1 100644
--- a/paku.json
+++ b/paku.json
@@ -2,15 +2,18 @@
"packages": [
{
"name": "remembering",
- "version": "793b782617b0667eefa938a836f24d8a5e087bb0"
+ "version": "793b782617b0667eefa938a836f24d8a5e087bb0",
+ "type": "bin"
},
{
"name": "autoqemu",
- "version": "4d1a0b6314c4f6fcf31f80e608f6b03a316a7255"
+ "version": "4d1a0b6314c4f6fcf31f80e608f6b03a316a7255",
+ "type": "bin"
},
{
"name": "fallible",
"version": "66a2ee41beaaffb9a9a6b521837c0967528845fa",
+ "type": "lib",
"check_inputs": [
"valgrind"
]
diff --git a/scripts/paku b/scripts/paku
index 239f1a5..88fd917 100755
--- a/scripts/paku
+++ b/scripts/paku
@@ -153,29 +153,85 @@ EOF
mv "$NIX_OUT" default.nix
}
+gen_homebrew() {
+ for p in $(jq -r '.packages[] | @base64' < paku.json); do
+ HOMEBREW_OUT="$(mktemp)"
+ NAME="$(echo "$p" | base64 --decode | jq -r '.name')"
+ VERSION="$(echo "$p" | base64 --decode | jq -r '.version')"
+ TYPE="$(echo "$p" | base64 --decode | jq -r '.type')"
+
+ TARBALL_URL="$(tarball_url "$NAME" "$VERSION")"
+ TARBALL="$(mktemp)"
+ wget -O "$TARBALL" "$TARBALL_URL"
+ SHA256="$(sha256sum "$TARBALL" | cut -d\ -f 1)"
+ DESCRIPTION="$(tar xvf "$TARBALL" -O "$NAME-$VERSION/description")"
+
+ JSON_CHECK_INPUTS="$(echo "$p" | base64 --decode | jq -r '.check_inputs')"
+ if [ "$JSON_CHECK_INPUTS" = 'null' ]; then
+ CHECK_INPUTS=''
+ else
+ CHECK_INPUTS=''
+ for check_input in $(echo "$JSON_CHECK_INPUTS" | jq -r '.[]'); do
+ CHECK_INPUTS="$CHECK_INPUTS
+ depends_on '$check_input' => :build"
+ done
+ CHECK_INPUTS="$CHECK_INPUTS
+"
+ fi
+
+ TEST_SECTION=''
+ if [ "$TYPE" = 'bin' ]; then
+ TEST_SECTION="
+
+ test do
+ system \"#{bin}/$NAME\", '-V'
+ end"
+ fi
+
+ cat <<EOF >>"$HOMEBREW_OUT"
+class ${NAME^} < Formula
+ desc '$DESCRIPTION'
+ homepage 'https://$NAME.euandreh.xyz'
+ url '$TARBALL_URL'
+ sha256 '$SHA256'
+ license 'AGPL-3.0-or-later'
+$CHECK_INPUTS
+ def install
+ system './configure', "--prefix=#{prefix}"
+ system 'make'
+ system 'make', 'check'
+ system 'make', 'install'
+ end$TEST_SECTION
+end
+EOF
+ mv "$HOMEBREW_OUT" "Formula/$NAME.rb"
+ done
+}
+
refresh_packages() {
- COUNT="$(jq -r '.packages[].name' < paku.json | wc -l)"
- INDEXES="$(seq 0 "$((COUNT - 1))")"
+ COUNT="$(jq -r '.packages[].name' < paku.json | wc -l)"
+ INDEXES="$(seq 0 "$((COUNT - 1))")"
for N in $INDEXES; do
- NAME="$(jq -r ".packages[$N].name" < paku.json)"
- cd "../$NAME/"
- NEW_VERSION="$(git rev-parse HEAD)"
- cd - >/dev/null
- jq -r ".packages[$N].version = \"$NEW_VERSION\"" paku.json | sponge paku.json
- done
+ NAME="$(jq -r ".packages[$N].name" < paku.json)"
+ cd "../$NAME/"
+ NEW_VERSION="$(git rev-parse HEAD)"
+ cd - >/dev/null
+ jq -r ".packages[$N].version = \"$NEW_VERSION\"" paku.json | sponge paku.json
+ done
}
while getopts 'gr' flag; do
- case "$flag" in
- g)
- gen_guix
- gen_nix
- ;;
- r)
- refresh_packages
- ;;
- *)
- printf 'Unrecognized flag "%s".\n' "$flag" >&2
- ;;
- esac
+ case "$flag" in
+ g)
+ gen_guix
+ gen_nix
+ gen_homebrew
+ ;;
+ r)
+ refresh_packages
+ ;;
+ *)
+ printf 'Unrecognized flag "%s".\n' "$flag" >&2
+ ;;
+ esac
done