You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2021/06/15 16:37:13 UTC

[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #5938: Updates ATS builds for cache-config integration tests.

zrhoffman commented on a change in pull request #5938:
URL: https://github.com/apache/trafficcontrol/pull/5938#discussion_r651578171



##########
File path: cache-config/testing/docker/trafficserver/trafficserver.spec
##########
@@ -16,59 +17,70 @@
 # 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 -far %{src}/../traffic_server_jemalloc ..

Review comment:
       `-a` implies `-r`, so `cp -far` can be just `cp -fa`.

##########
File path: cache-config/testing/docker/trafficserver/run.sh
##########
@@ -18,32 +18,58 @@
 # 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
+# sets minimum defaults if these are undefined. These are normally defined in the
+# environment section of the GHA workflow see, '.github/workflows/cache-config-tests.yml'
+RHEL_VERSION="${RHEL_VERSION:-7}"
+ATS_VERSION="${ATS_VERSION:-8.1.x}"
+
+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 zlib && \
+    make -j && \
+    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

Review comment:
       This command substitution should be `$(nproc)` instead of using legacy backticks.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org