File: builddeps

package info (click to toggle)
syslog-ng 4.8.1-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 20,440 kB
  • sloc: ansic: 177,631; python: 13,035; cpp: 11,611; makefile: 7,011; sh: 5,147; java: 3,651; xml: 3,344; yacc: 1,377; lex: 599; perl: 193; awk: 190; objc: 162
file content (241 lines) | stat: -rwxr-xr-x 8,272 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#!/bin/bash

. /dbld/functions.sh
DBLD_DIR=/dbld

YUM_INSTALL="yum install -y"
DNF_INSTALL="dnf install -y"
APT_INSTALL="apt-get install -y --no-install-recommends"

set -e
set -x

function update_packages() {
    case "${OS_DISTRIBUTION}" in
        centos|almalinux)
            yum update -y
            ;;
        debian|ubuntu)
            apt-get update
            apt-get upgrade -y
            ;;
        fedora)
            dnf upgrade -y
            ;;
    esac
}

function workaround_rpm_repos() {
    MIRROR_URL='https://ftp.halifax.rwth-aachen.de/fedora/linux'
    case "${OS_DISTRIBUTION}" in
        fedora)
            # Workaround for often getting 503 from mirrors.fedoraproject.org.
            sed -i -e "/baseurl/c\baseurl=${MIRROR_URL}/releases/\$releasever/Everything/\$basearch/os/" /etc/yum.repos.d/fedora.repo
            sed -i -e "/baseurl/c\baseurl=${MIRROR_URL}/updates/\$releasever/Everything/\$basearch/" /etc/yum.repos.d/fedora-updates.repo
            # we don't need h264 codecs
            sed -i -e "/enabled/c\enabled=0" /etc/yum.repos.d/fedora-cisco-openh264.repo
            ;;
    esac
}

# this function is run first and is responsible for installing stuff that is
# needed by this script _before_ installing packages from packages.manifest.
#
# NOTE: If at all possible don't put anything here.
function install_dbld_dependencies()
{
    case "${OS_DISTRIBUTION}" in
        centos|almalinux)
            $YUM_INSTALL yum-utils
            ;;
        debian|ubuntu)
            apt-get update
            $APT_INSTALL curl gnupg2
            ;;
        fedora)
            $DNF_INSTALL -y dnf-plugins-core
            ;;
    esac
}

function install_cmake() {
    CMAKE_VERSION=3.12.2
    CMAKE_SHORT_VERSION=$(echo ${CMAKE_VERSION} | cut -d"." -f1-2)
    download_target "https://cmake.org/files/v${CMAKE_SHORT_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.sh" /tmp/cmake.sh
    chmod +x /tmp/cmake.sh
    mkdir -p /opt/cmake
    /tmp/cmake.sh --skip-license --prefix=/opt/cmake/
    ln -s /opt/cmake/bin/cmake /usr/bin/cmake
    rm -rf /tmp/cmake.sh
}

function install_criterion() {
    CRITERION_VERSION=2.3.3

    download_target "https://github.com/Snaipe/Criterion/releases/download/v${CRITERION_VERSION}/criterion-v${CRITERION_VERSION}.tar.bz2" /tmp/criterion.tar.bz2
    cd /tmp/
    tar xvf /tmp/criterion.tar.bz2
    cd /tmp/criterion-v${CRITERION_VERSION}
    cmake -DCMAKE_INSTALL_PREFIX=/usr .
    make install
    ldconfig
    rm -rf /tmp/criterion.tar.bz2 /tmp/criterion-v${CRITERION_VERSION}

}

function set_jvm_paths() {
    find / -name 'libjvm.so' | sed 's@/libjvm.so@@g' | tee --append /etc/ld.so.conf.d/openjdk-libjvm.conf
    ldconfig
}

function install_gradle {
    GRADLE_VERSION=4.10
    download_target "https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip" /tmp/gradle.zip
    mkdir -p /opt/gradle
    unzip -d /opt/gradle /tmp/gradle.zip
    rm -rf /tmp/gradle.zip
    ln -s /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle /usr/bin/gradle
    find / -name 'libjvm.so' | sed 's@/libjvm.so@@g' | tee --append /etc/ld.so.conf.d/openjdk-libjvm.conf
    ldconfig
}

function install_pip2 {
    download_target "https://bootstrap.pypa.io/pip/2.7/get-pip.py" get-pip.py
    python2 get-pip.py
}

function download_target() {
    target=$1
    output=$2
    curl --location --insecure "$target" --output "$output"
}

function filter_packages_by_platform {
    FILENAME=$1
    grep -v "#" ${FILENAME} | grep -e "${IMAGE_PLATFORM}" -e "${OS_DISTRIBUTION}[^-]" | cut -d"[" -f1
}

function filter_pip_packages_by_platform_and_python_version {
    FILENAME=$1
    PYTHON_VERSION=$2
    grep -v "#" ${FILENAME} | grep -e "${IMAGE_PLATFORM}" -e "${OS_DISTRIBUTION}[^-]" | grep -e "${PYTHON_VERSION}" | cut -d"[" -f1
}

function add_copr_repo {

    # NOTE: we are removing dnf/yum plugins after enabling copr as they
    # install a couple of Python dependencies which then conflict with our
    # PIP installation later.
    case "${OS_DISTRIBUTION}" in
        centos|almalinux)
            $YUM_INSTALL yum-plugin-copr
            yum copr enable -y czanik/syslog-ng-githead
            case "${OS_DISTRIBUTION_CODE_NAME}" in
                8)
                    yum config-manager --set-enabled powertools
                    ;;
                9|stream9)
                    yum config-manager --set-enabled crb
                    ;;
                esac
            ;;
        fedora)
            $DNF_INSTALL -y dnf-plugins-core
            if [ "${OS_DISTRIBUTION_CODE_NAME}" = "rawhide" ]; then
                dnf5 install -y 'dnf5-command(copr)'
            fi
            dnf copr enable -y czanik/syslog-ng-githead
            ;;
    esac
}

function add_epel_repo {
    $YUM_INSTALL epel-release
}

function install_apt_packages {
    apt-get update -qq -o Acquire::CompressionTypes::Order::=gz
    filter_packages_by_platform $DBLD_DIR/packages.manifest | xargs -t $APT_INSTALL --yes
}

function install_debian_build_deps {
    DEBIAN_CONTROL_FILE="${DBLD_DIR}/extra-files/${IMAGE_PLATFORM}/packaging-debian-control"
    if ! [ -f ${DEBIAN_CONTROL_FILE} ]; then
        echo "install_debian_build_deps() called from dockerfile but without a Debian control file, make sure that control file is copied over to ${DEBIAN_CONTROL_FILE} by the prepare step"
        exit 1
    fi
    deb_run_build_command mk-build-deps -i ${DEBIAN_CONTROL_FILE} -t "apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends"
}

function install_rpm_build_deps {
    RPM_SPEC_FILE="${DBLD_DIR}/extra-files/${IMAGE_PLATFORM}/syslog-ng.spec"
    if ! [ -f ${RPM_SPEC_FILE} ]; then
        echo "install_rpm_build_deps() called from dockerfile but without a syslog-ng.spec file, make sure that control file is copied over to ${RPM_SPEC_FILE} by the prepare step"
        exit 1
    fi

    case "${OS_DISTRIBUTION}" in
        centos|almalinux)
            rpm_run_build_command yum-builddep -y ${RPM_SPEC_FILE}
            ;;
        fedora)
            rpm_run_build_command dnf builddep -y ${RPM_SPEC_FILE}
            ;;
    esac
}

function install_yum_packages {
    $YUM_INSTALL findutils
    filter_packages_by_platform $DBLD_DIR/packages.manifest | xargs $YUM_INSTALL
}

function install_pip_packages {
    local python_executables="python2 python3"
    for python_executable in ${python_executables}; do
        local pip_install="${python_executable} -m pip install --ignore-installed --no-cache-dir --upgrade"
        ${pip_install} "pip"
        ${pip_install} "setuptools<66.0"
        filter_pip_packages_by_platform_and_python_version $DBLD_DIR/pip_packages.manifest ${python_executable} | xargs ${pip_install}
    done
}

function install_lsb_release {
    apt-get update && $APT_INSTALL lsb-release
}

function enable_dbgsyms {
    install_lsb_release
    case "${OS_DISTRIBUTION}" in
        ubuntu)
            echo "deb http://ddebs.ubuntu.com ${OS_DISTRIBUTION_CODE_NAME} main restricted universe multiverse" | tee -a /etc/apt/sources.list.d/ddebs.list
            echo "deb http://ddebs.ubuntu.com ${OS_DISTRIBUTION_CODE_NAME}-updates main restricted universe multiverse" | tee -a /etc/apt/sources.list.d/ddebs.list
            apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 428D7C01 C8CAB6595FDFF622
            ;;
        debian)
            echo "deb http://deb.debian.org/debian-debug/ ${OS_DISTRIBUTION_CODE_NAME}-debug main" | tee -a /etc/apt/sources.list
            echo "deb http://deb.debian.org/debian-debug/ ${OS_DISTRIBUTION_CODE_NAME}-proposed-updates-debug main" | tee -a /etc/apt/sources.list
            ;;
    esac
}

function install_perf {
    case "${OS_DISTRIBUTION}" in
        ubuntu)
            apt-cache search linux-tools | grep 'linux-tools-.*-generic' | cut -d" " -f1 | tail -n1 | cut -d"-" -f1-4 | xargs $APT_INSTALL
            ;;
    esac
}

function install_bison_from_source {
    BISON_VERSION=3.7.6
    cd /tmp
    download_target https://ftp.gnu.org/gnu/bison/bison-${BISON_VERSION}.tar.gz /tmp/bison-${BISON_VERSION}.tar.gz
    tar xvfz /tmp/bison-${BISON_VERSION}.tar.gz
    cd /tmp/bison-${BISON_VERSION}
    ./configure --prefix=/usr/local --disable-nls
    make && make install
}


# DO NOT REMOVE!
"$@"