aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-02-21 19:48:17 -0300
committerEuAndreh <eu@euandre.org>2021-02-21 20:02:15 -0300
commit1e99186b9dcc75595b525a8aa93bd9fee70c323e (patch)
tree03654aecd6fab13f047b77e164404764e49e1cc5 /scripts
parentTODOs.md: Add Void to the list of target OSes (diff)
downloadpackage-repository-1e99186b9dcc75595b525a8aa93bd9fee70c323e.tar.gz
package-repository-1e99186b9dcc75595b525a8aa93bd9fee70c323e.tar.xz
Support -latest (main branch) and tagged releases
Diffstat (limited to '')
-rwxr-xr-xscripts/paku29
1 files changed, 21 insertions, 8 deletions
diff --git a/scripts/paku b/scripts/paku
index 88fd917..b31d2c4 100755
--- a/scripts/paku
+++ b/scripts/paku
@@ -32,6 +32,7 @@ EOF
for p in $(jq -r '.packages[] | @base64' < paku.json); do
NAME="$(echo "$p" | base64 --decode | jq -r '.name')"
+ SUFFIX="$(echo "$p" | base64 --decode | jq -r '.suffix')"
VERSION="$(echo "$p" | base64 --decode | jq -r '.version')"
TARBALL="$(tarball_url "$NAME" "$VERSION")"
@@ -58,9 +59,9 @@ EOF
cat <<EOF >>"$GUIX_OUT"
-(define-public $NAME
+(define-public $NAME$SUFFIX
(package
- (name "$NAME")
+ (name "$NAME$SUFFIX")
(version "$VERSION")
(source (origin
(method url-fetch)
@@ -81,8 +82,11 @@ EOF
done
printf '\n(list' >>"$GUIX_OUT"
- for name in $(jq -r '.packages[].name' < paku.json); do
- printf '\n %s' "$name" >>"$GUIX_OUT"
+ for p in $(jq -r '.packages[] | @base64' < paku.json); do
+ NAME="$(echo "$p" | base64 --decode | jq -r '.name')"
+ SUFFIX="$(echo "$p" | base64 --decode | jq -r '.suffix')"
+
+ printf '\n %s%s' "$NAME" "$SUFFIX" >>"$GUIX_OUT"
done
printf ')\n' >>"$GUIX_OUT"
@@ -100,6 +104,7 @@ EOF
for p in $(jq -r '.packages[] | @base64' < paku.json); do
NAME="$(echo "$p" | base64 --decode | jq -r '.name')"
+ SUFFIX="$(echo "$p" | base64 --decode | jq -r '.suffix')"
VERSION="$(echo "$p" | base64 --decode | jq -r '.version')"
TARBALL="$(tarball_url "$NAME" "$VERSION")"
SHA256="$(nix-prefetch-url --unpack "$TARBALL")"
@@ -118,7 +123,7 @@ EOF
fi
cat <<EOF >>"$NIX_OUT"
- $NAME = pkgs.stdenv.mkDerivation rec {
+ $NAME$SUFFIX = pkgs.stdenv.mkDerivation rec {
name = "$NAME";
version = "$VERSION";
@@ -157,6 +162,9 @@ gen_homebrew() {
for p in $(jq -r '.packages[] | @base64' < paku.json); do
HOMEBREW_OUT="$(mktemp)"
NAME="$(echo "$p" | base64 --decode | jq -r '.name')"
+ SUFFIX="$(echo "$p" | base64 --decode | jq -r '.suffix')"
+ SUFFIX_UC="$(echo "$SUFFIX" | cut -c2-)"
+ SUFFIX_UC="${SUFFIX_UC^}"
VERSION="$(echo "$p" | base64 --decode | jq -r '.version')"
TYPE="$(echo "$p" | base64 --decode | jq -r '.type')"
@@ -189,7 +197,7 @@ gen_homebrew() {
fi
cat <<EOF >>"$HOMEBREW_OUT"
-class ${NAME^} < Formula
+class ${NAME^}$SUFFIX_UC < Formula
desc '$DESCRIPTION'
homepage 'https://$NAME.euandreh.xyz'
url '$TARBALL_URL'
@@ -204,7 +212,7 @@ $CHECK_INPUTS
end$TEST_SECTION
end
EOF
- mv "$HOMEBREW_OUT" "Formula/$NAME.rb"
+ mv "$HOMEBREW_OUT" "Formula/$NAME$SUFFIX.rb"
done
}
@@ -213,8 +221,13 @@ refresh_packages() {
INDEXES="$(seq 0 "$((COUNT - 1))")"
for N in $INDEXES; do
NAME="$(jq -r ".packages[$N].name" < paku.json)"
+ SUFFIX="$(jq -r ".packages[$N].suffix" < paku.json)"
cd "../$NAME/"
- NEW_VERSION="$(git rev-parse HEAD)"
+ if [ "$SUFFIX" = '-latest' ]; then
+ NEW_VERSION="$(git rev-parse HEAD)"
+ else
+ NEW_VERSION="$(git describe --tags --abbrev=0 | cut -c2-)"
+ fi
cd - >/dev/null
jq -r ".packages[$N].version = \"$NEW_VERSION\"" paku.json | sponge paku.json
done