Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build-scripts/compile-options
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ export PROJECT
# Otherwise, we build it.
if [ -z "$SYSTEM_SSL" ]; then
# We don't bundle OpenSSL on some redhat-derived systems due to incompatability with libpam and our openssl.
_OS_MAJOR_VERSION="$(echo "$OS_VERSION" | cut -d. -f1)"
if [ "$OS" = "rhel" ] && expr "$_OS_MAJOR_VERSION" ">=" "8" >/dev/null; then
if [ "$OS" = "rhel" ] && [ "$OS_VERSION_MAJOR" -ge "8" ]; then
SYSTEM_SSL=1
fi
if [ "$OS" = "opensuse" ] || [ "$OS" = "sles" ]; then
if expr "$_OS_MAJOR_VERSION" ">=" "15"; then
if [ "$OS_VERSION_MAJOR" -ge "15" ]; then
SYSTEM_SSL=1
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/configure
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ yes)
esac

# RHEL 8 requires an SELinux policy
if [ "$OS" = "rhel" ] && [ "${OS_VERSION%\.*}" -gt "7" ]; then
if [ "$OS" = "rhel" ] && [ "$OS_VERSION_MAJOR" -ge "8" ]; then
var_append ARGS "--with-selinux-policy"
fi

Expand Down
14 changes: 10 additions & 4 deletions build-scripts/detect-environment
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ detect_cross_target() {
}

# This function exports operating system specific variables:
# - OS usually contains a specific distribution (e.g. Debian)
# - OS_VERSION operating system version (but is not always defined)
# - OS usually contains a specific distribution (e.g. Debian)
# - OS_VERSION operating system version (but is not always defined)
# - OS_VERSION_MAJOR the major (first part of) operating system version (defined if OS_VERSION is)
#
# Furthermore, the following variable is set, but it's not exported:
# - OS_FAMILY usually contains the kernel name (e.g. Linux)
# - OS_FAMILY usually contains the kernel name (e.g. Linux)
detect_os() {
case "$CROSS_TARGET" in
'')
Expand Down Expand Up @@ -106,8 +107,13 @@ detect_os() {
;;
esac

# Extract major version from OS_VERSION (e.g. 16.04 -> 16, 7.0 -> 7, 10.2.3 -> 10)
if [ -n "$OS_VERSION" ]; then
OS_VERSION_MAJOR="${OS_VERSION%%.*}"
fi

log_debug "Detected OS $OS $OS_VERSION"
export OS OS_VERSION
export OS OS_VERSION OS_VERSION_MAJOR
}

# The uname command does not reveal the specific distribution on Linux. Hence,
Expand Down
9 changes: 3 additions & 6 deletions build-scripts/package
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,12 @@ deb)
log_debug "Development DEB version: $DEB_VERSION"
fi

# Extract major version from OS_VERSION (e.g., 16.04 -> 16, 7.0 -> 7)
# This is appended to package name for OS-specific builds
# TODO: Define this in detect-environment script (CFE-4586)
os_version_major="${OS_VERSION%%.*}"
log_debug "OS version major: $os_version_major"
# The OS major version is appended to package name for OS-specific builds
log_debug "OS version major: $OS_VERSION_MAJOR"

# Generate debian changelog with version info
log_debug "Generating debian changelog"
sed -e "s/@@VERSION@@/$DEB_VERSION$safe_prefix.$OS$os_version_major/" "$BASEDIR/$PKG/pkg/debian/changelog.in" >"$BASEDIR/$PKG/pkg/debian/changelog"
sed -e "s/@@VERSION@@/$DEB_VERSION$safe_prefix.$OS$OS_VERSION_MAJOR/" "$BASEDIR/$PKG/pkg/debian/changelog.in" >"$BASEDIR/$PKG/pkg/debian/changelog"

# Generate debian package maintainer scripts
log_debug "Generating debian maintainer scripts"
Expand Down
6 changes: 2 additions & 4 deletions build-scripts/test-on-testmachine
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,11 @@ chroot)
ubuntu)
# gpg-agent sometimes is spawned on Ubuntu 24 during our tests.
# This happens only in chroot. Ignore that.
case "$OS_VERSION" in
24*)
if [ "$OS_VERSION_MAJOR" = "24" ]; then
if ps -o command --pid "$pid" | grep "gpg-agent --homedir /etc/apt/sources.list.d/.gnupg-temp --use-standard-socket --daemon"; then
continue
fi
;;
esac
fi
;;
esac

Expand Down
2 changes: 1 addition & 1 deletion deps-packaging/git/cfbuild-git.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mkdir -p %{_builddir}

case "$OS" in
rhel|centos)
if [ $(echo $OS_VERSION | cut -d. -f1) = 7 ]
if [ "$OS_VERSION_MAJOR" = "7" ]
then
# Fixes the following compilation error on rhel 7:
# 15:05:28 compat/posix.h:159:24: fatal error: sys/random.h: No such file or directory
Expand Down
2 changes: 1 addition & 1 deletion deps-packaging/openssl/cfbuild-openssl.spec
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fi
HACK_FLAGS=
if [ $OS = centos ] || [ $OS = rhel ]
then
if [ `echo $OS_VERSION | cut -d. -f1` = 4 ]
if [ "$OS_VERSION_MAJOR" = "4" ]
then
HACK_FLAGS=-D_GNU_SOURCE # CentOS 4 issue
fi
Expand Down
2 changes: 1 addition & 1 deletion deps-packaging/openssl/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ build-stamp:
fi ;\
\
HACK_FLAGS= ;\
if [ $$OS = debian ] && [ `echo $$OS_VERSION | cut -d. -f1` = 4 ] ;\
if [ $$OS = debian ] && [ $$OS_VERSION_MAJOR = 4 ] ;\
then \
HACK_FLAGS=-D_GNU_SOURCE ;\
fi ;\
Expand Down