Compare commits

..

19 Commits

Author SHA1 Message Date
William Douglas 2659038eaa Fix meson check builddir typo
Signed-off-by: William Douglas <william.douglas@intel.com>
2024-07-02 12:17:59 -07:00
William Douglas dc0ff31b43 Add support for a copy_prepend config file
This patch has a few interrelated changes in it but primarily it is
supporting a new copy_prepend configuration file for autospec. This is
intended to support cases where changes should be made to the source
directory prior to the source directory being copied for different
builds (avx2, 32bit, etc).

Also with this change some tweaks to how cmake builds are handled to
be more aligned with other build systems. Primarily that the source
directoy is now fully copied rather than just creating a cmake build
directory per build in the same source directory.

Finally check support has been updated to account for the new path and
update support for meson and apx.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-07-01 01:36:31 -07:00
William Douglas 3f1fa8e70b Fix mpi cmake Unix Makefiles argument
Signed-off-by: William Douglas <william.douglas@intel.com>
2024-07-01 01:36:31 -07:00
William Douglas 840d2ca0e2 Add new failed pattern detection
Signed-off-by: William Douglas <william.douglas@intel.com>
2024-07-01 01:36:31 -07:00
Brett T. Warden a5d3013703 Add pkgconfig detection pattern for rust dependencies 2024-06-25 13:13:03 -07:00
K1ngfish3r 381dfd88cc make check! 2024-06-20 14:55:48 -07:00
K1ngfish3r f483b68c90 make check? 2024-06-20 14:55:48 -07:00
K1ngfish3r 5d6bcfe2f7 zstd support 2024-06-20 14:55:48 -07:00
Brett T. Warden f9eab4897e Try a little bit harder to find licenses
Look in directories named 'licensing'.
2024-06-18 13:57:32 -07:00
William Douglas fbcebd0b3d Add missing install handling for ninja
For cmake builds, use ninja install if use_ninja is set.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-05-30 01:15:04 -07:00
William Douglas 1f398f5e7b Add config for using ninja instead of make
Given more packages are using ninja as the build system of choice
instead of make, add flag to enable ninja usage.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-05-29 16:02:05 -07:00
Arjan van de Ven 8e89d0cb0e no gcc-14 2024-05-29 17:44:43 +00:00
William Douglas 6fa3d52db4 Remove Ofast from flags
This caused some incorrect behavior for numpy. Generally disabling to
avoid problematic behavior.

Signed-off-by: William Douglas <william.douglas@intel.com>
2024-05-14 13:03:20 -07:00
Brett T. Warden 5905be97e8 Fix version parsing for x265 2024-04-12 09:23:30 -07:00
Brett T. Warden 81e1eebe28 Extend key ID matching to expired keys
gpg accepts signatures with expired keys as long as the signature was
made prior to key expiration. But it also changes the status-fd output
format that we grep for the expected key ID. Make sure we look for the
alternate EXPKEYSIG line in the output in that case to find the key ID.
2024-04-12 09:08:10 -07:00
Brett T. Warden 658bd0de10 Add gnupg as a buildreq if we'll need it during build 2024-04-11 16:10:02 -07:00
Brett T. Warden b628caf931 Add Config fields for pkey and signature macros 2024-04-11 12:37:09 -07:00
Brett T. Warden 8142032e7c Fix escaping to satisfy flake 2024-04-11 12:22:59 -07:00
Brett T. Warden 5a302d6c91 Check GPG package signatures during build
Add gpg commands to the specfile so we verify the package signature
during every rpmbuild. Also ensure that the signature key ID matches
what we expect.
2024-04-11 12:22:59 -07:00
9 changed files with 170 additions and 53 deletions
+6
View File
@@ -268,6 +268,12 @@ prep_prepend
resulting ``.spec``, and is used for situations where fine-grained
control is required.
copy_prepend
Additional actions that should take place directly before the source
directory is copied for other builds (32bit, avx2, etc). This will be
placed in the resulting ``.spec``, and is used for situations where
fine-grained control is required.
build_prepend
Additional actions that should take place after ``%build`` and before
the ``%configure`` macro or equivalent (``%cmake``, etc.). If autospec
+4
View File
@@ -751,6 +751,10 @@ class Requirements(object):
configure_ac_files = []
qmake_profiles = []
cmake_files = []
if config.config_opts['use_ninja']:
self.add_buildreq('ninja')
for dirpath, _, files in os.walk(dirn):
default_score = 2 if dirpath == dirn else 1
+10 -4
View File
@@ -97,17 +97,23 @@ def scan_for_tests(src_dir, config, requirements, content):
}
if config.config_opts.get('32bit'):
testsuites["makecheck"] += "\ncd ../build32;\n" + make_check + " || :"
testsuites["cmake"] += "\ncd ../clr-build32;\n" + cmake_check + " || :"
testsuites["cmake"] += "\ncd ../../build32/clr-build32;\n" + cmake_check + " || :"
testsuites["meson"] += "\ncd ../build32;\n" + meson_check + " || :"
if config.config_opts.get('use_avx2'):
testsuites["makecheck"] += "\ncd ../buildavx2;\n" + make_check + " || :"
testsuites["cmake"] += "\ncd ../clr-build-avx2;\n" + cmake_check + " || :"
testsuites["cmake"] += "\ncd ../../buildavx2/clr-build-avx2;\n" + cmake_check + " || :"
testsuites["meson"] += "\ncd ../buildavx2;\n" + meson_check + " || :"
if config.config_opts.get('use_avx512'):
testsuites["makecheck"] += "\ncd ../buildavx512;\n" + make_check + " || :"
testsuites["cmake"] += "\ncd ../clr-build-avx512;\n" + cmake_check + " || :"
testsuites["cmake"] += "\ncd ../../buildavx512/clr-build-avx512;\n" + cmake_check + " || :"
testsuites["meson"] += "\ncd ../buildavx512;\n" + meson_check + " || :"
if config.config_opts.get('use_apx'):
testsuites["makecheck"] += "\ncd ../buildapx;\n" + make_check + " || :"
testsuites["cmake"] += "\ncd ../../buildapx/clr-build-apx;\n" + cmake_check + " || :"
testsuites["meson"] += "\ncd ../buildapx;\n" + meson_check + " || :"
if config.config_opts.get('openmpi'):
testsuites["makecheck"] += "\ncd ../build-openmpi;\n" + make_check_openmpi
testsuites["cmake"] += "\ncd ../clr-build-openmpi;\n" + cmake_check_openmpi
testsuites["cmake"] += "\ncd ../../build-openmpi/clr-build-openmpi;\n" + cmake_check_openmpi
files = os.listdir(src_dir)
+13 -4
View File
@@ -91,6 +91,7 @@ class Config(object):
self.install_macro = "%make_install"
self.disable_static = "--disable-static"
self.prep_prepend = []
self.copy_prepend = []
self.build_prepend = []
self.build_prepend_once = []
self.build_append = []
@@ -115,6 +116,8 @@ class Config(object):
self.old_keyid = None
self.profile_payload = None
self.signature = None
self.signature_macro = None
self.pkey_macro = None
self.yum_conf = None
self.failed_pattern_dir = None
self.alias = None
@@ -185,6 +188,7 @@ class Config(object):
"server": "Package is only used by servers",
"no_glob": "Do not use the replacement pattern for file matching",
"allow_exe": "Allow Windows executables (*.exe, *.dll) to be packaged",
"use_ninja": "Use ninja build files",
}
# simple_pattern_pkgconfig patterns
# contains patterns for parsing build.log for missing dependencies
@@ -264,6 +268,7 @@ class Config(object):
(r"Can't locate [a-zA-Z0-9_\-\/\.]+ in @INC \(you may need to install the ([a-zA-Z0-9_\-:]+) module\)", 0, 'perl'),
(r"Cannot find ([a-zA-Z0-9\-_\.]*)", 1, None),
(r"Checking for (.*?)\.\.\.no", 0, None),
(r"checking for (.*?) \(using pkg-config\)\.\.\. no", 0, None),
(r"Checking for (.*?)\s*: not found", 0, None),
(r"Checking for (.*?)\s>=.*\s*: not found", 0, None),
(r"Could not find suitable distribution for Requirement.parse\('([a-zA-Z\-\.]*)", 0, None),
@@ -286,6 +291,7 @@ class Config(object):
(r"No rule to make target `(.*)',", 0, None),
(r"Package (.*) was not found in the pkg-config search path.", 0, 'pkgconfig'),
(r"Package '([a-zA-Z0-9\-:]*)', required by '.*', not found", 0, 'pkgconfig'),
(r"The file `([a-zA-Z0-9\-:]*)\.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory\.", 0, 'pkgconfig'),
(r"Package which this enhances but not available for checking: [']([a-zA-Z0-9\-]*)[']", 0, 'R'),
(r"Perhaps you should add the directory containing `([a-zA-Z0-9\-:]*)\.pc'", 0, 'pkgconfig'),
(r"Program (.*) found: NO", 0, None),
@@ -432,10 +438,11 @@ class Config(object):
# next the options
config_f['autospec'] = {}
for fname, comment in sorted(self.config_options.items()):
fpath = os.path.join(self.download_path, fname)
config_f.set('autospec', '# {}'.format(comment))
if os.path.exists(fname):
if os.path.isfile(fpath):
config_f['autospec'][fname] = 'true'
os.remove(fname)
os.remove(fpath)
else:
config_f['autospec'][fname] = 'false'
@@ -443,9 +450,10 @@ class Config(object):
config_f['autospec']['use_lto'] = 'true'
# renamed options need special care
if os.path.exists("skip_test_suite"):
skip_path = os.path.join(self.download_path, "skip_test_suite")
if os.path.exists(skip_path):
config_f['autospec']['skip_tests'] = 'true'
os.remove("skip_test_suite")
os.remove(skip_path)
self.write_config(config_f)
def create_buildreq_cache(self, version, buildreqs_cache):
@@ -999,6 +1007,7 @@ class Config(object):
requirements.add_buildreq("openssh")
self.prep_prepend = self.read_script_file(os.path.join(self.download_path, "prep_prepend"))
self.copy_prepend = self.read_script_file(os.path.join(self.download_path, "copy_prepend"))
if os.path.isfile(os.path.join(self.download_path, "prep_append")):
os.rename(os.path.join(self.download_path, "prep_append"), os.path.join(self.download_path, "build_prepend"))
self.make_prepend = self.read_script_file(os.path.join(self.download_path, "make_prepend"))
+1 -1
View File
@@ -178,7 +178,7 @@ def scan_for_licenses(srcdir, config, pkg_name):
# seen in the DPDK 20.11.3 tree, where the `LICENSES` directory is
# named `license` instead.
dirbase = os.path.basename(dirpath)
if re.search(r'^(LICENSES|licenses?)$', dirbase) and re.search(r'\.txt$', name):
if re.search(r'^(LICENSES|licenses?|licensing)$', dirbase) and re.search(r'\.txt$', name):
license_from_copying_hash(os.path.join(dirpath, name),
srcdir, config, pkg_name)
+1
View File
@@ -532,6 +532,7 @@ VERIFIER_TYPES = {
'.bz2': GPGVerifier,
'.xz': GPGVerifier,
'.zip': GPGVerifier,
'.zst': GPGVerifier,
}
+94 -43
View File
@@ -159,8 +159,17 @@ class Specfile(object):
# if package is verified, include the signature in the source tarball
if self.keyid and self.config.signature:
# We'll need gnupg to verify the signature. Need to add it here so it's ready before write_buildreq
self.requirements.add_buildreq("gnupg")
count += 1
self._write_strip(f"Source{count} : {self.config.signature}")
self.config.signature_macro = f"%{{SOURCE{count}}}"
# Also include the public key in the source tarball.
count += 1
self._write_strip(f"Source{count} : {self.keyid}.pkey")
self.config.pkey_macro = f"%{{SOURCE{count}}}"
for source in self.config.extra_sources:
count += 1
@@ -405,6 +414,8 @@ class Specfile(object):
self._write_strip("## make_prepend end")
if self.config.make_command:
make = self.config.make_command
elif self.config.config_opts['use_ninja']:
make = "ninja"
else:
make = "make"
if build32:
@@ -421,7 +432,11 @@ class Specfile(object):
def write_cmake_line_openmpi(self):
"""Write cmake line (openmpi) to spec file."""
cmake_string = 'cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=$MPI_ROOT -DCMAKE_INSTALL_SBINDIR=$MPI_BIN \\\n' \
if self.config.config_opts['use_ninja']:
cmake_type = "Ninja"
else:
cmake_type = "Unix Makefiles"
cmake_string = f"cmake -G '{cmake_type}' -DCMAKE_INSTALL_PREFIX=$MPI_ROOT -DCMAKE_INSTALL_SBINDIR=$MPI_BIN \\\n" \
'-DCMAKE_INSTALL_LIBDIR=$MPI_LIB -DCMAKE_INSTALL_INCLUDEDIR=$MPI_INCLUDE -DLIB_INSTALL_DIR=$MPI_LIB \\\n' \
'-DBUILD_SHARED_LIBS:BOOL=ON -DLIB_SUFFIX=64 \\\n' \
'-DCMAKE_AR=/usr/bin/gcc-ar -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_RANLIB=/usr/bin/gcc-ranlib \\\n'
@@ -430,6 +445,12 @@ class Specfile(object):
def write_prep(self):
"""Write prep section to spec file."""
self._write_strip("%prep")
if self.keyid and self.config.signature:
self._write_strip("mkdir .gnupg")
self._write_strip("chmod 700 .gnupg")
self._write_strip(f"gpg --homedir .gnupg --import {self.config.pkey_macro}")
self._write_strip(f"gpg --homedir .gnupg --status-fd 1 --verify {self.config.signature_macro} %{{SOURCE0}} > gpg.status")
self._write_strip(f"grep -E '^\\[GNUPG:\\] (GOODSIG|EXPKEYSIG) {self.keyid}' gpg.status")
self.write_prep_prepend()
prefix = self.content.prefixes[self.url]
if self.config.default_pattern == 'R':
@@ -444,6 +465,11 @@ class Specfile(object):
extract_cmd = 'unzip -q {}'
if archive.endswith('.bz2') and not archive.endswith('.tar.bz2'):
extract_cmd = 'bzcat {0} > $(basename "{0}" .bz2)'
if archive.endswith('.zst'):
if archive.endswith('.tar.zst'):
extract_cmd = 'tar -I zstd xf {}'
else:
extract_cmd = 'zstd -dqc {0} > $(basename "{0}" .zst)'
self._write_strip('cd %{_builddir}')
archive_file = os.path.basename(archive)
if self.config.archive_details.get(archive + "prefix"):
@@ -494,27 +520,28 @@ class Specfile(object):
if self.config.subdir:
self._write_strip("popd")
if self.config.default_pattern != 'cmake':
if self.config.config_opts['32bit']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} build32".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['use_avx2']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} buildavx2".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['use_avx512']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} buildavx512".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['use_apx']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} buildapx".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['openmpi']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} build-openmpi".format(self.content.tarball_prefix))
self._write_strip("popd")
self.write_copy_prepend()
if self.config.config_opts['32bit']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} build32".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['use_avx2']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} buildavx2".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['use_avx512']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} buildavx512".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['use_apx']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} buildapx".format(self.content.tarball_prefix))
self._write_strip("popd")
if self.config.config_opts['openmpi']:
self._write_strip("pushd ..")
self._write_strip("cp -a {} build-openmpi".format(self.content.tarball_prefix))
self._write_strip("popd")
self._write_strip("\n")
def write_32bit_exports(self):
@@ -576,7 +603,7 @@ class Specfile(object):
if self.config.config_opts['use_clang']:
flags.extend(["-O3"])
else:
flags.extend(["-Ofast", "-fno-semantic-interposition", "-falign-functions=32"])
flags.extend(["-fno-semantic-interposition", "-falign-functions=32"])
if not self.config.config_opts['full-debug-info'] and not self.config.config_opts['use_clang']:
flags.extend(["-gno-variable-location-views", "-gno-column-info", "-femit-struct-debug-baseonly", "-fdebug-types-section", "-gz=zstd", "-g1"])
if self.config.default_pattern != 'qmake' or self.config.default_pattern != 'qmake6':
@@ -774,6 +801,14 @@ class Specfile(object):
self._write_strip("{}\n".format(line))
self._write_strip("## prep_prepend end")
def write_copy_prepend(self):
"""Write out any custom supplied commands prior to creating source copies for avx, etc builds."""
if self.config.copy_prepend:
self._write_strip("## copy_prepend content")
for line in self.config.copy_prepend:
self._write_strip("{}\n".format(line))
self._write_strip("## copy_prepend end")
def write_build_prepend(self):
"""Write out any custom supplied commands at the start of the %build section and every build type."""
if self.config.build_prepend:
@@ -889,10 +924,11 @@ class Specfile(object):
self._write_strip("export GOAMD64=v2")
if self.config.subdir:
self._write_strip("pushd " + self.config.subdir)
if self.config.config_opts['use_ninja'] and self.config.install_macro == '%make_install':
self.config.install_macro = '%ninja_install'
if self.config.config_opts['32bit']:
self._write_strip("pushd ../build32/" + self.config.subdir)
self._write_strip("pushd clr-build32")
self._write_strip("{}32 {} {}".format(self.config.install_macro,
self.config.extra_make_install,
@@ -910,30 +946,42 @@ class Specfile(object):
self._write_strip(" popd")
self._write_strip("fi")
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['use_avx2']:
self._write_strip("pushd ../buildavx2/" + self.config.subdir)
self._write_strip("GOAMD64=v3")
self._write_strip("pushd clr-build-avx2")
self._write_strip("%s_v3 %s || :\n" % (self.config.install_macro, self.config.extra_make_install))
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['use_avx512']:
self._write_strip("pushd ../buildavx512/" + self.config.subdir)
self._write_strip("GOAMD64=v4")
self._write_strip("pushd clr-build-avx512")
self._write_strip("%s_v4 %s || :\n" % (self.config.install_macro, self.config.extra_make_install))
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['use_apx']:
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self._write_strip("GOAMD64=v3")
self._write_strip("pushd clr-build-apx")
self._write_strip("%s_va %s || :\n" % (self.config.install_macro, self.config.extra_make_install))
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['openmpi']:
self._write_strip("pushd ../build-openmpi/" + self.config.subdir)
self._write_strip("GOAMD64=v3")
self._write_strip("pushd clr-build-openmpi")
self.write_install_openmpi()
self._write_strip("popd")
self._write_strip("popd")
if self.config.subdir:
self._write_strip("pushd " + self.config.subdir)
self._write_strip("GOAMD64=v2")
self._write_strip("pushd clr-build")
@@ -1082,7 +1130,6 @@ class Specfile(object):
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self.write_build_prepend()
self._write_strip("GOAMD64=v3")
self._write_strip('CC="gcc-14"')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1188,7 +1235,6 @@ class Specfile(object):
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self.write_build_prepend()
self._write_strip("GOAMD64=v3")
self._write_strip('CC="gcc-14"')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1249,7 +1295,6 @@ class Specfile(object):
self._write_strip("pushd ../buildapx" + self.config.subdir)
self.write_build_prepend()
self._write_strip("GOAMD64=v3")
self._write_strip('CC=gcc-14')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1327,7 +1372,6 @@ class Specfile(object):
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self.write_build_prepend()
self._write_strip("GOAMD64=v3")
self._write_strip('CC=gcc-14')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1372,7 +1416,6 @@ class Specfile(object):
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self.write_build_prepend()
self._write_strip('CC=gcc-14')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1420,7 +1463,6 @@ class Specfile(object):
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self._write_strip('CC=gcc-14')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1463,7 +1505,6 @@ class Specfile(object):
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self.write_build_prepend()
self._write_strip('CC=gcc-14')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1508,7 +1549,6 @@ class Specfile(object):
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self._write_strip('CC=gcc-14')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
@@ -1624,14 +1664,22 @@ class Specfile(object):
self._write_strip("pushd clr-build")
self.write_variables()
self._write_strip("export GOAMD64=v2")
self._write_strip("%cmake {} {}".format(self.config.cmake_srcdir, self.extra_cmake))
if self.config.config_opts['use_ninja']:
cmake_type = "-G Ninja"
else:
cmake_type = "-G 'Unix Makefiles'"
self._write_strip(f"%cmake {self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
self.write_profile_payload("cmake")
self.write_make_line()
self._write_strip("popd")
if self.config.subdir:
self._write_strip("popd")
if self.config.config_opts['use_avx2']:
self._write_strip("pushd ../buildavx2/" + self.config.subdir)
self._write_strip("mkdir -p clr-build-avx2")
self._write_strip("pushd clr-build-avx2")
self.write_build_prepend()
@@ -1641,11 +1689,13 @@ class Specfile(object):
self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "')
self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX2_CFLAGS} {AVX2_LFLAGS} "')
self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX2_CFLAGS} "')
self._write_strip("%cmake {} {}".format(self.config.cmake_srcdir, self.extra_cmake))
self._write_strip(f"%cmake {self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
self.write_make_line()
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['use_avx512']:
self._write_strip("pushd ../buildavx512/" + self.config.subdir)
self._write_strip("mkdir -p clr-build-avx512")
self._write_strip("pushd clr-build-avx512")
self.write_build_prepend()
@@ -1655,26 +1705,29 @@ class Specfile(object):
self._write_strip(f'CXXFLAGS="$CLEAR_INTERMEDIATE_CXXFLAGS {AVX512_CFLAGS} {AVX512_LFLAGS} "')
self._write_strip(f'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {AVX512_CFLAGS} {AVX512_LFLAGS} "')
self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {AVX512_CFLAGS} "')
self._write_strip("%cmake {} {}".format(self.config.cmake_srcdir, self.extra_cmake))
self._write_strip(f"%cmake {self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
self.write_make_line()
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
self._write_strip("pushd ../buildapx/" + self.config.subdir)
self._write_strip("mkdir -p clr-build-apx")
self._write_strip("pushd clr-build-apx")
self.write_build_prepend()
self.write_variables()
self._write_strip("GOAMD64=v3")
self._write_strip('CC=gcc-14')
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'FFLAGS="$CLEAR_INTERMEDIATE_FFLAGS {APX_CFLAGS} {APX_LFLAGS} "')
self._write_strip(f'FCFLAGS="$CLEAR_INTERMEDIATE_FCFLAGS {APX_CFLAGS} "')
self._write_strip("%cmake {} {}".format(self.config.cmake_srcdir, self.extra_cmake))
self._write_strip(f"%cmake {self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
self.write_make_line()
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['32bit']:
self._write_strip("pushd ../build32/" + self.config.subdir)
self._write_strip("mkdir -p clr-build32")
self._write_strip("pushd clr-build32")
self.write_build_prepend()
@@ -1683,12 +1736,14 @@ class Specfile(object):
self._write_strip("%cmake -DLIB_INSTALL_DIR:PATH=/usr/lib32 "
"-DCMAKE_INSTALL_LIBDIR=/usr/lib32 "
"-DLIB_SUFFIX=32 "
"{} {} ".format(self.config.cmake_srcdir, self.extra_cmake))
f"{self.config.cmake_srcdir} {self.extra_cmake} {cmake_type}")
self.write_make_line()
self._write_strip("unset PKG_CONFIG_PATH")
self._write_strip("popd")
self._write_strip("popd")
if self.config.config_opts['openmpi']:
self._write_strip("pushd ../build-openmpi/" + self.config.subdir)
self._write_strip("mkdir -p clr-build-openmpi")
self._write_strip("pushd clr-build-openmpi")
self._write_strip(". /usr/share/defaults/etc/profile.d/modules.sh")
@@ -1704,8 +1759,6 @@ class Specfile(object):
self.write_make_line()
self._write_strip("module unload openmpi")
self._write_strip("popd")
if self.config.subdir:
self._write_strip("popd")
self._write_strip("\n")
@@ -1871,7 +1924,6 @@ class Specfile(object):
self._write_strip('ninja -v -C builddiravx512')
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
self._write_strip("GOAMD64=v3")
self._write_strip('CC=gcc-14')
if self.config.config_opts['pgo'] and self.config.profile_payload != "":
self._write_strip(f'CFLAGS="$CFLAGS_GENERATE {APX_CFLAGS} {APX_LFLAGS} "'
f' CXXFLAGS="$CXXFLAGS_GENERATE {AVX2_CFLAGS} {AVX2_LFLAGS} "'
@@ -1942,7 +1994,6 @@ class Specfile(object):
self._write_strip('DESTDIR=%{buildroot}-v4 ninja -C builddiravx512 install')
if self.config.config_opts['use_apx'] and not self.config.config_opts['use_clang']:
self._write_strip("GOAMD64=v3")
self._write_strip('CC=gcc-14')
self._write_strip('DESTDIR=%{buildroot}-va ninja -C builddirapx install')
self._write_strip("GOAMD64=v2")
+19 -1
View File
@@ -26,6 +26,7 @@ import tarfile
import zipfile
import download
import zstandard as zstd
from util import do_regex, get_sha1sum, print_fatal, write_out
@@ -53,6 +54,8 @@ class Source():
self.type = 'zip'
elif self.url.lower().endswith(('.bz2')) and not self.url.lower().endswith(('.tar.bz2')):
self.type = 'bz2'
elif self.url.lower().endswith('.zst'):
self.type = 'zst'
else:
self.type = 'tar'
@@ -81,6 +84,16 @@ class Source():
print_fatal("Not a valid tar file.")
sys.exit(1)
def set_zst_prefix(self):
"""Determine prefix folder name of tar.zst file."""
with tarfile.open(fileobj=zstd.open(self.path, 'rb'), mode='r|') as content:
lines = content.getnames()
if len(lines) == 0:
print_fatal("Zstd compressed tar file doesn't appear to have any content")
sys.exit(1)
elif len(lines) > 1:
self.prefix = os.path.commonpath(lines)
def set_bz2_prefix(self):
"""No prefix for plain bz2 archives."""
@@ -128,6 +141,11 @@ class Source():
with zipfile.ZipFile(self.path, 'r') as content:
content.extractall(path=extraction_path)
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)
def convert_version(ver_str, name):
"""Remove disallowed characters from the version."""
@@ -135,7 +153,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"]
"jurko", "%2f", "%2F", "%20", "x265"]
# 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
+22
View File
@@ -402,6 +402,7 @@ class TestBuildreq(unittest.TestCase):
should be sufficient.
"""
conf = config.Config("")
conf.config_opts['use_ninja'] = False
with tempfile.TemporaryDirectory() as tmpd:
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'setup.py'), 'w').close()
@@ -418,6 +419,7 @@ class TestBuildreq(unittest.TestCase):
should be sufficient.
"""
conf = config.Config("")
conf.config_opts['use_ninja'] = False
with tempfile.TemporaryDirectory() as tmpd:
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'CMakeLists.txt'), 'w').close()
@@ -434,6 +436,7 @@ class TestBuildreq(unittest.TestCase):
should be sufficient.
"""
conf = config.Config("")
conf.config_opts['use_ninja'] = False
with tempfile.TemporaryDirectory() as tmpd:
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'SConstruct'), 'w').close()
@@ -450,6 +453,7 @@ class TestBuildreq(unittest.TestCase):
should be sufficient.
"""
conf = config.Config("")
conf.config_opts['use_ninja'] = False
with tempfile.TemporaryDirectory() as tmpd:
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'meson.build'), 'w').close()
@@ -480,6 +484,7 @@ class TestBuildreq(unittest.TestCase):
buildreq.pypidata.get_pypi_metadata = MagicMock(return_value=content)
with tempfile.TemporaryDirectory() as tmpd:
conf = config.Config(tmpd)
conf.config_opts['use_ninja'] = False
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'subdir', 'pyproject.toml'), 'w').close()
self.reqs.scan_for_configure(os.path.join(tmpd, 'subdir'), "", conf)
@@ -512,6 +517,7 @@ class TestBuildreq(unittest.TestCase):
m_open = mock_open(read_data=content)
with tempfile.TemporaryDirectory() as tmpd:
conf = config.Config(tmpd)
conf.config_opts['use_ninja'] = False
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'subdir', 'pyproject.toml'), 'w').close()
open(os.path.join(tmpd, 'pypi.json'), 'w').close()
@@ -537,6 +543,7 @@ class TestBuildreq(unittest.TestCase):
with tempfile.TemporaryDirectory() as tmpd:
conf = config.Config(tmpd)
conf.config_opts['use_ninja'] = False
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'subdir', 'setup.py'), 'w').close()
open(os.path.join(tmpd, 'subdir', 'requires.txt'), 'w').close()
@@ -546,6 +553,21 @@ class TestBuildreq(unittest.TestCase):
self.reqs.add_setup_py_requires.assert_called_once()
self.reqs.grab_python_requirements.assert_called_once()
def test_scan_for_configure_ninja(self):
"""
Test scan_for_configure when ninja is enabled.
"""
conf = config.Config("")
conf.config_opts['use_ninja'] = True
with tempfile.TemporaryDirectory() as tmpd:
os.mkdir(os.path.join(tmpd, 'subdir'))
open(os.path.join(tmpd, 'setup.py'), 'w').close()
self.reqs.scan_for_configure(tmpd, "", conf)
self.assertEqual(self.reqs.buildreqs,
set(['buildreq-distutils3', 'ninja']))
def test_parse_cmake_pkg_check_modules(self):
"""
Test parse_cmake to ensure accurate detection of versioned and