update buildsystem

master
Marc Wäckerlin 6 years ago
parent 0d2baabf8c
commit 4528cd8d78
  1. 38
      build-in-docker.sh
  2. 2
      mac-create-app-bundle.sh
  3. 6
      resolve-rpmbuilddeps.sh
  4. 2
      src/mrw/string.hxx

@ -200,11 +200,25 @@ function ifthenelse() {
arg="$1" arg="$1"
shift shift
cmd="$*" cmd="$*"
DISTRIBUTOR=$(docker exec ${DOCKER_ID} lsb_release -si | sed 's, .*,,' | tr [:upper:] [:lower:]) DISTRIBUTOR=$(docker exec ${DOCKER_ID} lsb_release -si | sed 's, .*,,;s,.*,\L&,g')
CODENAME=$(docker exec ${DOCKER_ID} lsb_release -cs) CODENAME=$(docker exec ${DOCKER_ID} lsb_release -cs)
ARCH=$((docker exec ${DOCKER_ID} which dpkg > /dev/null 2> /dev/null && docker exec ${DOCKER_ID} dpkg --print-architecture) || echo amd64) ARCH=$((docker exec ${DOCKER_ID} which dpkg > /dev/null 2> /dev/null && docker exec ${DOCKER_ID} dpkg --print-architecture) || echo amd64)
case "$DISTRIBUTOR" in
(opensuse) # code name may be not available, then set leap or tumbleweed
if test "$CODENAME" = "n/a"; then
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')
fi
;;
(fedora|mageia) # numeric code name
CODENAME=$(docker exec ${DOCKER_ID} lsb_release -rs)
;;
(centos) # only look at major number in centos
CODENAME=$(docker exec ${DOCKER_ID} lsb_release -rs | sed 's,\..*,,')
;;
esac
if test "${arg/:::/}" = "${arg}"; then if test "${arg/:::/}" = "${arg}"; then
docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${arg//@DISTRIBUTOR@/${DISTRIBUTOR}}}" cmd_tmp="${cmd//ARG/${arg//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}"
else else
os="${arg%%:::*}" os="${arg%%:::*}"
thenpart="${arg#*:::}" thenpart="${arg#*:::}"
@ -215,11 +229,13 @@ function ifthenelse() {
fi fi
if [[ "${DISTRIBUTOR}-${CODENAME}-${ARCH}" =~ ${os} ]]; then if [[ "${DISTRIBUTOR}-${CODENAME}-${ARCH}" =~ ${os} ]]; then
if test -n "${thenpart}"; then if test -n "${thenpart}"; then
docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${thenpart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" cmd_tmp="${cmd//ARG/${thenpart//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}"
fi fi
else else
if test -n "${elsepart}"; then if test -n "${elsepart}"; then
docker exec ${DOCKER_ID} bash -c "${cmd//ARG/${elsepart//@DISTRIBUTOR@/${DISTRIBUTOR}}}" cmd_tmp="${cmd//ARG/${elsepart//@DISTRIBUTOR@/${DISTRIBUTOR}}}"
docker exec ${DOCKER_ID} bash -c "${cmd_tmp//@CODENAME@/${CODENAME}}"
fi fi
fi fi
fi fi
@ -259,12 +275,12 @@ case "$mode" in
PREVENT='libpam-systemd policykit.* colord dconf-service' PREVENT='libpam-systemd policykit.* colord dconf-service'
docker exec ${DOCKER_ID} apt-get update ${OPTIONS} docker exec ${DOCKER_ID} apt-get update ${OPTIONS}
docker exec ${DOCKER_ID} apt-mark hold ${PREVENT} docker exec ${DOCKER_ID} apt-mark hold ${PREVENT}
docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS} #docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS}
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release wget || \ docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties software-properties-common apt-transport-https dpkg-dev lsb-release wget || \
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- software-properties-common apt-transport-https dpkg-dev lsb-release wget || \ docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- software-properties-common apt-transport-https dpkg-dev lsb-release wget || \
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties apt-transport-https dpkg-dev lsb-release wget; docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- python-software-properties apt-transport-https dpkg-dev lsb-release wget;
if [[ "${img}" =~ "ubuntu" ]]; then if [[ "${img}" =~ "ubuntu" ]]; then
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT} locales docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- locales
docker exec ${DOCKER_ID} locale-gen ${LANG} docker exec ${DOCKER_ID} locale-gen ${LANG}
docker exec ${DOCKER_ID} update-locale LANG=${LANG} docker exec ${DOCKER_ID} update-locale LANG=${LANG}
fi fi
@ -274,7 +290,7 @@ case "$mode" in
docker exec ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences" docker exec ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences"
done done
if test -n "${keys[@]}"; then # fix dependency bug in cosmic and stretch if test -n "${keys[@]}"; then # fix dependency bug in cosmic and stretch
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT} gnupg docker exec ${DOCKER_ID} apt-get install ${OPTIONS} ${PREVENT// /- }- gnupg
for key in "${keys[@]}"; do for key in "${keys[@]}"; do
wget -O- "$key" \ wget -O- "$key" \
| docker exec -i ${DOCKER_ID} apt-key add - | docker exec -i ${DOCKER_ID} apt-key add -
@ -286,7 +302,7 @@ case "$mode" in
docker exec ${DOCKER_ID} apt-get update ${OPTIONS} docker exec ${DOCKER_ID} apt-get update ${OPTIONS}
for package in "${packages[@]}"; do for package in "${packages[@]}"; do
ifthenelse "${package}" "apt-get install ${OPTIONS} ${PREVENT} ARG" ifthenelse "${package}" "apt-get install ${OPTIONS} ${PREVENT// /- }- ARG"
done done
for command in "${commands[@]}"; do for command in "${commands[@]}"; do
ifthenelse "${command}" "ARG" ifthenelse "${command}" "ARG"
@ -323,8 +339,8 @@ EOF
docker exec -i ${DOCKER_ID} rm rpm-key docker exec -i ${DOCKER_ID} rm rpm-key
done done
for repo in "${repos[@]}"; do for repo in "${repos[@]}"; do
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)) 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))
ifthenelse "${repo}" "${INSTALL_REPO} 'ARG'" ifthenelse "${repo}" "${INSTALL_REPO} ARG"
((++i)) ((++i))
done done
for package in "${packages[@]}"; do for package in "${packages[@]}"; do
@ -347,7 +363,7 @@ docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" ${h
# not supported in trusty and jessie # not supported in trusty and jessie
if test "$mode" = deb -a "${img//trusty/}" = "${img}" -a "${img//jessie/}" = "${img}"; then if test "$mode" = deb -a "${img//trusty/}" = "${img}" -a "${img//jessie/}" = "${img}"; then
if test "${targets//deb/}" != "${targets}" && ls *.deb > /dev/null 2> /dev/null; then if test "${targets//deb/}" != "${targets}" && ls *.deb > /dev/null 2> /dev/null; then
docker exec ${DOCKER_ID} bash -c "apt-get install ${OPTIONS} ${PREVENT} /workdir/*.deb" docker exec ${DOCKER_ID} bash -c "apt-get install ${OPTIONS} ${PREVENT// /- }- /workdir/*.deb"
fi fi
fi fi
if test "$mode" = rpm -a "${targets//rpm/}" != "${targets}"; then if test "$mode" = rpm -a "${targets//rpm/}" != "${targets}"; then

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

@ -97,12 +97,12 @@ fi
if test -n "${SCHROOTNAME}"; then if test -n "${SCHROOTNAME}"; then
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') 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')
if test -n "${FILES}${DEPS}"; then if test -n "${FILES// /}${DEPS// /}"; then
schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL} ${FILES} ${DEPS} schroot -c ${SCHROOTNAME} -u root -- ${INSTALL_TOOL} ${FILES} ${DEPS}
fi fi
else else
FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p') FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
if test -n "${FILES}${DEPS}"; then if test -n "${FILES// /}${DEPS// /}"; then
${INSTALL_TOOL} ${FILES} ${DEPS} ${INSTALL_TOOL} ${FILES} ${DEPS}
fi fi
fi fi
@ -112,7 +112,7 @@ if test -n "${SCHROOTNAME}"; then
else else
FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p') FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p')
fi fi
if test -n "${FILES}"; then if test -n "${FILES// /}"; then
echo "**** ERROR: Cannot install: " $FILES echo "**** ERROR: Cannot install: " $FILES
exit 1 exit 1
fi fi

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

Loading…
Cancel
Save