From 48326a0e152d839e23b5069a2395f1a7e3977f98 Mon Sep 17 00:00:00 2001 From: Tom McKeesick Date: Mon, 29 Sep 2025 00:12:34 +1000 Subject: [PATCH 1/3] add script to build .deb installers - for now, just build versions for linux/amd64 and android/arm64 --- build/Makefile | 12 +++++++-- build/scripts/build_debs.sh | 49 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100755 build/scripts/build_debs.sh diff --git a/build/Makefile b/build/Makefile index 1998c452..f33c11d2 100644 --- a/build/Makefile +++ b/build/Makefile @@ -5,7 +5,7 @@ DOCKER_TAG ?= latest DOCKER_IMAGE=$(DOCKER_REPO)/pokesay:$(DOCKER_TAG) -all: build/docker build/cows build/assets test build/release +all: build/docker build/cows build/assets test build/release build/deb build/docker: echo "Building $(DOCKER_IMAGE)" @@ -37,6 +37,14 @@ build/release: build/assets build/scripts/build.sh tree $(PWD)/bin/ +build/deb: build/release + docker run \ + -v $(PWD)/../:/usr/local/src \ + --rm --name pokesay \ + $(DOCKER_IMAGE) \ + build/scripts/build_debs.sh + tree $(PWD)/deb/ + test: docker run \ -v $(PWD)/../:/usr/local/src \ @@ -44,4 +52,4 @@ test: $(DOCKER_IMAGE) \ gotestsum --format dots -.PHONY: all build/docker build/cows build/assets build/release test +.PHONY: all build/docker build/cows build/assets build/release build/deb test diff --git a/build/scripts/build_debs.sh b/build/scripts/build_debs.sh new file mode 100755 index 00000000..3c34a72e --- /dev/null +++ b/build/scripts/build_debs.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -euo pipefail + +function get_latest_version() { + curl -s https://api.github.com/repos/tmck-code/pokesay/releases/latest \ + | grep tag_name \ + | cut -d "\"" -f 4- \ + | sed -E 's/",$|v//g' +} + +VERSION="$(get_latest_version)" +MAINTAINER="Tom McKeesick " +DESCRIPTION="Print pokemon in the CLI! An adaptation of the classic 'cowsay'" + +OUTPUT_DIR="build/deb" +mkdir -p "$OUTPUT_DIR" + +function build_deb() { + local os=$1 + local arch=$2 + local suffix=${3:-} + + local bin="build/bin/pokesay-${os}-${arch}${suffix}" + local pkg_name="pokesay-${os}-${arch}" + + mkdir -p "$pkg_name" "$pkg_name/pokesay/DEBIAN" "$pkg_name/pokesay/usr/bin" + + cp "$bin" "$pkg_name/pokesay/usr/bin/pokesay" + + cat > "$pkg_name/pokesay/DEBIAN/control" < Date: Mon, 29 Sep 2025 00:13:22 +1000 Subject: [PATCH 2/3] update to golang 1.24 --- build/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/Dockerfile b/build/Dockerfile index 93660bd7..1ef3074c 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.23 +FROM golang:1.24 WORKDIR /usr/local/src From 59ab9f8fd0bac7eb2e40644e4a2375632901b178 Mon Sep 17 00:00:00 2001 From: Tom McKeesick Date: Mon, 29 Sep 2025 00:25:36 +1000 Subject: [PATCH 3/3] tidy dockerfile print output - remove apt warning - git clone quietly - ensure print statements and progress bars don't clash --- build/Dockerfile | 13 +++++++------ src/bin/convert/png_convert.go | 2 +- src/bin/pokedex/pokedex.go | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 1ef3074c..5ee39846 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -2,19 +2,20 @@ FROM golang:1.24 WORKDIR /usr/local/src -RUN BUILD_DEPS="make gcc" +ENV DEBIAN_FRONTEND=noninteractive +ENV BUILD_DEPS="make gcc" RUN apt-get update \ - && apt-get install -y --no-install-recommends "${BUILD_DEPS}" libmagickwand-dev ncurses-dev jq imagemagick + && apt-get install -y --no-install-recommends $BUILD_DEPS libmagickwand-dev ncurses-dev jq imagemagick -RUN git clone --depth 1 https://github.com/denilsonsa/img2xterm \ +RUN git clone -q --depth 1 https://github.com/denilsonsa/img2xterm \ && (cd img2xterm && make && make install) \ && rm -rf img2xterm \ - && apt purge -y "${BUILD_DEPS}" \ - && apt-get purge -y --auto-remove \ + && apt-get purge -y $BUILD_DEPS \ + && apt-get autoremove --purge -y \ && rm -rf /var/lib/apt/lists/* \ && rm -rf /tmp/* /var/tmp/* -RUN git clone --depth 1 https://github.com/msikma/pokesprite /tmp/original/pokesprite +RUN git clone -q --depth 1 https://github.com/msikma/pokesprite /tmp/original/pokesprite WORKDIR /usr/local/src/ ADD src/ /usr/local/src/src/ diff --git a/src/bin/convert/png_convert.go b/src/bin/convert/png_convert.go index 1da49052..8061714c 100644 --- a/src/bin/convert/png_convert.go +++ b/src/bin/convert/png_convert.go @@ -92,6 +92,6 @@ func main() { pokedex.WriteToCowfile(data, destDirpath, destFpath) pbar.Add(1) } - fmt.Println("Finished converting", len(fpaths), "pokesprite PNGs -> cowfiles") + fmt.Println("\nFinished converting", len(fpaths), "pokesprite PNGs -> cowfiles") fmt.Println("(skipped", nDuplicates, "duplicates and", nFailures, "failures)") } diff --git a/src/bin/pokedex/pokedex.go b/src/bin/pokedex/pokedex.go index 4362c864..7ca04761 100644 --- a/src/bin/pokedex/pokedex.go +++ b/src/bin/pokedex/pokedex.go @@ -124,7 +124,7 @@ func main() { pbar.Add(1) } - fmt.Println("- Writing entries to file") + fmt.Println("\n- Writing entries to file") pbar = bin.NewProgressBar(len(cowfileFpaths)) for i, fpath := range cowfileFpaths { data, err := os.ReadFile(fpath) @@ -147,8 +147,8 @@ func main() { pokedex.WriteStructToFile(uniqueNames, "build/assets/names.txt") - // 2. Create the category struct using the cowfile paths, pokemon names and indexes\ - fmt.Println("- Writing categories to file") + // 2. Create the category struct using the cowfile paths, pokemon names and indexes + fmt.Println("\n- Writing categories to file") categories := pokedex.CreateCategoryStruct(args.FromDir, pokemonMetadata, args.Debug) pokedex.WriteStructToFile(categories, "build/assets/category_keys.txt")