feat(package): Add RPM, deb, pacman and tar packages and manpage
Build package using fpm. As I don't want ruby/gem in my computer, the build system creates an OCI image with Podman (at this time), and generate dist pacakges. To enhance the packages, a manpage is now generated from the documentation.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -22,3 +22,6 @@ cover*
|
||||
# nsis
|
||||
nsis/*.dll
|
||||
nsis/*.exe
|
||||
|
||||
doc/share
|
||||
__pycache__
|
||||
|
55
Makefile
55
Makefile
@@ -220,6 +220,19 @@ doc:
|
||||
# generate the labels doc and code doc
|
||||
$(MAKE) __label_doc
|
||||
|
||||
manpage:
|
||||
@echo "=> Generating manpage from documentation"
|
||||
@cd doc && \
|
||||
[ -d venv ] || python -m venv venv; \
|
||||
source venv/bin/activate && \
|
||||
echo "==> Installing requirements in the virtual env..." && \
|
||||
pip install -qq -r requirements.txt && \
|
||||
pip install -qq -r manpage_requirements.txt && \
|
||||
echo "==> Generating manpage..." && \
|
||||
MANPAGE=true mkdocs build && \
|
||||
rm -rf site &&
|
||||
echo "==> Manpage generated in doc/share/man/man1/katenary.1"
|
||||
|
||||
install-gomarkdoc:
|
||||
go install github.com/princjef/gomarkdoc/cmd/gomarkdoc@latest
|
||||
|
||||
@@ -284,3 +297,45 @@ cover:
|
||||
dist-clean:
|
||||
rm -rf dist
|
||||
rm -f katenary
|
||||
|
||||
|
||||
#FPM_OPTS=--name katenary \
|
||||
# --description "$(shell cat packaging/description)" \
|
||||
# --version $(VERSION) \
|
||||
# --url https://katenary.org \
|
||||
# --vendor "Katenary Project" \
|
||||
# --maintainer "Patrice Ferlet <metal3d@gmail.com>" \
|
||||
# --license "MIT" \
|
||||
# katenary-linux-amd64=/usr/local/bin/katenary
|
||||
#packages:
|
||||
# podman build -t packaging:fedora ./packaging/oci
|
||||
# podman run -it --rm -w /opt -v ./dist:/opt:z --userns keep-id:uid=999,gid=999 packaging:fedora \
|
||||
# fpm -s dir -t rpm --rpm-summary="$(shell head -n1 packaging/description)" -f $(FPM_OPTS)
|
||||
# podman run -it --rm -w /opt -v ./dist:/opt:z --userns keep-id:uid=999,gid=999 packaging:fedora \
|
||||
# fpm -s dir -t deb -f $(FPM_OPTS)
|
||||
|
||||
# print packaging/description and replace newlines with explicit \n
|
||||
DESCRIPTION := $(shell cat packaging/description | sed ':a;N;$$!ba;s/\n/\\n/g')
|
||||
|
||||
|
||||
FPM_OCI_OPTS=-w /opt/katenary/dist \
|
||||
-v ./:/opt/katenary:z \
|
||||
--userns keep-id:uid=999,gid=999 packaging:fedora
|
||||
FPM_OPTS=--name katenary \
|
||||
--version $(VERSION) \
|
||||
--url https://katenary.org \
|
||||
--vendor "Katenary Project" \
|
||||
--maintainer "Patrice Ferlet <metal3d@gmail.com>" \
|
||||
--license "MIT" \
|
||||
--description="$$(printf "$(DESCRIPTION)" | fold -s)" \
|
||||
./katenary-linux-amd64=/usr/local/bin/katenary \
|
||||
../doc/share/man/man1/katenary.1=/usr/local/share/man/man1/katenary.1 \
|
||||
../LICENSE=/usr/local/share/doc/katenary/LICENSE \
|
||||
../README.md=/usr/local/share/doc/katenary/README.md
|
||||
packages: manpage
|
||||
@podman build -t packaging:fedora ./packaging/oci 1>/dev/null
|
||||
@for target in rpm deb pacman tar; do \
|
||||
echo "==> Building $$target package..."; \
|
||||
podman run $(FPM_OCI_OPTS) fpm -s dir -t $$target -f $(FPM_OPTS); \
|
||||
done
|
||||
mv dist/katenary.tar dist/katenary-$(VERSION).tar
|
||||
|
2
doc/manpage_requirements.txt
Normal file
2
doc/manpage_requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
beautifulsoup4==4.*
|
||||
mkdocs-manpage[preprocess]
|
@@ -3,6 +3,16 @@ docs_dir: ./docs
|
||||
plugins:
|
||||
- search
|
||||
- inline-svg
|
||||
- manpage:
|
||||
enabled: !ENV [MANPAGE, false]
|
||||
preprocess: preprocess.py
|
||||
pages:
|
||||
- title: Katenary
|
||||
header: Katenary helm chart generator
|
||||
output: share/man/man1/katenary.1
|
||||
inputs:
|
||||
- usage.md
|
||||
- labels.md
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: overrides
|
||||
|
22
doc/preprocess.py
Normal file
22
doc/preprocess.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""Called by mkdocs to preprocess files and build manpages"""
|
||||
|
||||
from bs4 import BeautifulSoup, Tag
|
||||
|
||||
|
||||
def to_remove(tag: Tag) -> bool:
|
||||
"""Removes images, SVGs, links containing images or SVGs, and permalinks from the BeautifulSoup object."""
|
||||
if tag.name in {"img", "svg"}:
|
||||
return True
|
||||
# remove links containing images or SVGs
|
||||
if tag.name == "a" and tag.img and to_remove(tag.img):
|
||||
return True
|
||||
# remove permalinks
|
||||
if tag.name == "a" and "headerlink" in tag.get("class", ()):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def preprocess(soup: BeautifulSoup, output: str) -> None:
|
||||
"""Preprocess the BeautifulSoup object to remove unwanted elements."""
|
||||
for element in soup.find_all(to_remove):
|
||||
element.decompose()
|
4
packaging/description
Normal file
4
packaging/description
Normal file
@@ -0,0 +1,4 @@
|
||||
Katenary transforms docker/podman compose files to Helm Charts.
|
||||
It harnesses the labels from your "compose" file to craft complete Helm Charts effortlessly, saving you time and energy.
|
||||
- Simple automated CLI: Katenary handles the grunt work, generating everything needed for seamless service binding and Helm Chart creation.
|
||||
- Effortless Efficiency: You only need to add labels when it's necessary to precise things. Then call katenary convert and let the magic happen
|
15
packaging/oci/Containerfile
Normal file
15
packaging/oci/Containerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM registry.fedoraproject.org/fedora:42
|
||||
RUN set -eux; \
|
||||
microdnf -y install \
|
||||
rubygems rpmbuild bsdtar
|
||||
|
||||
RUN useradd -m -r -d /home/builder -s /bin/bash builder; \
|
||||
chown builder:builder /home/builder
|
||||
|
||||
USER builder
|
||||
ENV PATH="/home/builder/bin:${PATH}"
|
||||
WORKDIR /home/builder
|
||||
RUN gem install fpm
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user