Compare commits

...

4 Commits

Author SHA1 Message Date
Robert Dower b5d8cf5341 archive repository 2025-08-07 13:27:48 -07:00
Brett T. Warden cd8d0065aa Detect Intel Simplified Software License 2025-06-04 15:15:13 -07:00
William Douglas 6aaa12ff76 Add qmake5 build pattern
Add support for qmake5 build pattern that uses the qmake binary in
/usr/lib64/qt5.

Signed-off-by: William Douglas <william.douglas@intel.com>
2025-05-30 13:31:57 -07:00
William Douglas 65cf152900 Add the Provide: pypi in most cases
Usually the pypi ecosystem will do the right thing and respond with a
name but in cases where it does not (bad network, bad json, message
without a name), still figure out a reasonable Provide to add.

Signed-off-by: William Douglas <william.douglas@intel.com>
2025-05-27 13:27:28 -07:00
6 changed files with 171 additions and 10 deletions
+7
View File
@@ -0,0 +1,7 @@
## DISCONTINUATION OF PROJECT.
This project will no longer be maintained by Intel.
Intel will not provide or guarantee development of or support for this project, including but not limited to, maintenance, bug fixes, new releases or updates. Patches to this project are no longer accepted by Intel. If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the community, please create your own fork of the project.
Contact: webadmin@linux.intel.com
+9 -4
View File
@@ -709,6 +709,7 @@ class Requirements(object):
"""Use pypi for getting package requires and metadata."""
# First look for a local override
pypi_json = ""
pypi_name = pypidata.get_pypi_name(name)
pypi_file = os.path.join(config.download_path, "pypi.json")
if os.path.isfile(pypi_file):
with open(pypi_file, "r") as pfile:
@@ -716,16 +717,20 @@ class Requirements(object):
else:
# Try and grab the pypi details for the package
if config.alias:
name = config.alias
pypi_name = pypidata.get_pypi_name(name)
pypi_name = config.alias
pypi_name = pypidata.get_pypi_name(pypi_name)
pypi_json = pypidata.get_pypi_metadata(pypi_name)
if pypi_json:
if not pypi_json:
self.pypi_provides = pypi_name
else:
try:
package_pypi = json.loads(pypi_json)
except json.JSONDecodeError:
package_pypi = {}
package_pypi = {"name": pypi_name}
if package_pypi.get("name"):
self.pypi_provides = package_pypi["name"]
else:
self.pypi_provides = pypi_name
if package_pypi.get("requires"):
for pkg in package_pypi["requires"]:
self.add_requires(f"pypi({pkg})", config.os_packages, override=True, subpkg="python3")
+1 -1
View File
@@ -175,7 +175,7 @@ def scan_for_licenses(srcdir, config, pkg_name):
"about_bsd.txt"]
# look for files that start with copying or licen[cs]e (but are
# not likely scripts) or end with licen[cs]e
target_pat = re.compile(r"^((copying)|(licen[cs]e)|(e[dp]l-v\d+))|(licen[cs]e)(\.(txt|xml))?$")
target_pat = re.compile(r"^((copying)|(licen[cs]e)|(e[dp]l-v\d+))|(licen[cs]e)(\.(txt|xml))?|(intel simplified software license.*\.txt)$")
for dirpath, dirnames, files in os.walk(srcdir):
for name in files:
if name.lower() in targets or target_pat.search(name.lower()):
+12 -5
View File
@@ -27,6 +27,15 @@ def pkg_search(name):
return False
def fixup_pypi_prefix(name):
"""Try and chop off the 'pypi-' or 'python-' prefix for names."""
name = name.lower().replace('-', '_')
for prefix in ["pypi_", "python_"]:
if name.startswith(prefix):
name = name[len(prefix):]
return name
def get_pypi_name(name, miss=False):
"""Try and verify the pypi name for a given package name."""
# normalize the name for matching as pypi is case insensitve for search
@@ -35,11 +44,9 @@ def get_pypi_name(name, miss=False):
if pkg_search(name):
return name
# Maybe we have a prefix
for prefix in ["pypi_", "python_"]:
if name.startswith(prefix):
name = name[len(prefix):]
if pkg_search(name):
return name
name = fixup_pypi_prefix(name)
if pkg_search(name):
return name
# Some cases where search fails (Sphinx)
# Just try the name we were given
if miss:
+53
View File
@@ -1806,6 +1806,59 @@ class Specfile(object):
self.write_cmake_install()
def write_qmake5_pattern(self):
"""Write qmake5 build pattern to spec file."""
extra_qmake_args = ""
if self.config.config_opts['use_clang']:
extra_qmake_args = "-spec linux-clang "
if self.config.config_opts['use_lto']:
extra_qmake_args += "-config ltcg -config fat-static-lto "
else:
extra_qmake_args += "QMAKE_CFLAGS+=-fno-lto QMAKE_CXXFLAGS+=-fno-lto "
self.write_prep()
self._write_strip("%build")
self.write_build_prepend()
self.write_proxy_exports()
self._write_strip("export LANG=C.UTF-8")
self.write_variables()
if self.config.subdir:
self._write_strip("pushd " + self.config.subdir)
self._write_strip('export QMAKE_CFLAGS="$CFLAGS"')
self._write_strip('export QMAKE_CXXFLAGS="$CXXFLAGS"')
self._write_strip('export QMAKE_LFLAGS="$LDFLAGS"')
self._write_strip('export QMAKE_LIBDIR=/usr/lib64')
self._write_strip('export QMAKE_CFLAGS_RELEASE=')
self._write_strip('export QMAKE_CXXFLAGS_RELEASE=')
# Add the qtbase tools to the path
self._write_strip('export PATH=/usr/lib64/qt5/bin:$PATH')
if self.config.make_command:
qmake = self.config.make_command
else:
qmake = "qmake"
self._write_strip(f"{qmake} {extra_qmake_args} {self.config.extra_configure}")
self._write_strip("test -r config.log && cat config.log")
self.write_make_line()
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(f"{qmake} 'QT_CPU_FEATURES.x86_64 += avx avx2 bmi bmi2 f16c fma lzcnt popcnt'\\\n")
self._write(f' QMAKE_CFLAGS+="{AVX2_CFLAGS} {AVX2_LFLAGS}" QMAKE_CXXFLAGS+="{AVX2_CFLAGS} {AVX2_LFLAGS}" \\\n')
self._write(f' QMAKE_LFLAGS+="{AVX2_LCFLAGS}" {extra_qmake_args} {self.config.extra_configure}\n')
self.write_make_line()
self._write_strip("popd")
self.write_build_append()
self._write_strip("\n")
self.write_make_install()
def write_qmake_pattern(self):
"""Write qmake build pattern to spec file."""
extra_qmake_args = ""
+89
View File
@@ -499,6 +499,95 @@ class TestBuildreq(unittest.TestCase):
self.assertEqual(self.reqs.requires['python3'], pypi_requires)
self.assertEqual(ssummary, summary)
def test_scan_for_configure_pypi_no_name_in_json(self):
"""
Test scan_for_configure when distutils is being used for the build
pattern to test connecting to pypi but not getting a name back.
"""
orig_summary = buildreq.specdescription.default_summary
orig_sscore = buildreq.specdescription.default_summary_score
orig_pypi_name = buildreq.pypidata.get_pypi_name
orig_pypi_meta = buildreq.pypidata.get_pypi_metadata
name = "pypi-name"
content = json.dumps({})
buildreq.pypidata.pkg_search = MagicMock(return_value=False)
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'), name, conf)
post_summary = buildreq.specdescription.default_summary
buildreq.specdescription.default_summary = orig_summary
buildreq.specdescription.default_summary_score = orig_sscore
buildreq.pypidata.get_pypi_name = orig_pypi_name
buildreq.pypidata.get_pypi_metadata = orig_pypi_meta
self.assertEqual(self.reqs.pypi_provides, "name")
self.assertEqual(post_summary, orig_summary)
def test_scan_for_configure_pypi_no_json(self):
"""
Test scan_for_configure when distutils is being used for the build
pattern to test being unable to connect to pypi.
"""
orig_summary = buildreq.specdescription.default_summary
orig_sscore = buildreq.specdescription.default_summary_score
orig_pypi_name = buildreq.pypidata.get_pypi_name
orig_pypi_meta = buildreq.pypidata.get_pypi_metadata
name = "pypi-name"
buildreq.pypidata.pkg_search = MagicMock(return_value=False)
buildreq.pypidata.get_pypi_metadata = MagicMock(return_value="")
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'), name, conf)
post_summary = buildreq.specdescription.default_summary
buildreq.specdescription.default_summary = orig_summary
buildreq.specdescription.default_summary_score = orig_sscore
buildreq.pypidata.get_pypi_name = orig_pypi_name
buildreq.pypidata.get_pypi_metadata = orig_pypi_meta
self.assertEqual(self.reqs.pypi_provides, "name")
self.assertEqual(post_summary, orig_summary)
def test_scan_for_configure_pypi_bad_json(self):
"""
Test scan_for_configure when distutils is being used for the build
pattern to test being given bad json data.
"""
orig_summary = buildreq.specdescription.default_summary
orig_sscore = buildreq.specdescription.default_summary_score
orig_pypi_name = buildreq.pypidata.get_pypi_name
orig_pypi_meta = buildreq.pypidata.get_pypi_metadata
orig_json_loads = buildreq.json.loads
name = "pypi-name"
content = json.dumps({})
buildreq.pypidata.pkg_search = MagicMock(return_value=False)
buildreq.pypidata.get_pypi_metadata = MagicMock(return_value=content)
buildreq.json.loads = MagicMock(side_effect=json.JSONDecodeError("", "", 0))
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'), name, conf)
post_summary = buildreq.specdescription.default_summary
buildreq.specdescription.default_summary = orig_summary
buildreq.specdescription.default_summary_score = orig_sscore
buildreq.pypidata.get_pypi_name = orig_pypi_name
buildreq.pypidata.get_pypi_metadata = orig_pypi_meta
buildreq.json.loads = orig_json_loads
self.assertEqual(self.reqs.pypi_provides, "name")
self.assertEqual(post_summary, orig_summary)
def test_scan_for_configure_pypi_override(self):
"""
Test scan_for_configure when distutils is being used for the build