From 9982b2e11c6f75df63ad61454a45156a80b25c7e Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 29 Dec 2024 20:14:15 +0100 Subject: [PATCH 1/8] feat: Initial debian/ dir with draft files --- Makefile | 3 ++- debian/changelog | 5 +++++ debian/control | 18 ++++++++++++++++++ debian/copyright | 8 ++++++++ debian/mfm.install | 3 +++ debian/rules | 4 ++++ 6 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/mfm.install create mode 100755 debian/rules diff --git a/Makefile b/Makefile index f0c5bb8..66965b8 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,8 @@ # SPDX-FileCopyrightText: 2023 Glenn Y. Rolland # Copyright © 2023 Glenn Y. Rolland -PREFIX=/usr +DESTDIR= +PREFIX=$(DESTDIR)/usr all: build diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..336b9fa --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +mfm (0.2.0) unstable; urgency=medium + + * Première version empaquetée pour Debian. + + -- Glenn Y. Rolland Sun, 29 Dec 2024 20:06:16 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..a1b1311 --- /dev/null +++ b/debian/control @@ -0,0 +1,18 @@ +Source: mfm +Section: utils +Priority: optional +Maintainer: Glenn Y. Rolland +Build-Depends: debhelper-compat (= 13), crystal, make +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} +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. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..b9a024d --- /dev/null +++ b/debian/copyright @@ -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 +License: MIT + https://opensource.org/license/mit diff --git a/debian/mfm.install b/debian/mfm.install new file mode 100644 index 0000000..94ffbf4 --- /dev/null +++ b/debian/mfm.install @@ -0,0 +1,3 @@ +bin/mfm /usr/bin/ +README.md /usr/share/doc/mfm/ +LICENSE /usr/share/doc/mfm/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..2d33f6a --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ From e6e5ea42e83ca141b77f95beb602c8b84f73ef23 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 29 Dec 2024 21:06:55 +0100 Subject: [PATCH 2/8] ci: add debian package build step --- .drone.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.drone.yml b/.drone.yml index 1599bbe..aeb4dfe 100644 --- a/.drone.yml +++ b/.drone.yml @@ -26,6 +26,23 @@ 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 + - mkdir -p /_cache/debian + - mkdir -p /_cache/bin + - cp -r * /_cache/debian + - cd /_cache/debian + - dpkg-buildpackage -us -uc + - mv ../*.deb /_cache/bin + - name: publish:tag image: alpine environment: From cbbc3027563d36bfcdefdf835d17afe144b6b0f0 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 29 Dec 2024 21:08:34 +0100 Subject: [PATCH 3/8] fix: improve debian/ dir with working values --- debian/changelog | 2 +- debian/control | 5 +++-- debian/mfm.install | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 336b9fa..ac1b32f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,4 +2,4 @@ mfm (0.2.0) unstable; urgency=medium * Première version empaquetée pour Debian. - -- Glenn Y. Rolland Sun, 29 Dec 2024 20:06:16 +0100 + -- Glenn Y. Rolland Sun, 29 Dec 2024 20:06:16 +0100 diff --git a/debian/control b/debian/control index a1b1311..d2f499a 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: mfm Section: utils Priority: optional Maintainer: Glenn Y. Rolland -Build-Depends: debhelper-compat (= 13), crystal, make +Build-Depends: debhelper-compat (= 13), crystal, shards, make Standards-Version: 4.6.0 Homepage: https://code.apps.glenux.net/glenux/mfm Vcs-Git: https://code.apps.glenux.net/glenux/mfm.git @@ -10,7 +10,8 @@ Vcs-Browser: https://code.apps.glenux.net/glenux/mfm Package: mfm Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +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 diff --git a/debian/mfm.install b/debian/mfm.install index 94ffbf4..a35d986 100644 --- a/debian/mfm.install +++ b/debian/mfm.install @@ -1,3 +1,3 @@ bin/mfm /usr/bin/ README.md /usr/share/doc/mfm/ -LICENSE /usr/share/doc/mfm/ +LICENSES/GPL-3.0-or-later.txt /usr/share/doc/mfm/LICENSE From 768c778998356d54ed4a56fca457266c273e98af Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 29 Dec 2024 21:09:05 +0100 Subject: [PATCH 4/8] fix: use the right binary name for install rule --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 66965b8..a371ae2 100644 --- a/Makefile +++ b/Makefile @@ -24,9 +24,10 @@ test: install: install \ + -D \ -m 755 \ - bin/code-preloader \ - $(PREFIX)/bin + bin/mfm \ + $(PREFIX)/bin/mfm .PHONY: spec test build all prepare install From fc38cc60082ee565a5acf67d372d0a87a45b76b0 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 29 Dec 2024 21:10:07 +0100 Subject: [PATCH 5/8] fix: breadcrump test was failing due to an oversight --- spec/utils/breadcrumbs_spec.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/utils/breadcrumbs_spec.cr b/spec/utils/breadcrumbs_spec.cr index deec943..1d97594 100644 --- a/spec/utils/breadcrumbs_spec.cr +++ b/spec/utils/breadcrumbs_spec.cr @@ -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 From 59e565212555e3ff606462f17b04fad2a6563d5b Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Sun, 29 Dec 2024 21:20:50 +0100 Subject: [PATCH 6/8] fix: add missing crystal installation for build --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index aeb4dfe..3e92d50 100644 --- a/.drone.yml +++ b/.drone.yml @@ -36,11 +36,12 @@ steps: 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 + - dpkg-buildpackage -us -uc -d - mv ../*.deb /_cache/bin - name: publish:tag From 744ef5daf14117bdee3e10b423b51c73bbf514e6 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Mon, 30 Dec 2024 00:53:26 +0100 Subject: [PATCH 7/8] chore: Update Drone CI configuration for package upload process --- .drone.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.drone.yml b/.drone.yml index 3e92d50..480ea53 100644 --- a/.drone.yml +++ b/.drone.yml @@ -64,10 +64,17 @@ 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; do + # curl -H "Authorization: token $PACKAGE_UPLOAD_TOKEN" \ + # --upload-file "$deb" \ + # "$PACKAGE_UPLOAD_URL/$DRONE_TAG/$(basename $deb)" + # done - | set -x curl -X POST \ @@ -93,6 +100,16 @@ 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; do + # 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 From a3add50d421897d607101cfca77247edc32ca4bb Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Mon, 30 Dec 2024 11:18:05 +0100 Subject: [PATCH 8/8] chore: Update Drone CI configuration for deb package uploads --- .drone.yml | 34 ++++++++++++++++++---------------- Makefile | 9 ++++++++- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.drone.yml b/.drone.yml index 480ea53..9ad18bc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -69,12 +69,13 @@ steps: 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; do - # curl -H "Authorization: token $PACKAGE_UPLOAD_TOKEN" \ - # --upload-file "$deb" \ - # "$PACKAGE_UPLOAD_URL/$DRONE_TAG/$(basename $deb)" - # done + - | + 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 \ @@ -100,16 +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; do - # 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 + - | + 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 diff --git a/Makefile b/Makefile index a371ae2..999feee 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,14 @@ DESTDIR= PREFIX=$(DESTDIR)/usr +.PHONY: all all: build +.PHONY: prepare prepare: shards install +.PHONY: build build: shards build --error-trace -Dpreview_mt @echo SUCCESS @@ -18,10 +21,12 @@ 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 \ @@ -29,5 +34,7 @@ install: bin/mfm \ $(PREFIX)/bin/mfm -.PHONY: spec test build all prepare install +.PHONY: deb +deb: + dpkg-buildpackage -us -uc -d