Compare commits

...

12 commits

Author SHA1 Message Date
d4013caab1 Merge branch 'feature/11-add-debian-packaging' of code.apps.glenux.net:glenux/mfm into feature/11-add-debian-packaging
All checks were successful
continuous-integration/drone/push Build is passing
2025-04-11 14:34:30 +02:00
3d2017aea9 feat(build): add Docker-based Debian package build system
Introduce a Docker-based build system for Debian packages to streamline
the build process and ensure consistency across environments. This
change mitigates potential build failures due to environment
discrepancies and simplifies the setup for new developers.

- Extend .gitignore to exclude debhelper and build artifacts
- Add build.sh script to automate Docker-based package building
- Update debian/control to include libyaml-dev as a build dependency
- Create debian/files to track generated Debian packages
- Add Dockerfile to define the build environment with necessary
  dependencies

Signed-off-by: Glenn Y. Rolland <glenux@glenux.net>
2025-04-11 14:24:04 +02:00
f9e5c532a0 chore: Update Drone CI configuration for deb package uploads 2025-04-11 12:39:37 +02:00
f5132e9207 chore: Update Drone CI configuration for package upload process 2025-04-11 12:39:37 +02:00
8ccb1ce6c2 fix: add missing crystal installation for build 2025-04-11 12:39:37 +02:00
a4fb095c22 fix: breadcrump test was failing due to an oversight 2025-04-11 12:39:37 +02:00
ea1e62729a fix: use the right binary name for install rule 2025-04-11 12:39:35 +02:00
344d905e10 fix: improve debian/ dir with working values 2025-04-11 12:38:54 +02:00
74a5f28f2d ci: add debian package build step 2025-04-11 12:38:54 +02:00
3a38aa7efc feat: Initial debian/ dir with draft files 2025-04-11 12:38:54 +02:00
c21f175217 feat(config): enable reuse of mfm configuration variables
All checks were successful
continuous-integration/drone/push Build is passing
This change introduces a two-pass parsing approach to allow reuse of mfm
configuration variables within other configuration parts. This initial
implementation does not handle recursive dependencies, which is
acceptable for the current requirements.

- Implemented a two-pass parsing mechanism for configuration files.
- Added mfm configuration variables to the Crinja render context in both
  passes.
- Ensured the global mount point base is safely retrieved and validated
  in each pass.

Signed-off-by: Glenn Y. Rolland <glenux@glenux.net>
2025-04-11 12:32:23 +02:00
7953f9f3a7 fix(install): correct binary name in Makefile
The previous binary name was incorrect, which could lead to installation
failures.

- Changed the binary name from 'bin/code-preloader' to 'bin/mfm' in the
  install section of the Makefile.

Signed-off-by: Glenn Y. Rolland <glenux@glenux.net>
2025-04-11 12:29:44 +02:00
6 changed files with 73 additions and 3 deletions

4
.gitignore vendored
View file

@ -7,3 +7,7 @@
.vagrant .vagrant
bin bin
lib lib
debian/.debhelper/
debian/debhelper-build-stamp
debian/mfm
debian/mfm.substvars

19
build.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# References:
# - https://www.debian.org/doc/manuals/maint-guide/build.en.html for base principles
# - https://www.patreon.com/posts/building-debian-23177439 for debuild output dir
#
set -ue
mkdir -p _build || true
docker build -t debbuilder --file docker/Dockerfile .
docker run -it -v "$(pwd):/app" -v "$(pwd)/_build:/_build" debbuilder \
sh -c "ARTIFACTS_DIR=/app/_build debuild --preserve-envvar=ARTIFACTS_DIR -us -uc --buildinfo-option=-u/app/_build --changes-option=-u/app/_build" \
|| docker run -it -v "$(pwd):/app" debbuilder
# dpkg-buildpackage -us -uc
# debuild
# git-buildpackage
echo SUCCESS

2
debian/control vendored
View file

@ -2,7 +2,7 @@ Source: mfm
Section: utils Section: utils
Priority: optional Priority: optional
Maintainer: Glenn Y. Rolland <glenux@glenux.net> Maintainer: Glenn Y. Rolland <glenux@glenux.net>
Build-Depends: debhelper-compat (= 13), crystal, shards, make Build-Depends: debhelper-compat (= 13), crystal, shards, make, libyaml-dev
Standards-Version: 4.6.0 Standards-Version: 4.6.0
Homepage: https://code.apps.glenux.net/glenux/mfm Homepage: https://code.apps.glenux.net/glenux/mfm
Vcs-Git: https://code.apps.glenux.net/glenux/mfm.git Vcs-Git: https://code.apps.glenux.net/glenux/mfm.git

2
debian/files vendored Normal file
View file

@ -0,0 +1,2 @@
mfm-dbgsym_0.2.0_amd64.deb debug optional automatic=yes
mfm_0.2.0_amd64.deb utils optional

22
docker/Dockerfile Normal file
View file

@ -0,0 +1,22 @@
FROM debian:trixie
RUN set -ex \
&& sed -i \
-e 's/Types: deb/Types: deb deb-src/g' \
/etc/apt/sources.list.d/debian.sources \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cdbs \
devscripts \
equivs \
fakeroot \
crystal \
shards \
git-buildpackage \
libyaml-dev \
libxml2-dev \
&& apt-get clean \
&& rm -rf /tmp/* /var/tmp/*
WORKDIR /app

View file

@ -94,14 +94,37 @@ module GX
exit(1) exit(1)
end end
## PASS 1
file_data = File.read(config_path) file_data = File.read(config_path)
file_patched = Crinja.render(file_data, {"env" => ENV.to_h}) file_patched = Crinja.render(
file_data,
{
"env" => ENV.to_h,
"mfm" => {
"global" => {"mount_point_base" => "" }
}
}
)
root = Models::RootConfig.from_yaml(file_patched) root = Models::RootConfig.from_yaml(file_patched)
mount_point_base_safe = root.global.mount_point_base mount_point_base_safe = root.global.mount_point_base
raise Models::InvalidMountpointError.new("Invalid global mount point") if mount_point_base_safe.nil? raise Models::InvalidMountpointError.new("Invalid global mount point") if mount_point_base_safe.nil?
## PASS 2
file_patched = Crinja.render(
file_data,
{
"env" => ENV.to_h,
"mfm" => {
"global" => {"mount_point_base" => mount_point_base_safe }
}
}
)
root = Models::RootConfig.from_yaml(file_patched)
mount_point_base_safe = root.global.mount_point_base
raise Models::InvalidMountpointError.new("Invalid global mount point") if mount_point_base_safe.nil?
root.filesystems.each do |selected_filesystem| root.filesystems.each do |selected_filesystem|
if !selected_filesystem.mount_point? if !selected_filesystem.mount_point?
selected_filesystem.mount_point = selected_filesystem.mount_point =