From: Michael Wagner Date: Fri, 6 Aug 2021 21:00:22 +0000 (+0200) Subject: posaune X-Git-Tag: v_0.0-2~4 X-Git-Url: http://wagnertech.de/git?p=projects.git;a=commitdiff_plain;h=6dac1fffbeab97aaefe2648a0f50ece7c4dc2b4d posaune --- diff --git a/debian/mbuild.changelog b/debian/mbuild.changelog index 35c75c3..a1de934 100644 --- a/debian/mbuild.changelog +++ b/debian/mbuild.changelog @@ -1,3 +1,8 @@ +projects (1.2-%BUILD%) unstable; urgency=medium + * support version numbers set by user (-v option) + * support version numbers set by project (-V option) + -- Michael Wagner Tue, 06 Aug 2021 22:54:48 +0100 + projects (1.1-%BUILD%) unstable; urgency=medium * support of cross compile environments with cmake -- Michael Wagner Tue, 12 Jan 2021 22:54:48 +0100 diff --git a/debian/mbuild.cp b/debian/mbuild.cp index 0babef4..9e8f3b8 100755 --- a/debian/mbuild.cp +++ b/debian/mbuild.cp @@ -6,6 +6,7 @@ base=$1 mkdir -p $base/usr/bin/ cp tools/make/mconfigure $base/usr/bin/ cp tools/make/treecopy $base/usr/bin/ +cp tools/make/make-conffile $base/usr/bin/ mkdir -p $base/usr/share/mbuild/ cp tools/make/rules $base/usr/share/mbuild/ diff --git a/doc/mbuild.8 b/doc/mbuild.8 index 3c26a7c..b1d4ef6 100644 --- a/doc/mbuild.8 +++ b/doc/mbuild.8 @@ -13,10 +13,17 @@ consists of 3 phases: configuration - compile - pack configuration is done by the .B mconfigure -script. It determins the verion number from the git/subversion status. A +script. The configuration step has the following tasks: + +Determination of version and build number. The version number can be set in a .B PAKET.changelog -file is needed. Per -default this script also performs compile and pack step. +file, can be set by the -v option of +.B mconfigure +or be set by the project itself in the +.B PAKET.prepare +script. The build number is always taken from the CM system: With SVN it is the global version number, with +GIT the build number is taken from the tag. On build a tag in the form project_version-build is expected. If not +present a tag in the form v_version-build is searched. Verion may be 0.0 if set elsewhere. If a .B PAKET.prepare @@ -35,7 +42,9 @@ file is present in the debian directory, it is called in the ~/build directory. compile To perform the compile step a .B PAKET.build -script is needed in the +script or a +.B PAKET.cmake +file is needed in the .B debian directory. .TP @@ -52,7 +61,7 @@ directory. A standard copyright file is included. An user defined file can be used by copying it to debian/copyright in the PAKET.prepare script. .br -A standard README.debian file is included. An user defined file can be used by defining a debian/PAKET.README.debian. + .SH FILES .TP PAKET.changelog @@ -71,6 +80,10 @@ Any executable script file executed in configure step in the ../build directory PAKET.build Any executable script file executing the build in the ../build directory .TP +PAKET.cmake +cmake file (CMakeLists.txt) for building C/C++ code. If a cross compile option is set in the mconfigure +script, according definitions are included. +.TP PAKET.cp An executable script file copying the artefacts to target paths preposed by $1: .br diff --git a/doc/mconfigure.1 b/doc/mconfigure.1 index 01c3513..8df0edc 100644 --- a/doc/mconfigure.1 +++ b/doc/mconfigure.1 @@ -15,9 +15,16 @@ that contains the files described in .B mbuild(8). .SH OPTIONS .TP +-a ARCH +A multiarch cross compile is issued +.TP -c select configuration step .TP +-C TOOLSET +Defines the cross compile toolset. TOOLSET can either be an absolute path or a directory expected +in the /opt/cross directory +.TP -d select compile step .TP @@ -26,6 +33,12 @@ select pack step .TP -o support old Debian 7 format +.TP +-v VERSION +set version to VERSION +.TP +-V +verion is set by the project in the prepare step .PP If no steps are selected all steps are performed. .SH SEE ALSO diff --git a/tools/make/create-conffiles b/tools/make/create-conffiles new file mode 100755 index 0000000..54567f9 --- /dev/null +++ b/tools/make/create-conffiles @@ -0,0 +1,14 @@ +#!/bin/bash +set -e + +if [ $# -ne 1 ]; then + echo "usage: create-conffiles BASE_DIR" + exit 1 +fi + +cd $1 +mkdir -p DEBIAN +for files in $(find etc -type f); do + echo "/$files" >> DEBIAN/conffiles +done + diff --git a/tools/make/mconfigure b/tools/make/mconfigure index a8c7f6e..e5f11b3 100755 --- a/tools/make/mconfigure +++ b/tools/make/mconfigure @@ -9,6 +9,7 @@ function echo_usage { echo " -d : compile" echo " -p : pack default: do all" echo " -v : set version" + echo " -V : version set by project" echo " -o : support old Debian 7 format" } @@ -80,6 +81,11 @@ function set_build { then tag=$(git describe --tags --match "${paket}_*" 2>/dev/null) || true if test -z "$tag" + then + # try generic "v_" tag + tag=$(git describe --tags --match "v_*" 2>/dev/null) || true + fi + if test -z "$tag" then tag="0.0-0TOP" fi @@ -119,6 +125,10 @@ function check_version { fi } +############################################################################## +# Main program +############################################################################## + if [ ! -d debian ] then echo "run mconfigure in the project base directory with a debian directory in it!" @@ -128,42 +138,48 @@ fi configure=0 compile=0 pack=0 -while getopts "a:cC:dpov:" opt; do - case $opt in - a) ARCH=$OPTARG - ;; - c) configure=1 - ;; - d) compile=1 - ;; - C) cross=$OPTARG - ;; - p) pack=1 - ;; - o) oldpack="-Zgzip" - ;; - v) optversion=$OPTARG - ;; - \?) echo "Invalid option: -$OPTARG" - echo_usage - exit 1 - ;; - :) echo "Option -$OPTARG requires an argument." - echo_usage - exit 1 - ;; - esac +while [ $OPTIND -le "$#" ] +do + if getopts "a:cC:dpov:V" opt + then + case $opt in + a) ARCH=$OPTARG + ;; + c) configure=1 + ;; + d) compile=1 + ;; + C) cross=$OPTARG + ;; + p) pack=1 + ;; + o) oldpack="-Zgzip" + ;; + v) optversion=$OPTARG + ;; + V) optversion="0.0" + ;; + \?) echo "Invalid option: -$OPTARG" + echo_usage + exit 1 + ;; + :) echo "Option -$OPTARG requires an argument." + echo_usage + exit 1 + ;; + esac + else + paket="${!OPTIND}" + eval OPTIND=OPTIND+1 + fi done -shift $((OPTIND -1)) -if [ $# -lt 1 ] +if [ -z "$paket" ] then echo_usage exit 1 fi -paket=$1 - if [ -n "$ARCH" -a -n "$cross" ] then echo "invalid options: supply -a for multiarch or -C for explicit cross compile environment" @@ -246,7 +262,6 @@ then fi # check for pre/post installation scripts - echo "TODO: check for conffiles" if [ -f $paket.preinst ] then echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre diff --git a/tools/make/rules b/tools/make/rules index 1b2e042..6b7d688 100755 --- a/tools/make/rules +++ b/tools/make/rules @@ -60,6 +60,7 @@ sync: ../build copy: debian/$(paket).cp debian/$(paket).cp debian/tmp + create-conffiles debian/tmp touch debian/tmp ../$(paket)_$(version)-$(build)_$(arch).deb:debian/tmp/DEBIAN/control $(std_inst_tgt) $(add_inst_tgt) debian/tmp