From d107c2959983dc8e97d265b54ae7b3a07180978b Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Sun, 5 Nov 2023 07:15:12 +0100 Subject: [PATCH 1/6] Improving build/ Makefile. --- build/Makefile | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/build/Makefile b/build/Makefile index 35845985..3e82d716 100644 --- a/build/Makefile +++ b/build/Makefile @@ -34,6 +34,7 @@ help: @echo "git-subs-update update git submodules" @echo "gen-lib-class generate lib C++ class skeleton: CLASS_NAME=My_Class" @echo "gen-ui-class generate UI C++ class skeleton: CLASS_NAME=My_Class" + @echo "devenv-debian install development environment on Debian" @echo "clean clean build artifacts" @echo "build build MindForger binary" @echo "l10n update and release localization strings: MF_LANG=en" @@ -50,6 +51,7 @@ help: @echo "api-reference generate Doxygen documentation" @echo "dev-install-local compile and install binary to ~/bin as MIND" +.PHONY: clean clean: rm -vf ../app/mindforger rm -vf ../lib/libmindforger.a @@ -57,17 +59,23 @@ clean: cd .. && make clean cd ../lib/test && make clean +.PHONY: git-subs-update git-subs-update: cd .. && git submodule update --init --recursive +.PHONY: gen-lib-class gen-lib-class: @echo "Generating lib C++ class for name: $(CLASS_NAME)" ./make/gen-cpp-class.py $(CLASS_NAME) +.PHONY: gen-ui-class gen-ui-class: @echo "Generating UI C++ class for name: $(CLASS_NAME)" ./make/gen-cpp-ui-class.py $(CLASS_NAME) +.PHONY: devenv-debian +devenv-debian: + sudo apt-get install build-essential zlib1g-dev libhunspell-dev libqt5webkit5-dev qttools5-dev-tools ccache cmake build: clean cd .. && qmake -r mindforger.pro && make -j 7 @@ -80,12 +88,14 @@ build-ci: clean @echo "If CI build succeeded, then MindForger executable can be found in:\n app/mindforger" ls -al ../app/mindforger +.PHONY: l10n l10n: cd make && ./l10n-update-strings.sh && ./l10n-edit-and-release.sh $(MF_LANG) test-lib: clean cd make && ./test-lib-units.sh +.PHONY: dist-work-clean dist-work-clean: rm -rvf $(MF_MAKER_WORKING_DIR) @@ -107,6 +117,7 @@ dist-deb: dist-work-clean $(MF_MAKER_WORKING_DIR) $(MINDFORGER_RELEASE_DIR) cp -vf ./debian/debian-make-deb.sh $(MF_MAKER_WORKING_DIR) && cd $(MF_MAKER_WORKING_DIR) && ./debian-make-deb.sh cp -vf $(MF_MAKER_WORKING_DIR)/`cd $(MF_MAKER_WORKING_DIR) && ls -d mindforger*`/mindforger_$(MINDFORGER_VERSION)-1_amd64.deb $(MINDFORGER_RELEASE_DIR) +.PHONY: dist-rpm dist-rpm: @echo "IMPORTANT: this target MUST be run on Fedora!" cd fedora && ./fedora-distro-setup.sh @@ -114,25 +125,32 @@ dist-rpm: cp -vf ./fedora-rpm-from-deb.sh ~/alien && cd ~/alien && sudo ./fedora-rpm-from-deb.sh $(MINDFORGER_VERSION) @echo "Find .rpm in ~/alien directory" +.PHONY: dist-dmg dist-dmg: @echo "Building .dmg package..." cd macos && ./mindforger-build.sh && ./dmg-package-build.sh +.PHONY: dist-debian-ppa dist-debian-ppa: cd debian && ./debian-aptly-add-deb.sh +.PHONY: dist-all-clean dist-all-clean: rm -rvf $(MINDFORGER_RELEASE_DIR) +.PHONY: dist-all dist-all: dist-all-clean $(MINDFORGER_RELEASE_DIR) dist-tarball dist-deb @echo "Building all $(MINDFORGER_VERSION) distributions" +.PHONY: statistic statistic: cd make && ./statistic.sh +.PHONY: doc-to-wiki doc-to-wiki: cd doc && ./mf-doc-to-wiki.py +.PHONY: api-reference api-reference: cd doxygen && doxygen ./mindforger.cfg From 692b4f91c8d2330268ef0c87fe5732652de5f51f Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Sun, 5 Nov 2023 13:11:27 +0100 Subject: [PATCH 2/6] Adding missing dependency to Debian devenv build. --- build/Makefile | 2 +- build/doc/mf-doc-to-wiki.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Makefile b/build/Makefile index 3e82d716..11ef102f 100644 --- a/build/Makefile +++ b/build/Makefile @@ -75,7 +75,7 @@ gen-ui-class: .PHONY: devenv-debian devenv-debian: - sudo apt-get install build-essential zlib1g-dev libhunspell-dev libqt5webkit5-dev qttools5-dev-tools ccache cmake + sudo apt-get install build-essential zlib1g-dev libhunspell-dev libqt5webkit5-dev qttools5-dev-tools ccache cmake debhelper build: clean cd .. && qmake -r mindforger.pro && make -j 7 diff --git a/build/doc/mf-doc-to-wiki.py b/build/doc/mf-doc-to-wiki.py index b51b2b85..dc27b30f 100755 --- a/build/doc/mf-doc-to-wiki.py +++ b/build/doc/mf-doc-to-wiki.py @@ -2,7 +2,7 @@ # # MindForger thinking notebook # -# Copyright (C) 2016-2022 Martin Dvorak +# Copyright (C) 2016-2023 Martin Dvorak # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License From 3910ef98a7639c3ebf139135f7bc8384849b2d80 Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Sun, 12 Nov 2023 13:05:04 +0100 Subject: [PATCH 3/6] Adding scripts to build Debian PPA(s) for all Debian releases. --- build/Makefile | 56 +++++- build/debian/debian-ppa-aptly-build.sh | 229 +++++++++++++++++++++++++ build/debian/index-all-ppas.html | 24 +++ build/debian/index-ppa.html | 34 ++++ 4 files changed, 340 insertions(+), 3 deletions(-) create mode 100755 build/debian/debian-ppa-aptly-build.sh create mode 100644 build/debian/index-all-ppas.html create mode 100644 build/debian/index-ppa.html diff --git a/build/Makefile b/build/Makefile index 11ef102f..ea7d355c 100644 --- a/build/Makefile +++ b/build/Makefile @@ -45,7 +45,7 @@ help: @echo "dist-deb build Debian distribution" @echo "dist-rpm build .rpm package on Fedora" @echo "dist-dmg build macOS Disk iMaGe .dmg package" - @echo "dist-debian-ppa add .deb to aptly PPA" + @echo "dist-debian-ppa create PPA for all Debian releases" @echo "statistic show source code statistic" @echo "doc-to-wiki mindforger-documentation to mindforger.wiki" @echo "api-reference generate Doxygen documentation" @@ -130,9 +130,59 @@ dist-dmg: @echo "Building .dmg package..." cd macos && ./mindforger-build.sh && ./dmg-package-build.sh +# +# Debian +# +# MindForger PPA: https://www.mindforger.com/debian is managed by aptly +# +# - information about MindForger's Debian PPAs can be found in +# https://www.mindforger.com/debian/index.html +# +# - aptly CANNOT be used to build one PPA for all Debian releases +# therefore every release has it's own PPA +# +# - the structure looks like this (from deprecated debian/ to new debian-ppa/): +# +# https://www.mindforger.com/debian-ppa/ +# stretch/ +# dists/ ... export from ~/.aptly/public +# pool/ +# index.html ... created by me w/ how to set it up +# ... +# trixie/ +# dists/ ... export from ~/.aptly/public +# pool/ +# index.html ... created by me w/ how to set it up +# +# - source Debian packages for every version (which are used by aptly) +# are stored in +# +# ~/p/mindforger/debian/aptly/ +# hstr/ +# 9-stretch/ +# ... +# 13-trixie/ +# mindforger/ +# 9-stretch/ +# mindforger-*.*.*.deb +# ... +# 13-trixie/ +# mindforger-*.*.*.deb +# +# - Makefile targets below are used to manage Debian PPAs and generate them +# + +# future repos : trixie-main +# CURRENT repos : bookworm-main, bullseye-main, buster-main, stretch-main +# obsolete repos: jessie-main + .PHONY: dist-debian-ppa -dist-debian-ppa: - cd debian && ./debian-aptly-add-deb.sh +dist-debian-aptly-create-ppa: + cd ./build/debian && ./debian-ppa-aptly-build.sh + +# +# ^ Debian +# .PHONY: dist-all-clean dist-all-clean: diff --git a/build/debian/debian-ppa-aptly-build.sh b/build/debian/debian-ppa-aptly-build.sh new file mode 100755 index 00000000..a367e7cf --- /dev/null +++ b/build/debian/debian-ppa-aptly-build.sh @@ -0,0 +1,229 @@ +#!/bin/bash +# +# MindForger knowledge management tool +# +# Copyright (C) 2016-2023 Martin Dvorak +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + + +# +# This script builds MindForger/HSTR Debian PPA for a particular Debian release. +# - it adds all .deb pacakges in given directory to aptly repository. +# +# Usage: +# +# MF_DEBIAN_DISTRO_DIR=... MF_DEBIAN_RELEASE=... ./debian-aptly-add-deb.sh +# +# Example: +# +# MF_DEBIAN_DEB_DIR=~/p/mindforger/debian/aptly/mindforger/12-bookworm \ +# MF_DEBIAN_RELEASE=bookworm \ +# ./debian-release-aptly-build.sh +# +# aptly abstractions hierarchy: +# +# - repository +# - packages +# ^ snapshots +# ^ publish +# +# See 'MindForger Release Guide#Debian and my PPA' notebook for detailed steps description. + +export MF_IN_DEB_PACKAGES_DIR="/home/dvorka/p/mindforger/debian/aptly" +# ^ must have the following structure: +#. +#├── hstr +#│   └── 09-stretch +#│   ├── hstr_1.27.0-1_amd64.deb +#│   ├── hstr_2.0.0-1_amd64.deb +#│   └── hstr_2.4.0-1_amd64.deb +#└── mindforger +# ├── 09-stretch +# │   ├── mindforger_1.42.0-1_amd64.deb +# │   ├── ... +# │   └── mindforger_1.53.0-1_amd64.deb +# ├── ... +# └── 13-trixie +#    └── mindforger_1.54.0-1_amd64.deb +# +export MF_OUT_PPA_ALL_DEBIAN_RELEASES_DIR="/home/dvorka/p/mindforger/debian/debian-ppa.mindforger.com" +# ^ PPAs for all releases side-by-side + + + +# Add ONE .deb package to aptly repository: +# +# Parameters: +# $1 - MF version e.g. 1.55.0 +# $2 - Debian release e.g. stretch +# +function add_deb { + NEW_MF_VERSION=${1} + NEW_DEBIAN_RELEASE=${2} + + export NEW_MF_RELEASE_NAME="mindforger_${NEW_MF_VERSION}" + export NEW_DEB_NAME="${NEW_MF_RELEASE_NAME}-1_amd64.deb" + + export MY_APTLY_PATH="/home/dvorka/.aptly" + export MY_APTLY_UPLOAD_PATH="${MY_APTLY_PATH}/public" + export MY_APTLY_VERSION="$(aptly version)" + # PPA REPOSITORY name (aptly can manage multiple - this identifier) + export MY_APTLY_REPO_NAME="${NEW_DEBIAN_RELEASE}-main" + # PPA repository SNAPSHOT is entity which is published + #export MY_APTLY_SNAPSHOT_NAME="$(aptly snapshot list --raw)" + export MY_APTLY_SNAPSHOT_NAME="${NEW_DEBIAN_RELEASE}-snapshot" + # PUBLISH of repository snapshot is stored to ~/.aptly/public so that it can be uploaded + #export MY_APTLY_PUBLISH="$(aptly publish list)" + #export MY_APTLY_PUBLISH_NAME="$(aptly publish list --raw | while read A B; do echo ${B}; done)" + export MY_APTLY_PUBLISH_NAME="${NEW_DEBIAN_RELEASE}-publish" + + echo + echo "= Local aptly repository overview: ====================================" + # echo " ${MY_APTLY_VERSION}" + echo " aptly repository path: ${MY_APTLY_PATH}" + echo " aptly config path : ${MY_APTLY_PATH}.config" + echo "New snapshot:" + echo " Debian release : ${NEW_DEBIAN_RELEASE}" + echo " MF release : ${NEW_MF_VERSION}" + echo " .deb file : ${NEW_DEB_NAME}" + echo " publish name : ${MY_APTLY_PUBLISH_NAME}" + echo " snapshot name : ${MY_APTLY_SNAPSHOT_NAME}" + echo " repository name : ${MY_APTLY_REPO_NAME}" + echo "# BEFORE repos ========================================================" + aptly repo list + echo "# BEFORE repo =========================================================" + aptly repo create "${MY_APTLY_REPO_NAME}" + aptly repo show -with-packages "${MY_APTLY_REPO_NAME}" + echo "# BEFORE snapshots ====================================================" + aptly snapshot list + echo "# BEFORE snapshot =====================================================" + aptly snapshot show -with-packages "${MY_APTLY_SNAPSHOT_NAME}" + echo "# BEFORE publishes ====================================================" + aptly publish list + echo "# BEFORE publish ======================================================" + aptly publish show "${MY_APTLY_PUBLISH_NAME}" + echo "> RUN >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + echo + + # checks + if [[ ! -f "${NEW_DEB_NAME}" ]] + then + echo "Error: File with package to be released not found: ${NEW_DEB_NAME}" + exit 1 + fi + + #echo "STEP: .aptly/ backup:" + #export timestamp=`date +%Y-%m-%d--%H-%M-%S` + #tar zcf ~/p/mindforger/debian/aptly/backup-aptly-${timestamp}.tgz ~/.aptly + #echo "DONE: backup" + + echo "STEP: drop publish > snapshot > repo" + aptly publish drop ${NEW_DEBIAN_RELEASE} + aptly snapshot drop ${MY_APTLY_SNAPSHOT_NAME} + + echo "STEP: add .deb to repo > snapshot > publish" + # aptly repo edit -distribution="${NEW_DEBIAN_RELEASE}" "${MY_APTLY_REPO_NAME}" + aptly repo add ${MY_APTLY_REPO_NAME} ${NEW_DEB_NAME} + aptly snapshot create ${MY_APTLY_SNAPSHOT_NAME} from repo ${MY_APTLY_REPO_NAME} + aptly publish snapshot -distribution=${NEW_DEBIAN_RELEASE} ${MY_APTLY_SNAPSHOT_NAME} + echo "DONE: add .deb" + + # upload + #echo -e "\n${MY_APTLY_UPLOAD_PATH} can be UPLOADED to www.mindforger.com/debian:" + #tree ${MY_APTLY_UPLOAD_PATH} + + # copy it to ALL Debian releases dir + export MY_PPA_DISTR_DIR="${MF_OUT_PPA_ALL_DEBIAN_RELEASES_DIR}/${NEW_DEBIAN_RELEASE}" + rm -rvf ${MY_PPA_DISTR_DIR} + mkdir -pv ${MY_PPA_DISTR_DIR} + cp -vrf ${MY_APTLY_UPLOAD_PATH}/* ${MY_PPA_DISTR_DIR} + # ensure index.html for the Debian release + echo "STEP: create index.html for the Debian release" + cat ./index-ppa.html | sed -e "s/DISTRO/${NEW_DEBIAN_RELEASE}/g" > "${MY_PPA_DISTR_DIR}/index.html" + + tree ${MF_OUT_PPA_ALL_DEBIAN_RELEASES_DIR} +} + +function add_debian_release { + export MF_DEBIAN_RELEASE_DIR=${1} + export MF_DEBIAN_RELEASE=${2} + + find ${MF_DEBIAN_RELEASE_DIR} -name "*.deb" | while read P + do + export MF_DEB_FILE_NAME=$(basename ${P}) + + echo ${MF_DEB_FILE_NAME} | tr "_" " " | while read A B C + do + echo $B | tr "-" " " | while read X Y + do + echo $X + done + done | while read MF_RELEASE_VERSION + do + echo "Debinan release: ${MF_DEBIAN_RELEASE}" + echo "Input file : ${P}" + echo ".deb file name : ${MF_DEB_FILE_NAME}" + echo "MF version : ${MF_RELEASE_VERSION}" + + # prepare .deb file to the current directory + rm -f ${MF_DEB_FILE_NAME} + cp -f ${P} . + + # add .deb to repo + add_deb ${MF_RELEASE_VERSION} ${MF_DEBIAN_RELEASE} + + # cleanup + rm -f ${MF_DEB_FILE_NAME} + done + done +} + +# +# MAIN +# + +# purge debian-ppa.mindforger.com +rm -rvf "${MF_OUT_PPA_ALL_DEBIAN_RELEASES_DIR}" + +# FOR every Debian release in the input directory +find "${MF_IN_DEB_PACKAGES_DIR}/mindforger" -maxdepth 1 -mindepth 1 -type d | while read MF_DEBIAN_RELEASE_DIR +do + export MF_DEBIAN_RELEASE=$(basename ${MF_DEBIAN_RELEASE_DIR} | tr "-" " " | while read A B; do echo ${B}; done) + echo "Debinan release: ${MF_DEBIAN_RELEASE}" + echo "Input dir : ${MF_DEBIAN_RELEASE_DIR}" + + export MY_APTLY_REPO_NAME="${MF_DEBIAN_RELEASE}-main" + export MY_APTLY_SNAPSHOT_NAME="${MF_DEBIAN_RELEASE}-snapshot" + + echo "STEP: DROP it all: snapshots, publishes, repos" + aptly publish drop ${MF_DEBIAN_RELEASE} + aptly snapshot drop ${MY_APTLY_SNAPSHOT_NAME} + aptly repo drop ${MY_APTLY_REPO_NAME} + aptly repo drop "bookworm-main" + aptly repo drop "jessie-main" + + add_debian_release ${MF_DEBIAN_RELEASE_DIR} ${MF_DEBIAN_RELEASE} + + # purge aptly and start over + aptly publish drop ${MF_DEBIAN_RELEASE} + aptly snapshot drop ${MY_APTLY_SNAPSHOT_NAME} + aptly repo drop ${MY_APTLY_REPO_NAME} +done + +# HTML w/ links to for all Debian releases +cp -vf ./index-all-ppas.html "${MF_OUT_PPA_ALL_DEBIAN_RELEASES_DIR}/index.html" + +# eof diff --git a/build/debian/index-all-ppas.html b/build/debian/index-all-ppas.html new file mode 100644 index 00000000..b7131e42 --- /dev/null +++ b/build/debian/index-all-ppas.html @@ -0,0 +1,24 @@ + + + + MindForger Debian PPA repositories + + +

MindForger provides Debian PPA repositories

+ +

MindForger provides Debian PPA repositories for the following + Debian releases: + +

+ + There is not one repository for all Debian releases, + but per-Debian release repository. +

+ + + diff --git a/build/debian/index-ppa.html b/build/debian/index-ppa.html new file mode 100644 index 00000000..153796eb --- /dev/null +++ b/build/debian/index-ppa.html @@ -0,0 +1,34 @@ + + + + MindForger Debian "DISTRO" PPA repository + + +

MindForger Debian "DISTRO" PPA repository

+ +

This is Personal Package Archive (PPA) + for MindForger. +

+

To install programs from this PPA add new repository + to /etc/apt/sources.list as follows:

+

+ +
+      echo "deb http://www.mindforger.com/debian-ppa/DISTRO DISTRO main" | sudo tee /etc/apt/sources.list.d/mindforger.list      
+    
+ +

... and import key that is used to sign the release:

+ +
+      $ wget -qO - http://www.mindforger.com/gpgpubkey.txt | sudo apt-key add -
+    
+ +

After that you can install MindForger as any other software package:

+ +
+      $ sudo apt update
+      $ sudo apt install mindforger
+    
+ + + From 82de66bda6b599649b071caeaae7457ba196ae49 Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Sun, 12 Nov 2023 13:11:41 +0100 Subject: [PATCH 4/6] Update README.md - fixing broken Debian wiki link. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec588869..56c465a7 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Install: * [macOS](https://github.com/dvorka/mindforger/wiki/Installation#macos) * [Windows](https://github.com/dvorka/mindforger/wiki/Installation#windows) * [Ubuntu](https://github.com/dvorka/mindforger/wiki/Installation#ubuntu) -* [Debian](https://github.com/dvorka/mindforger/wiki/Installation#windows) +* [Debian](https://github.com/dvorka/mindforger/wiki/Installation#debian) * [Fedora](https://github.com/dvorka/mindforger/wiki/Installation#fedora) * [FreeBSD](https://github.com/dvorka/mindforger/wiki/Installation#freebsd) * [Arch Linux](https://github.com/dvorka/mindforger/wiki/Installation#arch-linux) From 2e01afc3ed0c361a3732db4dc2f64b98767482a9 Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Thu, 16 Nov 2023 07:32:50 +0100 Subject: [PATCH 5/6] Updating Ubuntu GH Actions workflow to 20.04 as 18.04 is deprecated. --- .github/workflows/build_ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/build_ubuntu.yml index fa6dff8e..fe9f28f3 100644 --- a/.github/workflows/build_ubuntu.yml +++ b/.github/workflows/build_ubuntu.yml @@ -4,7 +4,7 @@ on: [push] jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 with: From 9314eaf84af4e3c13067cca499789dfd73476db3 Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Sun, 19 Nov 2023 20:24:55 +0100 Subject: [PATCH 6/6] Update build_ubuntu.yml to work @ Ubuntu 20.04 --- .github/workflows/build_ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/build_ubuntu.yml index fe9f28f3..75a0fd9b 100644 --- a/.github/workflows/build_ubuntu.yml +++ b/.github/workflows/build_ubuntu.yml @@ -17,7 +17,7 @@ jobs: run: cd deps/cmark-gfm && mkdir -v build && cd build && cmake -DCMARK_TESTS=OFF -DCMARK_SHARED=OFF .. && cmake --build . - name: Build test dependency - Google Test Framework - run: sudo apt-get install -y libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv -v libg* /usr/lib + run: sudo apt-get install -y libgtest-dev && cd /usr/src/gtest && sudo cmake . && sudo make && sudo mv -v lib/libg* /usr/lib - name: Build lib and run unit tests using Google Test Framework run: export M8R_GIT_PATH=`pwd` && cd build/make && M8R_CPU_CORES=4 ./test-lib-units.sh