fix rpm build

master
Marc Wäckerlin 7 years ago
parent 99d8a1c375
commit 2efbf47a34
  1. 7
      ChangeLog
  2. 6
      ax_check_qt.m4
  3. 63
      ax_init_standard_project.m4
  4. 15
      bootstrap.sh
  5. 19
      build-in-docker.sh
  6. 62
      mac-create-app-bundle.sh
  7. 2
      resolve-debbuilddeps.sh
  8. 4
      resolve-rpmbuilddeps.sh
  9. 131
      template.sh
  10. 21
      webtester.spec.in

@ -1,3 +1,10 @@
2018-04-04 21:03
* [r113] ChangeLog, ax_init_standard_project.m4, bootstrap.sh,
build-in-docker.sh, mac-create-app-bundle.sh,
test/test-commands.wt:
updated build system
2017-07-28 09:29 2017-07-28 09:29
* [r112] COPYING, INSTALL, ax_check_qt.m4, * [r112] COPYING, INSTALL, ax_check_qt.m4,

@ -275,8 +275,10 @@ AC_DEFUN([AX_QT_NO_KEYWORDS], [
AC_DEFUN([AX_INIT_QT], [ AC_DEFUN([AX_INIT_QT], [
if test -n "${AX_ADDITIONAL_QT_RULES_HACK}"; then if test -n "${AX_ADDITIONAL_QT_RULES_HACK}"; then
test -f src/makefile.in && cat >> src/makefile.in <<EOF for f in $(find test examples src -name makefile.in); do
${AX_ADDITIONAL_QT_RULES_HACK} test -f "$f" && cat >> "$f" <<EOF
${AX_ADDITIONAL_QT_RULES_HACK}
EOF EOF
done
fi fi
]) ])

@ -1066,13 +1066,16 @@ AC_DEFUN([AX_CHECK_VALID_LD_FLAG], [
# Check if a package exists in the current distribution, if yes, require it # Check if a package exists in the current distribution, if yes, require it
# in debian/control.in append @DEB_DEPEND_IFEXISTS@ to Build-Depends # in debian/control.in append @DEB_DEPEND_IFEXISTS@ to Build-Depends
# if you pass a list, it will require the first matching, if any matches
# - parameter: # - parameter:
# $1 = package name # $1 = space separated list of package names
AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [ AC_DEFUN([AX_DEB_DEPEND_IFEXISTS], [
pkg="$1" for pkg in $1; do
if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then
DEB_DEPEND_IFEXISTS="${DEB_DEPEND_IFEXISTS}, ${pkg}" DEB_DEPEND_IFEXISTS="${DEB_DEPEND_IFEXISTS}, ${pkg}"
fi break
fi
done
]) ])
# require package in debian/control.in append @DEB_BUILD_DEPEND@ to Build-Depends # require package in debian/control.in append @DEB_BUILD_DEPEND@ to Build-Depends
@ -1109,17 +1112,19 @@ AC_DEFUN([AX_DEB_RESOLVE], [
# Check if a package exists in the current distribution, if yes, require it # Check if a package exists in the current distribution, if yes, require it
# in .spec.in append @RPM_DEPEND_IFEXISTS@ to Build-Depends # in .spec.in append @RPM_DEPEND_IFEXISTS@ to Build-Depends
# if you pass a list, it will require the first matching, if any matches
# - parameter: # - parameter:
# $1 = package name # $1 = space separated package names
AC_DEFUN([AX_RPM_DEPEND_IFEXISTS], [ AC_DEFUN([AX_RPM_DEPEND_IFEXISTS], [
pkg="$1" for pkg in $1; do
if (test -x /usr/bin/zypper && zypper search -x "$pkg" 1>&2 > /dev/null) || \
if (test -x /usr/bin/zypper && zypper search -x "$pkg" 1>&2 > /dev/null) || \ (test -x /usr/bin/dnf && dnf list -q "$pkg" 1>&2 > /dev/null) || \
(test -x /usr/bin/dnf && dnf list -q "$pkg" 1>&2 > /dev/null) || \ (test -x /usr/bin/yum && yum list -q "$pkg" 1>&2 > /dev/null) || \
(test -x /usr/bin/yum && yum list -q "$pkg" 1>&2 > /dev/null) || \ (test -x /usr/sbin/urpmq && urpmq "$pkg" 1>&2 > /dev/null); then
(test -x /usr/sbin/urpmq && urpmq "$pkg" 1>&2 > /dev/null); then RPM_DEPEND_IFEXISTS="${RPM_DEPEND_IFEXISTS}, ${pkg}"
RPM_DEPEND_IFEXISTS="${RPM_DEPEND_IFEXISTS}, ${pkg}" break
fi fi
done
]) ])
# require package in .spec.in append @RPM_BUILD_DEPEND@ to Build-Depends # require package in .spec.in append @RPM_BUILD_DEPEND@ to Build-Depends
@ -1160,36 +1165,23 @@ AC_DEFUN([AX_RPM_RESOLVE], [
# Check if a package exists in the current distribution, if yes, require it # Check if a package exists in the current distribution, if yes, require it
# in .spec.in append @ALL_DEPEND_IFEXISTS@ to Build-Depends # in .spec.in append @ALL_DEPEND_IFEXISTS@ to Build-Depends
# if you pass a list, it will require the first matching, if any matches
# - parameter: # - parameter:
# $1 = package name # $1 = space separated list of package names
AC_DEFUN([AX_ALL_DEPEND_IFEXISTS], [ AC_DEFUN([AX_ALL_DEPEND_IFEXISTS], [
pkg="$1" AX_DEB_DEPEND_IFEXISTS([$1])
if test -n "$(apt-cache policy -q ${pkg} 2> /dev/null)"; then AX_RPM_DEPEND_IFEXISTS([$1])
DEB_DEPEND_IFEXISTS="${DEB_DEPEND_IFEXISTS}, ${pkg}"
fi
if (test -x /usr/bin/zypper && zypper search -x "$pkg" 1>&2 > /dev/null) || \
(test -x /usr/bin/dnf && dnf list -q "$pkg" 1>&2 > /dev/null) || \
(test -x /usr/bin/yum && yum list -q "$pkg" 1>&2 > /dev/null) || \
(test -x /usr/sbin/urpmq && urpmq "$pkg" 1>&2 > /dev/null); then
RPM_DEPEND_IFEXISTS="${RPM_DEPEND_IFEXISTS}, ${pkg}"
fi
]) ])
# Check if a package exists in the current distribution, if yes, require it # Check if a package exists in the current distribution, if yes, require it
# in .spec.in append @ALL_DEPEND_IFEXISTS@ to Build-Depends # in .spec.in append @ALL_DEPEND_IFEXISTS@ to Build-Depends
# if you pass a list, it will require the first matching, if any matches
# - parameter: # - parameter:
# $1 = package name # $1 = package name
AC_DEFUN([AX_ALL_DEPEND_IFEXISTS_DEV], [ AC_DEFUN([AX_ALL_DEPEND_IFEXISTS_DEV], [
pkg="$1" pkgs="$1"
if test -n "$(apt-cache policy -q ${pkg}-dev 2> /dev/null)"; then AX_DEB_DEPEND_IFEXISTS([${pkgs// /-dev }-dev])
DEB_DEPEND_IFEXISTS="${DEB_DEPEND_IFEXISTS}, ${pkg}-dev" AX_RPM_DEPEND_IFEXISTS([${pkgs// /-devel }-devel])
fi
if (test -x /usr/bin/zypper && zypper search -x "$pkg"-devel 1>&2 > /dev/null) || \
(test -x /usr/bin/dnf && dnf list -q "$pkg"-devel 1>&2 > /dev/null) || \
(test -x /usr/bin/yum && yum list -q "$pkg"-devel 1>&2 > /dev/null) || \
(test -x /usr/sbin/urpmq && urpmq "$pkg"-devel 1>&2 > /dev/null); then
RPM_DEPEND_IFEXISTS="${RPM_DEPEND_IFEXISTS}, ${pkg}-devel"
fi
]) ])
# require package in .spec.in append @ALL_BUILD_DEPEND@ to Build-Depends # require package in .spec.in append @ALL_BUILD_DEPEND@ to Build-Depends
@ -1230,5 +1222,4 @@ AC_DEFUN([AX_OUTPUT], [
AX_RPM_RESOLVE AX_RPM_RESOLVE
AC_OUTPUT AC_OUTPUT
AC_MSG_NOTICE([configured for ${PACKAGE_NAME}-${VERSION}]) AC_MSG_NOTICE([configured for ${PACKAGE_NAME}-${VERSION}])
AC_MSG_NOTICE([configured for ${PACKAGE_NAME}-${VERSION}])
]) ])

@ -1678,7 +1678,7 @@ fi)
$(if testtag AX_RPM_DEPEND; then echo "Requires: @RPM_DEPEND@"; fi) $(if testtag AX_RPM_DEPEND; then echo "Requires: @RPM_DEPEND@"; fi)
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: which, pkgconfig, pandoc, gnupg, expect, ${VCSDEPENDS_RPM}make, automake, autoconf, rpm-build$( BuildRequires: which, pkgconfig, gnupg, expect, ${VCSDEPENDS_RPM}make, automake, autoconf, rpm-build$(
if testtag AX_USE_CXX; then if testtag AX_USE_CXX; then
echo -n ", binutils-devel, gcc-c++" echo -n ", binutils-devel, gcc-c++"
fi fi
@ -1700,13 +1700,17 @@ BuildRequires: lsb-release$(
echo -n ", libqt5-qtbase-devel, libqt5-qttools, libqt5-linguist-devel, libQt5WebKit5-devel libqt5-qtwebengine-devel libQt5WebKitWidgets-devel"; echo -n ", libqt5-qtbase-devel, libqt5-qttools, libqt5-linguist-devel, libQt5WebKit5-devel libqt5-qtwebengine-devel libQt5WebKitWidgets-devel";
fi) fi)
%else %else
%if 0%{?mageia}
BuildRequires: rpm-sign, lsb-release
$( $(
if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then
echo -n "BuildRequires: qt5-qtbase-devel, qt5-qttools-devel, qt5-qtwebkit-devel"; echo -n "BuildRequires: qtbase5-common-devel, qttools5, lib64qt5webkit-devel, lib64qt5webkitwidgets-devel";
fi) fi)
%if 0%{?mageia}
BuildRequires: rpm-sign, lsb-release
%else %else
$(
if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then
echo -n "BuildRequires: qt5-qtbase-devel, qt5-qttools-devel, qt5-qtwebkit-devel";
fi)
BuildRequires: rpm-sign, redhat-lsb BuildRequires: rpm-sign, redhat-lsb
%global debug_package %{nil} %global debug_package %{nil}
%endif %endif
@ -1715,6 +1719,9 @@ $(
if testtag AX_USE_DOXYGEN; then cat <<EOS if testtag AX_USE_DOXYGEN; then cat <<EOS
%if ! 0%{?centos} %if ! 0%{?centos}
BuildRequires: mscgen BuildRequires: mscgen
%if ! 0%{?mageia}
BuildRequires: pandoc
%endif
%endif %endif
EOS EOS
fi fi

@ -248,16 +248,18 @@ case $mode in
docker exec ${DOCKER_ID} update-locale LANG=${LANG} docker exec ${DOCKER_ID} update-locale LANG=${LANG}
fi fi
OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends' OPTIONS='-o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y --force-yes --no-install-suggests --no-install-recommends'
for f in 'libpam-systemd:amd64' 'policykit*' 'colord'; do PREVENT='libpam-systemd- policykit*- colord-'
for f in 'libpam-systemd' 'policykit*' 'colord'; do
docker exec ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences" docker exec ${DOCKER_ID} bash -c "echo 'Package: $f' >> /etc/apt/preferences"
docker exec ${DOCKER_ID} bash -c "echo 'Pin-Priority: -100' >> /etc/apt/preferences" docker exec ${DOCKER_ID} bash -c "echo 'Pin-Priority: -100' >> /etc/apt/preferences"
docker exec ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences" docker exec ${DOCKER_ID} bash -c "echo >> /etc/apt/preferences"
done done
docker exec ${DOCKER_ID} apt-get update ${OPTIONS} docker exec ${DOCKER_ID} apt-get update ${OPTIONS}
docker exec ${DOCKER_ID} apt-mark hold 'libpam-systemd' 'policykit*' 'colord'
docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS} docker exec ${DOCKER_ID} apt-get upgrade ${OPTIONS}
docker exec ${DOCKER_ID} apt-get install ${OPTIONS} 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} 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} 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;
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 -
@ -267,7 +269,7 @@ case $mode in
done done
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} 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"
@ -294,11 +296,14 @@ EOF
LSB_RELEASE=/usr/bin/lsb_release LSB_RELEASE=/usr/bin/lsb_release
fi fi
docker exec ${DOCKER_ID} ${INSTALL_TOOL} rpm-build automake libtool subversion gcc-c++ pkgconfig wget $LSB_RELEASE docker exec ${DOCKER_ID} ${INSTALL_TOOL} rpm-build automake libtool subversion gcc-c++ pkgconfig wget $LSB_RELEASE
if docker exec ${DOCKER_ID} test -x /usr/bin/dnf; then
docker exec ${DOCKER_ID} dnf install -y 'dnf-command(config-manager)'
fi
i=0 i=0
for key in "${keys[@]}"; do for key in "${keys[@]}"; do
wget -Orpm-key "$key" docker exec -i ${DOCKER_ID} wget -Orpm-key "$key"
docker exec -i ${DOCKER_ID} rpm --import rpm-key docker exec -i ${DOCKER_ID} rpm --import rpm-key
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 wget -O/etc/yum.repos.d/additional$i.repo) || (docker exec ${DOCKER_ID} test -x /usr/sbin/urpmi && echo false))

@ -7,7 +7,7 @@
## Parameters: ## Parameters:
## $1: name of the app-target ## $1: name of the app-target
## $2: name of the project ## $2: name of the project
## $3: installation source ## $3: package installation target
## ##
## 1 2 3 4 5 6 7 8 ## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890 ## 45678901234567890123456789012345678901234567890123456789012345678901234567890
@ -16,31 +16,33 @@ if test "$(uname -s)" != "Darwin"; then
echo "**** ERROR: run on Mac OS-X: $0" echo "**** ERROR: run on Mac OS-X: $0"
exit 1 exit 1
fi fi
test -n "$1"
test -n "$2" cd ${0%/*}
test -d "$3"
target="$(pwd)/${1}/Contents/MacOS" project=${2:-$(sed -n 's/ *m4_define *( *x_package_name, *\(.*\) *).*/\1/p' $(pwd)/configure.ac)}
apptarget=${1:-${project}.app}
sources=${3:-$(pwd)/usr}
test -n "$project"
test -d "$sources"
! test -e "$apptarget" || rm -rf "$apptarget"
target="$(pwd)/${apptarget}/Contents/MacOS"
echo "Creating $apptarget for $project from $sources"
# Step 1: create and fill app directory structure # Step 1: create and fill app directory structure
mkdir -p ${1}/Contents/{Resources,MacOS} mkdir -p ${apptarget}/Contents/{Resources,MacOS}
! test -d ${3}/bin || \ ! test -d ${sources}/bin || \
find ${3}/bin -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; find ${sources}/bin -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
executablefile=$(ls -1 ${1}/Contents/MacOS/ | head -1) executablefile=${apptarget}/Contents/MacOS/${project}
! test -d ${3}/lib || \ test -x $executablefile || executablefile=$(ls -1 ${apptarget}/Contents/MacOS/ | head -1)
find ${3}/lib -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/MacOS/ \; ! test -d ${sources}/lib || \
! test -d ${3}/share/${2} || \ find ${sources}/lib -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/MacOS/ \;
find ${3}/share/${2} -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \; ! test -d ${sources}/share/${project} || \
! test -d ${3}/share/${2} || rmdir ${3}/share/${2} find ${sources}/share/${project} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${3}/share || \ ! test -d ${sources}/share || \
find ${3}/share -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \; find ${sources}/share -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${3}/bin || rmdir ${3}/bin ! test -d ${sources} || \
! test -d ${3}/lib || rmdir ${3}/lib find ${sources} -mindepth 1 -maxdepth 1 -exec cp -a {} ${apptarget}/Contents/Resources/ \;
! test -d ${3}/share || rmdir ${3}/share
! test -d ${3} || \
find ${3} -mindepth 1 -maxdepth 1 -exec mv {} ${1}/Contents/Resources/ \;
! test -d ${3}/include || rm -r ${3}/include
! test -d ${3} || rmdir ${3}
! test -d ${1}/tmp || rm -r ${1}/tmp
# Step 2: copy qt plugins, if necessary # Step 2: copy qt plugins, if necessary
for f in ${QT_PLUGINS}; do for f in ${QT_PLUGINS}; do
@ -79,23 +81,23 @@ if test -n "${QTDIR}"; then
MENU_NIB=$(find ${QTDIR} -name .svn -o -name .git -prune -o -name qt_menu.nib -print \ MENU_NIB=$(find ${QTDIR} -name .svn -o -name .git -prune -o -name qt_menu.nib -print \
| head -1) | head -1)
if test -e "${MENU_NIB}"; then if test -e "${MENU_NIB}"; then
rsync -r "${MENU_NIB}" ${1}/Contents/Resources/ rsync -r "${MENU_NIB}" ${apptarget}/Contents/Resources/
test -d ${1}/Contents/Resources/qt_menu.nib test -d ${apptarget}/Contents/Resources/qt_menu.nib
fi fi
fi fi
# Step 5: copy or create info.plist # Step 5: copy or create info.plist
infoplist=$(find ${1}/Contents/Resources -name Info.plist) infoplist=$(find ${apptarget}/Contents/Resources -name Info.plist)
if test -f "${infoplist}"; then if test -f "${infoplist}"; then
mv "${infoplist}" ${1}/Contents/Info.plist cp -a "${infoplist}" ${apptarget}/Contents/Info.plist
else else
cat > ${1}/Contents/Info.plist <<EOF cat > ${apptarget}/Contents/Info.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>${2}</string> <string>${project}</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${executablefile##/}</string> <string>${executablefile##/}</string>
</dict> </dict>

@ -24,7 +24,7 @@ else
fi fi
function install() { function install() {
if ${SUDO} apt-get -y install $*; then if ${SUDO} apt-get install -y --force-yes --no-install-suggests --no-install-recommends $*; then
return 0 return 0
else else
return 1 return 1

@ -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}"; 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}"; then if test -n "${FILES}${DEPS}"; then
${INSTALL_TOOL} ${FILES} ${DEPS} ${INSTALL_TOOL} ${FILES} ${DEPS}
fi fi
fi fi

@ -1,81 +1,89 @@
#!/bin/bash -e #!/bin/bash -e
# template for bash scripts ##########################################################################################
#### template for bash scripts #### START BELOW ##########################################
##########################################################################################
############################################################################ begin logging
# check if stdout is a terminal...
if test -t 1; then
# see if it supports colors...
ncolors=$(tput colors)
if test -n "$ncolors" && test $ncolors -ge 8; then
bold="$(tput bold)"
underline="$(tput smul)"
standout="$(tput smso)"
normal="$(tput sgr0)"
black="$(tput setaf 0)"
red="$(tput setaf 1)"
green="$(tput setaf 2)"
yellow="$(tput setaf 3)"
blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
cyan="$(tput setaf 6)"
white="$(tput setaf 7)"
fi
fi
# internal use only
append_msg() { append_msg() {
if test $# -ne 0; then if test $# -ne 0; then
echo -en ":\e[0m \e[1m$*" echo -n ": ${bold}$*"
fi fi
echo -e "\e[0m" echo "${normal}"
} }
# write a notice # write a message
notice() { message() {
if test $# -eq 0; then if test $# -eq 0; then
return return
fi fi
echo -e "\e[1m$*\e[0m" 1>&3 echo "${bold}${white}$*${normal}" 1>&2
} }
# write error message # write a success message
error() { success() {
echo -en "\e[1;31merror" 1>&2 echo -n "${bold}${green}success" 1>&2
append_msg $* 1>&2
}
# write a notice
notice() {
echo -n "${bold}${yellow}notice" 1>&2
append_msg $* 1>&2 append_msg $* 1>&2
} }
# write a warning message # write a warning message
warning() { warning() {
echo -en "\e[1;33mwarning" 1>&2 echo -en "${bold}${red}warning" 1>&2
append_msg $* 1>&2 append_msg $* 1>&2
} }
# write a success message # write error message
success() { error() {
echo -en "\e[1;32msuccess" 1>&2 echo -en "${bold}${red}error" 1>&2
append_msg $* 1>&2 append_msg $* 1>&2
} }
# commandline parameter evaluation
while test $# -gt 0; do
case "$1" in
(--help|-h) less <<EOF
SYNOPSIS
$0 [OPTIONS]
OPTIONS
--help, -h show this help
DESCRIPTION
EOF
exit;;
(*) error "unknow option $1, try $0 --help"; exit 1;;
esac
if test $# -eq 0; then
error "missing parameter, try $0 --help"; exit 1
fi
shift;
done
# run a command, print the result and abort in case of error # run a command, print the result and abort in case of error
# option: --no-check: ignore the result, continue in case of error # option: --ignore: ignore the result, continue in case of error
run() { run() {
check=1 ignore=1
while test $# -gt 0; do while test $# -gt 0; do
case "$1" in case "$1" in
(--no-check) check=0;; (--ignore) ignore=0;;
(*) break;; (*) break;;
esac esac
shift; shift;
done done
echo -en "\e[1m-> running:\e[0m $* ..." echo -n "${bold}${yellow}running:${white} $*${normal}"
set +e
result=$($* 2>&1) result=$($* 2>&1)
res=$? res=$?
set -e
if test $res -ne 0; then if test $res -ne 0; then
if test $check -eq 1; then if test $ignore -eq 1; then
error "failed with return code: $res" error "failed with return code: $res"
if test -n "$result"; then if test -n "$result"; then
echo "$result" echo "$result"
@ -89,7 +97,7 @@ run() {
fi fi
} }
# error handler ############################################################################ error handler
function traperror() { function traperror() {
set +x set +x
local err=($1) # error status local err=($1) # error status
@ -97,13 +105,14 @@ function traperror() {
local linecallfunc="$3" local linecallfunc="$3"
local command="$4" local command="$4"
local funcstack="$5" local funcstack="$5"
IFS=" "
for e in ${err[@]}; do for e in ${err[@]}; do
if test -n "$e" -a "$e" != "0"; then if test -n "$e" -a "$e" != "0"; then
error "line $line - command '$command' exited with status: $e (${err[@]})" error "line $line - command '$command' exited with status: $e (${err[@]})"
if [ "${funcstack}" != "main" -o "$linecallfunc" != "0" ]; then if [ "${funcstack}" != "main" -o "$linecallfunc" != "0" ]; then
echo -n " ... error at ${funcstack} " echo -n " ... error at ${funcstack} " 1>&2
if [ "$linecallfunc" != "" ]; then if [ "$linecallfunc" != "" ]; then
echo -n "called at line $linecallfunc" echo -n "called at line $linecallfunc" 1>&2
fi fi
echo echo
fi fi
@ -117,5 +126,35 @@ function traperror() {
# catch errors # catch errors
trap 'traperror "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' ERR SIGINT INT TERM EXIT trap 'traperror "$? ${PIPESTATUS[@]}" $LINENO $BASH_LINENO "$BASH_COMMAND" "${FUNCNAME[@]}" "${FUNCTION}"' ERR SIGINT INT TERM EXIT
########################################################################################## ##########################################################################################
#### START HERE ##########################################################################
##########################################################################################
######################################################### commandline parameter evaluation
while test $# -gt 0; do
case "$1" in
(--help|-h) less <<EOF
SYNOPSIS
$0 [OPTIONS]
OPTIONS
--help, -h show this help
DESCRIPTION
EOF
exit;;
(*) error "unknow option $1, try $0 --help"; exit 1;;
esac
if test $# -eq 0; then
error "missing parameter, try $0 --help"; exit 1
fi
shift;
done
##################################################################################### Main

@ -11,17 +11,22 @@ BuildRequires: which, pkgconfig, gnupg, expect, subversion, make, automake, auto
#### os dependent definitions #### #### os dependent definitions ####
%if 0%{?suse_version} || 0%{?sles_version} %if 0%{?suse_version} || 0%{?sles_version}
BuildRequires: lsb-release, libqt5-qtbase-devel, libqt5-qttools, libQt5WebKit5-devel libqt5-qtwebengine-devel libQt5WebKitWidgets-devel BuildRequires: lsb-release, libqt5-qtbase-devel, libqt5-qttools, libqt5-linguist-devel, libQt5WebKit5-devel libqt5-qtwebengine-devel libQt5WebKitWidgets-devel
%else %else
BuildRequires: qt5-qtbase-devel, qt5-qttools-devel, qt5-qtwebkit-devel
%if 0%{?mageia} %if 0%{?mageia}
BuildRequires: rpm-sign, lsb-release BuildRequires: rpm-sign, lsb-release
BuildRequires: qtbase5-common-devel, qttools5, lib64qt5webkit-devel, lib64qt5webkitwidgets-devel
%else %else
BuildRequires: qt5-qtbase-devel, qt5-qttools-devel, qt5-qtwebkit-devel
BuildRequires: rpm-sign, redhat-lsb BuildRequires: rpm-sign, redhat-lsb
%global debug_package %{nil}
%endif %endif
%endif %endif
%if ! 0%{?centos} %if ! 0%{?centos}
BuildRequires: mscgen BuildRequires: mscgen
%if ! 0%{?mageia}
BuildRequires: pandoc
%endif
%endif %endif
%description %description
@ -47,14 +52,14 @@ rm -rf $RPM_BUILD_ROOT
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
/usr/bin/* /etc
/usr/share/applications/* /usr/bin
/usr/share/emacs
%config /usr/share/applications
/etc/* /usr/share/@PACKAGE_NAME@
%doc %doc
/usr/share /usr/share/doc

Loading…
Cancel
Save