From f422c8b9767292fc4797e63a4a92dc91db4c8faf Mon Sep 17 00:00:00 2001 From: Oneric Date: Wed, 2 Oct 2024 16:50:51 +0200 Subject: [PATCH] Plant sapling --- .gitignore | 15 ++++++ .gitmodules | 4 ++ Makefile | 80 +++++++++++++++++++++++++++++ README.md | 34 ++++++++++++ akkoma | 1 + patches/000_plant-a-forest.patch.in | 26 ++++++++++ patches/series | 1 + quiltrc | 7 +++ 8 files changed, 168 insertions(+) create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 Makefile create mode 100644 README.md create mode 160000 akkoma create mode 100644 patches/000_plant-a-forest.patch.in create mode 100644 patches/series create mode 100644 quiltrc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed08aee --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +/patches/000_plant-a-forest.patch + +# build artefacts +/*.stamp + +# editor stuff +*.swp +*.bak +*.old +*.orig +~* + +# temporary files +tmp_* +*.tmp diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..515b8a3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "akkoma"] + path = akkoma + url = https://akkoma.dev/AkkomagAng/akkoma.git + branch = develop diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4354b33 --- /dev/null +++ b/Makefile @@ -0,0 +1,80 @@ +# Requires GNU Make +export LC_ALL = C.UTF-8 +export PLEROMA_BUILD_BRANCH = $(shell git rev-parse --abbrev-ref HEAD) + +QUILT ::= quilt --quiltrc ../quiltrc + + +.PHONY: patch +patch: patch.stamp + + +GIT_HASH ::= $(shell git rev-parse --short=8 HEAD) +GIT_HASH_OLD ::= $(shell cat git.stamp 2>/dev/null || :) +ifneq ($(GIT_HASH), $(GIT_HASH_OLD)) +.PHONY: git.stamp +endif +git.stamp: + @echo "Collecting buld info" + @echo $(GIT_HASH) > $@ + +patches/000_plant-a-forest.patch: patches/000_plant-a-forest.patch.in git.stamp + @echo "Encoding build info" + @number="$$(git rev-list --count HEAD)" && \ + hash="$$(git rev-parse --short=8 HEAD)" && \ + sed -e 's/%COMMIT_NUMBER%/'"$$number"'/g' \ + -e 's/%COMMIT_HASH%/'"$$hash"'/g' \ + $< > $@ + +submodule.stamp: + @echo "Ensure submodule is up-to-date" + @if [ ! -f akkoma/.git ] || \ + [ ! -f $@ ] || \ + git submodule status akkoma | grep -qE '^\+' ; then \ + git submodule sync && \ + git submodule update --init && \ + touch $@ ; \ + fi + +patch.stamp: submodule.stamp patches/series patches/000_plant-a-forest.patch $(wildcard patches/*.patch) + @echo "Applying patches" + @# `pop -a` return 2 if currently no patches applied, thus ignore exit code + @cd akkoma && \ + $(QUILT) pop -qfa; \ + $(QUILT) push -a + @touch $@ + + +# cleaning +.PHONY: clean +clean: + rm -f *.stamp + rm -f patches/000_plant-a-forest.patch + +.PHONY: reset +reset: clean + rm -fr akkoma/ + + +# mix command proxies +.PHONY: build +build: patch + cd akkoma && \ + mix deps.get && \ + mix deps.compile && \ + mix compile + +.PHONY: compile +compile: patch + cd akkoma && \ + mix compile + +.PHONY: migrate +migrate: patch + cd akkoma && \ + mix ecto.migrate + +.PHONY: server +server: patch + cd akkoma && \ + mix phx.server diff --git a/README.md b/README.md new file mode 100644 index 0000000..f7dc72f --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Akkoma: Whimsical Forest Edition + +This is [upstream Akkoma `develop`](https://akkoma.dev/AkkomaGang/akkoma/src/branch/develop) +with some additional patches for testing. + +All patches (sans the initial wf-ifying one) are intended to reach upstream +eventually and either already have an upstream PR or are intended to be turned +into one once they’ve passed initial testing and became more stable. + +See `patches/series` for a list of applied changes. +Patch names beginning with `pr111_` indicate it’s copied from upstream PR `#111`; +`wip_` is used for patches not yet ready for an upstream PR. + +## Usage + +You’re free to use this for your own instance but keep in mind some of those +patches are experimental and might not yet have been merged for a good reason. +Thus you should only do this if you’re comfortable with doing beta testing and +capable of debugging upcoming issues on your own far enought to figure out +which patch introduces the problem and create a useful, detailed report for +the corresponding upstream PR. +If a patch changes its database scheme prior to being merged upstream, +some manual DB fixups might be needed. + + +If you still want to, just clone this repo and run: + +```sh +MIX_ENV=prod make build +``` + +to build patched Akkoma WF Edition inside the `akkoma/` subdir. +You can then continue to use Akkoma from within this subdir as usual. +To upgrade to a new version, just repeat the above command. diff --git a/akkoma b/akkoma new file mode 160000 index 0000000..3c72b48 --- /dev/null +++ b/akkoma @@ -0,0 +1 @@ +Subproject commit 3c72b48a05921b00e201965ad22b751c5d46bcdf diff --git a/patches/000_plant-a-forest.patch.in b/patches/000_plant-a-forest.patch.in new file mode 100644 index 0000000..e72f49c --- /dev/null +++ b/patches/000_plant-a-forest.patch.in @@ -0,0 +1,26 @@ +From: Oneric +Subject: [PATCH] Prepare for Whimsical Forest patches + +--- + mix.exs | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/mix.exs b/mix.exs +index 7ffc450e2..1aaf7764a 100644 +--- a/mix.exs ++++ b/mix.exs +@@ -256,6 +256,12 @@ defp version(version) do + + # Pre-release version, denoted from patch version with a hyphen + cond do ++ commit_hash_err == 0 -> ++ "wf-%COMMIT_NUMBER%-g%COMMIT_HASH%-u" <> commit_hash ++ ++ true -> ++ "wf-%COMMIT_NUMBER%-g%COMMIT_HASH%" ++ + tag_err == 0 and describe_err == 0 -> + describe + |> String.trim() +-- +2.39.5 diff --git a/patches/series b/patches/series new file mode 100644 index 0000000..13e34c3 --- /dev/null +++ b/patches/series @@ -0,0 +1 @@ +000_plant-a-forest.patch diff --git a/quiltrc b/quiltrc new file mode 100644 index 0000000..eba770a --- /dev/null +++ b/quiltrc @@ -0,0 +1,7 @@ +QUILT_PATCHES=../patches +QUILT_NO_DIFF_INDEX=1 +QUILT_NO_DIFF_TIMESTAMPS=1 +QUILT_REFRESH_ARGS="-p ab" +QUILT_DIFF_ARGS="--color=auto" +QUILT_PATCH_OPTS="--reject-format=unified" +QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"