Skip to content

Commit 1acbec6

Browse files
build,salt: allow to pass a version constraint for packages
Instead of passing the exact version, we can now provide a constraint (<, >, <=, >=) if we don't need a specific version but we want to exclude some. Refs: #3387
1 parent a6978fe commit 1acbec6

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

buildchain/buildchain/versions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
SALT_VERSION : str = '3002.6'
2323
CONTAINERD_VERSION : str = '1.4.3'
2424
CONTAINERD_RELEASE : str = '2.el7'
25+
SOS_VERSION : str = '<4.0'
2526

2627
def load_version_information() -> None:
2728
"""Load version information from `VERSION`."""
@@ -331,7 +332,8 @@ def deb_full_name(self) -> str:
331332
PackageVersion(name='runc'),
332333
PackageVersion(name='salt-minion', version=SALT_VERSION),
333334
PackageVersion(name='socat'),
334-
PackageVersion(name='sos'), # TODO download built package dependencies
335+
# TODO download built package dependencies
336+
PackageVersion(name='sos', version=SOS_VERSION),
335337
PackageVersion(name='util-linux'),
336338
PackageVersion(name='xfsprogs'),
337339
),

salt/_modules/metalk8s_package_manager_yum.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ def check_pkg_availability(pkgs_info, exclude=None):
169169
for name, info in pkgs_info.items():
170170
pkg_name = name
171171
if info.get('version'):
172-
pkg_name += '-' + str(info['version'])
172+
pkg_name += "-" if info["version"][0].isgidit() else " "
173+
pkg_name += str(info['version'])
173174

174175
cmd = [
175176
'yum', 'install', pkg_name,
@@ -185,8 +186,9 @@ def check_pkg_availability(pkgs_info, exclude=None):
185186

186187
if ret['retcode'] != 0:
187188
raise CommandExecutionError(
188-
'Check availability of package {} failed: {}'.format(
189+
'Check availability of package {} failed:\n{}\n{}'.format(
189190
pkg_name,
190-
ret['stdout']
191+
ret['stdout'],
192+
ret['stderr'],
191193
)
192194
)

0 commit comments

Comments
 (0)