Skip to content

Commit

Permalink
tweak the scripts so we can build the html5 client for CentOS 7 the s…
Browse files Browse the repository at this point in the history
…ame way
  • Loading branch information
totaam committed May 19, 2021
1 parent a98f3c5 commit 025fed2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 29 deletions.
42 changes: 27 additions & 15 deletions packaging/buildah/build_rpms.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash

DNF="${DNF:-dnf}"
dnf --version >& /dev/null
if [ "$?" == "0" ]; then
DNF="${DNF:-dnf}"
else
DNF="${DNF:-yum}"
fi

if [ `id -u` != "0" ]; then
if [ "${DNF}" == "dnf" ]; then
Expand All @@ -13,7 +18,7 @@ for dir in "./repo/SRPMS" "./repo/$ARCH"; do
echo "* (re)creating repodata in $dir"
mkdir $dir 2> /dev/null
rm -fr $dir/repodata
createrepo $dir > /dev/null
createrepo_c $dir > /dev/null
done

#if we are going to build xpra,
Expand Down Expand Up @@ -54,20 +59,22 @@ while read p; do
echo " $p"
SPECFILE="./rpm/$p.spec"
MISSING=""
rpmspec -q --rpms ${SPECFILE}
while read -r dep; do
MATCHES=`$DNF repoquery "$dep" --repo xpra-local-build 2> /dev/null | wc -l`
if [ "${MATCHES}" == "0" ]; then
#sometimes rpmspec gets confused,
#try to find the source package instead:
srcdep="${dep/$ARCH/src}"
MATCHES=`$DNF repoquery "$srcdep" --repo xpra-local-source 2> /dev/null | wc -l`
if [ "${MATCHES}" != "0" ]; then
echo " * found ${srcdep}"
fi
if [ "$DNF" == "yum" ]; then
MATCHES=`repoquery "$dep" --repoid=xpra-local-build 2> /dev/null | wc -l`
else
echo " * found ${dep}"
MATCHES=`$DNF repoquery "$dep" --repo xpra-local-build 2> /dev/null | wc -l`
if [ "${MATCHES}" == "0" ]; then
#sometimes rpmspec gets confused,
#try to find the source package instead:
srcdep="${dep/$ARCH/src}"
MATCHES=`$DNF repoquery "$srcdep" --repo xpra-local-source 2> /dev/null | wc -l`
fi
fi
if [ "${MATCHES}" == "0" ]; then
if [ "${MATCHES}" != "0" ]; then
echo " * found ${srcdep}"
else
echo " * missing ${dep}"
if [[ $dep == *debuginfo* ]]; then
echo " (ignored debuginfo)"
Expand All @@ -79,7 +86,12 @@ while read p; do
if [ ! -z "${MISSING}" ]; then
echo " need to rebuild $p to get:${MISSING}"
echo " - installing build dependencies"
$DNF builddep -y ${SPECFILE} > builddep.log
yum-builddep --version >& /dev/null
if [ "$?" == "0" ]; then
yum-builddep -y ${SPECFILE} > builddep.log
else
$DNF builddep -y ${SPECFILE} > builddep.log
fi
if [ "$?" != "0" ]; then
echo "-------------------------------------------"
echo "builddep failed:"
Expand All @@ -105,7 +117,7 @@ while read p; do
#update the local repo:
echo " - re-creating repository metadata"
for dir in "./repo/SRPMS" "./repo/$ARCH"; do
createrepo $dir >& createrepo.log
createrepo_c $dir >& createrepo.log
if [ "$?" != "0" ]; then
echo "-------------------------------------------"
echo "'createrepo $dir' failed"
Expand Down
37 changes: 23 additions & 14 deletions packaging/buildah/setup_build_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi
BUILDAH_DIR=`dirname $(readlink -f $0)`
pushd ${BUILDAH_DIR}

RPM_DISTROS=${RPM_DISTROS:-Fedora:32 Fedora:33 Fedora:34 CentOS:8}
RPM_DISTROS=${RPM_DISTROS:-Fedora:32 Fedora:33 Fedora:34 CentOS:7 CentOS:8}
for DISTRO in $RPM_DISTROS; do
DISTRO_LOWER="${DISTRO,,}"
if [[ "$DISTRO_LOWER" == "xx"* ]];then
Expand All @@ -35,6 +35,10 @@ for DISTRO in $RPM_DISTROS; do
if [ "$?" == "0" ]; then
continue
fi
PM="dnf"
if [ "${DISTRO}" == "CentOS:7" ]; then
PM="yum"
fi
echo
echo "********************************************************************************"
echo "creating ${IMAGE_NAME}"
Expand All @@ -57,29 +61,34 @@ for DISTRO in $RPM_DISTROS; do
buildah run $IMAGE_NAME dnf config-manager --set-disabled $repo
done
fi
buildah run $IMAGE_NAME dnf update -y
buildah run $IMAGE_NAME dnf install -y 'dnf-command(builddep)'
buildah run $IMAGE_NAME dnf install -y redhat-rpm-config rpm-build rpmdevtools createrepo_c rsync
buildah run $IMAGE_NAME $PM update -y
buildah run $IMAGE_NAME $PM install -y redhat-rpm-config rpm-build rpmdevtools createrepo_c rsync
if [ "${PM}" == "dnf" ]; then
buildah run $IMAGE_NAME dnf install -y 'dnf-command(builddep)'
fi
if [ "${MINIMAL}" == "0" ]; then
buildah run $IMAGE_NAME dnf install -y gcc gcc-c++ make cmake
buildah run $IMAGE_NAME ${PM} install -y gcc gcc-c++ make cmake
fi
if [[ "${DISTRO_LOWER}" == "fedora"* ]]; then
RNUM=`echo $DISTRO | awk -F: '{print $2}'`
dnf -y makecache --releasever=$RNUM --setopt=cachedir=/var/cache/dnf/$RNUM
buildah run $IMAGE_NAME dnf install -y rpmspectool
buildah run $IMAGE_NAME ${PM} install -y rpmspectool
if [ "${MINIMAL}" == "0" ]; then
#these are required by the xpra-html5 build:
buildah run $IMAGE_NAME dnf install -y brotli js-jquery desktop-backgrounds-compat
buildah run $IMAGE_NAME ${PM} install -y brotli js-jquery desktop-backgrounds-compat
fi
else
#some of the packages we need for building are in the "PowerTools" repository:
buildah run $IMAGE_NAME dnf config-manager --set-enabled powertools
#no "rpmspectool" package on CentOS 8, use setuptools to install it:
buildah run $IMAGE_NAME dnf install -y python3-setuptools
buildah run $IMAGE_NAME easy_install-3.6 python-rpm-spec
#centos8:
if [ "${PM}" == "dnf" ]; then
#some of the packages we need for building are in the "PowerTools" repository:
buildah run $IMAGE_NAME dnf config-manager --set-enabled powertools
#no "rpmspectool" package on CentOS 8, use setuptools to install it:
buildah run $IMAGE_NAME dnf install -y python3-setuptools
buildah run $IMAGE_NAME easy_install-3.6 python-rpm-spec
fi
if [ "${MINIMAL}" == "0" ]; then
#these are required by the xpra-html5 build:
buildah run $IMAGE_NAME dnf install -y brotli centos-backgrounds centos-logos
buildah run $IMAGE_NAME ${PM} install -y brotli centos-backgrounds centos-logos
fi
fi
buildah run $IMAGE_NAME rpmdev-setuptree
Expand All @@ -88,7 +97,7 @@ for DISTRO in $RPM_DISTROS; do
buildah run $IMAGE_NAME mkdir -p "/src/repo/" "/src/rpm" "/src/debian" "/src/pkgs" "/usr/lib64/xpra/pkgconfig"
buildah config --workingdir /src $IMAGE_NAME
buildah copy $IMAGE_NAME "./xpra-build.repo" "/etc/yum.repos.d/"
buildah run $IMAGE_NAME createrepo "/src/repo/"
buildah run $IMAGE_NAME createrepo_c "/src/repo/"
if [ "${NVIDIA_CODECS}" == "1" ]; then
buildah copy $IMAGE_NAME "./nvenc-rpm.pc" "/usr/lib64/pkgconfig/nvenc.pc"
buildah copy $IMAGE_NAME "./cuda.pc" "/usr/lib64/pkgconfig/cuda.pc"
Expand Down

0 comments on commit 025fed2

Please sign in to comment.