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
Build and Publish Release / test-and-release (push) Failing after 48s
This commit is contained in:
1 parent
c5c3b87bd9
commit
6f23f14b76
14 files changed
+1730
-10
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user