Compare commits

...
Sign in to create a new pull request.

18 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
a3add50d42 chore: Update Drone CI configuration for deb package uploads
Some checks reported errors
continuous-integration/drone/push Build was killed
2024-12-30 11:18:05 +01:00
744ef5daf1 chore: Update Drone CI configuration for package upload process
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-30 00:53:26 +01:00
59e5652125 fix: add missing crystal installation for build
All checks were successful
continuous-integration/drone/push Build is passing
2024-12-29 21:20:50 +01:00
fc38cc6008 fix: breadcrump test was failing due to an oversight
Some checks failed
continuous-integration/drone/push Build is failing
2024-12-29 21:10:07 +01:00
768c778998 fix: use the right binary name for install rule 2024-12-29 21:09:05 +01:00
cbbc302756 fix: improve debian/ dir with working values 2024-12-29 21:08:34 +01:00
e6e5ea42e8 ci: add debian package build step 2024-12-29 21:06:55 +01:00
9982b2e11c feat: Initial debian/ dir with draft files 2024-12-29 20:14:15 +01:00
12 changed files with 137 additions and 5 deletions

View file

@ -26,6 +26,24 @@ steps:
- mkdir -p /_cache/bin
- cp -r bin/mfm /_cache/bin/$PACKAGE_BASENAME
- name: build:debian
image: debian:bullseye
environment:
PACKAGE_BASENAME: mfm_linux_amd64
volumes:
- name: cache
path: /_cache
commands:
- apt-get update
- apt-get install -y build-essential debhelper devscripts dh-make
- curl -fsSL https://crystal-lang.org/install.sh | bash
- mkdir -p /_cache/debian
- mkdir -p /_cache/bin
- cp -r * /_cache/debian
- cd /_cache/debian
- dpkg-buildpackage -us -uc -d
- mv ../*.deb /_cache/bin
- name: publish:tag
image: alpine
environment:
@ -46,10 +64,18 @@ steps:
commands:
- apk add --update --no-cache curl jq
- env |grep DRONE
# Upload packages
- |
curl -H "Authorization: token $PACKAGE_UPLOAD_TOKEN" \
--upload-file "/_cache/bin/$PACKAGE_BASENAME" \
"$PACKAGE_UPLOAD_URL/$DRONE_TAG/$PACKAGE_BASENAME"
- |
for deb in /_cache/bin/*.deb 0 ; do \
test -f "$deb" || continue ; \
curl -H "Authorization: token $PACKAGE_UPLOAD_TOKEN" \
--upload-file "$deb" \
"$PACKAGE_UPLOAD_URL/$DRONE_TAG/$(basename $deb)" ; \
done
- |
set -x
curl -X POST \
@ -75,6 +101,17 @@ steps:
-H "Content-Type: multipart/form-data" \
-F "attachment=@/_cache/bin/$PACKAGE_BASENAME" \
"$RELEASES_URL/$TAG_ID/assets?name=$PACKAGE_BASENAME"
- |
set -x
for deb in /_cache/bin/*.deb 0 ; do \
test -f "$deb" || continue ; \
curl -X POST \
-H "Authorization: token $RELEASE_UPLOAD_TOKEN" \
-H "accept: application/json" \
-H "Content-Type: multipart/form-data" \
-F "attachment=@$deb" \
"$RELEASES_URL/$TAG_ID/assets?name=$(basename $deb)" ; \
done
# FIXME: handle multi-arch

4
.gitignore vendored
View file

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

View file

@ -3,13 +3,17 @@
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
PREFIX=/usr
DESTDIR=
PREFIX=$(DESTDIR)/usr
.PHONY: all
all: build
.PHONY: prepare
prepare:
shards install
.PHONY: build
build:
shards build --error-trace -Dpreview_mt
@echo SUCCESS
@ -17,15 +21,20 @@ build:
watch:
watchexec --restart --delay-run 3 -c -e cr make build
.PHONY: spec test
spec: test
test:
crystal spec --error-trace
.PHONY: install
install:
install \
-D \
-m 755 \
bin/mfm \
$(PREFIX)/bin
$(PREFIX)/bin/mfm
.PHONY: spec test build all prepare install
.PHONY: deb
deb:
dpkg-buildpackage -us -uc -d

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

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
mfm (0.2.0) unstable; urgency=medium
* Première version empaquetée pour Debian.
-- Glenn Y. Rolland <glenux@glenux.net> Sun, 29 Dec 2024 20:06:16 +0100

19
debian/control vendored Normal file
View file

@ -0,0 +1,19 @@
Source: mfm
Section: utils
Priority: optional
Maintainer: Glenn Y. Rolland <glenux@glenux.net>
Build-Depends: debhelper-compat (= 13), crystal, shards, make, libyaml-dev
Standards-Version: 4.6.0
Homepage: https://code.apps.glenux.net/glenux/mfm
Vcs-Git: https://code.apps.glenux.net/glenux/mfm.git
Vcs-Browser: https://code.apps.glenux.net/glenux/mfm
Package: mfm
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libpcre3, libevent-2.1-7, fzf
Recommends: gocryptfs, httpdirfs, sshfs
Description: Simple command-line helper for FUSE filesystems
MFM is a Crystal-lang CLI designed to streamline the management of various
FUSE filesystems, such as sshfs, gocryptfs, httpdirfs, and more. Through its
user-friendly interface, users can effortlessly mount and unmount filesystems,
get real-time filesystem status, and handle errors proficiently.

8
debian/copyright vendored Normal file
View file

@ -0,0 +1,8 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: my-crystal-app
Source: https://code.apps.glenux.net/glenux/mfm
Files: *
Copyright: 2024, Glenn Y. Rolland <glenux@glenux.net>
License: MIT
https://opensource.org/license/mit

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

3
debian/mfm.install vendored Normal file
View file

@ -0,0 +1,3 @@
bin/mfm /usr/bin/
README.md /usr/share/doc/mfm/
LICENSES/GPL-3.0-or-later.txt /usr/share/doc/mfm/LICENSE

4
debian/rules vendored Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/make -f
%:
dh $@

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

@ -37,10 +37,10 @@ describe GX::Utils::BreadCrumbs do
b1.to_s.should eq("")
b2 = b1 + "test1"
b2.to_a.should eq("test1")
b2.to_s.should eq("test1")
b3 = b2 + "test2"
b3.to_a.should eq("test1 test2")
b3.to_s.should eq("test1 test2")
end
end
end