From 78de810649af29e8cbbf7cf9ced271aa40227313 Mon Sep 17 00:00:00 2001 From: mapk0y Date: Sat, 24 Jan 2026 03:14:45 +0900 Subject: [PATCH] First commit --- .SRCINFO | 14 +++++++++++++ .gitignore | 5 +++++ Dockerfile | 7 +++++++ Makefile | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ PKGBUILD | 37 ++++++++++++++++++++++++++++++++++ test.sh | 24 ++++++++++++++++++++++ 6 files changed, 145 insertions(+) create mode 100644 .SRCINFO create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 PKGBUILD create mode 100755 test.sh diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..868b858f0cb6 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,14 @@ +pkgbase = git-wt + pkgdesc = A Git subcommand that makes `git worktree` simple + pkgver = 0.15.0 + pkgrel = 1 + url = https://github.com/k1LoW/git-wt + arch = aarch64 + arch = x86_64 + license = MIT + source_aarch64 = https://github.com/k1LoW/git-wt/releases/download/v0.15.0/git-wt_v0.15.0_linux_arm64.tar.gz + sha256sums_aarch64 = 269e6ff231c84ad139b1350a8838dd6bf32d5262b48c04b6751e5c306597e2ba + source_x86_64 = https://github.com/k1LoW/git-wt/releases/download/v0.15.0/git-wt_v0.15.0_linux_amd64.tar.gz + sha256sums_x86_64 = c13442fef2ba65e43b57374311709ccd50ee20c9c15b5f76fc02c406ae553f88 + +pkgname = git-wt diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..6a12f7f5b9c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.tar.gz +*.tar.xz +pkg/ +src/ + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..569af1cb5cea --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM archlinux:base +# ref. https://github.com/KSXGitHub/github-actions-deploy-aur + +RUN pacman -Syu --noconfirm +RUN pacman -S --noconfirm --needed \ + pacman-contrib + diff --git a/Makefile b/Makefile new file mode 100644 index 000000000000..3815d369749e --- /dev/null +++ b/Makefile @@ -0,0 +1,58 @@ +# vi: set ft=make ts=2 sw=2 sts=0 noet: + +SHELL := /bin/bash + +MAKEFILE_DIR := $(dir $(lastword $(MAKEFILE_LIST))) + +TARGET_REPO := k1LoW/git-wt + +.PHONY: default +default: help + +# http://postd.cc/auto-documented-makefile/ +.PHONY: help help-common +help: help-common + +help-common: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-30s\033[0m %s\n", $$1, $$2}' + + +.PHONY: all renew install update_checksum packaging clean update_tag test + +all: update_tag packaging test ## Update to the latest version and packaging for release [Recommended] + +renew: update_tag install ## get newer version and renew package, install that + +install: ## install package + makepkg -si + +update_checksum: ## upgrade pkg checksum + @# makepkg -g は更新してくれるわけではない + @# https://wiki.archlinux.org/title/PKGBUILD#Integrity + updpkgsums + +packaging: update_checksum ## packaging for manual operation + makepkg -s + makepkg --printsrcinfo > .SRCINFO + +clean: ## remove tar.gz + rm -vf *.tar.xz *.tar.gz + +update_tag: LATEST := $(shell curl -sL https://api.github.com/repos/$(TARGET_REPO)/releases/latest | jq -r '.tag_name|ltrimstr("v")') +update_tag: ## get and update newest version in PKGBUILD + source ./PKGBUILD && \ + if [[ $${pkgver} != $(LATEST) ]]; then \ + sed -i -e 's/^pkgver=.*$$/pkgver=$(LATEST)/' ./PKGBUILD && \ + sed -i -e 's/^pkgrel=.*$$/pkgrel=1/' ./PKGBUILD && \ + updpkgsums && \ + git diff ./PKGBUILD; \ + else \ + echo "This is the latest version: $${pkgver}"; \ + fi + +test: ## test (needs make packaging) + docker build -t arch:arch-package-test -f $(MAKEFILE_DIR)/Dockerfile $(MAKEFILE_DIR) && \ + docker run -it --rm -v $(MAKEFILE_DIR):/work -w /work arch:arch-package-test ./test.sh + namcap PKGBUILD + source ./PKGBUILD && namcap "$${pkgname}-$${pkgver}-$${pkgrel}-$$(uname -m).pkg.tar.xz" + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..a3ac6dc10a82 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,37 @@ +# Maintainer: Kazuya Yokogawa + +pkgname='git-wt' +pkgver=0.15.0 +pkgrel=1 +pkgdesc='A Git subcommand that makes `git worktree` simple' +url='https://github.com/k1LoW/git-wt' + +license=('MIT') +arch=('aarch64' 'x86_64') +depends=() +conflicts=() +source_aarch64=("${url}/releases/download/v${pkgver}/${pkgname}_v${pkgver}_linux_arm64.tar.gz") +source_x86_64=("${url}/releases/download/v${pkgver}/${pkgname}_v${pkgver}_linux_amd64.tar.gz") +sha256sums_aarch64=('269e6ff231c84ad139b1350a8838dd6bf32d5262b48c04b6751e5c306597e2ba') +sha256sums_x86_64=('c13442fef2ba65e43b57374311709ccd50ee20c9c15b5f76fc02c406ae553f88') + +build() { + cd "$srcdir" + ${pkgname} --init zsh > ${pkgname}.zsh + ${pkgname} --init bash > ${pkgname}.bash + ${pkgname} --init fish > ${pkgname}.fish +} + +package() { + install -Dm644 ${srcdir}/README.md "$pkgdir/usr/share/doc/${pkgname}/README.md" + install -Dm644 ${srcdir}/LICENSE "$pkgdir/usr/share/licenses/${pkgname}/LICENSE" + + install -Dm755 ${srcdir}/${pkgname} "$pkgdir/usr/bin/${pkgname}" + install -Dm644 ${srcdir}/${pkgname}.zsh "$pkgdir/usr/share/zsh/site-functions/_${pkgname}" + install -Dm644 ${srcdir}/${pkgname}.bash "$pkgdir/usr/share/bash-completion/completions/${pkgname}" + install -Dm644 ${srcdir}/${pkgname}.fish "$pkgdir/usr/share/fish/completions/${pkgname}.fish" +} + +check() { + ${srcdir}/${pkgname} version +} diff --git a/test.sh b/test.sh new file mode 100755 index 000000000000..302c03980004 --- /dev/null +++ b/test.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -eu + +source ./PKGBUILD + +echo "## install start" +pacman -U --noconfirm "${pkgname}-${pkgver}-${pkgrel}-$(uname -m).pkg.tar.xz" + +echo "## install completed" + +echo "## check installed files" + +echo +echo "### check command help" + +${pkgname} --help + +echo +echo "### check command version" + +${pkgname} --version + +echo "test OK"