2 # Tricks to install unavailable packages - used by install.sh and install-src.sh
4 # Copyright (C) 2011 Roland Mas
5 # Copyright (C) 2011 Olivier Berger - Institut Telecom
6 # Copyright (C) 2014 Inria (Sylvain Beucler)
7 # Copyright 2017-2018, Franck Villaume - TrivialDev
9 # This file is part of FusionForge. FusionForge is free software;
10 # you can redistribute it and/or modify it under the terms of the
11 # GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the Licence, or (at your option)
15 # FusionForge is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along
21 # with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 function backports_deb {
26 if grep -q ^8 /etc/debian_version; then
27 # Install Mediawiki from jessie-backport
28 if [ ! -f /etc/apt/sources.list.d/backports.list ]; then
29 echo 'deb http://archive.debian.org/debian jessie-backports main' \
30 > /etc/apt/sources.list.d/backports.list
32 if [ ! -f /etc/apt/apt.conf.d/10no--check-valid-until ]; then
33 echo 'Acquire::Check-Valid-Until "0";' \
34 > /etc/apt/apt.conf.d/10no--check-valid-until
39 function backport_rpm_from_fedora {
40 rebuild_one_rpm --enablefedora $*
43 function rebuild_rpm_from_centos {
44 rebuild_one_rpm --rebuild $*
47 function rebuild_one_rpm {
50 if [ "$1" = "--enablefedora" ] ; then
51 if [ "$2" = "mediawiki" ] ; then
52 enablefedsrc="--enablerepo=fedora-source"
54 enablefedsrc="--enablerepo=fedora-source --enablerepo=fedora-updates-source"
60 if [ "$1" = "--rebuild" ] ; then
66 if [ "$1" = "--source-package" ] ; then
79 if [ $rebuild = yes ] ; then
82 for i in $target $others ; do
83 if ! yum list $i >/dev/null 2>&1; then
90 if [ $rebuild_needed = yes ] ; then
91 yumdownloader $enablefedsrc --source $src
93 if [ -n "$DEPS" ]; then
97 for i in $src-*.src.rpm ; do
98 if [ $rebuild = yes ] || [ ! -e "$i.done" ] ; then
99 if [ $src = "mediawiki" ] ; then
100 rpm -i $src-*.src.rpm
102 sed -e 's/, php-pecl-jsonc//g' -i SPECS/mediawiki.spec
103 rpmbuild --define='_unpackaged_files_terminate_build 0' -ba SPECS/mediawiki.spec
106 rpmbuild --rebuild $src-*.src.rpm
111 if [ -n "$REMOVEDEPS" ] ; then
112 : yum remove -y $REMOVEDEPS
115 for i in $target $others ; do
118 for i in $target $others ; do
119 yum install -y ~/rpmbuild/RPMS/*/$i-[0-9]*.*.rpm || rpm -i ~/rpmbuild/RPMS/*/$i-[0-9]*.*.rpm
122 yum install -y $target $others
126 # TODO: compile in a different job and use mockbuild?
127 function backports_rpm {
130 # Fedora/RHEL/CentOS version:
131 os_version=$(rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release))
133 if ! rpm -q fedora-release >/dev/null; then
135 yum install -y epel-release
137 # Prepare manual backports
138 cat <<'EOF' > /etc/yum.repos.d/fedora-source.repo
141 failovermethod=priority
142 metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-22&arch=$basearch
146 name=Fedora 22 Updates
147 failovermethod=priority
148 metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f22&arch=$basearch
152 name=Fedora 22 - Source
153 failovermethod=priority
154 metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-source-22&arch=$basearch
157 [fedora-updates-source]
158 name=Fedora 22 Updates - Source
159 failovermethod=priority
160 metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-source-f22&arch=$basearch
165 # Speed-up by recreating 'fastestmirror' now partial cache
166 # (/var/cache/yum/x86_64/7/timedhost.txt)
169 yum install -y yum-utils # yumdownloader
170 if [ ! -e /usr/bin/rpmbuild ] ; then
171 yum install -y rpm-build
177 yum --enablerepo=epel -y install php-tidy
178 # php-htmlpurifier-htmlpurifier Requires, available in EPEL6 but not EPEL7
181 backport_rpm_from_fedora php-channel-htmlpurifier
185 # libnss-pgsql: no available package for RHEL; though it's available in Fedora
186 # (there's also http://yum.postgresql.org/8.4/redhat/rhel-5-x86_64/)
187 DEPS="xmlto gcc postgresql-devel"
189 backport_rpm_from_fedora libnss-pgsql
193 backport_rpm_from_fedora php-nusoap
197 backport_rpm_from_fedora php-htmlpurifier-htmlpurifier
199 DEPS="python-devel python-setuptools"
201 backport_rpm_from_fedora python-simpletal
203 DEPS="python2-devel python-paste python-paste-deploy python-simplejson python-testtools python-pygments"
205 backport_rpm_from_fedora loggerhead
209 backport_rpm_from_fedora mediawiki
211 mkdir -p /usr/src/fusionforge/build/RPMS/
212 cp -r ~/rpmbuild/RPMS/* /usr/src/fusionforge/build/RPMS/
214 # TODO: postfix: rebuild from RHEL/CentOS sources with pgsql enabled,
215 # so we can test mta-postfix
218 function suse_backport_from_fedora_rpm {
219 if [ ! -e "libnss-pgsql.done" ]; then
222 zypper in postgresql-devel
224 pkg=libnss-pgsql-1.5.0-0.24.beta.fc33.src.rpm
225 if ! test -f "$pkg"; then
226 wget https://ftp-stud.hs-esslingen.de/pub/fedora/linux/releases/33/Everything/source/tree/Packages/l/$pkg
228 patch -d / -p0 -i $PWD/autoinstall/libnss-pgsql-openSUSE-Leap-15.2.patch
229 rpmbuild -ba /usr/src/packages/SPECS/libnss-pgsql.spec
230 rpm -Uvh /usr/src/packages/RPMS/x86_64/libnss-pgsql-1.5.0-0.24.beta.x86_64.rpm
231 touch libnss-pgsql.done
236 function suse_check_release {
237 supported=$(. /etc/os-release; echo $VERSION | grep "15\.[0123]")
238 if test -z "$supported"; then
239 echo "unsupported openSUSE version"
244 function suse_install_repos {
245 has_repo=$(zypper lr | grep 'Apache:Modules' | sed 's, ,,g')
246 if test -z "$has_repo"; then
247 dist_path=$(. /etc/os-release; echo $PRETTY_NAME | sed 's, ,_,g')
248 zypper --gpg-auto-import-keys ar http://download.opensuse.org/repositories/Apache:/Modules/$dist_path/ Apache:Modules
250 has_repo=$(zypper lr | grep 'server:php:applications' | sed 's, ,,g')
251 if test -z "$has_repo"; then
252 dist_path=$(. /etc/os-release; echo $PRETTY_NAME | sed 's, ,_,g')
253 zypper --gpg-auto-import-keys ar http://download.opensuse.org/repositories/server:/php:/applications/$dist_path/ server:php:applications
257 function suse_install_rpms {
258 # Install build dependencies
261 for m in $modules; do
262 if ! rpm -q $m >/dev/null; then
263 instmods="$instmods $m"
266 if [ -n "$instmods" ] ; then
267 zypper --gpg-auto-import-keys install -y $instmods