function echo_usage {
echo "usage: mconfigure <package> [options]"
echo " -a <arch>"
+ echo " -p : prepare build, but not do it"
}
function set_build {
if [ -e .svn ]
then
+ version="0.0"
build=$(svnversion)
elif [ -e .git ]
then
- build=$(git describe --tags 2>/dev/null) || true
- if test -z "$build"
+ tag=$(git describe --tags 2>/dev/null) || true
+ if test -z "$tag"
then
- build="0.0-TOP"
+ tag="0.0-TOP"
fi
changes=$(git status -s |grep "^ *M") || true
if test -z "$changes"
then
- build="${build}M"
+ tag="${tag}M"
fi
+ version=${tag%-*}
+ build=${tag#*-}
fi
}
+function check_version {
+ if [ $version = "0.0" ]
+ then
+ return
+ fi
+ vline=$(head -1 debian/$paket.changelog)
+ vline=${vline%-*}
+ clversion=${vline#*(}
+ if [ "$clversion" != $version ]
+ then
+ echo "version mismatch: git: $version, changelog: $clversion"
+ exit 1
+ fi
+}
# to build a package you need ...
# <package>.cp (optional): copy step for package production
# <package>.cpp.sh (optional): commands to setup the C++ compile environment
exit 2
fi
-export paket=$1
+echo "export paket=$1" > debian/setenv.sh
shift
ARCH=""
cpp_build=0
set_build
-export build
+check_version
+echo "export version=$version" >> debian/setenv.sh
+echo "export build=$build" >> debian/setenv.sh
# get repository name
tmp=$(pwd)
-export pwd=${tmp##*/}
-
-echo "building $paket with build $build"
-
-#while getopts ":a" opt; do
-# case $opt in
-# a) ARCH=$OPTARG
-# ;;
-# \?) echo "Invalid option: -$OPTARG"
-# echo_usage
-# exit 1
-# ;;
-# :) echo "Option -$OPTARG requires an argument."
-# echo_usage
-# exit 1
-# ;;
-# esac
-#done
+pwd=${tmp##*/}
+echo "export pwd=$pwd" >> debian/setenv.sh
+
+echo "building $paket with build $version-$build"
+
+prepare=0
+while getopts ":ap" opt; do
+ case $opt in
+ a) ARCH=$OPTARG
+ ;;
+ p) prepare=1
+ ;;
+ \?) echo "Invalid option: -$OPTARG"
+ echo_usage
+ exit 1
+ ;;
+ :) echo "Option -$OPTARG requires an argument."
+ echo_usage
+ exit 1
+ ;;
+ esac
+done
#
## clean dirs and check out
#if [ -d build -a $delete_src -eq 1 ]
popd >/dev/null
+if [ $prepare = 1 ]
+then
+ exit 0
+fi
+
# build package
+. debian/setenv.sh
debian/rules binary
## check for copy file
# Löschen aller kompilierten, erzeugten und nicht benötigten Dateien im Bauverzeichnis
clean:
-rm -rf debian/tmp
- -rm debian/changelog
# Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis
build:
binary-arch:
# Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis
-binary-indep: copy ../$(paket)_$(build)$(_arch).deb
+binary-indep: copy ../$(paket)_$(version)-$(build)$(_arch).deb
copy: debian/$(paket).cp
debian/$(paket).cp debian/tmp
-../$(paket)_$(build)$(_arch).deb:
+../$(paket)_$(version)-$(build)$(_arch).deb:
$(DEB)
- mv debian/tmp.deb ../$(paket)_$(build)$(_arch).deb
+ mv debian/tmp.deb ../$(paket)_$(version)-$(build)$(_arch).deb
debian/tmp/DEBIAN/control: debian/control debian/changelog
dpkg-gencontrol
-debian/changelog:
- echo "${pwd} (${build}) unstable; urgency=medium" > debian/changelog
- echo " * generated by mbuild" >> debian/changelog
- echo " -- Michael Wagner <info@wagnertech.de> Sun, 11 Feb 2018 20:03:04 +0100" >> debian/changelog
+debian/changelog: debian/$(paket).changelog
+ sed "s/%BUILD%/$(build)/" debian/$(paket).changelog > debian/changelog
+# echo "${pwd} (${build}) unstable; urgency=medium" > debian/changelog
+# echo " * generated by mbuild" >> debian/changelog
+# echo " -- Michael Wagner <info@wagnertech.de> Sun, 11 Feb 2018 20:03:04 +0100" >> debian/changelog
# mb_create_changelog
# Load project specification