Skip to content

Commit

Permalink
Update lmod 8.7.14
Browse files Browse the repository at this point in the history
This also updates tests/ci/run_build.py to continuously show the output
during CI runs.

Signed-off-by: Adrian Reber <[email protected]>
  • Loading branch information
adrianreber committed Nov 29, 2022
1 parent 358fbdf commit 783b246
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 57 deletions.
12 changes: 4 additions & 8 deletions components/admin/lmod/SPECS/lmod.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@

Summary: Lua based Modules (lmod)
Name: %{pname}%{PROJ_DELIM}
Version: 8.7.6
Release: 1%{?dist}
Version: 8.7.14
Release: %{?dist}.1
License: MIT
Group: %{PROJ_NAME}/admin
Url: https://github.com/TACC/Lmod
Source0: https://github.com/TACC/Lmod/archive/%{version}.tar.gz#$/%{pname}-%{version}.tar.gz

# Known dependencies
Requires: lua
Requires: tcl

BuildRequires: lua
BuildRequires: lua-devel
BuildRequires: rsync
BuildRequires: tcl tcl-devel
BuildRequires: tcl-devel
BuildRequires: gcc make bc

%if 0%{?rhel}
BuildRequires: lua-libs
Expand Down
106 changes: 57 additions & 49 deletions tests/ci/run_build.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env python3

import csv
import subprocess
import selectors
import logging
import shutil
import sys
import csv
import os
import io

logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)

Expand Down Expand Up @@ -40,35 +42,66 @@
dnf_based = True


def build_srpm_and_rpm(command, family=None):
def run_command(command):
logging.info("About to run command %s" % ' '.join(command))
result = subprocess.run(
process = subprocess.Popen(
command,
bufsize=1,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
)

buf = io.StringIO()

def handle_output(stream, mask):
line = stream.readline()
buf.write(line)
sys.stdout.write(line)

selector = selectors.DefaultSelector()
selector.register(
process.stdout,
selectors.EVENT_READ,
handle_output,
)
if result.returncode != 0:

while process.poll() is None:
events = selector.select()
for key, mask in events:
callback = key.data
callback(key.fileobj, mask)

return_code = process.wait()
selector.close()

output = buf.getvalue()
buf.close()

return ((return_code == 0), output)


def build_srpm_and_rpm(command, family=None):
success, output = run_command(command)
if not success:
# First check if the architecture is not supported
if output is not None:
for line in output.split('\n'):
if 'No compatible architectures found for build' in line:
logging.info("Skipping unsupported architecture RPM")
return True

logging.error("Running misc/build_srpm.sh failed")
logging.error(result.stdout.decode('utf-8'))
logging.error(result.stderr.decode('utf-8'))
return False

if result.stderr is not None:
for line in result.stderr.decode('utf-8').split('\n'):
if 'No compatible architectures found for build' in line:
logging.info("Skipping unsupported architecture RPM")
return True

src_rpm = ""
for line in result.stdout.decode('utf-8').split('\n'):
for line in output.split('\n'):
if line.endswith('.src.rpm'):
src_rpm = line
break

if src_rpm == "":
logging.error("SRPM generation failed")
logging.error(result.stdout.decode('utf-8'))
logging.error(result.stderr.decode('utf-8'))
return False

logging.info(src_rpm)
Expand All @@ -89,20 +122,11 @@ def build_srpm_and_rpm(command, family=None):
src_rpm,
]

logging.info("About to run command %s" % ' '.join(builddep_command))
result = subprocess.run(
builddep_command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
if result.returncode != 0:
success, _ = run_command(builddep_command)
if not success:
logging.error("Running 'dnf builddep' failed")
logging.error(result.stdout.decode('utf-8'))
logging.error(result.stderr.decode('utf-8'))
return False

logging.info(result.stdout.decode('utf-8'))

tmp_src_rpm = os.path.join('/tmp', os.path.basename(src_rpm))

try:
Expand All @@ -123,20 +147,11 @@ def build_srpm_and_rpm(command, family=None):
if family is not None:
rebuild_command[-1] += " --define 'mpi_family %s'" % family

logging.info("About to run command %s" % ' '.join(rebuild_command))
result = subprocess.run(
rebuild_command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
if result.returncode != 0:
logging.info("Running 'rpmbuild --rebuild' failed")
logging.error(result.stdout.decode('utf-8'))
logging.error(result.stderr.decode('utf-8'))
success, _ = run_command(rebuild_command)
if not success:
logging.error("Running 'rpmbuild --rebuild' failed")
return False

logging.info(result.stdout.decode('utf-8'))

return True


Expand All @@ -162,17 +177,10 @@ def build_srpm_and_rpm(command, family=None):
just_spec,
]

logging.info("About to run command %s" % ' '.join(command))
result = subprocess.run(
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
if result.returncode != 0:
success, _ = run_command(command)
if not success:
logging.error("Running misc/get_source.sh failed")
logging.error(result.stdout.decode('utf-8'))
logging.error(result.stderr.decode('utf-8'))
failed += 1
failed.append(just_spec)
continue

# cache spec file contents
Expand Down

0 comments on commit 783b246

Please sign in to comment.