feat(docs): implement slice 8 documentation triad, man page, completions and Gitea Actions CI/CD
Build and Publish Release / test-and-release (push) Failing after 48s

This commit is contained in:
soda64 committed 2026-10-09 20:22:51 +02:00
1 parent c5c3b87bd9
commit 6f23f14b76
14 files changed
+1730 -10

No files matched your search

+119
View File
@@ -10,6 +10,7 @@ Zero mandatory external pip dependencies required.
"""
import argparse
import gzip
import io
import os
import re
@@ -202,6 +203,62 @@ exit 0
ti.mtime = int(time.time())
tar.addfile(ti, io.BytesIO(file_data))
# Add man page
man_src = os.path.join(repo_root, "man", "linux-backuper.8")
if os.path.isfile(man_src):
add_dir("./usr/share")
add_dir("./usr/share/man")
add_dir("./usr/share/man/man8")
with open(man_src, "rb") as f:
man_raw = f.read()
man_gz = gzip.compress(man_raw)
ti = tarfile.TarInfo("./usr/share/man/man8/linux-backuper.8.gz")
ti.size = len(man_gz)
ti.mode = 0o644
ti.mtime = int(time.time())
tar.addfile(ti, io.BytesIO(man_gz))
# Add shell completions
bash_comp_src = os.path.join(repo_root, "completions", "bash", "linux-backuper")
if os.path.isfile(bash_comp_src):
add_dir("./usr/share/bash-completion")
add_dir("./usr/share/bash-completion/completions")
with open(bash_comp_src, "rb") as f:
comp_data = f.read()
ti = tarfile.TarInfo("./usr/share/bash-completion/completions/linux-backuper")
ti.size = len(comp_data)
ti.mode = 0o644
ti.mtime = int(time.time())
tar.addfile(ti, io.BytesIO(comp_data))
zsh_comp_src = os.path.join(repo_root, "completions", "zsh", "_linux-backuper")
if os.path.isfile(zsh_comp_src):
add_dir("./usr/share/zsh")
add_dir("./usr/share/zsh/site-functions")
with open(zsh_comp_src, "rb") as f:
comp_data = f.read()
ti = tarfile.TarInfo("./usr/share/zsh/site-functions/_linux-backuper")
ti.size = len(comp_data)
ti.mode = 0o644
ti.mtime = int(time.time())
tar.addfile(ti, io.BytesIO(comp_data))
# Add documentation
docs_src = os.path.join(repo_root, "docs")
if os.path.isdir(docs_src):
add_dir("./usr/share/doc")
add_dir("./usr/share/doc/linux-backuper")
for doc_name in ["user-guide.md", "admin-guide.md", "developer-guide.md"]:
doc_path = os.path.join(docs_src, doc_name)
if os.path.isfile(doc_path):
with open(doc_path, "rb") as f:
ddata = f.read()
ti = tarfile.TarInfo(f"./usr/share/doc/linux-backuper/{doc_name}")
ti.size = len(ddata)
ti.mode = 0o644
ti.mtime = int(time.time())
tar.addfile(ti, io.BytesIO(ddata))
data_tar_gz = data_buf.getvalue()
# Package into ar archive
@@ -281,6 +338,40 @@ def build_tar_package(repo_root: str, out_dir: str, version: str) -> str:
ti.mode = 0o644
tar.addfile(ti, io.BytesIO(data))
# Add man page
man_src = os.path.join(repo_root, "man", "linux-backuper.8")
if os.path.isfile(man_src):
with open(man_src, "rb") as f:
data = f.read()
ti = tarfile.TarInfo(f"{prefix}/man/linux-backuper.8")
ti.size = len(data)
ti.mode = 0o644
tar.addfile(ti, io.BytesIO(data))
# Add completions
for shell, cname in [("bash", "linux-backuper"), ("zsh", "_linux-backuper")]:
c_src = os.path.join(repo_root, "completions", shell, cname)
if os.path.isfile(c_src):
with open(c_src, "rb") as f:
data = f.read()
ti = tarfile.TarInfo(f"{prefix}/completions/{shell}/{cname}")
ti.size = len(data)
ti.mode = 0o644
tar.addfile(ti, io.BytesIO(data))
# Add docs
docs_src = os.path.join(repo_root, "docs")
if os.path.isdir(docs_src):
for doc_name in ["user-guide.md", "admin-guide.md", "developer-guide.md"]:
doc_path = os.path.join(docs_src, doc_name)
if os.path.isfile(doc_path):
with open(doc_path, "rb") as f:
data = f.read()
ti = tarfile.TarInfo(f"{prefix}/docs/{doc_name}")
ti.size = len(data)
ti.mode = 0o644
tar.addfile(ti, io.BytesIO(data))
print(f"[SUCCESS] Built binary tarball: {tar_path} ({os.path.getsize(tar_path)} bytes)")
return tar_path
@@ -327,12 +418,40 @@ find %{{buildroot}}/usr/lib/linux-backuper -name "__pycache__" -type d -exec rm
find %{{buildroot}}/usr/lib/linux-backuper -type d -exec chmod 0755 {{}} +
find %{{buildroot}}/usr/lib/linux-backuper -type f -exec chmod 0644 {{}} +
if [ -f man/linux-backuper.8 ]; then
mkdir -p %{{buildroot}}%{{_mandir}}/man8
gzip -c -n man/linux-backuper.8 > %{{buildroot}}%{{_mandir}}/man8/linux-backuper.8.gz
chmod 0644 %{{buildroot}}%{{_mandir}}/man8/linux-backuper.8.gz
fi
if [ -f completions/bash/linux-backuper ]; then
mkdir -p %{{buildroot}}/usr/share/bash-completion/completions
cp completions/bash/linux-backuper %{{buildroot}}/usr/share/bash-completion/completions/linux-backuper
chmod 0644 %{{buildroot}}/usr/share/bash-completion/completions/linux-backuper
fi
if [ -f completions/zsh/_linux-backuper ]; then
mkdir -p %{{buildroot}}/usr/share/zsh/site-functions
cp completions/zsh/_linux-backuper %{{buildroot}}/usr/share/zsh/site-functions/_linux-backuper
chmod 0644 %{{buildroot}}/usr/share/zsh/site-functions/_linux-backuper
fi
if [ -d docs ]; then
mkdir -p %{{buildroot}}/usr/share/doc/linux-backuper
cp docs/*.md %{{buildroot}}/usr/share/doc/linux-backuper/ 2>/dev/null || true
chmod 0644 %{{buildroot}}/usr/share/doc/linux-backuper/* 2>/dev/null || true
fi
%files
%defattr(-,root,root,-)
/usr/bin/linux-backuper
/usr/lib/linux-backuper
%dir /etc/linux-backuper
%attr(0700,root,root) %dir /var/backups/linux-backuper
%{{_mandir}}/man8/linux-backuper.8*
/usr/share/bash-completion/completions/linux-backuper
/usr/share/zsh/site-functions/_linux-backuper
/usr/share/doc/linux-backuper
%changelog
* Fri Oct 09 2026 wiredLAB <lain@wired.intra> - {version}-1
+23 -1
View File
@@ -63,6 +63,25 @@ do_install() {
cp "${SOURCE_ROOT}/bin/linux-backuper" "${BINDIR}/linux-backuper"
chmod 0755 "${BINDIR}/linux-backuper"
# Install man page
if [[ -f "${SOURCE_ROOT}/man/linux-backuper.8" ]]; then
mkdir -p "${PREFIX}/share/man/man8"
cp "${SOURCE_ROOT}/man/linux-backuper.8" "${PREFIX}/share/man/man8/linux-backuper.8"
chmod 0644 "${PREFIX}/share/man/man8/linux-backuper.8"
fi
# Install completions
if [[ -f "${SOURCE_ROOT}/completions/bash/linux-backuper" ]]; then
mkdir -p "${PREFIX}/share/bash-completion/completions"
cp "${SOURCE_ROOT}/completions/bash/linux-backuper" "${PREFIX}/share/bash-completion/completions/linux-backuper"
chmod 0644 "${PREFIX}/share/bash-completion/completions/linux-backuper"
fi
if [[ -f "${SOURCE_ROOT}/completions/zsh/_linux-backuper" ]]; then
mkdir -p "${PREFIX}/share/zsh/site-functions"
cp "${SOURCE_ROOT}/completions/zsh/_linux-backuper" "${PREFIX}/share/zsh/site-functions/_linux-backuper"
chmod 0644 "${PREFIX}/share/zsh/site-functions/_linux-backuper"
fi
echo "[SUCCESS] linux-backuper installed successfully to ${BINDIR}/linux-backuper"
echo "[INFO] Testing installed binary:"
"${BINDIR}/linux-backuper" --version || true
@@ -77,7 +96,10 @@ do_uninstall() {
echo "[INFO] Uninstalling linux-backuper..."
rm -f "${BINDIR}/linux-backuper"
rm -rf "${LIBDIR}"
echo "[SUCCESS] linux-backuper removed from ${BINDIR} and ${LIBDIR}."
rm -f "${PREFIX}/share/man/man8/linux-backuper.8"
rm -f "${PREFIX}/share/bash-completion/completions/linux-backuper"
rm -f "${PREFIX}/share/zsh/site-functions/_linux-backuper"
echo "[SUCCESS] linux-backuper removed from system."
echo "[NOTE] Backup storage at ${BACKUPDIR} and configuration at ${CONFDIR} were preserved."
}