Browse Source

update buildsystem

master
Marc Wäckerlin 8 months ago
parent
commit
4528cd8d78
4 changed files with 32 additions and 16 deletions
  1. 27
    11
      build-in-docker.sh
  2. 1
    1
      mac-create-app-bundle.sh
  3. 3
    3
      resolve-rpmbuilddeps.sh
  4. 1
    1
      src/mrw/string.hxx

+ 27
- 11
build-in-docker.sh View File

@@ -200,11 +200,25 @@ function ifthenelse() {
200 200
     arg="$1"
201 201
     shift
202 202
     cmd="$*"
203
-    DISTRIBUTOR=$(docker exec ${DOCKER_ID} lsb_release -si | sed 's, .*,,' | tr [:upper:] [:lower:])
203
+    DISTRIBUTOR=$(docker exec ${DOCKER_ID} lsb_release -si | sed 's, .*,,;s,.*,\L&,g')
204 204
     CODENAME=$(docker exec ${DOCKER_ID} lsb_release -cs)
205 205
     ARCH=$((docker exec ${DOCKER_ID} which dpkg > /dev/null 2> /dev/null && docker exec ${DOCKER_ID} dpkg --print-architecture) || echo amd64)
206
+    case "$DISTRIBUTOR" in
207
+        (opensuse) # code name may be not available, then set leap or tumbleweed
208
+            if test "$CODENAME" = "n/a"; then
209
+                CODENAME=$(docker exec ${DOCKER_ID} lsb_release -ds | sed "s,\($(docker exec ${DOCKER_ID} lsb_release -si | sed 's, ,\\|,g')\) *,,"';s, .*,,g;s,",,g;s,.*,\L&,g')
210
+            fi
211
+            ;;
212
+        (fedora|mageia) # numeric code name
213
+            CODENAME=$(docker exec ${DOCKER_ID} lsb_release -rs)
214
+            ;;
215
+        (centos) # only look at major number in centos
216
+            CODENAME=$(docker exec ${DOCKER_ID} lsb_release -rs | sed 's,\..*,,')
217
+            ;;
218
+    esac
206 219
     if test "${arg/:::/}" = "${arg}"; then
207
-        docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${arg//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
220
+        cmd_tmp="${cmd//ARG/${arg//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
221
+        docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}"
208 222
     else
209 223
         os="${arg%%:::*}"
210 224
         thenpart="${arg#*:::}"
@@ -215,11 +229,13 @@ function ifthenelse() {
215 229
         fi
216 230
         if [[ "${DISTRIBUTOR}-${CODENAME}-${ARCH}" =~ ${os} ]]; then
217 231
             if test -n "${thenpart}"; then
218
-                docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${thenpart//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
232
+                cmd_tmp="${cmd//ARG/${thenpart//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
233
+                docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}"
219 234
             fi
220 235
         else
221 236
             if test -n "${elsepart}"; then
222
-                docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${elsepart//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
237
+                cmd_tmp="${cmd//ARG/${elsepart//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
238
+                docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}"
223 239
             fi
224 240
         fi
225 241
     fi
@@ -259,12 +275,12 @@ case "$mode" in
259 275
         PREVENT='libpam-systemd policykit.* colord dconf-service'
260 276
         docker exec ${DOCKER_ID} apt-get update ${OPTIONS}
261 277
         docker exec ${DOCKER_ID} apt-mark hold ${PREVENT}
262
-        docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS}
278
+        #docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS}
263 279
         docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release wget || \
264 280
             docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- software-properties-common apt-transport-https dpkg-dev lsb-release wget || \
265 281
             docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties apt-transport-https dpkg-dev lsb-release wget;
266 282
         if [[ "${img}" =~ "ubuntu" ]]; then
267
-            docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT} locales
283
+            docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- locales
268 284
             docker exec ${DOCKER_ID} locale-gen ${LANG}
269 285
             docker exec ${DOCKER_ID} update-locale LANG=${LANG}
270 286
         fi
@@ -274,7 +290,7 @@ case "$mode" in
274 290
             docker exec ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences"
275 291
         done
276 292
         if test -n "${keys[@]}"; then # fix dependency bug in cosmic and stretch
277
-            docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT} gnupg
293
+            docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- gnupg
278 294
             for key in "${keys[@]}"; do
279 295
                 wget -O- "$key" \
280 296
                     | docker exec -i ${DOCKER_ID} apt-key add -
@@ -286,7 +302,7 @@ case "$mode" in
286 302
 
287 303
         docker exec ${DOCKER_ID} apt-get update ${OPTIONS}
288 304
         for package in "${packages[@]}"; do
289
-            ifthenelse "${package}" "apt-get install ${OPTIONS} ${PREVENT} ARG"
305
+            ifthenelse "${package}" "apt-get install ${OPTIONS} ${PREVENT// /- }- ARG"
290 306
         done
291 307
         for command in "${commands[@]}"; do
292 308
             ifthenelse "${command}" "ARG"
@@ -323,8 +339,8 @@ EOF
323 339
             docker exec -i ${DOCKER_ID} rm rpm-key
324 340
         done
325 341
         for repo in "${repos[@]}"; do
326
-            INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo wget -O/etc/yum.repos.d/additional$i.repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo false))
327
-            ifthenelse "${repo}" "${INSTALL_REPO} 'ARG'"
342
+            INSTALL_REPO=$((docker exec ${DOCKER_ID} test -x /usr/bin/zypper && echo zypper ar) || (docker exec ${DOCKER_ID} test -x /usr/bin/dnf && echo dnf config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/bin/yum && echo yum-config-manager --add-repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo false))
343
+            ifthenelse "${repo}" "${INSTALL_REPO} ARG"
328 344
             ((++i))
329 345
         done
330 346
         for package in "${packages[@]}"; do
@@ -347,7 +363,7 @@ docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" ${h
347 363
 # not supported in trusty and jessie
348 364
 if test "$mode" = deb -a "${img//trusty/}" = "${img}" -a "${img//jessie/}" = "${img}"; then
349 365
    if test "${targets//deb/}" != "${targets}" && ls *.deb > /dev/null 2> /dev/null; then
350
-       docker exec ${DOCKER_ID} bash -c "apt-get install ${OPTIONS} ${PREVENT} /workdir/*.deb"
366
+       docker exec ${DOCKER_ID} bash -c "apt-get install ${OPTIONS} ${PREVENT// /- }- /workdir/*.deb"
351 367
    fi
352 368
 fi
353 369
 if test "$mode" = rpm -a "${targets//rpm/}" != "${targets}"; then

+ 1
- 1
mac-create-app-bundle.sh View File

@@ -59,7 +59,7 @@ while [ $found -ne 0 ]; do
59 59
     cd "${target}"
60 60
     for file in $(find . -type f); do
61 61
         for lib in $(otool -L ${file} | tail -n +2 \
62
-            | egrep '/usr/local/|/opt/local/|'"${HOME}" \
62
+            | egrep '/usr/local/|/opt/local/|/opt/X11/|'"${HOME}" \
63 63
             | grep -v $file | awk '{print $1}'); do
64 64
             found=1
65 65
             test -f ${lib##*/} \

+ 3
- 3
resolve-rpmbuilddeps.sh View File

@@ -97,12 +97,12 @@ fi
97 97
 
98 98
 if test -n "${SCHROOTNAME}"; then
99 99
     FILES=$(LANG= schroot -c ${SCHROOTNAME} -- rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec  2>&1 | sed -n 's, is needed by.*,,p')
100
-    if test -n "${FILES}${DEPS}"; then
100
+    if test -n "${FILES// /}${DEPS// /}"; then
101 101
         schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL}  ${FILES} ${DEPS}
102 102
     fi
103 103
 else
104 104
     FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
105
-    if test -n "${FILES}${DEPS}"; then
105
+    if test -n "${FILES// /}${DEPS// /}"; then
106 106
         ${INSTALL_TOOL} ${FILES} ${DEPS}
107 107
     fi
108 108
 fi
@@ -112,7 +112,7 @@ if test -n "${SCHROOTNAME}"; then
112 112
 else
113 113
     FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
114 114
 fi
115
-if test -n "${FILES}"; then
115
+if test -n "${FILES// /}"; then
116 116
     echo "**** ERROR: Cannot install: " $FILES
117 117
     exit 1
118 118
 fi

+ 1
- 1
src/mrw/string.hxx View File

@@ -50,7 +50,7 @@ namespace mrw {
50 50
       @subsection stdextstringfeatures Extensions to std::string
51 51
 
52 52
        - Shift operator to shift any kind of values into a string
53
-         without the need for a stingstream.
53
+         without the need for a stringstream.
54 54
        - Addition operators to add, means concatenate, any kind of
55 55
          value (e.g. integer) to a string without the need for a
56 56
          stringstream.

Loading…
Cancel
Save