diff options
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | Makefile | 90 | ||||
-rw-r--r-- | PKGBUILD | 22 | ||||
-rw-r--r-- | changelog.md | 5 |
5 files changed, 114 insertions, 18 deletions
@@ -1,18 +1,18 @@ pkgbase = jiq-bin pkgdesc = Interactive JSON query tool using jq expressions pkgver = 0.7.2 - pkgrel = 1 + pkgrel = 2 url = https://github.com/fiatjaf/jiq arch = x86_64 license = MIT depends = jq provides = jiq conflicts = jiq - source = jiq-0.7.2-readme::https://github.com/fiatjaf/jiq/raw/v0.7.2/README.md - source = jiq-0.7.2-license::https://github.com/fiatjaf/jiq/raw/v0.7.2/LICENSE + source = README.md::https://github.com/fiatjaf/jiq/raw/v0.7.2/README.md + source = LICENSE::https://github.com/fiatjaf/jiq/raw/v0.7.2/LICENSE + source = jiq::https://github.com/fiatjaf/jiq/releases/download/v0.7.2/jiq_linux_amd64 b2sums = 1db52e38549bf2e38dcfe7df9d564cb3ce5be56ee6af6c1bdb5e27c50887e786ed484ac7b572bf90c0d9ddf7967ba2497de825cf5c8d9a00ded3ec738cb75f41 b2sums = bc715507c1551ee3bf11013fe54c2ddb9e218092852401ce858b6d50b014e67463bcd7ede03c8332375254a9864ef3bb9005f90adad19083caa949e1935ffbe4 - source_x86_64 = jiq-0.7.2-x86_64::https://github.com/fiatjaf/jiq/releases/download/v0.7.2/jiq_linux_amd64 - b2sums_x86_64 = 893d6d919d2f51740965a88afcb8eef64d6ee3cc08f66e7afa5d1f6450eb84edf35d0db6362dcebfe7819d2e7398c4e3e39eaa7dbc142b7fab96e91c5e66a934 + b2sums = 893d6d919d2f51740965a88afcb8eef64d6ee3cc08f66e7afa5d1f6450eb84edf35d0db6362dcebfe7819d2e7398c4e3e39eaa7dbc142b7fab96e91c5e66a934 pkgname = jiq-bin diff --git a/.gitignore b/.gitignore index 623d0e70ff3e..fd1cf73e6413 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ * !.gitignore -!.SRCINFO +!Makefile !PKGBUILD - +!.SRCINFO +!changelog.md diff --git a/Makefile b/Makefile new file mode 100644 index 000000000000..ffa42df81816 --- /dev/null +++ b/Makefile @@ -0,0 +1,90 @@ +MAKEFLAGS += --warn-undefined-variables +SHELL=/bin/bash + +REPO = $(shell grep url .SRCINFO | cut -d '=' -f 2 | tr -d '[:space:]') +VERSION = $(shell grep pkgver .SRCINFO | cut -d '=' -f 2 | tr -d '[:space:]') +TRASH = $(shell git check-ignore * | tr '\n' ' ') + +# DEFAULT +all: clean log sum build check pre clean + +# just build the package +build: + makepkg -sfr + +# build and install the package +install: + makepkg --install + +# update checksums +sum: + updpkgsums + +# check/lint +check: + @echo "shellcheck: " + shellcheck -e SC2148 -e SC2034 PKGBUILD || exit 0 + + @echo "shell formate: " + shfmt -d PKGBUILD || exit 0 + + @echo "checking PKGBUILD: " + namcap -i PKGBUILD + + @echo "checking build: " + namcap -i *.pkg.* + +# clean up the mess +clean: +ifeq ($(strip $(TRASH)),) + @echo "nothing to clear" +else + file $(TRASH) + @echo -n "Are you sure? [Y/n] " && read ans && if [ $${ans:-'Y'} = 'Y' ]; then \ + trash-put -v $(TRASH) ; \ + exit 0 ; \ + fi +endif + +# generate `changelog.md` +log: + @echo "wait, it will take some time" + $(eval NAME := $(shell gh release --repo $(REPO) view --json name | jq -r .name)) + echo "# Name: $(NAME) " >changelog.md + $(eval URL := $(shell gh release --repo $(REPO) view --json url | jq -r .url)) + echo "### URL: $(URL)" >>changelog.md + $(eval PUBLISHED_AT := $(shell gh release --repo $(REPO) view --json publishedAt | jq -r .publishedAt)) + $(eval AUTHOR := $(shell gh release --repo $(REPO) view --json author | jq -r .author.login)) + echo "### published at '$(PUBLISHED_AT)' by $(AUTHOR)" >>changelog.md + echo "---" >>changelog.md + gh release --repo $(REPO) view --json body | jq -r .body >>changelog.md + +# prepare for commit +pre: + shfmt -w PKGBUILD + makepkg --printsrcinfo > .SRCINFO + + git diff + + git add PKGBUILD + git add changelog.md + git add .SRCINFO + git add .gitignore + git add Makefile + +# commit with version bump message +commit: + $(eval VERSION := $(shell read -p "enter version (pkgver=$(VERSION)): " enter ; echo $${enter})) + @echo "commit message: \"updating to v$(VERSION)\"" + + @echo -n "Are you sure? [Y/n] " && read ans && if [ $${ans:-'Y'} = 'Y' ]; then \ + git diff --cached ; \ + exit 0 ; \ + fi + + @echo -n "Are you sure? [Y/n] " && read ans && if [ $${ans:-'Y'} = 'Y' ]; then \ + git commit -m "updating to v$(VERSION)" ; \ + exit 0 ; \ + fi + + @echo "recheck everything before pushing to AUR" @@ -3,27 +3,27 @@ pkgname="jiq-bin" pkgver=0.7.2 -pkgrel=1 +pkgrel=2 + pkgdesc='Interactive JSON query tool using jq expressions' arch=('x86_64') url='https://github.com/fiatjaf/jiq' license=('MIT') + depends=('jq') provides=("jiq") conflicts=("jiq") -source=("jiq-${pkgver}-readme::https://github.com/fiatjaf/jiq/raw/v${pkgver}/README.md" - "jiq-${pkgver}-license::https://github.com/fiatjaf/jiq/raw/v${pkgver}/LICENSE") -source_x86_64=("jiq-${pkgver}-x86_64::https://github.com/fiatjaf/jiq/releases/download/v${pkgver}/jiq_linux_amd64") +source=("README.md::https://github.com/fiatjaf/jiq/raw/v${pkgver}/README.md" + "LICENSE::https://github.com/fiatjaf/jiq/raw/v${pkgver}/LICENSE" + "jiq::https://github.com/fiatjaf/jiq/releases/download/v${pkgver}/jiq_linux_amd64") b2sums=('1db52e38549bf2e38dcfe7df9d564cb3ce5be56ee6af6c1bdb5e27c50887e786ed484ac7b572bf90c0d9ddf7967ba2497de825cf5c8d9a00ded3ec738cb75f41' - 'bc715507c1551ee3bf11013fe54c2ddb9e218092852401ce858b6d50b014e67463bcd7ede03c8332375254a9864ef3bb9005f90adad19083caa949e1935ffbe4') -b2sums_x86_64=('893d6d919d2f51740965a88afcb8eef64d6ee3cc08f66e7afa5d1f6450eb84edf35d0db6362dcebfe7819d2e7398c4e3e39eaa7dbc142b7fab96e91c5e66a934') + 'bc715507c1551ee3bf11013fe54c2ddb9e218092852401ce858b6d50b014e67463bcd7ede03c8332375254a9864ef3bb9005f90adad19083caa949e1935ffbe4' + '893d6d919d2f51740965a88afcb8eef64d6ee3cc08f66e7afa5d1f6450eb84edf35d0db6362dcebfe7819d2e7398c4e3e39eaa7dbc142b7fab96e91c5e66a934') package() { - install -Dvm755 "jiq-${pkgver}-${CARCH}" "${pkgdir}/usr/bin/jiq" - install -Dvm644 "jiq-${pkgver}-readme" "${pkgdir}/usr/share/doc/jiq/README.md" - install -Dvm644 "jiq-${pkgver}-license" "${pkgdir}/usr/share/licenses/jiq/LICENSE" + install -Dm755 "jiq" "${pkgdir}/usr/bin/jiq" + install -Dm644 "README.md" "${pkgdir}/usr/share/doc/$pkgname/README.md" + install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/$pkgname/LICENSE" } - -# vim: ts=2 sw=2 et: diff --git a/changelog.md b/changelog.md new file mode 100644 index 000000000000..64a4404a452d --- /dev/null +++ b/changelog.md @@ -0,0 +1,5 @@ +# Name: v0.7.2 +### URL: https://github.com/fiatjaf/jiq/releases/tag/v0.7.2 +### published at '2021-08-25T10:07:43Z' by fiatjaf +--- + |