You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by zr...@apache.org on 2021/06/18 00:36:43 UTC
[trafficcontrol] branch master updated: Modifies building ATS for
cache-config integration tests so that (#5938)
This is an automated email from the ASF dual-hosted git repository.
zrhoffman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 9944e7b Modifies building ATS for cache-config integration tests so that (#5938)
9944e7b is described below
commit 9944e7be15e92f88d5fabee9addb5d5e7c585796
Author: John J. Rushford <jr...@apache.org>
AuthorDate: Thu Jun 17 18:36:33 2021 -0600
Modifies building ATS for cache-config integration tests so that (#5938)
proper versions of openssl, cjose, and jansson are linked and
provided by the ATS rpm.
---
.github/workflows/cache-config-tests.yml | 5 +-
.../testing/docker/docker-compose-ats-build.yml | 11 +-
cache-config/testing/docker/docker-compose.yml | 4 +-
cache-config/testing/docker/ort_test/Dockerfile | 21 ++-
cache-config/testing/docker/ort_test/run.sh | 2 +-
.../.dependency_license} | 22 +--
.../testing/docker/trafficserver/Dockerfile | 130 ++++++++++++------
.../testing/docker/trafficserver/cjose.pic.patch | 10 ++
.../testing/docker/trafficserver/jansson.pic.patch | 9 ++
cache-config/testing/docker/trafficserver/run.sh | 123 +++++++++++------
.../traffic_server_jemalloc} | 32 ++---
.../docker/trafficserver/trafficserver-9.spec | 149 ---------------------
.../{trafficserver-8.spec => trafficserver.spec} | 69 +++++++---
13 files changed, 283 insertions(+), 304 deletions(-)
diff --git a/.github/workflows/cache-config-tests.yml b/.github/workflows/cache-config-tests.yml
index 6f396ea..63a1036 100644
--- a/.github/workflows/cache-config-tests.yml
+++ b/.github/workflows/cache-config-tests.yml
@@ -18,7 +18,8 @@
name: Traffic Control Cache Config integration tests
env:
- RHEL_VERSION: 7
+ RHEL_VERSION: 8
+ ATS_VERSION: 8.1.x
on:
push:
@@ -104,7 +105,7 @@ jobs:
with:
owner: apache
repo: trafficserver
- branch: 8.1.x
+ branch: ${{ env.ATS_VERSION }}
id: git-repo-sha
- name: Check Cache
id: ats-rpm-cache
diff --git a/cache-config/testing/docker/docker-compose-ats-build.yml b/cache-config/testing/docker/docker-compose-ats-build.yml
index 422f57c..219b473 100644
--- a/cache-config/testing/docker/docker-compose-ats-build.yml
+++ b/cache-config/testing/docker/docker-compose-ats-build.yml
@@ -18,7 +18,7 @@
#
---
-version: '2'
+version: '2.1'
volumes:
trafficcontrol:
@@ -28,10 +28,17 @@ services:
trafficserver_build:
environment:
- ATS_VERSION=8.1.x
+ - CJOSE_URL=https://github.com/cisco/cjose
+ - CJOSE_TAG=latest
+ - JANSSON_URL=https://github.com/akheron/jansson
+ - JANSSON_TAG=v2.11
+ - OPENSSL_URL=https://github.com/openssl/openssl
+ - OPENSSL_TAG=OpenSSL_1_1_1
+ - RUN_ATS_UNIT_TESTS=false
build:
context: ../../..
dockerfile: cache-config/testing/docker/trafficserver/Dockerfile
args:
- RHEL_VERSION: ${RHEL_VERSION:-7}
+ RHEL_VERSION: ${RHEL_VERSION:-8}
volumes:
- ../../..:/trafficcontrol:z
diff --git a/cache-config/testing/docker/docker-compose.yml b/cache-config/testing/docker/docker-compose.yml
index 019f3bc..f5d9215 100644
--- a/cache-config/testing/docker/docker-compose.yml
+++ b/cache-config/testing/docker/docker-compose.yml
@@ -27,7 +27,7 @@
#
---
-version: '2'
+version: '2.1'
volumes:
trafficcontrol:
@@ -81,6 +81,8 @@ services:
env_file:
- variables.env
build:
+ args:
+ RHEL_VERSION: ${RHEL_VERSION:-8}
context: .
dockerfile: ort_test/Dockerfile
depends_on:
diff --git a/cache-config/testing/docker/ort_test/Dockerfile b/cache-config/testing/docker/ort_test/Dockerfile
index 1e88c94..6d3ac7f 100644
--- a/cache-config/testing/docker/ort_test/Dockerfile
+++ b/cache-config/testing/docker/ort_test/Dockerfile
@@ -14,11 +14,6 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-############################################################
-# Dockerfile to build Traffic Server container images
-# as Edges for Traffic Control 1.4
-# Based on CentOS 6.6
-############################################################
# For cache, you may either use (RAM or disk) block devices or disk directories
# To use RAM block devices, pass them as /dev/ram0 and /dev/ram1 via `docker run --device`
@@ -28,15 +23,17 @@
# The recommended minimum size for each block devices is 1G.
# For example, `sudo modprobe brd rd_size=1048576 rd_nr=2`
-FROM centos:7
+ARG RHEL_VERSION=8
+FROM centos:${RHEL_VERSION}
+ARG RHEL_VERSION=8
+# Makes RHEL_VERSION available in later layers without needing to specify it again
+ENV RHEL_VERSION=$RHEL_VERSION
MAINTAINER dev@trafficcontrol.apache.org
-RUN yum install -y \
- https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm \
- epel-release initscripts postgresql13.x86_64 git gcc lua-5.1.4-15.el7 lua-devel-5.1.4-15.el7 \
- ImageMagick-c++-devel && \
- # jq is used in run.sh to update tc-fixtures.json with the ATS RPM version
- yum install -y jq
+RUN echo "Image Version: ${RHEL_VERSION}"
+
+RUN yum install -y epel-release && yum repolist && \
+ yum install -y initscripts git jq gcc lua
ADD ort_test/trafficcontrol-cache-config*.rpm /trafficcontrol-cache-config.rpm
RUN yum install -y /trafficcontrol-cache-config.rpm
diff --git a/cache-config/testing/docker/ort_test/run.sh b/cache-config/testing/docker/ort_test/run.sh
index c374ef5..0627177 100755
--- a/cache-config/testing/docker/ort_test/run.sh
+++ b/cache-config/testing/docker/ort_test/run.sh
@@ -70,7 +70,7 @@ fi
cd /ort-tests
go get -u ./...
cp /ort-tests/tc-fixtures.json /tc-fixtures.json
-ATS_RPM=`basename /yumserver/test-rpms/trafficserver-*.rpm |
+ATS_RPM=`basename /yumserver/test-rpms/trafficserver-[0-9]*.rpm |
gawk 'match($0, /trafficserver\-(.+)\.rpm$/, arr) {print arr[1]}'`
echo "ATS_RPM: $ATS_RPM"
diff --git a/cache-config/testing/docker/docker-compose-ats-build.yml b/cache-config/testing/docker/trafficserver/.dependency_license
similarity index 70%
copy from cache-config/testing/docker/docker-compose-ats-build.yml
copy to cache-config/testing/docker/trafficserver/.dependency_license
index 422f57c..d2754c3 100644
--- a/cache-config/testing/docker/docker-compose-ats-build.yml
+++ b/cache-config/testing/docker/trafficserver/.dependency_license
@@ -15,23 +15,9 @@
# specific language governing permissions and limitations
# under the License.
#
-#
-
----
-version: '2'
-
-volumes:
- trafficcontrol:
+# SPDX-License-Identifier: Apache-2.0
-services:
+# Patch files, cannot bear comments
+cjose.pic.patch, Apache-2.0
+jansson.pic.patch, Apache-2.0
- trafficserver_build:
- environment:
- - ATS_VERSION=8.1.x
- build:
- context: ../../..
- dockerfile: cache-config/testing/docker/trafficserver/Dockerfile
- args:
- RHEL_VERSION: ${RHEL_VERSION:-7}
- volumes:
- - ../../..:/trafficcontrol:z
diff --git a/cache-config/testing/docker/trafficserver/Dockerfile b/cache-config/testing/docker/trafficserver/Dockerfile
index 1969faa..e0e7805 100644
--- a/cache-config/testing/docker/trafficserver/Dockerfile
+++ b/cache-config/testing/docker/trafficserver/Dockerfile
@@ -17,54 +17,100 @@
###############################################################
# Dockerfile to build Traffic Server RPM
-# Based on CentOS 7 for ATS RPM ot match the ort_test
-# container running CentOS 7.
###############################################################
-ARG RHEL_VERSION=7
+ARG RHEL_VERSION=8
FROM centos:${RHEL_VERSION}
-ARG RHEL_VERSION=7
-ENV RHEL_VERSION="$RHEL_VERSION"
+ARG RHEL_VERSION=8
+# Makes RHEL_VERSION available in later layers without needing to specify it again
+ENV RHEL_VERSION=$RHEL_VERSION
+
+MAINTAINER dev@trafficcontrol.apache.org
+
VOLUME /atsbuild
-# install the required toolsets
+RUN echo "Image Version: ${RHEL_VERSION}"
+
+### Common for all sub-component builds
RUN set -o errexit; \
- if [[ "${RHEL_VERSION%%.*}" -le 7 ]]; then \
- yum -y install centos-release-scl; \
- enable_repo=''; \
- toolset_rpms='devtoolset-9'; \
- else \
- enable_repo='--enablerepo=powertools'; \
- toolset_rpms='gcc-toolset-9-gcc gcc-toolset-9-gcc-c++'; \
- fi; \
- yum -y $enable_repo install \
- autoconf \
- automake \
- curl \
- flex \
- git \
- hwloc \
- hwloc-devel \
- libtool \
- libcap \
- libcap-devel \
- lua \
- make \
- openssl \
- openssl-devel \
- pcre \
- pcre-devel \
- pkgconfig \
- python3 \
- redhat-rpm-config \
- rpm-build \
- tcl \
- tcl-devel \
- $toolset_rpms
+ if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \
+ rpm_gpg_key=RPM-GPG-KEY-centosofficial; \
+ yum install -y 'dnf-command(config-manager)'; \
+ yum config-manager --set-enabled powertools; \
+ else \
+ rpm_gpg_key="RPM-GPG-KEY-CentOS-${RHEL_VERSION%%.*}"; \
+ yum install -y deltarpm centos-release-scl-rh; \
+ yum-config-manager --enable rhel-server-rhscl-7-rpms; \
+ fi && \
+ rpm --import "/etc/pki/rpm-gpg/${rpm_gpg_key}" && \
+ rpm --import "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-${RHEL_VERSION%%.*}" && \
+ yum -y clean all && \
+ yum -y update ca-certificates && \
+ yum -y install \
+ git \
+ rpm-build \
+ rsync \
+ epel-release && \
+ yum -y clean all
+
+RUN if [[ ${RHEL_VERSION%%.*} -ge 8 ]]; then \
+ os_pkgs=( \
+ brotli \
+ brotli-devel \
+ curl \
+ gcc-toolset-9 \
+ gcc-toolset-9-runtime \
+ jansson \
+ jansson-devel \
+ libmaxminddb \
+ libmaxminddb-devel); \
+ os_toolset="gcc-toolset-9"; \
+ else \
+ os_pkgs=(devtoolset-9); \
+ fi \
+ && yum install -y \
+ ${os_pkgs[*]} \
+ autoconf \
+ automake \
+ expat-devel \
+ flex \
+ gcc-c++ \
+ glibc-devel \
+ hwloc \
+ hwloc-devel \
+ libcap-devel \
+ libcurl-devel \
+ libtool \
+ libuuid-devel \
+ lua-devel \
+ luajit-devel \
+ make \
+ man \
+ nano \
+ ncurses-devel \
+ nmap-ncat \
+ openssl \
+ openssl-devel \
+ pcre \
+ pcre-devel \
+ perl-Digest-SHA \
+ perl-ExtUtils-MakeMaker \
+ perl-URI \
+ pkgconfig \
+ python3 \
+ sudo \
+ tcl-devel \
+ zlib \
+ zlib-devel \
+ && yum clean all
+
+ADD traffic_server/plugins/astats_over_http /astats_over_http
-COPY cache-config/testing/docker/trafficserver/trafficserver-8.spec \
- cache-config/testing/docker/trafficserver/trafficserver-9.spec \
- cache-config/testing/docker/trafficserver/run.sh \
- /
+COPY cache-config/testing/docker/trafficserver/traffic_server_jemalloc \
+ cache-config/testing/docker/trafficserver/trafficserver.spec \
+ cache-config/testing/docker/trafficserver/cjose.pic.patch \
+ cache-config/testing/docker/trafficserver/jansson.pic.patch \
+ cache-config/testing/docker/trafficserver/run.sh \
+ /
CMD /run.sh
diff --git a/cache-config/testing/docker/trafficserver/cjose.pic.patch b/cache-config/testing/docker/trafficserver/cjose.pic.patch
new file mode 100644
index 0000000..394ed5d
--- /dev/null
+++ b/cache-config/testing/docker/trafficserver/cjose.pic.patch
@@ -0,0 +1,10 @@
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 659e1c0..b8da1c3 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,4 +1,4 @@
+-AM_CFLAGS =-std=gnu99 --pedantic -Wall -Werror -g -O2 -I$(top_builddir)/include
++AM_CFLAGS =-std=gnu99 --pedantic -Wall -Werror -g -O2 -I$(top_builddir)/include -fpic
+
+ lib_LTLIBRARIES=libcjose.la
+ libcjose_la_CPPFLAGS= -I$(topdir)/include
diff --git a/cache-config/testing/docker/trafficserver/jansson.pic.patch b/cache-config/testing/docker/trafficserver/jansson.pic.patch
new file mode 100644
index 0000000..67e58bf
--- /dev/null
+++ b/cache-config/testing/docker/trafficserver/jansson.pic.patch
@@ -0,0 +1,9 @@
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 5516927..118ea7c 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,3 +1,4 @@
++AM_CFLAGS = -fpic
+ EXTRA_DIST = jansson.def
+
+ include_HEADERS = jansson.h
diff --git a/cache-config/testing/docker/trafficserver/run.sh b/cache-config/testing/docker/trafficserver/run.sh
index 7e98d66..cbefad0 100755
--- a/cache-config/testing/docker/trafficserver/run.sh
+++ b/cache-config/testing/docker/trafficserver/run.sh
@@ -18,32 +18,55 @@
# under the License.
#
-function initBuildArea() {
- cd /root
-
- # prep build environment
- [ -e rpmbuild ] && rm -rf rpmbuild
- [ ! -e rpmbuild ] || { echo "Failed to clean up rpm build directory 'rpmbuild': $?" >&2; exit 1; }
- mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SPECS,SOURCES,SRPMS} || { echo "Failed to create build directory '$RPMBUILD': $?" >&2;
- exit 1; }
+function die() {
+ { test -n "$@" && echo "$@"; exit 1; } >&2
}
-setowner() {
- own="$(stat -c%u:%g "$1")"
- shift
- chown -R "${own}" "$@"
-}
-trap 'exit_code=$?; setowner /trafficcontrol /trafficcontrol/dist; exit $exit_code' EXIT;
-
-case ${ATS_VERSION:0:1} in
- 8) cp /trafficserver-8.spec /trafficserver.spec
- ;;
- 9) cp /trafficserver-9.spec /trafficserver.spec
- ;;
- *) echo "Unknown trafficserver version was specified"
- exit 1
- ;;
-esac
+RHEL_VERSION="${RHEL_VERSION}"
+ATS_VERSION="${ATS_VERSION}"
+
+echo "RHEL_VERSION:${RHEL_VERSION}"
+echo "ATS_VERSION:${ATS_VERSION}"
+
+mkdir -p /opt/build
+cd /opt/build
+
+# build openssl 1.1.1 if RHEL_VERSION is not 8 or greater.
+if [[ ${RHEL_VERSION%%.*} -le 7 ]]; then
+ git clone $OPENSSL_URL --branch $OPENSSL_TAG || die "Failed to fetch the OpenSSL Source."
+ (
+ cd /opt/build/openssl &&
+ ./config --prefix=/opt/trafficserver/openssl --openssldir=/opt/trafficserver/openssl zlib &&
+ make -j$(nproc) && make install_sw
+ ) || die "Failed to build OpenSSL"
+ cjose_openssl='--with-openssl=/opt/trafficserver/openssl'
+ rpmbuild_openssl='--with openssl_included'
+else
+ cjose_openssl=''
+ rpmbuild_openssl='--without openssl_included'
+fi
+
+# Build jansson
+(
+ git clone $JANSSON_URL --branch $JANSSON_TAG
+ cd /opt/build/jansson && patch -p1 < /jansson.pic.patch &&
+ autoreconf -i && ./configure --enable-shared=no && make -j &&
+ make install
+) || die "Failed to install jansson from source."
+
+# Build and install cjose
+(
+ git clone $CJOSE_URL --branch $CJOSE_TAG
+ cd /opt/build/cjose && patch -p1 < /cjose.pic.patch &&
+ autoreconf -i && ./configure --enable-shared=no \
+ ${cjose_openssl} && make -j$(nproc) && make install
+) || die "Falled to build cjose from source."
+
+# prep build environment
+cd /root
+[ -e rpmbuild ] && rm -rf rpmbuild
+[ ! -e rpmbuild ] || { echo "Failed to clean up rpm build directory 'rpmbuild': $?" >&2; exit 1; }
+mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SPECS,SOURCES,SRPMS} || die "Failed to initialize the build environment"
echo "Building a RPM for ATS version: $ATS_VERSION"
@@ -51,24 +74,49 @@ echo "Building a RPM for ATS version: $ATS_VERSION"
id ats &>/dev/null || /usr/sbin/useradd -u 176 -r ats -s /sbin/nologin -d /
# setup the environment to use the devtoolset-9 tools.
-if [[ "${RHEL_VERSION%%.*}" -le 7 ]]; then \
+if [[ "${RHEL_VERSION%%.*}" -le 7 ]]; then
source scl_source enable devtoolset-9
else
source scl_source enable gcc-toolset-9
fi
-initBuildArea
+cd /root
+# prep build environment
+[ -e rpmbuild ] && rm -rf rpmbuild
+[ ! -e rpmbuild ] || { echo "Failed to clean up rpm build directory 'rpmbuild': $?" >&2; exit 1; }
+mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SPECS,SOURCES,SRPMS} || die "Failed to create build directory '$RPMBUILD': $?"
cd /root/rpmbuild/SOURCES
# clone the trafficserver repo
-git clone https://github.com/apache/trafficserver.git
+git clone https://github.com/apache/trafficserver.git --branch $ATS_VERSION || die "Failed to fetch the ATS Source"
+cp /traffic_server_jemalloc .
+
+# patch in the astats plugin
+(cp -fa /astats_over_http /root/rpmbuild/SOURCES/trafficserver/plugins/astats_over_http
+
+cat > /root/rpmbuild/SOURCES/trafficserver/plugins/astats_over_http/Makefile.inc <<MAKEFILE
+pkglib_LTLIBRARIES += astats_over_http/astats_over_http.la
+astats_over_http_astats_over_http_la_SOURCES = astats_over_http/astats_over_http.c
+MAKEFILE
+
+ex /root/rpmbuild/SOURCES/trafficserver/plugins/Makefile.am << ED
+/stats_over_http/
+a
+include astats_over_http/Makefile.inc
+.
+wq
+ED
+) || die "Failed to patch in astats_over_http"
-# build trafficserver version 9
+# build a trafficserver RPM
rm -f /root/rpmbuild/RPMS/x86_64/trafficserver-*.rpm
cd trafficserver
-git fetch --all
-git checkout $ATS_VERSION
-rpmbuild -bb /trafficserver.spec
+
+if [[ ${RUN_ATS_UNIT_TESTS} == true ]]; then
+ rpmbuild -bb ${rpmbuild_openssl} /trafficserver.spec --define 'run_unit_tests 1' || die "Failed to build the ATS RPM."
+else
+ rpmbuild -bb ${rpmbuild_openssl} /trafficserver.spec || die "Failed to build the ATS RPM."
+fi
echo "Build completed"
@@ -76,12 +124,7 @@ if [[ ! -d /trafficcontrol/dist ]]; then
mkdir /trafficcontrol/dist
fi
-case ${ATS_VERSION:0:1} in
- 8) cp /root/rpmbuild/RPMS/x86_64/trafficserver-8*.rpm /trafficcontrol/dist
- ;;
- 9) cp /root/rpmbuild/RPMS/x86_64/trafficserver-8*.rpm /trafficcontrol/dist
- ;;
- *) echo "Unknown trafficserver version was specified"
- exit 1
- ;;
-esac
+cp /root/rpmbuild/RPMS/x86_64/trafficserver*.rpm /trafficcontrol/dist ||
+ die "Failed to copy the ATS RPM to the dist directory"
+
+echo "trafficserver RPM has been copied"
diff --git a/cache-config/testing/docker/docker-compose-ats-build.yml b/cache-config/testing/docker/trafficserver/traffic_server_jemalloc
old mode 100644
new mode 100755
similarity index 55%
copy from cache-config/testing/docker/docker-compose-ats-build.yml
copy to cache-config/testing/docker/trafficserver/traffic_server_jemalloc
index 422f57c..fc5b650
--- a/cache-config/testing/docker/docker-compose-ats-build.yml
+++ b/cache-config/testing/docker/trafficserver/traffic_server_jemalloc
@@ -1,3 +1,5 @@
+#!/bin/sh
+
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -15,23 +17,21 @@
# specific language governing permissions and limitations
# under the License.
#
-#
+# SPDX-License-Identifier: Apache-2.0
----
-version: '2'
+# This file is a simple shim that configures some basic profiling for
+# traffic_server in jemalloc. If you use it, you'll want to adjust the values
+# in MALLOC_CONF to meet your specific needs. (man jemalloc for details.)
-volumes:
- trafficcontrol:
+# To use this, set your traffic server binary parameter to be this file instead
+# of traffic_server.
-services:
+prefix=/usr
+exec_prefix=/usr
+libdir=/usr/lib64
- trafficserver_build:
- environment:
- - ATS_VERSION=8.1.x
- build:
- context: ../../..
- dockerfile: cache-config/testing/docker/trafficserver/Dockerfile
- args:
- RHEL_VERSION: ${RHEL_VERSION:-7}
- volumes:
- - ../../..:/trafficcontrol:z
+MALLOC_CONF="prof:true,prof_prefix:/tmp/jeprof.out,lg_prof_interval:33,lg_prof_sample:20"
+LD_PRELOAD=${libdir}/libjemalloc.so.2
+export LD_PRELOAD
+export MALLOC_CONF
+/opt/trafficserver/bin/traffic_server $@
diff --git a/cache-config/testing/docker/trafficserver/trafficserver-9.spec b/cache-config/testing/docker/trafficserver/trafficserver-9.spec
deleted file mode 100644
index 458584d..0000000
--- a/cache-config/testing/docker/trafficserver/trafficserver-9.spec
+++ /dev/null
@@ -1,149 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-#
-# SPDX-License-Identifier: Apache-2.0
-
-%global src %{_topdir}/SOURCES/trafficserver
-%global git_args --git-dir="%{src}/.git" --work-tree="%{src}"
-%global git_tag %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\1/' | sed 's/-/_/')
-%global distance %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\2/')
-%global commit %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\3/')
-%global git_serial %(git %{git_args} rev-list HEAD | wc -l)
-%global install_prefix "/opt"
-%global api_stats "4096"
-%global _find_debuginfo_dwz_opts %{nil}
-
-%global min_tag 9.0.0
-%global tag %(echo -e '%{min_tag}\\n%{git_tag}' | sort | tail -n 1 )
-
-Name: trafficserver
-Version: %{tag}
-Epoch: %{git_serial}
-Release: %{distance}.%{commit}%{?dist}
-Summary: Apache Traffic Server
-Packager: ORT integration tests.
-Vendor: IPCDN
-Group: Applications/Communications
-License: Apache License, Version 2.0
-URL: https://github.com/apache/trafficcontrol
-BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-Requires: tcl, hwloc, pcre, libcap, brotli, libmaxminddb, openssl
-BuildRequires: autoconf, automake, libtool, pcre, libcap-devel, pcre-devel
-%{?el7:BuildRequires: devtoolset-9}
-%{?el8:BuildRequires: gcc-toolset-9-gcc, gcc-toolset-9-gcc-c++}
-Source: trafficserver
-
-%description
-Apache Traffic Server with Comcast modifications and environment specific modifications
-
-%prep
-%setup -c -T
-cp -far %{src}/. .
-autoreconf -vfi
-
-%build
-./configure --with-openssl=/usr --prefix=%{install_prefix}/%{name} --with-user=ats --with-group=ats --with-build-number=%{release} --enable-experimental-plugins --with-max-api-stats=%{api_stats} --disable-unwind
-make %{?_smp_mflags}
-make %{?_smp_mflags}
-
-%install
-make DESTDIR=$RPM_BUILD_ROOT install
-# WARNING! Don't build a RPM on a 'real' (ats server) box
-# Totally ghetto, but ATS build scripts aren't RPM (DESTDIR=$RPM_BUILD_ROOT, etc) compliant
-# ..so why haven't we fixed them? VSSCDNENG-767
-
-mkdir -p $RPM_BUILD_ROOT/opt/trafficserver/etc/trafficserver/snapshots
-mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system
-cp rc/trafficserver.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%pre
-id ats &>/dev/null || /usr/sbin/useradd -u 176 -r ats -s /sbin/nologin -d /
-
-%post
-/bin/systemctl daemon-reload
-/bin/systemctl enable trafficserver
-
-%preun
-/bin/systemctl stop trafficserver
-
-# if 0 uninstall, if 1 upgrade
-if [ "$1" = "0" ]; then
- /bin/systemctl disable trafficserver
-fi
-
-%postun
-# Helpful in understanding order of operations in relation to install/uninstall/upgrade:
-# https://fedoraproject.org/wiki/Packaging:Scriptlets
-
-# Always do this because the service file may have been updated.
-/bin/systemctl daemon-reload
-
-# if 0 uninstall, if 1 upgrade
-if [ "$1" = "0" ]; then
- id ats &>/dev/null && /usr/sbin/userdel ats
-fi
-
-%files
-%defattr(-,root,root)
-%attr(644,-,-) /usr/lib/systemd/system/trafficserver.service
-%dir /opt/trafficserver
-/opt/trafficserver/bin
-/opt/trafficserver/include
-/opt/trafficserver/lib
-/opt/trafficserver/libexec
-/opt/trafficserver/share
-%dir /opt/trafficserver/var
-%attr(-,ats,ats) /opt/trafficserver/var/trafficserver
-%dir /opt/trafficserver/var/log
-%attr(-,ats,ats) /opt/trafficserver/var/log/trafficserver
-%dir /opt/trafficserver/etc
-%attr(-,ats,ats) %dir /opt/trafficserver/etc/trafficserver
-%attr(-,ats,ats) %dir /opt/trafficserver/etc/trafficserver/snapshots
-/opt/trafficserver/etc/trafficserver/body_factory
-/opt/trafficserver/etc/trafficserver/trafficserver-release
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/cache.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/hosting.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/ip_allow.yaml
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/logging.yaml
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/parent.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/plugin.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/records.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/remap.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/sni.yaml
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/socks.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/splitdns.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/ssl_multicert.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/storage.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/strategies.yaml
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/volume.config
-
-%changelog
-* Wed Jun 8 2016 John Rushford <john_rushford(at)cable.comcast.com>
-- Added tools/rc_admin.pl to complete rpm tasks under both Enterprise Linux 6 or 7 using either chkconfig or systemd commands.
-- Modified this spec file to use rc_admin.pl
-* Wed Aug 7 2013 Jeff Elsloo <jeffrey_elsloo(at)cable.comcast.com>
-- Modified to support building 3.3.x
-- Modified to support upgrades
-* Sun Aug 12 2012 John Benton <john_benton(at)cable.comcast.com>
-- Initial RPM build based on SVN version 2376
-- Rev for ATS 3.2.0 based on SVN version 2470
-- Rev for ATS 3.2.0 based on SVN version 2555
-- Rev for ATS 3.2.0 based on SVN version 4812
diff --git a/cache-config/testing/docker/trafficserver/trafficserver-8.spec b/cache-config/testing/docker/trafficserver/trafficserver.spec
similarity index 65%
rename from cache-config/testing/docker/trafficserver/trafficserver-8.spec
rename to cache-config/testing/docker/trafficserver/trafficserver.spec
index aaab736..12a0b72 100644
--- a/cache-config/testing/docker/trafficserver/trafficserver-8.spec
+++ b/cache-config/testing/docker/trafficserver/trafficserver.spec
@@ -1,3 +1,4 @@
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -16,59 +17,77 @@
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
-#
+
%global src %{_topdir}/SOURCES/trafficserver
%global git_args --git-dir="%{src}/.git" --work-tree="%{src}"
-%global git_tag %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\1/' | sed 's/-/_/')
+%global tag %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\1/' | sed 's/-/_/')
%global distance %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\2/')
-%global commit %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\3/')
+%global commit %(git %{git_args} describe --long | sed 's/^\\\(.*\\\)-\\\([0-9]\\\+\\\)-g\\\([0-9a-f]\\\+\\\)$/\\\3/')
%global git_serial %(git %{git_args} rev-list HEAD | wc -l)
%global install_prefix "/opt"
%global api_stats "4096"
%global _find_debuginfo_dwz_opts %{nil}
-
-%global min_tag 8.1.0
-%global tag %(echo -e '%{min_tag}\\n%{git_tag}' | sort | tail -n 1 )
+%{!?_with_openssl_included: %{!?_without_openssl_included: %define _without_openssl_included --without-openssl_included}}
+%{?_with_openssl_included: %{?_without_openssl_included: %{error: both _with_openssl_included and _without_openssl_included}}}
+%{!?_with_openssl_included: %{!?_without_openssl_included: %{error: neither _with_openssl_included nor _without_openssl_included}}}
+%{?_without_openssl_included:BuildRequires: openssl-devel}
Name: trafficserver
Version: %{tag}
Epoch: %{git_serial}
Release: %{distance}.%{commit}%{?dist}
Summary: Apache Traffic Server
-Packager: ORT integration tests.
-Vendor: IPCDN
+Vendor: Apache
Group: Applications/Communications
License: Apache License, Version 2.0
-URL: https://github.com/apache/trafficcontrol
+URL: https://github.com/apache/trafficserver
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
-Requires: tcl, hwloc, pcre, libcap, brotli, libmaxminddb, openssl
-BuildRequires: autoconf, automake, libtool, pcre, libcap-devel, pcre-devel
-%{?el7:BuildRequires: devtoolset-9}
-%{?el8:BuildRequires: gcc-toolset-9-gcc, gcc-toolset-9-gcc-c++}
-Source: trafficserver
+Requires: tcl, hwloc, pcre, libcap
+BuildRequires: autoconf, automake, libtool, gcc-c++, glibc-devel, expat-devel, pcre, libcap-devel, pcre-devel, perl-ExtUtils-MakeMaker, tcl-devel, hwloc-devel
+Source: src
%description
-Apache Traffic Server with Comcast modifications and environment specific modifications
+Apache Traffic Server with Apache Traffic Control modifications and environment specific modifications
%prep
%setup -c -T
cp -far %{src}/. .
+cp -fa %{src}/../traffic_server_jemalloc ..
autoreconf -vfi
%build
-./configure --with-openssl=/usr --prefix=%{install_prefix}/%{name} --with-user=ats --with-group=ats --with-build-number=%{release} --enable-experimental-plugins --with-max-api-stats=%{api_stats} --disable-unwind
+%if %{?_with_openssl_included:1}%{!?_with_openssl_included:0}
+./configure --with-openssl=/opt/trafficserver/openssl --prefix=%{install_prefix}/%{name} --with-user=ats --with-group=ats --with-build-number=%{release} --enable-experimental-plugins --with-max-api-stats=%{api_stats} --disable-unwind
+%else
+./configure --prefix=%{install_prefix}/%{name} --with-user=ats --with-group=ats --with-build-number=%{release} --enable-experimental-plugins --with-max-api-stats=%{api_stats} --disable-unwind
+%endif
make %{?_smp_mflags}
-make %{?_smp_mflags}
+%if %{?_with_openssl_included:1}%{!?_with_openssl_included:0}
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/trafficserver/openssl/lib:/usr/local/lib
+%else
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
+%endif
+
+%check
+%if 0%{?run_unit_tests:1}
+echo "Running Trafficserver Unit tests ..."
+make %{?_smp_mflags} check || ( cat ./test-suite.log; exit 1 )
+%else
+echo "Skipping Trafficserver Unit tests"
+%endif
%install
make DESTDIR=$RPM_BUILD_ROOT install
-# WARNING! Don't build a RPM on a 'real' (ats server) box
-# Totally ghetto, but ATS build scripts aren't RPM (DESTDIR=$RPM_BUILD_ROOT, etc) compliant
-# ..so why haven't we fixed them? VSSCDNENG-767
mkdir -p $RPM_BUILD_ROOT/opt/trafficserver/etc/trafficserver/snapshots
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system
cp rc/trafficserver.service $RPM_BUILD_ROOT/usr/lib/systemd/system/
+cp ../traffic_server_jemalloc $RPM_BUILD_ROOT/opt/trafficserver/bin/
+
+%if %{?_with_openssl_included:1}%{!?_with_openssl_included:0}
+mkdir -p $RPM_BUILD_ROOT/opt/trafficserver/openssl
+cp -r /opt/trafficserver/openssl/lib $RPM_BUILD_ROOT/opt/trafficserver/openssl/lib
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
@@ -101,9 +120,13 @@ if [ "$1" = "0" ]; then
fi
%files
+%license LICENSE
%defattr(-,root,root)
%attr(644,-,-) /usr/lib/systemd/system/trafficserver.service
%dir /opt/trafficserver
+%if %{?_with_openssl_included:1}%{!?_with_openssl_included:0}
+/opt/trafficserver/openssl
+%endif
/opt/trafficserver/bin
/opt/trafficserver/include
/opt/trafficserver/lib
@@ -126,14 +149,18 @@ fi
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/plugin.config
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/records.config
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/remap.config
-%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/ssl_server_name.yaml
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/socks.config
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/splitdns.config
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/ssl_multicert.config
+%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/ssl_server_name.yaml
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/storage.config
%config(noreplace) %attr(644,ats,ats) /opt/trafficserver/etc/trafficserver/volume.config
%changelog
+* Wed Mar 10 2021 Jonathan Gray <jhg03a(at)apache.org>
+- Modified to support stop bundling openssl with ats
+* Wed Aug 26 2020 Chris Lemmons <alficles(at)gmail.com>
+- Updated to incorporate new tooling and Apache Traffic Control patches
* Wed Jun 8 2016 John Rushford <john_rushford(at)cable.comcast.com>
- Added tools/rc_admin.pl to complete rpm tasks under both Enterprise Linux 6 or 7 using either chkconfig or systemd commands.
- Modified this spec file to use rc_admin.pl