phpide
authorMichael Wagner <michael@wagnertech.de>
Tue, 17 Apr 2018 20:23:07 +0000 (22:23 +0200)
committerMichael Wagner <michael@wagnertech.de>
Tue, 17 Apr 2018 20:23:07 +0000 (22:23 +0200)
debian/control
debian/mbuild.changelog [new file with mode: 0644]
tools/make/mconfigure
tools/make/rules

index baf5d7d..4034bfd 100644 (file)
@@ -1,7 +1,7 @@
 Source: projects
 Section: main
 Priority: optional
-Maintainer: Michael Wagner <info@wagenrtech.de>
+Maintainer: Michael Wagner <michael@wagnertech.de>
 Build-Depends: git
  
 Package: mbuild
diff --git a/debian/mbuild.changelog b/debian/mbuild.changelog
new file mode 100644 (file)
index 0000000..f684a91
--- /dev/null
@@ -0,0 +1,6 @@
+projects (0.1-%BUILD%) unstable; urgency=medium
+
+  * Build in neuer git-Umgebung
+
+ -- Michael Wagner <michael@wagnertech.de>  Mon, 12 Feb 2018 09:45:25 +0100
+
index d329219..3bca62a 100755 (executable)
@@ -4,27 +4,45 @@ set -e
 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
@@ -41,34 +59,40 @@ then
        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 ]
@@ -115,7 +139,13 @@ fi
 
 popd >/dev/null
 
+if [ $prepare = 1 ]
+then
+       exit 0
+fi
+
 # build package
+. debian/setenv.sh
 debian/rules binary
 
 ## check for copy file
index 68ba315..d61e224 100755 (executable)
@@ -12,7 +12,6 @@ default:
 # 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:
@@ -33,22 +32,23 @@ binary: debian/tmp/DEBIAN/control binary-arch binary-indep
 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