mirror of
https://github.com/clearlinux/autospec.git
synced 2026-06-16 02:45:56 +00:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9594167cc7 | |||
| c62c42a21d | |||
| a88ffdc2a7 | |||
| 936534a889 | |||
| d73a1e70d8 | |||
| f07e061437 | |||
| d4144f5efd | |||
| 07a959cc83 | |||
| e36a856c50 | |||
| 2618dc3eb1 | |||
| 8b9384758b | |||
| 94c6be068b | |||
| f4a13a5a93 | |||
| 5424026110 | |||
| e822d6e48d | |||
| 9bfe801c96 | |||
| 412ce5ee2e | |||
| 1fa3bdd6e0 | |||
| 4ea76c998e | |||
| b2d28bb55a | |||
| 4d029647d7 | |||
| 5279a11b53 |
@@ -212,6 +212,12 @@ ${custom}_provides_ban
|
||||
Controlling the build process
|
||||
------------------------------
|
||||
|
||||
invalid_release_sig
|
||||
This file contains the current version that will **not** have its package
|
||||
file be processed for signature verification (overriding the config_opt).
|
||||
This file will be automatically deleted after a new release and is intended
|
||||
to override a single bad signed release.
|
||||
|
||||
extra_sources
|
||||
This file contains a list of extra files to be added to the ``.spec`` and
|
||||
optionally installed as well. Each non-blank and non-comment line should start
|
||||
|
||||
@@ -155,7 +155,7 @@ def is_file_valid(path):
|
||||
|
||||
def dump_symbols(path):
|
||||
"""Get symbols from a file."""
|
||||
cmd = "nm --defined-only -g --dynamic \"{}\"".format(path)
|
||||
cmd = "nm --defined-only -g --dynamic \"{}\" | c++filt".format(path)
|
||||
lines = None
|
||||
|
||||
ret = set()
|
||||
|
||||
@@ -215,6 +215,8 @@ class Build(object):
|
||||
elif infiles == 1 and "not matching the package arch" not in line:
|
||||
# exclude blank lines from consideration...
|
||||
file = line.strip()
|
||||
if file in ("/usr", "/usr/"):
|
||||
self.must_restart += 1
|
||||
if file and file[0] == "/":
|
||||
filemanager.push_file(file, content.name)
|
||||
|
||||
|
||||
@@ -508,7 +508,7 @@ class Requirements(object):
|
||||
"""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_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',
|
||||
'NO_CMAKE_ENVIRONMENT_PATH', 'IMPORTED_TARGET'}
|
||||
extractword = re.compile(r'(?:"([^"]+)"|(\S+))(.*)')
|
||||
@@ -518,8 +518,13 @@ class Requirements(object):
|
||||
for line in lines:
|
||||
if match := findpackage.search(line):
|
||||
module = match.group(1)
|
||||
if pkg := cmake_modules.get(module):
|
||||
self.add_buildreq(pkg)
|
||||
if pkgs := cmake_modules.get(module):
|
||||
# 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):
|
||||
self.findpackage_parse_lines(line, lines, cmake_modules)
|
||||
|
||||
@@ -758,7 +763,7 @@ class Requirements(object):
|
||||
for dirpath, _, files in os.walk(dirn):
|
||||
default_score = 2 if dirpath == dirn else 1
|
||||
|
||||
if "Cargo.toml" in files:
|
||||
if "Cargo.toml" in files and 'Makefile' not in files:
|
||||
config.set_build_pattern('cargo', default_score)
|
||||
|
||||
if "CMakeLists.txt" in files and "configure.ac" not in files:
|
||||
|
||||
@@ -80,19 +80,16 @@ def scan_for_tests(src_dir, config, requirements, content):
|
||||
"{} test || :\nmodule unload openmpi".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"
|
||||
if config.config_opts.get('allow_test_failures'):
|
||||
make_check += " || :"
|
||||
cmake_check += " || :"
|
||||
perl_check += " || :"
|
||||
setup_check += " || :"
|
||||
meson_check += " || :"
|
||||
|
||||
testsuites = {
|
||||
"makecheck": make_check,
|
||||
"perlcheck": perl_check,
|
||||
"setup.py": setup_check,
|
||||
"cmake": "cd clr-build; " + cmake_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:
|
||||
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":
|
||||
tests_config = "export _R_CHECK_FORCE_SUGGESTS_=false\n" \
|
||||
"R CMD check --no-manual --no-examples --no-codoc . " \
|
||||
|
||||
+13
-1
@@ -347,7 +347,7 @@ class Config(object):
|
||||
def detect_build_from_url(self, url):
|
||||
"""Detect build patterns and build requirements from the patterns detected in the url."""
|
||||
# R package
|
||||
if "cran.r-project.org" in url or "cran.rstudio.com" in url:
|
||||
if "cran.r-project.org" in url or "cran.rstudio.com" in url or "/pub/cran/" in url:
|
||||
self.set_build_pattern("R", 10)
|
||||
|
||||
# python
|
||||
@@ -837,6 +837,18 @@ class Config(object):
|
||||
except Exception as e:
|
||||
print_warning(f"Unable to remove buildreq_cache file: {e}")
|
||||
|
||||
invalid_release_sig_file = os.path.join(self.download_path, "invalid_release_sig")
|
||||
content = self.read_conf_file(invalid_release_sig_file)
|
||||
if content and content[0] == version:
|
||||
self.config_opts['verify_required'] = False
|
||||
else:
|
||||
try:
|
||||
os.unlink(invalid_release_sig_file)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
except Exception as e:
|
||||
print_warning(f"Unable to remove invalid_release_sig file: {e}")
|
||||
|
||||
content = self.read_conf_file(os.path.join(self.download_path, "pkgconfig_add"))
|
||||
for extra in content:
|
||||
extra = pkgconfig_re.sub(r'\1', extra)
|
||||
|
||||
@@ -71,14 +71,8 @@ def sanitize_counts():
|
||||
"""Validate test counts are within sane bounds."""
|
||||
global total_tests
|
||||
global total_pass
|
||||
global total_fail
|
||||
global total_xfail
|
||||
global total_skip
|
||||
global counted_tests
|
||||
global counted_pass
|
||||
global counted_fail
|
||||
global counted_xfail
|
||||
global counted_skip
|
||||
if total_tests > 0 and total_pass == 0:
|
||||
total_pass = total_tests - total_fail - total_skip - total_xfail
|
||||
|
||||
@@ -170,7 +164,6 @@ def parse_log(log, pkgname=''):
|
||||
global total_fail
|
||||
global total_xfail
|
||||
global total_skip
|
||||
global counted_tests
|
||||
global counted_pass
|
||||
global counted_fail
|
||||
global counted_xfail
|
||||
|
||||
@@ -377,6 +377,7 @@ class FileManager(object):
|
||||
(r"^/lib/systemd/user/", "services"),
|
||||
(r"^/usr/lib/systemd/system/", "services"),
|
||||
(r"^/usr/lib/systemd/user/", "services"),
|
||||
(r"^/usr/lib/udev/hwdb.d", "config"),
|
||||
(r"^/usr/lib/udev/rules.d", "config"),
|
||||
(r"^/usr/lib/modules-load.d", "config"),
|
||||
(r"^/usr/lib/tmpfiles.d", "config"),
|
||||
|
||||
@@ -55,8 +55,6 @@ def add_license(lic, translations, blacklist):
|
||||
presence in the blacklist. Returns False if no license were added, True
|
||||
otherwise.
|
||||
"""
|
||||
global licenses
|
||||
global license_files
|
||||
lic = lic.strip().strip(',')
|
||||
result = False
|
||||
|
||||
@@ -208,9 +206,6 @@ def scan_for_licenses(srcdir, config, pkg_name):
|
||||
|
||||
def load_specfile(specfile):
|
||||
"""Get licenses from the specfile content."""
|
||||
global licenses
|
||||
global license_files
|
||||
global hashes
|
||||
specfile.licenses = licenses if licenses else [default_license]
|
||||
specfile.license_files = sorted(license_files)
|
||||
specfile.hashes = hashes
|
||||
|
||||
@@ -96,7 +96,7 @@ class GPGCli(object):
|
||||
util.write_out(os.path.join(_gpghome, 'gpg.conf'), GNUPGCONF)
|
||||
if pubkey is not None:
|
||||
args = self.args + ['--import', pubkey]
|
||||
output, err, code = self.exec_cmd(args)
|
||||
_, err, code = self.exec_cmd(args)
|
||||
if code == -9:
|
||||
raise Exception('Command {} timeout after {} seconds'.format(' '.join(args), CMD_TIMEOUT))
|
||||
elif code != 0:
|
||||
@@ -212,16 +212,15 @@ class Verifier(object):
|
||||
@staticmethod
|
||||
def calc_sum(filepath, digest_algo):
|
||||
"""Use digest_algo to calculate block sum of a file."""
|
||||
BLOCK_SIZE = 4096
|
||||
block_size = 4096
|
||||
with open(filepath, 'rb') as fp:
|
||||
digest = digest_algo()
|
||||
for block in iter(lambda: fp.read(BLOCK_SIZE), b''):
|
||||
for block in iter(lambda: fp.read(block_size), b''):
|
||||
digest.update(block)
|
||||
return digest.hexdigest()
|
||||
|
||||
def print_result(self, result, err_msg=''):
|
||||
"""Display verification results."""
|
||||
global EMAIL
|
||||
package_name = ''
|
||||
if self.url is not None:
|
||||
package_name = os.path.basename(self.url)
|
||||
|
||||
+24
-16
@@ -37,9 +37,9 @@ AVX512_CFLAGS = "-march=x86-64-v4 -mprefer-vector-width=512"
|
||||
AVX512_FCFLAGS = "-march=x86-64-v4 -mprefer-vector-width=256"
|
||||
AVX512_LCFLAGS = "-march=x86-64-v4"
|
||||
AVX512_LFLAGS = "-Wl,-z,x86-64-v4"
|
||||
APX_CFLAGS = "-march=x86-64-v3 -mapxf -mavx10.1"
|
||||
APX_LCFLAGS = "-march=x86-64-v3"
|
||||
APX_LFLAGS = "-Wl,-z,x86-64-v3"
|
||||
APX_CFLAGS = "-march=x86-64-v4 -mapxf"
|
||||
APX_LCFLAGS = "-march=x86-64-v4"
|
||||
APX_LFLAGS = "-Wl,-z,x86-64-v4"
|
||||
|
||||
|
||||
class Specfile(object):
|
||||
@@ -326,6 +326,9 @@ class Specfile(object):
|
||||
self._write("Group: Default\n")
|
||||
|
||||
for dep in deps.get(pkg, []):
|
||||
# honor requires_ban for manual overrides
|
||||
if f"{self.name}-{dep}" in self.requirements.banned_requires.get(pkg, []):
|
||||
continue
|
||||
if dep in self.packages:
|
||||
self._write("Requires: {}-{} = %{{version}}-%{{release}}\n".format(self.name, dep))
|
||||
|
||||
@@ -537,7 +540,7 @@ class Specfile(object):
|
||||
if not archive_prefix:
|
||||
# Make it up
|
||||
archive_prefix = os.path.splitext(os.path.basename(archive))[0]
|
||||
self._write_strip("cp -r %{{_builddir}}/{0}/* %{{_builddir}}/{1}/{2}"
|
||||
self._write_strip("cp -r %{{_builddir}}/{0}/. %{{_builddir}}/{1}/{2}"
|
||||
.format(archive_prefix,
|
||||
self.content.tarball_prefix,
|
||||
destination))
|
||||
@@ -548,7 +551,7 @@ class Specfile(object):
|
||||
if self.config.subdir:
|
||||
self._write_strip("pushd " + self.config.subdir)
|
||||
self._write_strip("mkdir -p .cargo")
|
||||
self._write_strip(f"echo '{self.config.cargo_vendors}' >> .cargo/config.toml")
|
||||
self._write_strip(f"echo '\n{self.config.cargo_vendors}' >> .cargo/config.toml")
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
|
||||
@@ -1163,7 +1166,7 @@ class Specfile(object):
|
||||
self.write_build_prepend()
|
||||
self._write_strip("GOAMD64=v3")
|
||||
self._write_strip(f'CFLAGS="$CLEAR_INTERMEDIATE_CFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
|
||||
self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "')
|
||||
self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
|
||||
self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
|
||||
self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "')
|
||||
self._write_strip(f'LDFLAGS="$CLEAR_INTERMEDIATE_LDFLAGS {APX_LCFLAGS} "')
|
||||
@@ -1345,6 +1348,8 @@ class Specfile(object):
|
||||
self.write_lang_c(export_epoch=True)
|
||||
self.write_variables()
|
||||
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("{0}%autogen {1} {2} {3}"
|
||||
.format(self.get_profile_use_flags(),
|
||||
@@ -1353,6 +1358,8 @@ class Specfile(object):
|
||||
self.config.extra_configure64))
|
||||
self.write_make_line()
|
||||
self._write_strip("\n")
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
if self.config.config_opts['32bit']:
|
||||
self._write_strip("pushd ../build32/" + self.config.subdir)
|
||||
self.write_build_prepend()
|
||||
@@ -1430,6 +1437,9 @@ class Specfile(object):
|
||||
for module in self.config.pypi_overrides:
|
||||
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("\n")
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
|
||||
if self.config.config_opts['use_avx2']:
|
||||
self._write_strip("pushd ../buildavx2/" + self.config.subdir)
|
||||
@@ -1460,8 +1470,6 @@ class Specfile(object):
|
||||
self._write_strip("popd")
|
||||
|
||||
self._write_strip("\n")
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
self.write_build_append()
|
||||
self.write_check()
|
||||
self._write_strip("%install")
|
||||
@@ -1825,6 +1833,9 @@ class Specfile(object):
|
||||
self._write_strip('export QMAKE_CFLAGS_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:
|
||||
qmake = self.config.make_command
|
||||
else:
|
||||
@@ -2059,14 +2070,11 @@ class Specfile(object):
|
||||
self.write_license_files()
|
||||
if self.config.subdir:
|
||||
self._write_strip("pushd " + self.config.subdir)
|
||||
if self.config.install_macro:
|
||||
self._write_strip(self.config.install_macro)
|
||||
else:
|
||||
self._write_strip("cargo install --path .")
|
||||
self._write_strip("mkdir -p %{buildroot}/usr/bin")
|
||||
self._write_strip('pushd "${HOME}/.cargo/bin/"')
|
||||
self._write_strip("mv * %{buildroot}/usr/bin/")
|
||||
self._write_strip("popd")
|
||||
self._write_strip("cargo install --path .")
|
||||
self._write_strip("mkdir -p %{buildroot}/usr/bin")
|
||||
self._write_strip('pushd "${HOME}/.cargo/bin/"')
|
||||
self._write_strip("mv * %{buildroot}/usr/bin/")
|
||||
self._write_strip("popd")
|
||||
if self.config.subdir:
|
||||
self._write_strip("popd")
|
||||
self.write_install_append()
|
||||
|
||||
+8
-5
@@ -120,12 +120,15 @@ class Source():
|
||||
extraction_path = base_path
|
||||
|
||||
extract_method = getattr(self, 'extract_{}'.format(self.type))
|
||||
extract_method(extraction_path)
|
||||
try:
|
||||
extract_method(extraction_path)
|
||||
except tarfile.AbsoluteLinkError:
|
||||
pass
|
||||
|
||||
def extract_tar(self, extraction_path):
|
||||
"""Extract tar in path."""
|
||||
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):
|
||||
"""Extract plain bz2 file in path."""
|
||||
@@ -144,7 +147,7 @@ class Source():
|
||||
def extract_zst(self, extraction_path):
|
||||
"""Extract zst in path."""
|
||||
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):
|
||||
@@ -153,7 +156,7 @@ def convert_version(ver_str, name):
|
||||
# them out with expensive regular expressions
|
||||
banned_subs = ["x86.64", "source", "src", "all", "bin", "release", "rh",
|
||||
"ga", ".ce", "lcms", "onig", "linux", "gc", "sdk", "orig",
|
||||
"jurko", "%2f", "%2F", "%20", "x265"]
|
||||
"jurko", "%2f", "%2F", "%20", "x265", "autotools"]
|
||||
|
||||
# package names may be modified in the version string by adding "lib" for
|
||||
# example. Remove these from the name before trying to remove the name from
|
||||
@@ -169,7 +172,7 @@ def convert_version(ver_str, name):
|
||||
ver_str = ver_str.replace(name.replace(mod, ""), "")
|
||||
|
||||
# replace illegal characters
|
||||
ver_str = ver_str.strip().replace('-', '.').replace('_', '.')
|
||||
ver_str = ver_str.strip().replace('-', '.').replace('_', '.').replace('+', '.')
|
||||
|
||||
# remove banned substrings
|
||||
for sub in banned_subs:
|
||||
|
||||
@@ -156,7 +156,6 @@ def _file_write(self, s):
|
||||
|
||||
def translate(package):
|
||||
"""Convert terms to their alternate definition."""
|
||||
global dictionary
|
||||
for item in dictionary:
|
||||
if item.startswith(package + "="):
|
||||
return item.split("=")[1]
|
||||
|
||||
@@ -1613,3 +1613,4 @@ https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3.11-pigeonhole-0.5.11.tar
|
||||
https://pigeonhole.dovecot.org/releases/2.3/dovecot-2.3-pigeonhole-0.5.20.tar.gz,pigeonhole,0.5.20
|
||||
https://www.ezix.org/software/files/lshw-B.02.19.2.tar.gz,lshw,02.19.2
|
||||
https://github.com/VectorCamp/vectorscan/archive/refs/tags/vectorscan/5.4.11.tar.gz,vectorscan,5.4.11
|
||||
https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-0.7.13+release.autotools.tar.gz,libopenmpt,0.7.13
|
||||
|
||||
@@ -152,26 +152,6 @@ class TestTest(unittest.TestCase):
|
||||
check.os.listdir = listdir_backup
|
||||
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):
|
||||
"""
|
||||
Test scan_for_tests with cmake suite
|
||||
|
||||
@@ -6,6 +6,7 @@ import config
|
||||
# Structure: (url, build_pattern)
|
||||
BUILD_PAT_URL = [
|
||||
("https://cran.r-project.org/src/contrib/raster_3.0-12.tar.gz", "R"),
|
||||
("https://ftp.osuosl.org/pub/cran/src/contrib/hexbin_1.28.5.tar.gz", "R"),
|
||||
("http://pypi.debian.net/argparse/argparse-1.4.0.tar.gz", "distutils3"),
|
||||
("https://pypi.python.org/packages/source/T/Tempita/Tempita-0.5.2.tar.gz", "distutils3"),
|
||||
("https://cpan.metacpan.org/authors/id/T/TO/TODDR/IO-Tty-1.14.tar.gz", "cpan"),
|
||||
|
||||
Reference in New Issue
Block a user