Browse Source

build in docker for all debian based distros

master
Marc Wäckerlin 3 years ago
parent
commit
dc9c339b06
10 changed files with 341 additions and 55 deletions
  1. 10
    0
      ChangeLog
  2. 24
    13
      ax_init_standard_project.m4
  3. 34
    12
      bootstrap.sh
  4. 4
    0
      build-in-docker.conf
  5. 171
    9
      build-in-docker.sh
  6. 9
    0
      mrw-c++.desktop.in
  7. 6
    2
      resolve-debbuilddeps.sh
  8. 81
    0
      sql-to-dot.sed
  9. 2
    2
      src/version.cxx
  10. 0
    17
      src/version.cxx.in

+ 10
- 0
ChangeLog View File

@@ -1,3 +1,13 @@
1
+2015-11-16 12:38  marc
2
+
3
+	* doc/doxyfile.in: SVG must not be interactive for embedding in
4
+	  redmine
5
+
6
+2015-11-09 08:27  marc
7
+
8
+	* ChangeLog, ax_init_standard_project.m4, bootstrap.sh,
9
+	  resolve-debbuilddeps.sh: fixed dependency resolve
10
+
1 11
 2015-11-07 10:47  marc
2 12
 
3 13
 	* bootstrap.sh: there is no qt4-default

+ 24
- 13
ax_init_standard_project.m4 View File

@@ -90,16 +90,19 @@ AC_DEFUN([AX_ADD_MAKEFILE_TARGET_DEP], [
90 90
   fi
91 91
 ])
92 92
 
93
-# Same as AC_SUBST, but adds -Dname="value" option to CPPFLAGS
93
+# Same as AC_SUBST, but adds -Dname="value" option to CPPFLAGS and a
94
+# notz only a @name@ replacement, but also a @name_ENCODED@ one to be
95
+# used in code.
94 96
 #  - parameters:
95 97
 #     $1 = variable name
96 98
 AC_DEFUN([AX_SUBST], [
99
+  [$1]_ENCODED=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,')
100
+  [$1]_ENCODED=${[$1]_ENCODED//\"/\\\"}
101
+  [$1]_ENCODED=${[$1]_ENCODED//\'/\'\"\'\"\'}
102
+  [$1]_ENCODED=${[$1]_ENCODED//#/\\#}
103
+  AM_CPPFLAGS+=" '-D$1=\"${[$1]_ENCODED}\"'"
97 104
   AC_SUBST([$1])
98
-  tmp_var=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,')
99
-  tmp_var=${tmp_var//\"/\\\"}
100
-  tmp_var=${tmp_var//\'/\'\"\'\"\'}
101
-  tmp_var=${tmp_var//#/\\#}
102
-  AM_CPPFLAGS+=" '-D$1=\"${tmp_var}\"'"
105
+  AC_SUBST([$1]_ENCODED)
103 106
   AC_SUBST(AM_CPPFLAGS)
104 107
 ])
105 108
 
@@ -167,14 +170,18 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
167 170
   AX_SUBST(BUILD_NUMBER)
168 171
   BUILD_DATE=$(LANG= date +"%a, %d %b %Y %H:%M:%S %z")
169 172
   AX_SUBST(BUILD_DATE)
170
-  if test -f "${PROJECT_NAME}-logo.png"; then
171
-     PROJECT_LOGO="${PROJECT_NAME}-logo.png"
173
+  if test -f "${PACKAGE_NAME}.desktop.in"; then
174
+     PACKAGE_DESKTOP="${PACKAGE_NAME}.desktop"
172 175
   fi
173
-  AX_SUBST(PROJECT_LOGO)
174
-  if test -f "${PROJECT_NAME}-icon.png"; then
175
-     PROJECT_ICON="${PROJECT_NAME}-icon.png"
176
+  AX_SUBST(PACKAGE_DESKTOP)
177
+  if test -f "${PACKAGE_NAME}-logo.png"; then
178
+     PACKAGE_LOGO="${PACKAGE_NAME}-logo.png"
176 179
   fi
177
-  AX_SUBST(PROJECT_ICON)
180
+  AX_SUBST(PACKAGE_LOGO)
181
+  if test -f "${PACKAGE_NAME}-icon.png"; then
182
+     PACKAGE_ICON="${PACKAGE_NAME}-icon.png"
183
+  fi
184
+  AX_SUBST(PACKAGE_ICON)
178 185
 
179 186
   AC_ARG_ENABLE(pedantic,
180 187
     [AS_HELP_STRING([--enable-pedantic],
@@ -203,6 +210,10 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
203 210
   else
204 211
     AM_CPPFLAGS="${AM_CPPFLAGS} -DQT_NO_DEBUG_OUTPUT -DQT_NO_DEBUG"
205 212
   fi
213
+  
214
+  if test -f ${PACKAGE_NAME}.desktop.in; then
215
+    AC_CONFIG_FILES([${PACKAGE_NAME}.desktop])
216
+  fi
206 217
 
207 218
   AC_CONFIG_FILES([makefile])
208 219
   AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-standard-project-targets], [makefile.in])
@@ -345,7 +356,7 @@ EOF
345 356
 
346 357
 # use this in configure.ac to support debian packages
347 358
 AC_DEFUN([AX_USE_DEBIAN_PACKAGING], [
348
-  README_DEB=$(tail -n +3 README | sed -e 's/^$/./g' -e 's/^/ /g')
359
+  README_DEB=$(tail -n +3 README | sed -e 's/^ *$/./g' -e 's/^/ /g')
349 360
   AC_SUBST(README_DEB)
350 361
   _AM_SUBST_NOTMAKE([README_DEB])
351 362
   AC_CONFIG_FILES([debian/changelog debian/control])

+ 34
- 12
bootstrap.sh View File

@@ -20,7 +20,7 @@ DEFAULT_PROJECT_NAME=${PROJECT_PATH##*/}
20 20
 configure=0
21 21
 build=0
22 22
 docker=0
23
-buildtarget="distcheck"
23
+buildtarget=""
24 24
 overwrite=0
25 25
 rebuild=0
26 26
 rebuildfiles=()
@@ -28,8 +28,9 @@ while test $# -gt 0; do
28 28
     case "$1" in
29 29
         (--configure|-c) configure=1;;
30 30
         (--docker|-d) docker=1;;
31
-        (--build|-b) configure=1; build=1;;
32
-        (--target|-t) shift; configure=1; build=1; buildtarget="$1";;
31
+        (--build|-b) configure=1; build=1; buildtarget+=" distcheck";;
32
+        (--target|-t) shift; configure=1; build=1; buildtarget+=" $1";;
33
+        (--clean) shift; configure=1; build=1; buildtarget+=" maintainer-clean";;
33 34
         (--overwrite|-o) overwrite=1;;
34 35
         (--rebuild|-r) rebuild=1;;
35 36
         (--rebuild-file|-f) shift; rebuildfiles+=("$1");;
@@ -110,12 +111,15 @@ GENERATED FILES
110 111
     * resolve-rpmbuilddeps.sh - script to install RPM package dependencies
111 112
     * build-in-docker.sh - script to build the project encapsulated in a docker container
112 113
     * build-resource-file.sh - build resource.qrc file from a resource directory
114
+    * sql-to-dot.sed - script to convert SQL schema files to graphviz dot in doxygen
113 115
     * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle
116
+    * test/runtests.sh - template file to run test scripts, i.e. docker based
114 117
     * AUTHORS - replace your name in AUTHORS before first run
115 118
     * NEWS - empty file add your project's news
116 119
     * README - add project description (first line is header, followed by an empty line)
117 120
     * configure.ac - global configuration file template
118 121
     * makefile.am - global makefile template
122
+    * ${DEFAULT_PROJECT_NAME}.desktop.in - linux desktop file
119 123
     * src/makefile.am - if you enabled AX_USE_CXX
120 124
     * src/version.hxx - if you enabled AX_USE_CXX
121 125
     * src/version.cxx - if you enabled AX_USE_CXX
@@ -320,7 +324,7 @@ checkdir() {
320 324
 
321 325
 checkfile() {
322 326
     exists=0
323
-    if test -f "$1"; then
327
+    if test -f "$1" -o -f "$1".in; then
324 328
         exists=1
325 329
     fi
326 330
     test $exists -eq 1
@@ -424,6 +428,7 @@ copy resolve-debbuilddeps.sh
424 428
 copy resolve-rpmbuilddeps.sh
425 429
 copy build-in-docker.sh
426 430
 copy build-resource-file.sh
431
+copy sql-to-dot.sed
427 432
 copy mac-create-app-bundle.sh
428 433
 AUTHOR=$(gpg -K  | sed -n 's,uid *,,p' | sort | head -1)
429 434
 if test -z "${AUTHOR}"; then
@@ -703,10 +708,10 @@ namespace NAMESPACE {
703 708
     return README;
704 709
   }
705 710
   std::string logo() {
706
-    return PROJECT_LOGO;
711
+    return PACKAGE_LOGO;
707 712
   }
708 713
   std::string icon() {
709
-    return PROJECT_ICON;
714
+    return PACKAGE_ICON;
710 715
   }
711 716
   const std::string WHAT("#(@) " PACKAGE_STRING);
712 717
   const std::string IDENT("\$Id: " PACKAGE_STRING);
@@ -718,6 +723,7 @@ ${HEADER}dist_bin_SCRIPTS =
718 723
 MAINTAINERCLEANFILES = makefile.in
719 724
 EOF
720 725
 echo "${HEADER}MAINTAINERCLEANFILES = makefile.in" | to --condition AX_USE_DOXYGEN doc/makefile.am
726
+to --condition AX_BUILD_TEST test/runtests.sh < ${0%/*}/test/runtests.sh
721 727
 to --condition 'AX_BUILD_TEST|AX_USE_CPPUNIT' test/makefile.am <<EOF
722 728
 ${HEADER}$(if testtag AX_USE_CXX; then
723 729
 cat <<EOF2
@@ -761,7 +767,7 @@ if testtag AX_USE_DOXYGEN; then
761 767
         doxyreplace PROJECT_NAME "@PACKAGE_NAME@"
762 768
         doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@"
763 769
         doxyreplace PROJECT_BRIEF "@DESCRIPTION@"
764
-        doxyreplace PROJECT_LOGO "@PROJECT_LOGO@"
770
+        doxyreplace PROJECT_LOGO "@top_srcdir@/@PACKACE_LOGO@"
765 771
         doxyreplace INLINE_INHERITED_MEMB YES
766 772
         doxyreplace MULTILINE_CPP_IS_BRIEF YES
767 773
         doxyreplace TAB_SIZE 2
@@ -771,6 +777,7 @@ if testtag AX_USE_DOXYGEN; then
771 777
         doxyadd ALIASES '"classmutex=\\par Reentrant:\\nAccess is locked with class static mutex @c "'
772 778
         doxyadd ALIASES '"instancemutex=\\par Reentrant:\\nAccess is locked with per instance mutex @c "'
773 779
         doxyadd ALIASES '"mutex=\\par Reentrant:\\nAccess is locked with mutex @c "'
780
+        doxyadd ALIASES '"api=\\xrefitem api \\"API Call\\" \\"\\""'
774 781
         doxyreplace ENABLE_PREPROCESSING YES
775 782
         doxyreplace MACRO_EXPANSION YES
776 783
         doxyadd PREDEFINED '"NAMESPACE=@PACKAGE_NAME@"'
@@ -797,14 +804,14 @@ if testtag AX_USE_DOXYGEN; then
797 804
         if testtag AX_BUILD_TEST AX_USE_CPPUNIT; then
798 805
             doxyadd INPUT "@top_srcdir@/test"
799 806
         fi
800
-        doxyreplace FILE_PATTERNS '*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt'
807
+        doxyreplace FILE_PATTERNS '*.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.idl *.ddl *.odl *.h *.hh *.hxx *.hpp *.h++ *.cs *.d *.php *.php4 *.php5 *.phtml *.inc *.m *.markdown *.md *.mm *.dox *.py *.f90 *.f *.for *.tcl *.vhd *.vhdl *.ucf *.qsf *.as *.js *.wt *.sql'
801 808
         doxyreplace RECURSIVE YES
802 809
         doxyreplace EXCLUDE_PATTERNS "moc_* uic_* qrc_*"
803 810
         if testtag AX_BUILD_EXAMPLES; then
804 811
             doxyreplace EXAMPLE_PATH @top_srcdir@/examples
805 812
         fi
806 813
         doxyreplace EXAMPLE_RECURSIVE YES
807
-        doxyreplace FILTER_PATTERNS '*.wt=doxygen-webtester.sed'
814
+        doxyreplace FILTER_PATTERNS '*.wt=doxygen-webtester.sed *.sql=@top_srcdir@/sql-to-dot.sed'
808 815
         doxyreplace SOURCE_BROWSER YES
809 816
         doxyreplace INLINE_SOURCES YES
810 817
         doxyreplace GENERATE_TESTLIST YES
@@ -822,7 +829,7 @@ if testtag AX_USE_DOXYGEN; then
822 829
         doxyreplace CLASS_GRAPH YES
823 830
         doxyreplace TEMPLATE_RELATIONS YES
824 831
         doxyreplace DOT_IMAGE_FORMAT svg
825
-        doxyreplace INTERACTIVE_SVG YES
832
+        doxyreplace INTERACTIVE_SVG NO
826 833
         doxyreplace DOT_TRANSPARENT YES
827 834
     fi
828 835
 fi
@@ -835,7 +842,7 @@ if testtag AX_USE_DEBIAN_PACKAGING; then
835 842
 
836 843
  -- @AUTHOR@  @BUILD_DATE@
837 844
 EOF
838
-    BUILD_DEPENDS="debhelper, subversion, svn2cl, pkg-config, automake, libtool, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | qt4-default | qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)"
845
+    BUILD_DEPENDS="debhelper, subversion, pkg-config, automake, libtool, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | libqt4-core | libqtcore4, qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)"
839 846
     to debian/control.in <<EOF
840 847
 Source: @PACKAGE_NAME@
841 848
 Priority: extra
@@ -882,6 +889,17 @@ ${HEADER}%:
882 889
 EOF
883 890
     echo 7 | to debian/compat
884 891
 fi
892
+to ${PACKAGE_NAME}.desktop.in <<EOF
893
+[Desktop Entry]
894
+Type=Application
895
+Name=${PACKAGE_NAME}
896
+GenericName=${PACKAGE_NAME}
897
+Comment=@DESCRIPTION@
898
+Icon=@prefix@/share/@PACKAGE_NAME@/@PACKAGE_ICON@
899
+Exec=${PACKAGE_NAME} %u
900
+Terminal=false
901
+Categories=Qt;Utility;
902
+EOF
885 903
 to --condition AX_USE_RPM_PACKAGING ${PACKAGE_NAME}.spec.in <<EOF
886 904
 Summary: @DESCRIPTION@
887 905
 Name: @PACKAGE_NAME@
@@ -955,6 +973,7 @@ $(if testtag AX_USE_LIBTOOL; then
955 973
 echo '/usr/%_lib/@PACKAGE_NAME@.so.*'
956 974
 else
957 975
 echo '/usr/bin/*'
976
+echo '/usr/share/applications/*'
958 977
 fi)
959 978
 %doc
960 979
 $(if testtag AX_USE_LIBTOOL; then
@@ -1025,7 +1044,10 @@ done
1025 1044
 to makefile.am<<EOF
1026 1045
 ${HEADER}SUBDIRS =${SUBDIRS}
1027 1046
 
1028
-doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog
1047
+desktopdir = \${datadir}/applications
1048
+desktop_DATA = @PACKAGE_DESKTOP@
1049
+dist_pkgdata_DATA = @PACKAGE_ICON@
1050
+dist_doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog
1029 1051
 
1030 1052
 MAINTAINERCLEANFILES = makefile.in
1031 1053
 EOF

+ 4
- 0
build-in-docker.conf View File

@@ -0,0 +1,4 @@
1
+repos+=("Debian|Ubuntu-precise::::::universe")
2
+repos+=("Ubuntu-precise:::'deb http://archive.ubuntu.com/ubuntu precise universe'")
3
+envs+=("-e 'HOME=${HOME}'")
4
+dirs+=("-v ${HOME}/.gnupg:${HOME}/.gnupg:ro")

+ 171
- 9
build-in-docker.sh View File

@@ -1,15 +1,177 @@
1
-#! /bin/bash -ex
1
+#! /bin/bash -e
2
+set -o errtrace
2 3
 
3 4
 # build and test everything in a fresh docker installation
5
+img="ubuntu:latest"
6
+repos=()
7
+keys=()
8
+envs=()
9
+dirs=("-v $(pwd):/workdir")
10
+packages=()
11
+targets="all check distcheck"
12
+commands=()
13
+if test -e ./build-in-docker.conf; then
14
+    # you can preconfigure the variables in file build-in-docker.conf
15
+    # if you do so, add the file to EXTRA_DIST in makefile.am
16
+    source ./build-in-docker.conf
17
+fi
18
+while test $# -gt 0; do
19
+    case "$1" in
20
+        (-h|--help)
21
+            echo "$0 [OPTIONS]"
22
+            echo
23
+            echo "OPTIONS:"
24
+            echo
25
+            echo "  -h, --help            show this help"
26
+            echo "  -i, --image <image>   use given docker image instead of ${img}"
27
+            echo "  -t, --targets targets specify build targets, default: ${targets}"
28
+            echo "  -r, --repo <url>      add given apt repository"
29
+            echo "  -k, --key <url>       add public key from url"
30
+            echo "  -e, --env <var>=<val> set environment variable in docker"
31
+            echo "  -d, --dir <dir>       access given directory read only"
32
+            echo "  -p, --package <pkg>   install extra debian packages"
33
+            echo "  -c, --cmd <command>   execute commands as root in docker"
34
+            echo
35
+            echo "  The options -r -k -e -d -p -c can be repeated several times."
36
+            echo
37
+            echo "  The options -r -p -c allow an if-then-else contruct"
38
+            echo "  depending on the operating system:"
39
+            echo "    <os>:::<A>:::<B>"
40
+            echo "    <os>:::<A>"
41
+            echo "  Read as: On linux type <os> use <A> else use <B>"
42
+            echo "  That means: If the distributer ID or codename in lsb_release"
43
+            echo "  matches regular expression <os>, then <A> is replaced, else <B> is replaced."
44
+            echo "  The three colons are for splitting <os> from <A> and <B> part."
45
+            echo "  E.g.: Install package curl on wheezy and npm on olter systems:"
46
+            echo "    $0 -p Debian|precise:::curl:::npm"
47
+            echo
48
+            echo "EXAMPLE:"
49
+            echo
50
+            echo "$0 -i mwaeckerlin/ubuntu:trusty-i386 \\"
51
+            echo "                     -t deb \\"
52
+            echo "                     -e ANDROID_HOME=/opt/local/android \\"
53
+            echo "                     -d /opt/local/android \\"
54
+            echo "                     -r universe \\"
55
+            echo "                     -r https://dev.marc.waeckerlin.org/repository \\"
56
+            echo "                     -k https://dev.marc.waeckerlin.org/repository/PublicKey \\"
57
+            echo "                     -p mrw-c++"
58
+            echo
59
+            exit 0
60
+            ;;
61
+        (-i|--image) shift;
62
+            img="$1"
63
+            ;;
64
+        (-t|--targets) shift;
65
+            targets="$1"
66
+            ;;
67
+        (-r|--repo) shift;
68
+            repos+=("$1")
69
+            ;;
70
+        (-k|--key) shift;
71
+            keys+=("$1")
72
+            ;;
73
+        (-e|--env) shift;
74
+            envs+=("-e $1")
75
+            ;;
76
+        (-d|--dirs) shift;
77
+            dirs+=("-v $1:$1:ro")
78
+            ;;
79
+        (-p|--package) shift;
80
+            packages+=("$1")
81
+            ;;
82
+        (-c|--cmd) shift;
83
+            commands+=("$1")
84
+            ;;
85
+        (*)
86
+            echo "**** ERROR: unknown option '$1', try --help" 1>&2
87
+            exit 1
88
+            ;;
89
+    esac
90
+    if test $# -eq 0; then
91
+        echo "**** ERROR: missing value, try --help" 2>61
92
+        exit 1
93
+    fi
94
+    shift
95
+done
4 96
 
5
-DOCKER_ID=$(docker run -d -v $(pwd):/workdir -w /workdir ubuntu sleep infinity)
6
-trap "docker rm -f ${DOCKER_ID}" INT TERM EXIT
7
-docker exec ${DOCKER_ID} apt-get install -y software-properties-common apt-transport-https dpkg-dev
8
-docker exec ${DOCKER_ID} apt-add-repository universe
9
-docker exec ${DOCKER_ID} apt-add-repository https://dev.marc.waeckerlin.org/repository
10
-wget -O- https://dev.marc.waeckerlin.org/repository/PublicKey \
11
-   | docker exec -i ${DOCKER_ID} apt-key add -
97
+function traperror() {
98
+    set +x
99
+    local DOCKER_ID="$1"
100
+    local err=($2) # error status
101
+    local line="$3" # LINENO
102
+    local linecallfunc="$4" 
103
+    local command="$5"
104
+    local funcstack="$6"
105
+    for e in ${err[@]}; do
106
+        if test -n "$e" -a "$e" != "0"; then
107
+            echo "<---"
108
+            echo "ERROR: line $line - command '$command' exited with status: $e (${err[@]})"
109
+            if [ "${funcstack}" != "main" -o "$linecallfunc" != "0" ]; then
110
+                echo -n "   ... Error at ${funcstack} "
111
+                if [ "$linecallfunc" != "" ]; then
112
+                    echo -n "called at line $linecallfunc"
113
+                fi
114
+                echo
115
+            fi
116
+            echo -n "   ... cleanup docker: "
117
+            docker rm -f "${DOCKER_ID}"
118
+            echo "returning status: $e"
119
+            echo "--->"
120
+            exit $e
121
+        fi
122
+    done
123
+    echo -n "   SUCCESS ... cleanup docker: "
124
+    docker rm -f "${DOCKER_ID}"
125
+    exit 0
126
+}
127
+
128
+function ifthenelse() {
129
+    arg="$1"
130
+    shift
131
+    cmd="$*"
132
+    if test "${arg/:::/}" = "${arg}"; then
133
+        docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${arg}}"
134
+    else
135
+        os="${arg%%:::*}"
136
+        thenpart="${arg#*:::}"
137
+        if test "${thenpart/:::/}" = "${thenpart}"; then
138
+            docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; fi'
139
+        else
140
+            elsepart="${thenpart##*:::}"
141
+            thenpart="${thenpart%:::*}"
142
+            if test -n "${thenpart}"; then
143
+                docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then '"${cmd//ARG/${thenpart}}"'; else '"${cmd//ARG/${elsepart}}"'; fi'
144
+            else
145
+                docker exec ${DOCKER_ID} bash -c 'os="'$os'"; if [[ "$(lsb_release -is)-$(lsb_release -cs)-$(dpkg --print-architecture)" =~ ${os} ]]; then true; else '"${cmd//ARG/${elsepart}}"'; fi'
146
+            fi    
147
+        fi
148
+    fi
149
+}
150
+
151
+set -x
152
+
153
+docker pull $img
154
+DOCKER_ID=$(docker run -d ${dirs[@]} ${envs[@]} -w /workdir $img sleep infinity)
155
+trap 'traperror '"${DOCKER_ID}"' "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' SIGINT INT TERM EXIT
156
+docker exec ${DOCKER_ID} apt-get update
157
+docker exec ${DOCKER_ID} apt-get upgrade -y
158
+docker exec ${DOCKER_ID} apt-get install -y python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release || \
159
+    docker exec ${DOCKER_ID} apt-get install -y software-properties-common apt-transport-https dpkg-dev lsb-release || \
160
+    docker exec ${DOCKER_ID} apt-get install -y python-software-properties apt-transport-https dpkg-dev lsb-release;
161
+for repo in "${repos[@]}"; do
162
+    ifthenelse "${repo}" "apt-add-repository ARG"
163
+done
164
+for key in "${keys[@]}"; do
165
+    wget -O-  \
166
+        | docker exec -i ${DOCKER_ID} apt-key add -
167
+done
12 168
 docker exec ${DOCKER_ID} apt-get update
169
+for package in "${packages[@]}"; do
170
+    ifthenelse "${package}" "apt-get install -y --force-yes ARG"
171
+done
172
+for command in "${commands[@]}"; do
173
+    ifthenelse "${command}" "ARG"
174
+done
13 175
 docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh
14 176
 docker exec -u $(id -u) ${DOCKER_ID} svn upgrade || true
15
-docker exec -u $(id -u) ${DOCKER_ID} ./bootstrap.sh -t "all check distcheck"
177
+docker exec -u $(id -u) ${DOCKER_ID} ./bootstrap.sh -t "${targets}"

+ 9
- 0
mrw-c++.desktop.in View File

@@ -0,0 +1,9 @@
1
+[Desktop Entry]
2
+Type=Application
3
+Name=mrw-c++
4
+GenericName=mrw-c++
5
+Comment=@DESCRIPTION@
6
+Icon=@prefix@/share/@PACKAGE_NAME@/@PACKAGE_ICON@
7
+Exec=mrw-c++ %u
8
+Terminal=false
9
+Categories=Qt;Utility;

+ 6
- 2
resolve-debbuilddeps.sh View File

@@ -16,7 +16,11 @@ if test -n "${SCHROOTNAME}"; then
16 16
   SUDO="schroot -c "${SCHROOTNAME}" -u root -d / --"
17 17
 else
18 18
   DO=""
19
-  SUDO="sudo"
19
+  if grep -q '/docker/' /proc/1/cgroup; then
20
+      SUDO=""
21
+  else
22
+      SUDO="sudo"
23
+  fi
20 24
 fi
21 25
 
22 26
 function install() {
@@ -31,7 +35,7 @@ TO_INSTALL=
31 35
 
32 36
 if test -e debian/control.in -a ! -e debian/control; then
33 37
     for f in $(sed -n 's, *AX_DEB_DEPEND_IFEXISTS(\([^)]*\)).*,\1,p' configure.ac); do
34
-        if test -n "$(${DO} apt-cache policy -q ${f})" && ! ${DO} dpkg -l "${f}"; then
38
+        if test -n "$(${DO} apt-cache policy -q ${f})" && ! "$(${DO} apt-cache policy ${f} 2>&1 | grep -q 'N: Unable to locate package')" && ! ${DO} dpkg -l "${f}"; then
35 39
             TO_INSTALL+=" ${f}"
36 40
         fi
37 41
     done

+ 81
- 0
sql-to-dot.sed View File

@@ -0,0 +1,81 @@
1
+#! /bin/sed -nf
2
+1i\
3
+/** @page database Database Schema\
4
+\
5
+@dot\
6
+digraph schema {
7
+
8
+# get everithing on one single line
9
+H;$!d;$x
10
+
11
+# remove all single-line comment lines
12
+s/\n--[^\n]*//g
13
+
14
+# reduce spaces
15
+s,\t\| \+, ,g
16
+
17
+# remove multiline comments
18
+:f;s,\(.*\)/\*.*\*/[ \n]*;*,\1,g;tf
19
+
20
+# remove empty lines
21
+s,\n\+,\n,g
22
+
23
+# remove unknown commands
24
+s,\(;\|\n\) *\(DELIMITER\|USE\|DROP\|CREATE[ \n]\+DATABASE\)[ \n]\+[^;]*;\+,,ig
25
+
26
+# convert special characters within quotes
27
+:a;s/^\(\([^"]*"[^",]*"\)*[^"]*"[^"]*\),\([^"]*".*\)/\1\##COMMA##\3/g;ta
28
+:c;s/^\(\([^']*'[^',]*'\)*[^']*'[^']*\),\([^']*'.*\)/\1\##COMMA##\3/g;tc
29
+
30
+# backup everything to the buffer
31
+# then analyze only on one create table
32
+:i
33
+h
34
+s,.*\(create[ \n]\+table[^;]*;\).*,\1,ig
35
+
36
+# start html table node
37
+s|CREATE[ \n]\+TABLE[ \n]\+\(if[ \n]\+not[ \n]\+exists[ \n]\+\)\?`\?\(\w\+\)`\?|    \2\n        [shape=none, margin=0, label=<\n            <table bgcolor="#dddddd">\n                <tr><td bgcolor="#ddddff" colspan="4"><b>\2</b></td></tr>|ig
38
+
39
+# remove key definitions
40
+s/[),][\n ]*\(PRIMARY[ \n]\+\)\?KEY[ \n]\+[^(]*([^)]*)//gi
41
+
42
+# move foreign keys as relation to the end
43
+:b;s/\(\w\+\)\([^;]*\)FOREIGN[\n ]\+KEY[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*REFERENCES[ \n]*`\?\([a-z]\+\)`\?[ \n]*([ \n]*`\?\([a-z]\+\)`\?[ \n]*)[ \n]*\([^,)]*\)\([,)].*\)/\1\2\7\n \1:\3 -> \4:\5 [label="\6"]##SEMICOLON##/ig;tb
44
+
45
+# create table rows
46
+s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)[ \n]\+COMMENT[ \n]*["']\([^"']*\)["'][ \n]*|\n                <tr><td align="left" port="\1"><b>\1</b></td><td align="left">\2</td><td align="left">\4</td><td align="left">\5</td></tr>|gi
47
+s|[(,][ \n]*`\?\(\w\+\)`\?[ \n]\+\(\w\+\(([^)]\+)\)\?\)[ \n]*\([^,)]*\)|\n                <tr><td align="left" port="\1"><b>\1</b></td><td align="left">\2</td><td align="left">\4</td></tr>|g
48
+
49
+# add line breaks for long lines
50
+s|\(<td[^>]*>[^<]\{30,40\}\)[ \n]\+\([^<]\{20,\}</td>\)|\1<br/>\2|g
51
+#:d;s|\(<br/>[^<]\{30,40\}\)[ \n]\+\([^<]\{20,\}</td>\)|\1<br/>\2|g;td
52
+
53
+# add table comment below
54
+:k;tk
55
+s|[ \n]*)[^)]*COMMENT[ \n]*=[ \n]*["']\?\([^"']*\)["']\?[^;]*|\n                <tr><td bgcolor="#ddddff" colspan="4">\1</td></tr>|ig;th
56
+s|)[^);]*;|\n;|ig
57
+:h
58
+
59
+# cleanup comment below, add line breaksfor long lines
60
+s|\(<td[^>]*>[^<]\{60,80\}\)[ \n]\+\([^<]\{30,\}</td>\)|\1<br/>\2|g
61
+#:e;s|\(<br/>[^<]\{60,80\}\)[ \n]\+\([^<]\{30,\}</td>\)|\1<br/>\2|g;te
62
+
63
+# close table
64
+s|;|\n            </table>\n        >];|ig
65
+
66
+# convert ##COMMA## to ,
67
+s|##COMMA##|,|g
68
+# convert ##SEMICOLON## to ;
69
+s,##SEMICOLON##,;,g
70
+
71
+# print one table
72
+p
73
+# get buffer back and remove the table that has just been analyzed
74
+x
75
+s,\(.*\)create[ \n]\+table[^;]*;\(.*\),\1\2,ig
76
+ti
77
+
78
+$a\
79
+}\
80
+@enddot\
81
+*/

+ 2
- 2
src/version.cxx View File

@@ -30,10 +30,10 @@ namespace NAMESPACE {
30 30
     return README;
31 31
   }
32 32
   std::string logo() {
33
-    return PROJECT_LOGO;
33
+    return PACKAGE_LOGO;
34 34
   }
35 35
   std::string icon() {
36
-    return PROJECT_ICON;
36
+    return PACKAGE_ICON;
37 37
   }
38 38
   const std::string WHAT("#(@) " PACKAGE_STRING);
39 39
   const std::string IDENT("$Id: " PACKAGE_STRING);

+ 0
- 17
src/version.cxx.in View File

@@ -1,17 +0,0 @@
1
-/*! @file
2
-
3
-    @id $Id$
4
-*/
5
-//       1         2         3         4         5         6         7         8
6
-// 45678901234567890123456789012345678901234567890123456789012345678901234567890
7
-
8
-#include <string>
9
-
10
-namespace mrw {
11
-  std::string version() {
12
-    return "@PACKAGE_NAME@-@PACKAGE_VERSION@";
13
-  }
14
-  const std::string WHAT("#(@) @PACKAGE_NAME@-@PACKAGE_VERSION@");
15
-  const std::string IDENT("$Id: @PACKAGE_NAME@-@PACKAGE_VERSION@ $");
16
-}
17
-

Loading…
Cancel
Save