mirror of
https://github.com/clearlinux/autospec.git
synced 2026-08-22 07:08:04 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e822d6e48d | |||
| 9bfe801c96 | |||
| 412ce5ee2e | |||
| 1fa3bdd6e0 | |||
| 4ea76c998e | |||
| b2d28bb55a | |||
| 4d029647d7 | |||
| 5279a11b53 |
@@ -508,7 +508,7 @@ class Requirements(object):
|
|||||||
"""Scan a .cmake or CMakeLists.txt file for what's it's actually looking for."""
|
"""Scan a .cmake or CMakeLists.txt file for what's it's actually looking for."""
|
||||||
findpackage = re.compile(r"^[^#]*find_package\((\w+)\b.*\)", re.I)
|
findpackage = re.compile(r"^[^#]*find_package\((\w+)\b.*\)", re.I)
|
||||||
findpackage_multiline = re.compile(r"^[^#]*find_package\((\w+)\b.*", re.I)
|
findpackage_multiline = re.compile(r"^[^#]*find_package\((\w+)\b.*", re.I)
|
||||||
pkgconfig = re.compile(r"^[^#]*pkg_check_modules\s*\(\w+ (.*)\)", re.I)
|
pkgconfig = re.compile(r"^[^#]*pkg_check_modules\s*\([\w\-]+ (.*)\)", re.I)
|
||||||
pkg_search_modifiers = {'REQUIRED', 'QUIET', 'NO_CMAKE_PATH',
|
pkg_search_modifiers = {'REQUIRED', 'QUIET', 'NO_CMAKE_PATH',
|
||||||
'NO_CMAKE_ENVIRONMENT_PATH', 'IMPORTED_TARGET'}
|
'NO_CMAKE_ENVIRONMENT_PATH', 'IMPORTED_TARGET'}
|
||||||
extractword = re.compile(r'(?:"([^"]+)"|(\S+))(.*)')
|
extractword = re.compile(r'(?:"([^"]+)"|(\S+))(.*)')
|
||||||
@@ -518,8 +518,13 @@ class Requirements(object):
|
|||||||
for line in lines:
|
for line in lines:
|
||||||
if match := findpackage.search(line):
|
if match := findpackage.search(line):
|
||||||
module = match.group(1)
|
module = match.group(1)
|
||||||
if pkg := cmake_modules.get(module):
|
if pkgs := cmake_modules.get(module):
|
||||||
self.add_buildreq(pkg)
|
# Some of the entries in cmake_modules list multiple packages, space-separated, so we need to split.
|
||||||
|
# Otherwise, anything in buildreq_ban would have to match the entire string, not just a single package name.
|
||||||
|
# For example: Png2Ico, extra-cmake-modules png2ico
|
||||||
|
# buildreq_ban would have to contain "extra-cmake-modules png2ico" to match, instead of just "png2ico"
|
||||||
|
for pkg in pkgs.split():
|
||||||
|
self.add_buildreq(pkg)
|
||||||
elif findpackage_multiline.search(line):
|
elif findpackage_multiline.search(line):
|
||||||
self.findpackage_parse_lines(line, lines, cmake_modules)
|
self.findpackage_parse_lines(line, lines, cmake_modules)
|
||||||
|
|
||||||
|
|||||||
@@ -80,19 +80,16 @@ def scan_for_tests(src_dir, config, requirements, content):
|
|||||||
"{} test || :\nmodule unload openmpi".format(make_command)
|
"{} test || :\nmodule unload openmpi".format(make_command)
|
||||||
|
|
||||||
perl_check = "{} TEST_VERBOSE=1 test".format(make_command)
|
perl_check = "{} TEST_VERBOSE=1 test".format(make_command)
|
||||||
setup_check = """PYTHONPATH=%{buildroot}$(python -c "import sys; print(sys.path[-1])") python setup.py test"""
|
|
||||||
meson_check = "meson test -C builddir --print-errorlogs"
|
meson_check = "meson test -C builddir --print-errorlogs"
|
||||||
if config.config_opts.get('allow_test_failures'):
|
if config.config_opts.get('allow_test_failures'):
|
||||||
make_check += " || :"
|
make_check += " || :"
|
||||||
cmake_check += " || :"
|
cmake_check += " || :"
|
||||||
perl_check += " || :"
|
perl_check += " || :"
|
||||||
setup_check += " || :"
|
|
||||||
meson_check += " || :"
|
meson_check += " || :"
|
||||||
|
|
||||||
testsuites = {
|
testsuites = {
|
||||||
"makecheck": make_check,
|
"makecheck": make_check,
|
||||||
"perlcheck": perl_check,
|
"perlcheck": perl_check,
|
||||||
"setup.py": setup_check,
|
|
||||||
"cmake": "cd clr-build; " + cmake_check,
|
"cmake": "cd clr-build; " + cmake_check,
|
||||||
"meson": meson_check,
|
"meson": meson_check,
|
||||||
}
|
}
|
||||||
@@ -145,13 +142,6 @@ def scan_for_tests(src_dir, config, requirements, content):
|
|||||||
elif config.default_pattern in ["cpan"] and "Makefile.PL" in files:
|
elif config.default_pattern in ["cpan"] and "Makefile.PL" in files:
|
||||||
tests_config = testsuites["perlcheck"]
|
tests_config = testsuites["perlcheck"]
|
||||||
|
|
||||||
elif config.default_pattern == "distutils3" and "setup.py" in files:
|
|
||||||
with util.open_auto(os.path.join(src_dir, "setup.py"), 'r') as setup_fp:
|
|
||||||
setup_contents = setup_fp.read()
|
|
||||||
|
|
||||||
if "test_suite" in setup_contents or "pbr=True" in setup_contents:
|
|
||||||
tests_config = testsuites["setup.py"]
|
|
||||||
|
|
||||||
elif config.default_pattern == "R":
|
elif config.default_pattern == "R":
|
||||||
tests_config = "export _R_CHECK_FORCE_SUGGESTS_=false\n" \
|
tests_config = "export _R_CHECK_FORCE_SUGGESTS_=false\n" \
|
||||||
"R CMD check --no-manual --no-examples --no-codoc . " \
|
"R CMD check --no-manual --no-examples --no-codoc . " \
|
||||||
|
|||||||
+10
-2
@@ -1345,6 +1345,8 @@ class Specfile(object):
|
|||||||
self.write_lang_c(export_epoch=True)
|
self.write_lang_c(export_epoch=True)
|
||||||
self.write_variables()
|
self.write_variables()
|
||||||
self.write_profile_payload("autogen")
|
self.write_profile_payload("autogen")
|
||||||
|
if self.config.subdir:
|
||||||
|
self._write_strip("pushd " + self.config.subdir)
|
||||||
self._write_strip("export GOAMD64=v2")
|
self._write_strip("export GOAMD64=v2")
|
||||||
self._write_strip("{0}%autogen {1} {2} {3}"
|
self._write_strip("{0}%autogen {1} {2} {3}"
|
||||||
.format(self.get_profile_use_flags(),
|
.format(self.get_profile_use_flags(),
|
||||||
@@ -1353,6 +1355,8 @@ class Specfile(object):
|
|||||||
self.config.extra_configure64))
|
self.config.extra_configure64))
|
||||||
self.write_make_line()
|
self.write_make_line()
|
||||||
self._write_strip("\n")
|
self._write_strip("\n")
|
||||||
|
if self.config.subdir:
|
||||||
|
self._write_strip("popd")
|
||||||
if self.config.config_opts['32bit']:
|
if self.config.config_opts['32bit']:
|
||||||
self._write_strip("pushd ../build32/" + self.config.subdir)
|
self._write_strip("pushd ../build32/" + self.config.subdir)
|
||||||
self.write_build_prepend()
|
self.write_build_prepend()
|
||||||
@@ -1430,6 +1434,9 @@ class Specfile(object):
|
|||||||
for module in self.config.pypi_overrides:
|
for module in self.config.pypi_overrides:
|
||||||
self._write_strip(f"pypi-dep-fix.py . {module}")
|
self._write_strip(f"pypi-dep-fix.py . {module}")
|
||||||
self._write_strip("python3 -m build --wheel --skip-dependency-check --no-isolation " + self.config.extra_configure)
|
self._write_strip("python3 -m build --wheel --skip-dependency-check --no-isolation " + self.config.extra_configure)
|
||||||
|
self._write_strip("\n")
|
||||||
|
if self.config.subdir:
|
||||||
|
self._write_strip("popd")
|
||||||
|
|
||||||
if self.config.config_opts['use_avx2']:
|
if self.config.config_opts['use_avx2']:
|
||||||
self._write_strip("pushd ../buildavx2/" + self.config.subdir)
|
self._write_strip("pushd ../buildavx2/" + self.config.subdir)
|
||||||
@@ -1460,8 +1467,6 @@ class Specfile(object):
|
|||||||
self._write_strip("popd")
|
self._write_strip("popd")
|
||||||
|
|
||||||
self._write_strip("\n")
|
self._write_strip("\n")
|
||||||
if self.config.subdir:
|
|
||||||
self._write_strip("popd")
|
|
||||||
self.write_build_append()
|
self.write_build_append()
|
||||||
self.write_check()
|
self.write_check()
|
||||||
self._write_strip("%install")
|
self._write_strip("%install")
|
||||||
@@ -1825,6 +1830,9 @@ class Specfile(object):
|
|||||||
self._write_strip('export QMAKE_CFLAGS_RELEASE=')
|
self._write_strip('export QMAKE_CFLAGS_RELEASE=')
|
||||||
self._write_strip('export QMAKE_CXXFLAGS_RELEASE=')
|
self._write_strip('export QMAKE_CXXFLAGS_RELEASE=')
|
||||||
|
|
||||||
|
# Add the qt6base tools to the path
|
||||||
|
self._write_strip('export PATH=/usr/lib64/qt6/bin:$PATH')
|
||||||
|
|
||||||
if self.config.make_command:
|
if self.config.make_command:
|
||||||
qmake = self.config.make_command
|
qmake = self.config.make_command
|
||||||
else:
|
else:
|
||||||
|
|||||||
+2
-2
@@ -125,7 +125,7 @@ class Source():
|
|||||||
def extract_tar(self, extraction_path):
|
def extract_tar(self, extraction_path):
|
||||||
"""Extract tar in path."""
|
"""Extract tar in path."""
|
||||||
with tarfile.open(self.path) as content:
|
with tarfile.open(self.path) as content:
|
||||||
content.extractall(path=extraction_path)
|
content.extractall(path=extraction_path, filter='data')
|
||||||
|
|
||||||
def extract_bz2(self, extraction_path):
|
def extract_bz2(self, extraction_path):
|
||||||
"""Extract plain bz2 file in path."""
|
"""Extract plain bz2 file in path."""
|
||||||
@@ -144,7 +144,7 @@ class Source():
|
|||||||
def extract_zst(self, extraction_path):
|
def extract_zst(self, extraction_path):
|
||||||
"""Extract zst in path."""
|
"""Extract zst in path."""
|
||||||
with tarfile.open(fileobj=zstd.open(self.path, 'rb'), mode='r|') as content:
|
with tarfile.open(fileobj=zstd.open(self.path, 'rb'), mode='r|') as content:
|
||||||
content.extractall(path=extraction_path)
|
content.extractall(path=extraction_path, filter='data')
|
||||||
|
|
||||||
|
|
||||||
def convert_version(ver_str, name):
|
def convert_version(ver_str, name):
|
||||||
|
|||||||
@@ -152,26 +152,6 @@ class TestTest(unittest.TestCase):
|
|||||||
check.os.listdir = listdir_backup
|
check.os.listdir = listdir_backup
|
||||||
self.assertEqual(check.tests_config, 'make TEST_VERBOSE=1 test')
|
self.assertEqual(check.tests_config, 'make TEST_VERBOSE=1 test')
|
||||||
|
|
||||||
def test_scan_for_tests_setup(self):
|
|
||||||
"""
|
|
||||||
Test scan_for_tests with setup.py suite
|
|
||||||
"""
|
|
||||||
reqs = buildreq.Requirements("")
|
|
||||||
conf = config.Config("")
|
|
||||||
tcontent = tarball.Content("", "", "", [], conf, "")
|
|
||||||
listdir_backup = os.listdir
|
|
||||||
check.os.listdir = mock_generator(['setup.py'])
|
|
||||||
content = 'test_suite'
|
|
||||||
m_open = mock_open(read_data=content)
|
|
||||||
with patch(self.open_name, m_open, create=True):
|
|
||||||
conf.default_pattern = "distutils3"
|
|
||||||
check.scan_for_tests('pkgdir', conf, reqs, tcontent)
|
|
||||||
|
|
||||||
check.os.listdir = listdir_backup
|
|
||||||
self.assertEqual(check.tests_config,
|
|
||||||
'PYTHONPATH=%{buildroot}$(python -c "import sys; print(sys.path[-1])") '
|
|
||||||
'python setup.py test')
|
|
||||||
|
|
||||||
def test_scan_for_tests_cmake(self):
|
def test_scan_for_tests_cmake(self):
|
||||||
"""
|
"""
|
||||||
Test scan_for_tests with cmake suite
|
Test scan_for_tests with cmake suite
|
||||||
|
|||||||
Reference in New Issue
Block a user