Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-16621 build: Fix Go versions in rpm/deb packaging (#15174) #15255

Open
wants to merge 6 commits into
base: release/2.6
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
daos (2.6.1-4) unstable; urgency=medium
daos (2.6.1-5) unstable; urgency=medium
[ Kris Jacque ]
* Bump minimum golang-go version to 1.21

-- Kris Jacque <kris.jacque@intel.com> Fri, 04 Oct 2024 15:13:00 -0700

daos (2.6.1-4) unstable; urgency=medium
[ Tomasz Gromadzki ]
* Add support of the PMDK package 2.1.0 with NDCTL enabled.
* Increase the default ULT stack size to 20KiB if the engine uses
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Build-Depends: debhelper (>= 10),
dpdk-dev (>= 21.11.2),
libisal-crypto-dev,
libcunit1-dev,
golang-go (>= 1.18),
golang-go (>= 2:1.21),
libboost-dev,
libspdk-dev (>= 22.01.2),
libipmctl-dev,
Expand Down Expand Up @@ -117,7 +117,7 @@ Depends: python (>=3.8), python3, python-yaml, python3-yaml,
${shlibs:Depends}, ${misc:Depends},
daos-client (= ${binary:Version}),
daos-admin (= ${binary:Version}),
golang-go (>=1.18),
golang-go (>= 2:1.21),
libcapstone-dev,
libndctl-dev,
libdaxctl-dev
Expand Down
27 changes: 22 additions & 5 deletions site_scons/site_tools/go_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
import re
import subprocess # nosec B404

from SCons.Script import Configure, Exit, File, GetOption, Glob, Scanner
from SCons.Script import Configure, Dir, Exit, File, GetOption, Glob, Scanner

GO_COMPILER = 'go'
MIN_GO_VERSION = '1.18.0'
include_re = re.compile(r'\#include [<"](\S+[>"])', re.M)


Expand Down Expand Up @@ -49,6 +48,17 @@ def _scan_go_file(node, env, _path):
return includes


def get_min_go_version():
"""Get go minimum version from go.mod"""
go_mod_path = os.path.join(Dir('#').abspath, "src", "control", "go.mod")
with open(go_mod_path, 'r') as f:
for line in f:
if line.startswith('go '): # e.g. "go 1.21"
parts = line.split()
return get_go_version("go" + parts[1])
return None


def get_go_version(output):
"""Capture only the version after 'go'"""
ver_re = re.compile(r'go([0-9\.]+)')
Expand Down Expand Up @@ -81,6 +91,13 @@ def _check_go_version(context):
context.Result(0)
return 0

context.Display('Getting minimum go version... ')
min_go_version = get_min_go_version()
if min_go_version is None:
context.Result('no minimum go version found in go.mod')
return 0
context.Display(min_go_version + '\n')

context.Display(f'Checking {env.d_go_bin} version... ')
cmd_rc = subprocess.run([env.d_go_bin, 'version'], check=True, stdout=subprocess.PIPE)
out = cmd_rc.stdout.decode('utf-8').strip()
Expand All @@ -93,11 +110,11 @@ def _check_go_version(context):
if go_version is None:
context.Result(f'failed to get version from "{out}"')
return 0
if len([x for x, y in
zip(go_version.split('.'), MIN_GO_VERSION.split('.'))
if len([x for x, y in zip(go_version.split('.'), min_go_version.split('.'))
if int(x) < int(y)]) > 0:
context.Result(f'{out} is too old (min supported: {MIN_GO_VERSION}) ')
context.Result(f'{out} is too old (min supported: {min_go_version}) ')
return 0

context.Result(go_version)
return 1

Expand Down
6 changes: 4 additions & 2 deletions src/control/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/daos-stack/daos/src/control

// NB: When updating minimum Go build version, don't forget to update:
// - rpm packaging version checks: utils/rpms/daos.spec
// - debian packaging version checks: debian/control
// Scons uses this file to extract the minimum version.
go 1.21

toolchain go1.22.3

require (
github.com/Jille/raft-grpc-transport v1.2.0
github.com/desertbit/grumble v1.1.3
Expand Down
3 changes: 3 additions & 0 deletions utils/docker/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/no-prompt
RUN echo "APT::Install-Recommends \"false\";" > /etc/apt/apt.conf.d/no-recommends
RUN apt-get update && \
apt-get upgrade && \
apt-get install gpg-agent software-properties-common && \
add-apt-repository ppa:longsleep/golang-backports && \
apt-get update && \
chmod +x /tmp/install.sh && \
/tmp/install.sh && \
apt-get clean all
Expand Down
6 changes: 4 additions & 2 deletions utils/rpms/daos.spec
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ BuildRequires: libyaml-devel
BuildRequires: libcmocka-devel
BuildRequires: valgrind-devel
BuildRequires: systemd
BuildRequires: go >= 1.17
BuildRequires: go >= 1.21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit late now I suppose since the master PR for this has already landed, but you could add a new %global go_version 1.21 after

%global libfabric_version 1.15.1-1
and then this would be:

Suggested change
BuildRequires: go >= 1.21
BuildRequires: go >= %{go_version}

and the same for

Requires: go >= 1.21
below so that you only have one place to have to update this.

Maybe next time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tip, Brian. Yeah, we should probably make that fix at the master level first.

BuildRequires: pciutils-devel
%if (0%{?rhel} >= 8)
BuildRequires: numactl-devel
Expand Down Expand Up @@ -218,7 +218,7 @@ Requires: dbench
Requires: lbzip2
Requires: attr
Requires: ior
Requires: go >= 1.18
Requires: go >= 1.21
%if (0%{?suse_version} >= 1315)
Requires: lua-lmod
Requires: libcapstone-devel
Expand Down Expand Up @@ -598,6 +598,8 @@ getent passwd daos_agent >/dev/null || useradd -s /sbin/nologin -r -g daos_agent
# No files in a shim package

%changelog
* Fri Oct 04 2024 Kris Jacque <kris.jacque@intel.com> 2.6.1-5
- Bump min supported go version to 1.21

* Wed Oct 02 2024 Tomasz Gromadzki <tomasz.gromadzki@intel.com> 2.6.1-4
- Add support of the PMDK package 2.1.0 with NDCTL enabled.
Expand Down
Loading