Compare commits

...

10 Commits
v7 ... v12

Author SHA1 Message Date
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
5 changed files with 65 additions and 19 deletions
+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
+3
View File
@@ -115,6 +115,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 +187,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
+35 -18
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':
@@ -576,7 +597,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':
@@ -892,6 +913,9 @@ class Specfile(object):
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 clr-build32")
self._write_strip("{}32 {} {}".format(self.config.install_macro,
@@ -1082,7 +1106,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 +1211,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 +1271,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 +1348,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 +1392,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 +1439,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 +1481,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 +1525,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,7 +1640,11 @@ 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")
@@ -1641,7 +1661,7 @@ 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")
@@ -1655,7 +1675,7 @@ 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")
@@ -1665,12 +1685,11 @@ class Specfile(object):
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")
@@ -1683,7 +1702,7 @@ 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")
@@ -1871,7 +1890,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 +1960,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")
+1 -1
View File
@@ -135,7 +135,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