68 lines
2.5 KiB
Bash
Executable File
68 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright (C) 2011-2015 OpenStack Foundation
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
#
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
# dib-lint: disable=setu setpipefail
|
|
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
set -x
|
|
fi
|
|
set -e
|
|
|
|
# Build up a list of packages to install by concatenating bindep lists
|
|
FALLBACKREPO=/opt/git/openstack-infra/project-config
|
|
FALLBACKFILE=jenkins/data/bindep-fallback.txt
|
|
PACKAGES=`git --git-dir=$FALLBACKREPO/.git show master:$FALLBACKFILE`
|
|
|
|
# NOTE(pabelanger): We currently don't gate on bindep.txt/other-requirements.txt
|
|
# for centos and fedora nodes. As such, we have no way to ensure this will
|
|
# not break DIB process. So we only run this for ubuntu-trusty.
|
|
# bindep.txt is new filename, other-requirements.txt is the old one. We should
|
|
# handle both for now.
|
|
if [ -f /usr/bin/apt-get ] ; then
|
|
for REPO in /opt/git/*/* ; do
|
|
BRANCHES=`git --git-dir=$REPO/.git branch -r | grep '^ origin/[^H]'`
|
|
for BRANCH in $BRANCHES ; do
|
|
for reqsfile in bindep.txt other-requirements.txt ; do
|
|
REQS=`git --git-dir=$REPO/.git show $BRANCH:$reqsfile 2>/dev/null \
|
|
|| true`
|
|
if [ -n "$REQS" ] ; then
|
|
PACKAGES=`echo -e "$PACKAGES\n$REQS" | sort -u`
|
|
fi
|
|
done
|
|
done
|
|
done
|
|
fi
|
|
|
|
PACKAGELIST=`echo "$PACKAGES" | /usr/bindep-env/bin/bindep -b -f - || true`
|
|
|
|
if [ -f /usr/bin/apt-get ] ; then
|
|
# --ignore-missing conflicts with set -e, so force it to be ok
|
|
apt-get -y --ignore-missing -d install $PACKAGELIST || true
|
|
elif [ -f /usr/bin/emerge ] ; then
|
|
# write out use config (won't install/fetch without it)
|
|
# This lays down install / compile time options needed for bindep to
|
|
# install / fetch the needed packages.
|
|
USE_FILE=/etc/portage/package.use/bindep.use
|
|
cat > $USE_FILE <<EOF
|
|
x11-libs/cairo X
|
|
x11-libs/gdk-pixbuf X
|
|
media-libs/gd truetype png fontconfig jpeg
|
|
EOF
|
|
emerge -q --fetchonly $PACKAGELIST || true
|
|
else
|
|
${YUM:-yum} install -y --downloadonly $PACKAGELIST
|
|
fi
|